Skip to content
Snippets Groups Projects
Commit 648a8973 authored by echicken's avatar echicken :chicken:
Browse files

Skip cache stuff if 0 ttl; keep some methods private.

parent 41dc9df9
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
......@@ -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;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment