diff --git a/xtrn/wttr.in/wttr-lib.js b/xtrn/wttr.in/wttr-lib.js index c30a41518035e2a2b0251e4f36388eb79f5b0c4d..e3d511552328ca46076028a9be48df30f4b8e63b 100644 --- a/xtrn/wttr.in/wttr-lib.js +++ b/xtrn/wttr.in/wttr-lib.js @@ -67,13 +67,19 @@ function getWeather() { const settings = loadSettings(); const addr = locator.getAddress() || settings.fallback_ip; const url = getURL(settings, addr); - const cachedWeather = readCache(url, addr, settings.cache_ttl); - if (cachedWeather !== undefined) return cachedWeather; + if (settings.cache_ttl > 0) { + const cachedWeather = readCache(url, addr, settings.cache_ttl); + if (cachedWeather !== undefined) return cachedWeather; + } const weather = fetchWeather(url, addr); const text = uReplace(weather); const ansi = xterm.convertColors(text); - writeCache(url, addr, ansi); + if (settings.cache_ttl > 0) writeCache(url, addr, ansi); return ansi; } -this; \ No newline at end of file +const exports = { + getWeather: getWeather, +}; + +exports;