Skip to content

Commit ec092f6

Browse files
committed
Fix Weather Underground possible rain/snow confusion. Automatically set Celsius vs. Fahrenheit. Make sure Chromium is closed before relaunching it.
1 parent 1ddfaa4 commit ec092f6

8 files changed

Lines changed: 19 additions & 17 deletions

File tree

build.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -902,6 +902,8 @@ async function doServiceDeployment(uid: number): Promise<void> {
902902
write(' ');
903903
await sleep(3000, true);
904904
stepDone();
905+
await monitorProcess(spawn('pkill', ['-x', chromium], { uid }), true, ErrorMode.NO_ERRORS);
906+
await sleep(500);
905907
exec(launchChromium + ' --user-data-dir=' + userHome, { uid });
906908
await sleep(1000, false);
907909
}

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"scripts": {

server/package-lock.json

Lines changed: 2 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "aw-clock-server",
3-
"version": "2.2.1",
3+
"version": "2.2.2",
44
"license": "MIT",
55
"author": "Kerry Shetline <kerry@shetline.com>",
66
"private": true,

server/src/wunderground-forecast.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,16 @@ function convertForecast(wuForecast: any, isMetric: boolean): ForecastData {
137137
if (!precipType || precipTypeNight === 'snow')
138138
precipType = precipTypeNight;
139139

140+
let precipAccumulation = wd.qpf[i];
141+
142+
if (precipType === 'snow' || (wd.qpfSnow[i] > 0 && precipType === 'precip')) {
143+
precipType = 'snow';
144+
precipAccumulation = wd.qpfSnow[i];
145+
}
146+
140147
daily.push({
141148
icon: getIcon(wd.daypart[0]?.iconCode[i * 2] ?? wd.daypart[0]?.iconCode[i * 2 + 1] ?? -1),
142-
precipAccumulation: precipType === 'snow' ? wd.qpfSnow[i] : wd.qpf[i],
149+
precipAccumulation,
143150
precipIntensityMax: 0,
144151
precipProbability: Math.max(wd.daypart[0]?.precipChance[i * 2] ?? 0, wd.daypart[0]?.precipChance[i * 2 + 1] ?? 0) / 100,
145152
precipType,

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@
260260
</div>
261261
</div>
262262
<div class="dialog-buttons">
263-
<span class="version-number">2.2.1</span>
263+
<span class="version-number">2.2.2</span>
264264
<button id="settings-reload">Reload</button>
265265
<span>&bull;</span>
266266
<button id="settings-cancel">Cancel</button>

src/main.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class AwClockApp implements AppService {
218218
const site = (runningDev ? DEV_URL : '');
219219
const promises = [
220220
getJson(`${site}/defaults`),
221-
getJson('https://skyviewcafe.com/ip/json/?callback=?')
221+
getJson('http://ip-api.com/json/?callback=?')
222222
];
223223

224224
Promise.all(promises)
@@ -231,9 +231,9 @@ class AwClockApp implements AppService {
231231
if (data[1]?.status === 'success') {
232232
this.settings.latitude = data[1].lat;
233233
this.settings.longitude = data[1].lon;
234-
const city = [data[1].city, data[1].region, data[1].countryCode].join(', ')
234+
this.settings.city = [data[1].city, data[1].region, data[1].countryCode].join(', ')
235235
.replace(/(, [A-Z]{2}), US$/, '$1');
236-
this.settings.city = city;
236+
this.settings.celsius = !/AS|BS|BZ|FM|GU|MH|PW|US|VI/i.test(data[1].countryCode);
237237
}
238238

239239
this.settingsChecked = true;

0 commit comments

Comments
 (0)