diff --git a/bin/cli.js b/bin/cli.js index 965719658..3b2e3be06 100644 --- a/bin/cli.js +++ b/bin/cli.js @@ -86,8 +86,10 @@ function openUrl(url) { } // Load resources from local file or fetch remotely using shared loader -async function loadData() { - return loadCatalog(); +async function loadData(options = {}) { + const cliArgs = process.argv.slice(2); + const shouldRefresh = cliArgs.includes("--refresh") || cliArgs.includes("-r"); + return loadCatalog({ ...options, refresh: options.refresh || shouldRefresh }); } async function loadMatchmakerData() { diff --git a/bin/lib/catalog.js b/bin/lib/catalog.js index b8a5621ca..e326345fd 100644 --- a/bin/lib/catalog.js +++ b/bin/lib/catalog.js @@ -10,7 +10,7 @@ const __dirname = path.dirname(__filename); let cachedCatalog = null; -export const DEFAULT_CACHE_TTL_MS = 24 * 60 * 60 * 1000; // 24 hours +export const DEFAULT_CACHE_TTL_MS = 4 * 60 * 60 * 1000; // 4 hours auto-refresh TTL export function getMilestone(totalCount) { const count = Number(totalCount); @@ -109,8 +109,8 @@ export function clearPersistentCache() { */ export async function fetchLiveCatalog(timeoutMs = 4000, fetchFn = fetch) { const candidateUrls = [ - "https://ritualdev.in/data.json", "https://raw.githubusercontent.com/RitualDev-Lab/DevShelf/main/site/data.json", + "https://ritualdev.in/data.json", "https://devshelf.ritualdev.in/data.json", ];