#301 but for auto detected city name also

This commit is contained in:
end-4
2024-03-05 23:09:16 +07:00
parent 1f1283f062
commit dd08a134fc
+1 -1
View File
@@ -154,7 +154,7 @@ const BatteryModule = () => Stack({
],
setup: (self) => self.poll(900000, async (self) => {
const WEATHER_CACHE_PATH = WEATHER_CACHE_FOLDER + '/wttr.in.txt';
const updateWeatherForCity = (city) => execAsync(`curl https://wttr.in/${city}?format=j1`)
const updateWeatherForCity = (city) => execAsync(`curl https://wttr.in/${city.replace(/ /g, '%20')}?format=j1`)
.then(output => {
const weather = JSON.parse(output);
Utils.writeFile(JSON.stringify(weather), WEATHER_CACHE_PATH)