Skip to content

Commit ddc629c

Browse files
Merge branch 'develop' into fetch
2 parents a192caf + 2b08288 commit ddc629c

File tree

21 files changed

+205
-85
lines changed

21 files changed

+205
-85
lines changed

.gitignore

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,12 @@ Temporary Items
5858
modules
5959
!modules/default
6060

61-
# Ignore changes to the custom css files but keep others.
62-
css/custom.css
61+
# Ignore changes to the custom css files but keep the sample and main.
62+
/css/*
63+
!/css/custom.css.sample
64+
!/css/font-awesome.css
65+
!/css/main.css
66+
!/css/roboto.css
6367

6468
# Ignore users config file but keep the sample.
6569
config

CHANGELOG.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ planned for 2026-01-01
1515

1616
- [weather] feat: add configurable forecast date format option (#3918)
1717
- [core] Add new `server:watch` script to run MagicMirror² server-only with automatic restarts when files (defined in `config.watchTargets`) change (#3920)
18+
- [weather] add error handling to fetch functions including cors (#3791)
1819

1920
### Removed
2021

21-
- [weather] Removed deprecated ukmetoffice datapoint provider (#3842, #3952)
22+
- [weather] Removed deprecated `ukmetoffice` datapoint provider (#3842, #3952)
2223

2324
### Changed
2425

@@ -32,6 +33,7 @@ planned for 2026-01-01
3233
- [calendar] hide repeatingCountTitle if the event count is zero (#3949)
3334
- [core] refactor: replace `XMLHttpRequest` with `fetch` in `translator.js` (#3950)
3435
- [tests] migrate e2e tests to Playwright (#3950)
36+
- [core] configure cspell to check default modules only and fix typos (#3955)
3537

3638
### Fixed
3739

cspell.config.json

Lines changed: 101 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,25 @@
33
"language": "en",
44
"words": [
55
"aarch",
6+
"Adak",
67
"Alvinger",
78
"Ampio",
89
"andrezibaia",
910
"angeldeejay",
11+
"apikey",
1012
"apiontek",
1113
"armv",
1214
"ashishtank",
1315
"autoplay",
16+
"Autorestart",
1417
"beada",
18+
"Behaviour",
1519
"Binney",
1620
"bluemanos",
1721
"bnitkin",
1822
"bokmål",
23+
"bouncyflip",
24+
"boxspinner",
1925
"Brasileiro",
2026
"Brento",
2127
"browserwindow",
@@ -25,14 +31,22 @@
2531
"bugsounet",
2632
"buxxi",
2733
"byday",
34+
"calcage",
35+
"calendarfetcher",
2836
"calendarfetcherutils",
2937
"calendarutils",
38+
"calevents",
3039
"chamakura",
40+
"Citypage",
3141
"cjbrunner",
42+
"clearsky",
3243
"clientonly",
3344
"clockfaces",
45+
"cloudcover",
3446
"cmdline",
3547
"codac",
48+
"Codrops",
49+
"cornerexpand",
3650
"Crazylegstoo",
3751
"crazyscot",
3852
"Creepin",
@@ -43,14 +57,23 @@
4357
"Cymraeg",
4458
"dariom",
4559
"darksky",
60+
"dataheaders",
61+
"Datamart",
4662
"dateheader",
4763
"dateheaders",
64+
"datekey",
4865
"dathbe",
4966
"davide",
5067
"DAYAFTERTOMORROW",
5168
"DAYBEFOREYESTERDAY",
5269
"defaultmodules",
70+
"Deificit",
71+
"Descr",
72+
"dewpoint",
5373
"dgoth",
74+
"difflink",
75+
"dismissttl",
76+
"Displayer",
5477
"dkallen",
5578
"drivelist",
5679
"DTEND",
@@ -63,18 +86,26 @@
6386
"Edgardos",
6487
"Ekristoffe",
6588
"elec",
89+
"elif",
6690
"eltociear",
91+
"endfor",
92+
"endmacro",
6793
"envcanada",
6894
"envsub",
6995
"envsubst",
7096
"eouia",
97+
"Evapotranspration",
7198
"exdate",
99+
"exdates",
72100
"expectedheaders",
101+
"exploader",
73102
"ezeholz",
103+
"Fadesteps",
74104
"Faizan",
75105
"feedme",
76106
"feelslike",
77107
"Fenner",
108+
"Feuchte",
78109
"fewieden",
79110
"fixuppm",
80111
"flopp",
@@ -83,7 +114,9 @@
83114
"forecastweather",
84115
"fortawesome",
85116
"frameguard",
117+
"freezinglevel",
86118
"Frysk",
119+
"fullarticle",
87120
"fulldate",
88121
"fullday",
89122
"fullscreen",
@@ -92,9 +125,19 @@
92125
"GHSA",
93126
"ghsas",
94127
"grenagit",
128+
"Halfclear",
129+
"heavyrain",
130+
"heavyrainandthunder",
131+
"heavyrainshowers",
132+
"heavyrainshowersandthunder",
133+
"heavysleet",
134+
"heavysleetshowersandthunder",
135+
"heavysnow",
136+
"heavysnowandthunder",
95137
"Heiko",
96138
"Hirschberger",
97139
"hourlyweather",
140+
"humidex",
98141
"Hwind",
99142
"ical",
100143
"illimarkangur",
@@ -123,15 +166,18 @@
123166
"Knapoc",
124167
"Koepke",
125168
"kolbyjack",
169+
"Komplex",
126170
"krekos",
127171
"Kristjan",
128172
"krukle",
129173
"labwc",
130174
"Landis",
131175
"larryare",
176+
"Lastberechnung",
132177
"letsencrypt",
133178
"libgpiod",
134179
"Lightspeed",
180+
"loadingcircle",
135181
"locationforecast",
136182
"lockstring",
137183
"lstrip",
@@ -159,9 +205,12 @@
159205
"Ñandú",
160206
"nathannaveen",
161207
"naveensrinivasan",
208+
"nbsp",
162209
"ndom",
163210
"Nerfzooka",
164211
"NEWSFEED",
212+
"newsfeedfetcher",
213+
"newsfetcher",
165214
"newsitems",
166215
"nfogal",
167216
"njwilliams",
@@ -170,42 +219,61 @@
170219
"nunjuck",
171220
"odroid",
172221
"oemel",
222+
"oldconfig",
173223
"onecall",
174224
"onevent",
175225
"openmeteo",
226+
"openmeto",
176227
"openweathermap",
177228
"oraclesean",
178229
"oscarb",
230+
"pcat",
179231
"philnagel",
232+
"pirateweather",
233+
"plained",
180234
"plebcity",
235+
"pmax",
236+
"pmean",
237+
"pmedian",
238+
"pmin",
181239
"Português",
182240
"PRECIP",
183241
"Problema",
184242
"psieg",
243+
"pubdate",
185244
"radokristof",
186245
"rajniszp",
187246
"rebuilded",
188247
"Reis",
189248
"rejas",
249+
"relativehumidity",
190250
"Resig",
191251
"roboto",
192252
"rohitdharavath",
193253
"Rosso",
254+
"Rothfusz",
194255
"rrule",
195256
"savvadam",
196257
"sdetweil",
258+
"searchstr",
197259
"sendheaders",
198260
"serveronly",
199261
"sexualized",
262+
"Sitecode",
200263
"skpanagiotis",
201264
"SMHI",
202265
"Snille",
266+
"snowandthunder",
267+
"snowshowersandthunder",
203268
"socketclient",
204269
"socketio",
205270
"spectron",
206271
"Starinvest",
272+
"stationid",
273+
"STEADMAN",
207274
"sthuber",
208275
"Stieber",
276+
"strinner",
209277
"stylelintrc",
210278
"subclassing",
211279
"sunaction",
@@ -216,42 +284,74 @@
216284
"tada",
217285
"taglist",
218286
"Teeuw",
287+
"Teil",
219288
"TESTMODE",
220289
"thomasrockhu",
290+
"thumbslider",
291+
"timeformat",
292+
"titlereplacestr",
293+
"titlesearchstr",
294+
"todaytemp",
221295
"tomzt",
296+
"trunc",
297+
"ttlms",
222298
"ukmetoffice",
223299
"ukmetofficedatahub",
224300
"unitless",
301+
"unixtime",
225302
"unparseable",
226303
"updatenotification",
304+
"uxdt",
227305
"Vaice",
228306
"veeck",
307+
"verjaardag",
229308
"VEVENT",
230309
"vgtu",
310+
"Vitest",
231311
"Voelt",
312+
"Vorberechnung",
232313
"vppencilsharpener",
233314
"Wallys",
234315
"Weatherbit",
316+
"weathercode",
235317
"WEATHERDATA",
236318
"Weatherflow",
237319
"weatherforecast",
238320
"weathergov",
239321
"weathericon",
240322
"weathericons",
241323
"weatherobject",
324+
"weatherprovider",
242325
"weatherutils",
326+
"webcal",
327+
"winddirection",
328+
"windgusts",
243329
"windspeed",
244330
"Woolridge",
245331
"worktree",
332+
"Wsymb",
246333
"xlarge",
334+
"xmark",
247335
"xrandr",
248336
"xsmall",
249337
"xsorifc",
250338
"xwindows",
251339
"xxxe",
252340
"Ybbet",
341+
"yearmatch",
253342
"yearmatchgroup"
254343
],
255-
"ignorePaths": ["node_modules/**", "modules/**", "translations/**", "tests/mocks/**", "tests/e2e/modules/clock_es_spec.js", "css/roboto.css"],
344+
"ignorePaths": [
345+
"css/roboto.css",
346+
"node_modules/**",
347+
"modules/!(default)/**",
348+
"modules/default/**/translations/!(en).json",
349+
"modules/default/calendar/windowsZones.json",
350+
"modules/default/clock/faces/*.svg",
351+
"modules/default/weather/providers/yr.js",
352+
"tests/mocks/**",
353+
"tests/e2e/modules/clock_es_spec.js",
354+
"translations/**"
355+
],
256356
"dictionaries": ["node"]
257357
}

js/server_functions.js

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ function getStartup (req, res) {
3030
* Only the url-param of the input request url is required. It must be the last parameter.
3131
* @param {Request} req - the request
3232
* @param {Response} res - the result
33+
* @returns {Promise<void>} A promise that resolves when the response is sent
3334
*/
3435
async function cors (req, res) {
3536
try {
@@ -40,29 +41,32 @@ async function cors (req, res) {
4041
if (!match) {
4142
url = `invalid url: ${req.url}`;
4243
Log.error(url);
43-
res.send(url);
44+
return res.status(400).send(url);
4445
} else {
4546
url = match[1];
4647

4748
const headersToSend = getHeadersToSend(req.url);
4849
const expectedReceivedHeaders = geExpectedReceivedHeaders(req.url);
49-
5050
Log.log(`cors url: ${url}`);
51-
const response = await fetch(url, { headers: headersToSend });
5251

53-
for (const header of expectedReceivedHeaders) {
54-
const headerValue = response.headers.get(header);
55-
if (header) res.set(header, headerValue);
52+
const response = await fetch(url, { headers: headersToSend });
53+
if (response.ok) {
54+
for (const header of expectedReceivedHeaders) {
55+
const headerValue = response.headers.get(header);
56+
if (header) res.set(header, headerValue);
57+
}
58+
const data = await response.text();
59+
res.send(data);
60+
} else {
61+
throw new Error(`Response status: ${response.status}`);
5662
}
57-
const data = await response.text();
58-
res.send(data);
5963
}
6064
} catch (error) {
6165
// Only log errors in non-test environments to keep test output clean
6266
if (process.env.mmTestMode !== "true") {
63-
Log.error(error);
67+
Log.error(`Error in CORS request: ${error}`);
6468
}
65-
res.send(error);
69+
res.status(500).json({ error: error.message });
6670
}
6771
}
6872

modules/default/alert/notificationFx.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
// notice, warning, error, success
6060
// will add class ns-type-warning, ns-type-error or ns-type-success
6161
type: "notice",
62-
// if the user doesn´t close the notification then we remove it
62+
// if the user doesn't close the notification then we remove it
6363
// after the following time
6464
ttl: 6000,
6565
al_no: "ns-box",

0 commit comments

Comments
 (0)