liftie 4.2.6 → 4.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cli/noaa.js +2 -3
- package/lib/env.js +2 -0
- package/lib/lifts/request.js +2 -2
- package/lib/lifts/rest.js +2 -3
- package/lib/resorts/sierra/index.js +3 -3
- package/lib/weather/noaa.js +2 -4
- package/lib/webcams.js +2 -3
- package/package.json +1 -1
package/lib/cli/noaa.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { readFile, writeFile } from 'node:fs/promises';
|
|
2
2
|
import { program } from 'commander';
|
|
3
|
+
import { LIFTIE_USER_AGENT } from '../env.js';
|
|
3
4
|
import { descriptorPath } from './dirs.js';
|
|
4
5
|
import forEachResort from './for-each-resort.js';
|
|
5
6
|
|
|
6
|
-
const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)';
|
|
7
|
-
|
|
8
7
|
function points([lon, lat]) {
|
|
9
8
|
function shorten(n) {
|
|
10
9
|
return n.toFixed(4).replace(/0+$/, '');
|
|
@@ -27,7 +26,7 @@ async function noaaForResort(resortId, { overwrite }) {
|
|
|
27
26
|
const { ll } = descriptor;
|
|
28
27
|
const res = await fetch(`https://api.weather.gov/points/${points(ll)}`, {
|
|
29
28
|
headers: {
|
|
30
|
-
'User-Agent':
|
|
29
|
+
'User-Agent': LIFTIE_USER_AGENT,
|
|
31
30
|
Accept: 'application/geo+json'
|
|
32
31
|
}
|
|
33
32
|
});
|
package/lib/env.js
CHANGED
|
@@ -4,6 +4,7 @@ const {
|
|
|
4
4
|
CSP_REPORT_URI,
|
|
5
5
|
LIFTIE_CSP_ENFORCE,
|
|
6
6
|
LIFTIE_STATIC_HOST = '',
|
|
7
|
+
LIFTIE_USER_AGENT,
|
|
7
8
|
LOG_DIR = tmpdir(),
|
|
8
9
|
NODE_ENV = 'development',
|
|
9
10
|
OPENWEATHER_API_KEY,
|
|
@@ -19,6 +20,7 @@ export {
|
|
|
19
20
|
CSP_REPORT_URI,
|
|
20
21
|
LIFTIE_CSP_ENFORCE,
|
|
21
22
|
LIFTIE_STATIC_HOST,
|
|
23
|
+
LIFTIE_USER_AGENT,
|
|
22
24
|
LOG_DIR,
|
|
23
25
|
NODE_ENV,
|
|
24
26
|
OPENWEATHER_API_KEY,
|
package/lib/lifts/request.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
import { LIFTIE_USER_AGENT } from '../env.js';
|
|
2
2
|
|
|
3
3
|
export default function request({ host, pathname, query }) {
|
|
4
4
|
const fullUrl = new URL(pathname, host);
|
|
@@ -7,7 +7,7 @@ export default function request({ host, pathname, query }) {
|
|
|
7
7
|
}
|
|
8
8
|
return fetch(fullUrl, {
|
|
9
9
|
headers: {
|
|
10
|
-
'User-Agent':
|
|
10
|
+
'User-Agent': LIFTIE_USER_AGENT,
|
|
11
11
|
Accept: '*/*'
|
|
12
12
|
}
|
|
13
13
|
});
|
package/lib/lifts/rest.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
+
import { LIFTIE_USER_AGENT } from '../env.js';
|
|
1
2
|
import { parseHtml } from './parser.js';
|
|
2
3
|
|
|
3
|
-
const userAgent = 'liftie/1.0.0 (https://liftie.info)';
|
|
4
|
-
|
|
5
4
|
export default function rest(url, parse, fn) {
|
|
6
5
|
const fullUrl = new URL(url.pathname, url.host);
|
|
7
6
|
if (url.query) {
|
|
@@ -9,7 +8,7 @@ export default function rest(url, parse, fn) {
|
|
|
9
8
|
}
|
|
10
9
|
const reqInit = {
|
|
11
10
|
headers: {
|
|
12
|
-
'User-Agent':
|
|
11
|
+
'User-Agent': LIFTIE_USER_AGENT,
|
|
13
12
|
Accept: 'application/json'
|
|
14
13
|
}
|
|
15
14
|
};
|
package/lib/weather/noaa.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import Debug from 'debug';
|
|
2
|
-
import { LIFTIE_STATIC_HOST as staticHost } from '../env.js';
|
|
2
|
+
import { LIFTIE_USER_AGENT, LIFTIE_STATIC_HOST as staticHost } from '../env.js';
|
|
3
3
|
import { iconsFromUrl } from './icons.js';
|
|
4
4
|
|
|
5
5
|
const debug = Debug('liftie:weather');
|
|
6
6
|
|
|
7
|
-
const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)';
|
|
8
|
-
|
|
9
7
|
function normalize(data, ll) {
|
|
10
8
|
debug('weather %j', data.properties.periods);
|
|
11
9
|
|
|
@@ -40,7 +38,7 @@ export default function fetchWeather(resort, fn) {
|
|
|
40
38
|
fetch(url, {
|
|
41
39
|
method: 'GET',
|
|
42
40
|
headers: {
|
|
43
|
-
'User-Agent':
|
|
41
|
+
'User-Agent': LIFTIE_USER_AGENT,
|
|
44
42
|
Accept: 'application/geo+json'
|
|
45
43
|
}
|
|
46
44
|
})
|
package/lib/webcams.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import Debug from 'debug';
|
|
2
|
+
import { LIFTIE_USER_AGENT } from './env.js';
|
|
2
3
|
import limiter from './tools/limiter.js';
|
|
3
4
|
import { minute } from './tools/millis.js';
|
|
4
5
|
|
|
5
6
|
const debug = Debug('liftie:webcams');
|
|
6
7
|
|
|
7
|
-
const userAgent = 'Mozilla/5.0 (compatible; Liftie/1.0; +https://liftie.info)';
|
|
8
|
-
|
|
9
8
|
fetchWebcams.interval = {
|
|
10
9
|
active: 8.5 * minute, // v3 API images are only valid for 10 minutes
|
|
11
10
|
inactive: Number.POSITIVE_INFINITY
|
|
@@ -58,7 +57,7 @@ export default function fetchWebcams(resort, fn) {
|
|
|
58
57
|
fetch(url, {
|
|
59
58
|
headers: {
|
|
60
59
|
Accept: 'application/json',
|
|
61
|
-
'User-Agent':
|
|
60
|
+
'User-Agent': LIFTIE_USER_AGENT,
|
|
62
61
|
'x-windy-api-key': WEBCAMS_API_KEY
|
|
63
62
|
}
|
|
64
63
|
})
|