Compare commits

..

390 Commits

Author SHA1 Message Date
Karsten Hassel
d072345775 update dependencies incl. electron to v41 (#4058)
- update to electron v41
- update other deps
- add missing `globals` dep, see
https://github.com/MagicMirrorOrg/MagicMirror/pull/4057#issuecomment-4049058107
2026-03-12 20:18:18 +01:00
Kristjan ESPERANTO
3ea3f0a605 chore: upgrade ESLint to v10 and fix newly surfaced issues (#4057)
`eslint-plugin-import-x` was the last thing blocking the ESLint v10
upgrade - it just got v10 support. So here we go.

The upgrade itself is tiny. The rest of the diff is cleanup from issues
ESLint v10 now catches: a few `let` declarations with initial values
that were immediately overwritten anyway (`no-useless-assignment`), and
`Translator` listed in `/* global */` in `main.js` and `module.js`.

Working through those `no-useless-assignment` warnings also surfaced a
dead default in `openmeteo`: `maxEntries: 5` in the constructor, which
was never actually doing anything - `openmeteo` never reads
`this.config.maxEntries` anywhere. And `weather.js` already sets that
default for all providers, so it was just a redundant duplicate. Removed
that too.

No runtime behavior changes.
2026-03-12 11:58:26 +01:00
Kristjan ESPERANTO
21d1e7472a refactor: simplify internal require() calls (#4056)
Remove unnecessary `__dirname` template-literal prefix from relative
`require()` paths. Node.js resolves relative require() paths correctly
without it.

While this may look like nitpicking: `require("./server")` is
transparent to static analysis tools - IDEs can resolve the path and
support go-to-definition. Template literals with `__dirname` are opaque
to them. It also removes another usage of `__dirname`, which has no
native equivalent in ESM and would need to be replaced there anyway
(when we switch to ESM anytime in the future).

The import reordering is a side effect: `import-x/order` treats
template-literal `require()` calls differently from plain strings, so
the previous order was no longer valid.
2026-03-12 10:35:42 +01:00
Kristjan ESPERANTO
9fe7d1eb75 test(calendar): fix hardcoded date in event shape test (#4055)
While looking into #4053 I noticed that one of the calendar tests had
stopped working. The cause was simple: the test had `2026-03-10`
hardcoded, and since that date is now in the past, the event was
silently filtered out by `includePastEvents: false`.

Instead of bumping the date to some future value (which would only delay
the same problem), I made it relative so it always lies in the future.

Command to test:

```bash
npx vitest run tests/unit/modules/default/calendar/
```
2026-03-12 00:40:23 +01:00
Karsten Hassel
0ca91f7292 weather: fixes for templates (#4054)
Follow up for #4051 

- fix loading default weather.css (the construction with `./weather.css`
gave a 404)
- accept `themeDir` with and without trailing slash
2026-03-09 23:29:48 +01:00
Karsten Hassel
35cd4d8759 weather: add possibility to override njk's and css (#4051)
This is an approach for #2909

It adds 2 values to the config:

```js
		themeDir: "./",
		themeCustomScripts: []
```

`themeDir` must be specified relative to the weather dir.

Example config:

```js
		{
			module: "weather",
			position: "top_center",
			config: {
				weatherProvider: "openmeteo",
				type: "current",
				lat: 40.776676,
				lon: -73.971321,
				themeDir: "../../../modules/MyWeatherTemplate/",
				themeCustomScripts: [ "skycons.js", "weathertheme.js" ],
			}
		},
```

The `themeDir` must contain the 4 files
- current.njk
- forecast.njk
- hourly.njk
- weather.css

You can add more files (if needed) and add them to the
`themeCustomScripts` so they are loaded as script.

There are 2 methods inserted which are called if defined:
- initWeatherTheme: For doing special things when starting the module
- updateWeatherTheme: For doing special things before updating the dom

I see this as a simple approach for overriding the default njk templates
and css. I did already convert my
[MMM-WeatherBridge](https://gitlab.com/khassel/MMM-WeatherBridge) into a
template.
2026-03-08 10:34:14 +01:00
Kristjan ESPERANTO
cb61aebb5a chore: update ESLint and plugins, simplify config, apply new rules (#4052)
This PR updates ESLint and the ESLint plugins to their latest versions
and takes advantage of the new versions to simplify the config.

The main cleanup: removed all explicit `plugins: {}` registrations from
`eslint.config.mjs`. When passing direct config objects like
`js.configs.recommended`, the plugin registration is already included –
we were just doing it twice.

Two lint warnings are also fixed:
- A wrong import style for `eslint-plugin-package-json` (named vs.
default)
- `playwright/no-duplicate-hooks` is disabled for e2e tests – the rule
doesn't handle plain `beforeAll()`/`afterAll()` (Vitest style) correctly
and produces false positives. I've created an issue for that:
https://github.com/mskelton/eslint-plugin-playwright/issues/443.

Built-in Node.js imports were manually updated to use the `node:` prefix
(e.g. `require("fs")` → `require("node:fs")`). Minor formatting fixes
were applied automatically by `eslint --fix`.
2026-03-07 08:34:28 -07:00
Kristjan ESPERANTO
e7503a457b refactor: further logger clean-up (#4050)
After #4049 here are two small follow-up improvements to `js/logger.js`.

**1. Simpler bind syntax** —
`Function.prototype.bind.call(console.debug, console)` is an archaic
pattern. The equivalent `console.debug.bind(console)` works fine in all
supported engines (Node.js ≥ 22, modern browsers) and is much easier to
read. Also: `console.timeStamp` exists in all supported environments, so
the conditional fallback to an empty function is no longer needed.

**2. Simpler `setLogLevel`** — instead of iterating over all keys in the
logger object and permanently overwriting them, the method now loops
over the five log-level keys explicitly and rebinds from `console[key]`.
This makes the filtered set obvious at a glance and ensures utility
methods like `group`, `time`, and `timeStamp` are never accidentally
silenced — they're structural helpers, not log levels.
2026-03-06 18:56:16 +01:00
Kristjan ESPERANTO
3eb3745dd3 Fix Node.js v25 logging prefix and modernize logger (#4049)
On Node.js v25, the log prefix in the terminal stopped working - instead
of seeing something like:

```
[2026-03-05 23:00:00.000] [LOG]   [app] Starting MagicMirror: v2.35.0
```

the output was:

```
[2026-03-05 23:00:00.000] :pre() Starting MagicMirror: v2.35.0
```

Reported in #4048.

## Why did it break?

The logger used the `console-stamp` package to format log output. One
part of that formatting used `styleText("grey", ...)` to color the
caller prefix gray. Node.js v25 dropped `"grey"` as a valid color name
(only `"gray"` with an "a" is accepted now). This caused `styleText` to
throw an error internally - and `console-stamp` silently swallowed that
error and fell back to returning its raw `:pre()` format string as the
prefix. Not ideal.

## What's in this PR?

**1. The actual fix** - `"grey"` → `"gray"`.

**2. Cleaner stack trace approach** - the previous code set
`Error.prepareStackTrace` *after* creating the `Error`, which is fragile
and was starting to behave differently across Node versions. Replaced
with straightforward string parsing of `new Error().stack`.

**3. Removed the `console-stamp` dependency** - all formatting is now
done with plain Node.js built-ins (`node:util` `styleText`). Same visual
result, no external dependency.

**4. Simplified the module wrapper** - the logger was wrapped in a UMD
pattern, which is meant for environments like AMD/RequireJS. MagicMirror
only runs in two places: Node.js and the browser. Replaced with a simple
check (`typeof module !== "undefined"`), which is much easier to follow.
2026-03-06 13:10:59 +01:00
Kristjan ESPERANTO
ab3108fc14 [calendar] refactor: delegate event expansion to node-ical's expandRecurringEvent (#4047)
node-ical 0.25.x added `expandRecurringEvent()` — a proper API for
expanding both recurring and non-recurring events, including EXDATE
filtering and RECURRENCE-ID overrides. This PR replaces our hand-rolled
equivalent with it.

`calendarfetcherutils.js` loses ~125 lines of code. What's left only
deals with MagicMirror-specific concerns: timezone conversion,
config-based filtering, and output formatting. The extra lines in the
diff come from new tests.

## What was removed

- `getMomentsFromRecurringEvent()` — manual rrule.js wrapping with
custom date extraction
- `isFullDayEvent()` — heuristic with multiple fallback checks
- `isFacebookBirthday` workaround — patched years < 1900 and
special-cased `@facebook.com` UIDs
- The `if (event.rrule) / else` split — all events now go through a
single code path

## Bugs fixed along the way

Both were subtle enough to go unnoticed before:

- **`[object Object]` in event titles/description/location** — node-ical
represents ICS properties with parameters (e.g.
`DESCRIPTION;LANGUAGE=de:Text`) as `{val, params}` objects. The old code
passed them straight through. Mainly affected multilingual Exchange/O365
setups. Fixed with `unwrapParameterValue()`.

- **`excludedEvents` with `until` never worked** —
`shouldEventBeExcluded()` returned `{ excluded, until }` but the caller
destructured it as `{ excluded, eventFilterUntil }`, so the until date
was always `undefined` and events were never hidden. Fixed by correcting
the destructuring key.

The expansion loop also gets error isolation: a single broken event is
logged and skipped instead of aborting the whole feed.

## Other clean-ups

- Replaced `this.shouldEventBeExcluded` with
`CalendarFetcherUtils.shouldEventBeExcluded` — avoids context-loss bugs
when the method is destructured or called indirectly.
- Replaced deprecated `substr()` with `slice()`.
- Replaced `now < filterUntil` (operator overloading) with
`now.isBefore(filterUntil)` — idiomatic Moment.js comparison.
- Fixed `@returns` JSDoc: `string[]` → `object[]`.
- Moved verbose `Log.debug("Processing entry...")` after the `VEVENT`
type guard to reduce log noise from non-event entries.
- Replaced `JSON.stringify(event)` debug log with a lightweight summary
to avoid unnecessary serialization cost.
- Added comment explaining the 0-duration → end-of-day fallback for
events without DTEND.

## Tests

24 unit tests, all passing (`npx vitest run
tests/unit/modules/default/calendar/`).

New coverage: `excludedEvents` with/without `until`, Facebook birthday
year expansion, output object shape, no-DTEND fallback, error isolation,
`unwrapParameterValue`, `getTitleFromEvent`, ParameterValue properties,
RECURRENCE-ID overrides, DURATION (single and recurring).
2026-03-02 21:31:32 +01:00
Veeck
06b1361457 Use getDateString in openmeteo (#4046)
Fixes #4045 

Otherwise the calculation comes to the result that its yesterday...
2026-03-01 15:28:06 +01:00
Kristjan ESPERANTO
587bc2571e chore: remove obsolete Jest config and unit test global setup (#4044)
The files were overlooked during the migration from jest to vitest
(#3940).
2026-03-01 14:12:15 +01:00
Kristjan ESPERANTO
083953fff5 chore: update dependencies + add exports, files, and sideEffects fields to package.json (#4040)
This updates all dependencies to their latest versions - except two
packages:

- eslint: Some plugins we use here aren't compatible yet to ESLint v10.
- node-ical: The new version has revealed an issue in our calendar
logic. I would prefer to address this in a separate PR.

After updating the dependencies, eslint-plugin-package-json rules
complained about missing fields in the package.json. I added them in the
second commit.
2026-03-01 08:30:24 +01:00
Kristjan ESPERANTO
df8a882966 fix(newsfeed): fix full article view and add framing check (#4039)
I was playing around with the newsfeed notification system
(`ARTICLE_MORE_DETAILS`, `ARTICLE_TOGGLE_FULL`, …) and discovered some
issues with the full article view:

The iframe was loading the CORS proxy URL instead of the actual article
URL, which could cause blank screens depending on the feed. Also, many
news sites block iframes entirely (`X-Frame-Options: DENY`) and the user
got no feedback at all — just an empty page. On top of that, scrolling
used `window.scrollTo()` which moved the entire MagicMirror page instead
of just the article.

This PR cleans that up:

- Use the raw article URL for the iframe (CORS proxy is only needed for
server-side feed fetching)
- Check `X-Frame-Options` / `Content-Security-Policy` headers
server-side before showing the iframe — if the site blocks it, show a
brief "Article cannot be displayed here." message and return to normal
view
- Show the iframe as a fixed full-screen overlay so other modules aren't
affected, scroll via `container.scrollTop`
- Keep the progressive disclosure behavior for `ARTICLE_MORE_DETAILS`
(title → description → iframe → scroll)
- Delete `fullarticle.njk`, replace with `getDom()` override
- Fix `ARTICLE_INFO_RESPONSE` returning proxy URL instead of real URL
- A few smaller fixes (negative scroll, null guard)
- Add `NEWSFEED_ARTICLE_UNAVAILABLE` translation to all 47 language
files
- Add e2e tests for the notification handlers (`ARTICLE_NEXT`,
`ARTICLE_PREVIOUS`, `ARTICLE_INFO_REQUEST`, `ARTICLE_LESS_DETAILS`)

## What this means for users

- The full article view now works reliably across different feeds
- If a news site blocks iframes, the user sees a brief message instead
of a blank screen
- Additional e2e tests make the module more robust and less likely to
break silently in future MagicMirror versions
2026-03-01 00:32:42 +01:00
Kristjan ESPERANTO
729f7f0fd1 [core] refactor: enable ESLint rule require-await and handle detected issues (#4038)
Enable the `require-await` ESLint rule. Async functions without `await`
are just regular functions with extra overhead — marking them `async`
adds implicit Promise wrapping, can hide missing `return` statements,
and misleads readers into expecting asynchronous behavior where there is
none.

While fixing the violations, I removed unnecessary `async` keywords from
source files and from various test callbacks that never used `await`.
2026-02-25 10:55:56 +01:00
Kristjan ESPERANTO
8ce0cda7bf [weather] refactor: migrate to server-side providers with centralized HTTPFetcher (#4032)
This migrates the Weather module from client-side fetching to use the
server-side centralized HTTPFetcher (introduced in #4016), following the
same pattern as the Calendar and Newsfeed modules.

## Motivation

This brings consistent error handling and better maintainability and
completes the refactoring effort to centralize HTTP error handling
across all default modules.

Migrating to server-side providers with HTTPFetcher brings:
- **Centralized error handling**: Inherits smart retry strategies
(401/403, 429, 5xx backoff) and timeout handling (30s)
- **Consistency**: Same architecture as Calendar and Newsfeed modules
- **Security**: Possibility to hide API keys/secrets from client-side
- **Performance**: Reduced API calls in multi-client setups - one server
fetch instead of one per client
- **Enabling possible future features**: e.g. server-side caching, rate
limit monitoring, and data sharing with third-party modules

## Changes

- All 10 weather providers now use HTTPFetcher for server-side fetching
- Consistent error handling like Calendar and Newsfeed modules

## Breaking Changes

None. Existing configurations continue to work.

## Testing

To ensure proper functionality, I obtained API keys and credentials for
all providers that require them. I configured all 10 providers in a
carousel setup and tested each one individually. Screenshots for each
provider are attached below demonstrating their working state.

I even requested developer access from the Tempest/WeatherFlow team to
properly test this provider.

**Comprehensive test coverage**: A major advantage of the server-side
architecture is the ability to thoroughly test providers with unit tests
using real API response snapshots. Don't be alarmed by the many lines
added in this PR - they are primarily test files and real-data mocks
that ensure provider reliability.

## Review Notes

I know this is an enormous change - I've been working on this for quite
some time. Unfortunately, breaking it into smaller incremental PRs
wasn't feasible due to the interdependencies between providers and the
shared architecture.

Given the scope, it's nearly impossible to manually review every change.
To ensure quality, I've used both CodeRabbit and GitHub Copilot to
review the code multiple times in my fork, and both provided extensive
and valuable feedback. Most importantly, my test setup with all 10
providers working successfully is very encouraging.

## Related

Part of the HTTPFetcher migration #4016.

## Screenshots

<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-06-54"
src="https://github.com/user-attachments/assets/2139f4d2-2a9b-4e49-8d0a-e4436983ed6e"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-02"
src="https://github.com/user-attachments/assets/880f7ce2-4e44-42d5-bfe4-5ce475cca7c2"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-07"
src="https://github.com/user-attachments/assets/abd89933-fe03-40ab-8a7c-41ae1ff99255"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-12"
src="https://github.com/user-attachments/assets/22225852-f0a9-4d33-87ab-0733ba30fad3"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-17"
src="https://github.com/user-attachments/assets/7a7192a5-f237-4060-85d7-6f50b9bef5af"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-22"
src="https://github.com/user-attachments/assets/df84d9f1-e531-4995-8da8-d6f2601b6a08"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-27"
src="https://github.com/user-attachments/assets/4cf391ac-db43-4b52-95f4-f5eadc5ea34d"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-32"
src="https://github.com/user-attachments/assets/8dd8e688-d47f-4815-87f6-7f2630f15d58"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-37"
src="https://github.com/user-attachments/assets/ee84a8bc-6b35-405a-b311-88658d9268dd"
/>
<img width="1920" height="1080" alt="Ekrankopio de 2026-02-08 13-07-42"
src="https://github.com/user-attachments/assets/f941f341-453f-4d4d-a8d9-6b9158eb2681"
/>

Provider "Weather API" added later:

<img width="1910" height="1080" alt="Ekrankopio de 2026-02-15 19-39-06"
src="https://github.com/user-attachments/assets/3f0c8ba3-105c-4f90-8b2e-3a1be543d3d2"
/>
2026-02-23 10:27:29 +01:00
Andrés Vanegas Jiménez
80c48791b2 [weather] feat: add Weather API Provider (#4036)
Weather API: https://www.weatherapi.com/docs/
2026-02-21 23:19:22 +01:00
Karsten Hassel
6cb3e24c2a replace template_spec test with config_variables test (#4034)
After introducing new config loading this PR replaces the obsolete
template test with a config test.
2026-02-09 20:35:54 +01:00
Karsten Hassel
1dc3032171 allow environment variables in cors urls (#4033)
and centralize and optimize replace regex.

Another follow up to #4029 

With this PR you can use secrets in urls in browser modules if you use
the cors proxy.
2026-02-08 16:18:56 +01:00
Karsten Hassel
172ca18178 fix cors proxy getting binary data (e.g. png, webp) (#4030)
fixes #3266

---------

Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2026-02-08 12:02:50 +01:00
Karsten Hassel
b9481d27fa fix: correct secret redaction and optimize loadConfig (#4031)
- fix copy/paste typo in redacted replacement
- create redacted content only if hideConfigSecrets is true

follow up for #4029
2026-02-08 00:26:40 +01:00
Karsten Hassel
9dd964e004 change loading config.js, allow variables in config.js and try to protect sensitive data (#4029)
## Loading `config.js`

### Previously

Loaded on server-side in `app.js` and in the browser by including
`config.js` in `index.html`. The web server has an endpoint `/config`
providing the content of server loaded `config.js`.

### Now

Loaded only on server-side in `app.js`. The browser loads the content
using the web server endpoint `/config`. So the server has control what
to provide to the clients.

Loading the `config.js` was moved to `Utils.js` so that
`check_config.js` can use the same functions.

## Using environment variables in `config.js`

### Previously

Environment variables were not allowed in `config.js`. The workaround
was to create a `config.js.template` with curly braced bash variables
allowed. While starting the app the `config.js.template` was converted
via `envsub` into a `config.js`.

### Now

Curly braced bash variables are allowed in `config.js`. Because only the
server loads `config.js` he can substitute the variables while loading.

## Secrets in MagicMirror²

To be honest, this is a mess.

### Previously

All content defined in the `config` directory was reachable from the
browser. Everyone with access to the site could see all stuff defined in
the configuration e.g. using the url http://ip:8080/config. This
included api keys and other secrets.

So sharing a MagicMirror² url to others or running MagicMirror² without
authentication as public website was not possible.

### Now

With this PR we add (beta) functionality to protect sensitive data. This
is only possible for modules running with a `node_helper`. For modules
running in the browser only (e.g. default `weather` module), there is no
way to hide data (per construction). This does not mean, that every
module with `node_helper` is safe, e.g. the default `calendar` module is
not safe because it uses the calendar url's as sort of id and sends them
to the client.

For adding more security you have to set `hideConfigSecrets: true` in
`config.js`. With this:
- `config/config.env` is not deliverd to the browser
- the contents of environment variables beginning with `SECRET_` are not
published to the clients

This is a first step to protect sensitive data and you can at least
protect some secrets.
2026-02-06 00:21:35 +01:00
Karsten Hassel
f9f3461f13 calendar.js: remove useless hasCalendarURL function (#4028)
Found this while debugging.

The `hasCalendarURL` function does a check if the url is in the config.
But the calendar sees only his own config part, so this check is always
true (tested with more than one calendar module in `config.js`).
2026-02-06 00:11:53 +01:00
Karsten Hassel
f6d559e3dc remove kioskmode (#4027)
Marked as deprecated since 2016.
2026-02-06 00:09:59 +01:00
Jordan Welch
431103437c Add dark theme logo (#4026)
I noticed that this icon that I normally can't read on a dark theme has
a light version on the website as well!

This is using [the HTML `<picture>`
element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/picture)
that is [supported by GitHub
Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax#the-picture-element)

<img width="544" height="432" alt="CleanShot 2026-01-31 at 22 54 42@2x"
src="https://github.com/user-attachments/assets/6ce5dda8-2aaa-4171-9989-7e2ab593e943"
/>
<img width="544" height="432" alt="CleanShot 2026-01-31 at 22 54 58@2x"
src="https://github.com/user-attachments/assets/3ed2944f-77b4-4645-9764-2aaf3cf21621"
/>

![CleanShot 2026-01-31 at 22 55
12](https://github.com/user-attachments/assets/97e1a56d-ae97-4dad-82d2-ebde8d92be2e)
2026-02-01 08:22:46 +01:00
Veeck
751c83bef0 Update node-ical and other deps (#4025) 2026-01-31 23:45:46 +01:00
Kristjan ESPERANTO
5c1cc476f3 [newsfeed] refactor: migrate to centralized HTTPFetcher (#4023)
This migrates the Newsfeed module to use the centralized HTTPFetcher
class (introduced in #4016), following the same pattern as the Calendar
module.

This continues the refactoring effort to centralize HTTP error handling
across all modules.

## Changes

**NewsfeedFetcher:**
- Refactored from function constructor to ES6 class (like the calendar
module in #3959)
- Replaced manual fetch() + timer handling with HTTPFetcher composition
- Uses structured error objects with translation keys
- Inherits smart retry strategies (401/403, 429, 5xx backoff)
- Inherits timeout handling (30s) and AbortController

**node_helper.js:**
- Updated error handler to use `errorInfo.translationKey`
- Simplified property access (`fetcher.url`, `fetcher.items`)

**Cleanup:**
- Removed `js/module_functions.js` (`scheduleTimer` no longer needed)
- Removed `#module_functions` import from package.json

## Related

Part of the HTTPFetcher migration effort started in #4016.
Next candidate: Weather module (client-side → server-side migration).
2026-01-29 19:41:59 +01:00
Kristjan ESPERANTO
2b55b8e0f4 refactor(clientonly): modernize code structure and add comprehensive tests (#4022)
This PR improves `clientonly` start option with better code structure,
validation, and comprehensive test coverage.

### Changes

**Refactoring:**
- Improved parameter handling with explicit function parameter passing
instead of closure
- Added port validation (1-65535) with proper NaN handling
- Removed unnecessary IIFE wrapper (Node.js modules are already scoped)
- Extracted `getCommandLineParameter` as a reusable top-level function
- Enhanced error reporting with better error messages
- Added connection logging for debugging

**Testing:**
- Added comprehensive e2e tests for parameter validation
- Test coverage for missing/incomplete parameters
- Test coverage for local address rejection (localhost, 127.0.0.1, ::1,
::ffff:127.0.0.1)
- Test coverage for port validation (invalid ranges, non-numeric values)
- Test coverage for TLS flag parsing
- Integration test with running server

### Testing

All tests pass:
```bash
npm test -- tests/e2e/clientonly_spec.js
# ✓ 18 tests passed
2026-01-28 20:48:47 +01:00
Karsten Hassel
6324ec2116 move custom.css from css to config (#4020)
This is another change to cleanup structure, already mentioned in
https://github.com/MagicMirrorOrg/MagicMirror/pull/4019#issuecomment-3792953018

After separating default and 3rd-party modules this PR moves the
`custom.css` from the mm-owned directory `css` into user owned directory
`config`.

It has a built-in function which moves the `css/custom.css` to the new
location `config/custom.css` (if the target not exists).

Let me know if there's a majority in favor of this change.
2026-01-28 10:50:25 +01:00
Kristjan ESPERANTO
43503e8fff chore: update dependencies (#4021)
This includes a new version of `node-ical` which should resolve a
calendar issue that was reported
[here](https://github.com/MagicMirrorOrg/MagicMirror/pull/4016#issuecomment-3787073856)
and
[here](https://github.com/MagicMirrorOrg/MagicMirror/pull/4010#issuecomment-3798857137).
2026-01-27 22:31:35 +01:00
Karsten Hassel
d44db6ea10 move default modules from /modules/default to /defaultmodules (#4019)
Since the project's inception, I've missed a clear separation between
default and third-party modules.

This increases complexity within the project (exclude `modules`, but not
`modules/default`), but the mixed use is particularly problematic in
Docker setups.

Therefore, with this pull request, I'm moving the default modules to a
different directory.

~~I've chosen `default/modules`, but I'm not bothered about it;
`defaultmodules` or something similar would work just as well.~~

Changed to `defaultmodules`.

Let me know if there's a majority in favor of this change.
2026-01-27 08:37:52 +01:00
Karsten Hassel
5e0cd28980 update electron to v40, update node versions in workflows (#4018)
- remove param `--enable-features=UseOzonePlatform` in start electron
tests (as we did already in `package.json`)
- update node versions in github workflows, remove `22.21.1`, add `25.x`
- fix formatting in tests
- update dependencies including electron to v40

This is still a draft PR because most calendar electron tests are not
running which is caused by the electron update from `v39.3.0` to
`v40.0.0`. Maybe @KristjanESPERANTO has an idea ...

---------

Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2026-01-24 06:15:15 -06:00
Kristjan ESPERANTO
34913bfb9f [core] refactor: extract and centralize HTTP fetcher (#4016)
## Summary

PR [#3976](https://github.com/MagicMirrorOrg/MagicMirror/pull/3976)
introduced smart HTTP error handling for the Calendar module. This PR
extracts that HTTP logic into a central `HTTPFetcher` class.

Calendar is the first module to use it. Follow-up PRs would migrate
Newsfeed and maybe even Weather.

**Before this change:**

-  Each module had to implemented its own `fetch()` calls
-  No centralized retry logic or backoff strategies
-  No timeout handling for hanging requests
-  Error detection relied on fragile string parsing

**What this PR adds:**

-  Unified HTTPFetcher class with intelligent retry strategies
-  Modern AbortController with configurable timeout (default 30s)
-  Proper undici Agent for self-signed certificates
-  Structured error objects with translation keys
-  Calendar module migrated as first consumer
-  Comprehensive unit tests with msw (Mock Service Worker)

## Architecture

**Before - Decentralized HTTP handling:**

```
Calendar Module          Newsfeed Module         Weather Module
┌─────────────┐         ┌─────────────┐         ┌─────────────┐
│ fetch() own │         │ fetch() own │         │ fetch() own │
│ retry logic │         │ basic error │         │ no retry    │
│ error parse │         │   handling  │         │ client-side │
└─────────────┘         └─────────────┘         └─────────────┘
      │                       │                       │
      └───────────────────────┴───────────────────────┘
                              ▼
                        External APIs
```

**After - Centralized with HTTPFetcher:**

```
┌─────────────────────────────────────────────────────┐
│                  HTTPFetcher                        │
│  • Unified retry strategies (401/403, 429, 5xx)     │
│  • AbortController timeout (30s)                    │
│  • Structured errors with translation keys          │
│  • undici Agent for self-signed certs               │
└────────────┬──────────────┬──────────────┬──────────┘
             │              │              │
     ┌───────▼───────┐ ┌────▼─────┐ ┌──────▼──────┐
     │   Calendar    │ │ Newsfeed │ │   Weather   │
     │    This PR  │ │  future  │ │   future    │
     └───────────────┘ └──────────┘ └─────────────┘
             │              │              │
             └──────────────┴──────────────┘
                          ▼
                   External APIs
```
## Complexity Considerations

**Does HTTPFetcher add complexity?**

Even if it may look more complex, it actually **reduces overall
complexity**:

- **Calendar already has this logic** (PR #3976) - we're extracting, not
adding
- **Alternative is worse:** Each module implementing own logic = 3× the
code
- **Better testability:** 443 lines of tests once vs. duplicating tests
for each module
- **Standards-based:** Retry-After is RFC 7231, not custom logic

## Future Benefits

**Weather migration (future PR):**

Moving Weather from client-side to server-side will enable:
- **Same robust error handling** - Weather gets 429 rate-limiting, 5xx
backoff for free
- **Simpler architecture** - No proxy layer needed

Moving the weather modules from client-side to server-side will be a big
undertaking, but I think it's a good strategy. Even if we only move the
calendar and newsfeed to the new HTTP fetcher and leave the weather as
it is, this PR still makes sense, I think.

## Breaking Changes

**None**

----

I am eager to hear your opinion on this 🙂
2026-01-22 19:24:37 +01:00
in-voker
23f0290139 Switch to undici Agent for HTTPS requests (#4015)
Allow the selfSignedCert: true flag in calenders array to work.
2026-01-17 21:34:46 +01:00
Kristjan ESPERANTO
37a8b11112 chore(eslint): migrate from eslint-plugin-vitest to @vitest/eslint-plugin and run rules only on test files (#4014)
This PR makes three small changes to the ESLint setup:

1. Migrate from
[eslint-plugin-vitest](https://www.npmjs.com/package/eslint-plugin-vitest)
to it's successor
[@vitest/eslint-plugin](https://www.npmjs.com/package/@vitest/eslint-plugin).
2. Change the eslint config so that only the test files are checked with
the vitest rules. Previously, it was just unnecessary and inefficient to
check all js files with them.
3. We had defined some of the test rules as warnings, but that is not
really ideal. I changed them to errors.
2026-01-12 09:03:32 +01:00
Kristjan ESPERANTO
2d3a557864 fix(calendar): update to node-ical 0.23.1 and fix full-day recurrence lookup (#4013)
Adapts calendar module to node-ical changes and fixes a bug with moved
full-day recurring events in eastern timezones.

## Changes

### 1. Update node-ical to 0.23.1
- Includes upstream fixes for UNTIL UTC validation errors from CalDAV
servers (reported by @rejas in PR #4010)
- Changes to `getDateKey()` behavior for VALUE=DATE events (now uses
local date components)
- Fixes issue with malformed DURATION values (reported by MagicMirror
user here: https://github.com/jens-maus/node-ical/issues/381)

### 2. Remove dead code
- Removed ineffective UNTIL modification code (rule.options is read-only
in rrule-temporal)
- The code attempted to extend UNTIL for all-day events but had no
effect

### 3. Fix recurrence lookup for full-day events
node-ical changed the behavior of `getDateKey()` - it now uses local
date components for VALUE=DATE events instead of UTC. This broke
recurrence override lookups for full-day events in eastern timezones.

**Why it broke:**
- **before node-ical update:** Both node-ical and MagicMirror used UTC →
keys matched 
- **after node-ical update:** node-ical uses local date (RFC 5545
conform), MagicMirror still used UTC → **mismatch** 

**Example:**
- Full-day recurring event on October 12 in Europe/Berlin (UTC+2)
- node-ical 0.23.1 stores override with key: `"2024-10-12"` (local date)
- MagicMirror looked for key: `"2024-10-11"` (from UTC: Oct 11 22:00)
- **Result:** Moved event not found, appears on wrong date

**Solution:** Adapt to node-ical's new behavior by using local date
components for full-day events, UTC for timed events.

**Note:** This is different from previous timezone fixes - those
addressed event generation, this fixes the lookup of recurrence
overrides.

## Background

node-ical 0.23.0 switched from `rrule` to `rrule-temporal`, introducing
breaking changes. Version 0.23.1 fixed the UNTIL validation issue and
formalized the `getDateKey()` behavior for DATE vs DATE-TIME values,
following RFC 5545 specification that DATE values represent local
calendar dates without timezone context.
2026-01-11 21:27:52 -06:00
Karsten Hassel
82e39a2476 fix systeminformation not displaying electron version (#4012)
Bug was introduced with #4002

Because the sysinfo process runs as own subprocess the
`${process.versions.electron}` variable is always `undefined`.
2026-01-11 23:17:01 +01:00
Kristjan ESPERANTO
3b793bf31b Update node-ical and support it's rrule-temporal changes (#4010)
Updating `node-ical` and adapt logic to new behaviour.

## Problem

node-ical 0.23.0 switched from `rrule.js` to `rrule-temporal`, changing
how recurring event dates are returned. Our code assumed the old
behavior where dates needed manual timezone conversion.

## Solution

Updated `getMomentsFromRecurringEvent()` in `calendarfetcherutils.js`:
- Removed `tzid = null` clearing (no longer needed)
- Simplified timed events: `moment.tz(date, eventTimezone)` instead of
`moment.tz(date, "UTC").tz(eventTimezone, true)`
- Kept UTC component extraction for full-day events to prevent date
shifts
2026-01-10 18:35:46 -06:00
Kristjan ESPERANTO
471dbd80a5 Change default start scripts from X11 to Wayland (#4011)
This PR changes the default `start` and `start:dev` scripts to use
Wayland instead of X11. I think after three years, it's time to take
this step.

### Background

Since Raspberry Pi OS Bookworm (2023), Wayland is the default display
server. As most MagicMirror installations run on Raspberry Pi, this
change aligns with what new users already have installed.

### Benefits

Especially for new users (which install the OS with Wayland) it's easier
- they can simply run `npm start` without needing to understand display
server differences or manually switch scripts.

And for projects in general it's better to rely on modern defaults than
on legacy.

### Breaking Changes

**None** - X11 support is maintained. Users who really use and need X11
can use `node --run start:x11`.
2026-01-11 00:01:55 +01:00
Veeck
8e6701f6fd Update deps as requested by dependabot (#4008) 2026-01-08 20:31:42 +01:00
Karsten Hassel
b847dd7f3f update Collaboration.md and dependencies (#4001)
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2026-01-08 10:14:47 +01:00
Kristjan ESPERANTO
56fe067afa chore: migrate CI workflows to ubuntu-slim for faster startup times (#4007)
*This type of runner is optimized for automation tasks, issue operations
and short-running jobs. They are not suitable for typical heavyweight
CI/CD builds.*
[[1](https://docs.github.com/en/actions/reference/runners/github-hosted-runners#single-cpu-runners)].

We are not necessarily dependent on faster startups, but that seems to
be becoming the best practice now.
2026-01-07 23:18:24 +01:00
Kristjan ESPERANTO
9731ea28eb refactor: unify favicon for index.html and Electron (#4006)
In #3407 we already talked about unifying them.

- Create SVG favicon (better then png)
- Replace base64 placeholder in index.html with SVG favicon
- Update electron.js to use SVG favicon instead of mm2.png
- Add favicon.svg to server static routes
- Remove mm2.png
2026-01-05 10:51:43 +01:00
Kristjan ESPERANTO
40301f2a59 fix(calendar): correct day-of-week for full-day recurring events across all timezones (#4004)
Fixes **full-day recurring events showing on wrong day** in timezones
west of UTC (reported in #4003).

**Root cause**: `moment.tz(date, eventTimezone).startOf("day")`
interprets UTC midnight as local time:
- `2025-11-03T00:00:00.000Z` in America/Chicago (UTC-6)
- → Converts to `2025-11-02 18:00:00` (6 hours back)
- → `.startOf("day")` → `2025-11-02 00:00:00`  **Wrong day!**

**Impact**: The bug affects:
- All timezones west of UTC (UTC-1 through UTC-12): Americas, Pacific
- Timezones east of UTC (UTC+1 through UTC+12): Europe, Asia, Africa -
work correctly
- UTC itself - works correctly

The issue was introduced with commit c2ec6fc2 (#3976), which fixed the
time but broke the date. This PR fixes both.

| | Result | Day | Time | Notes |
|----------|--------|-----|------|-------|
| **Before c2ec6fc2** | `2025-11-03 05:00:00 Monday` |  |  | Wrong
time, but correct day |
| **Current (c2ec6fc2)** | `2025-11-02 00:00:00 Sunday` |  (west of
UTC)<br> (east of UTC) |  | Wrong day - visible bug! |
| **This fix** | `2025-11-03 00:00:00 Monday` |  |  | Correct in all
timezones |

Note: While the old logic had incorrect timing, it produced the correct
calendar day due to how it handled UTC offsets. The current logic fixed
the timing issue but introduced the more visible calendar day bug.

### Solution

Extract UTC date components and interpret as local calendar dates:

```javascript
const utcYear = date.getUTCFullYear();
const utcMonth = date.getUTCMonth();
const utcDate = date.getUTCDate();
return moment.tz([utcYear, utcMonth, utcDate], eventTimezone);
```

### Testing

To prevent this from happening again in future refactorings, I wrote a
test for it.

```bash
npm test -- tests/unit/modules/default/calendar/calendar_fetcher_utils_spec.js
```
2026-01-04 06:36:16 -06:00
Karsten Hassel
241921b79c [core] run systeminformation in subprocess so the info is always displayed (#4002)
If an error occurs during startup, we request system information from
the user. The problem is that this information is displayed too late,
for example, if the configuration check fails.

My initial idea was to use `await
Utils.logSystemInformation(global.version);`, but this increased the
startup time.

Therefore, the function is now called in a subprocess. This approach
provides the information in all cases and does not increase the startup
time.
2026-01-03 01:14:48 +01:00
sam detweiler
950f55197e set next release dev number (#4000)
change develop for next release labels
2026-01-01 16:06:29 +01:00
Karsten Hassel
a4f29f753f Merge branch 'master' into develop 2026-01-01 15:33:56 +01:00
sam detweiler
d5d1441782 Prepare Release 2.34.0 (#3998)
starting 2.34.0 release
2026-01-01 07:51:45 -06:00
Karsten Hassel
0fb6fcbb12 dependency update + adjust Playwright setup + fix linter issue (#3994)
update dependencies before next release

---------

Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-12-28 12:14:31 +01:00
Karsten Hassel
49620781c2 demo with gif (#3995)
add demo.gif to README.md
2025-12-27 18:00:48 -06:00
Kristjan ESPERANTO
9d3b07db12 [core] fix: allow browser globals in config files (#3992)
The config checker previously only allowed Node.js globals, but since
the config file runs also in the browser context, users should be able
to access browser APIs like `document` or `window` when needed.

This was incorrectly flagged as an error by the `no-undef` ESLint rule.
The fix adds browser globals to the allowed globals in the linter
config.

Fixes #3990.
2025-12-21 12:44:03 +01:00
sam detweiler
9c25b15f6a add checksum to test whether calendar event list changed (#3988)
for issue #3971 add checksum to test if event list changed to
reduce/eliminate no change screen update
fixes #3971

crc32 checksum created in node helper, easy require, vs trying to do in
browser.
added to socket notification payload, used in browser
2025-12-18 20:57:24 +01:00
Kristjan ESPERANTO
c64d3ef146 [core] fix: restore --ozone-platform=wayland flag for reliable Wayland support (#3989)
The Electron 38+ auto-detection of ozone-platform does not work reliably
in all environments (e.g., Docker containers) because it depends on
environment variables like XDG_SESSION_TYPE which may not be set.

Since `start:wayland` is explicitly called for Wayland sessions, it
makes sense to explicitly specify the platform flag for maximum
reliability.

The `--enable-features=UseOzonePlatform` flag remains removed as it is
no longer needed since Electron 38.

Fixes Docker compatibility issue reported in
MagicMirrorOrg/MagicMirror#3974
2025-12-14 19:45:20 +01:00
Karsten Hassel
1998b6273b testing: update "Enforce Pull-Request Rules" workflow (#3987)
With this update the workflow file from inside the feature branch is
used, not the old stuff coming from `master` as before. This does not
help for the currently failing job which still comes from `master` (we
have to live with this until next release), but this will help in the
future to prevent such errors.

Tested this on my fork:
- base against `develop`: workflow is skipped
- base against `master`: workflow fails
- base against `master` with label `mastermerge`: workflow is skipped

I took this new workflow from the same repo where the previous workflows
was taken (see diff for the link) so this is the further development.
2025-12-10 22:28:34 +01:00
Karsten Hassel
e7ad361c93 [chore] update dependencies and min. node version (#3986) 2025-12-10 19:42:20 +01:00
Karsten Hassel
4186cbf0b2 [core] auto create release notes with every push on develop (#3985)
and remove CHANGELOG.md logic.

This is my attempt to create a draft release instead of editing a
changelog, see discussion on discord.

Logic:
- new github workflow `.github/workflows/release-notes.yaml`
- runs with every push on `develop` (so after PR's are merged)
- collects the commits on `develop` which are newer than the latest tag
- searches the commit messages for keywords defined in an array and
group the messages into categories (this is a first shot, we will update
this ...)
- creates markdown content
- looks for an untagged and unpublished draft release with name
`unreleased`, if it exists, it will be deleted
- creates an untagged and unpublished draft release with name
`unreleased` with markdown content created above

Example created on my fork (this caused having `MagicMirrorOrg` in the
PR-Links):

<img width="952" height="1804" alt="grafik"
src="https://github.com/user-attachments/assets/38687bed-f5da-4dcb-93eb-242c317769df"
/>

Please review this PR, it is a draft release at the moment because I got
problems in my fork where I tested this: The created draft release is
not visible at the moment (they are visible via api). AFAIS this is a
queue problem on GitHub, maybe I flooded their queue while testing ...
So I will test this tomorrow again before removing `draft` here.
2025-12-10 11:56:31 -06:00
Kristjan ESPERANTO
c2ec6fc2b9 [calendar] fix: prevent excessive fetching on client reload and refactor calendarfetcherutils.js (#3976)
The bottom line of this PR is, that it fixes an issue and simplifies the
code by dealing with the TODOs in the code.

For review, I suggest looking at each commit individually. If there are
too many changes for a PR, let me know and I'll split it up
🙂

## 1. [fix(calendar): prevent excessive fetching with smart refresh
strategy](8892cd3d5a)

- Add lastFetch timestamp tracking to CalendarFetcher
- Add shouldRefetch() method with configurable minimum interval
(default: 3 minutes)
- When reusing existing fetcher: fetch if data is stale (>3 min),
otherwise broadcast cached events
- Prevents double broadcasts to consuming modules while maintaining
fresh data
- Balances rate limit prevention (Issue
https://github.com/MagicMirrorOrg/MagicMirror/issues/3971) with data
freshness on user reload
- Prevents excessive fetching during rapid reloads (e.g., Fully Kiosk
screensaver use case)
- Allows fresh calendar data when enough time has passed since last
fetch

## 2. [refactor(calendar): simplify event exclusion
logic](d507aba82d)

- Extract filtering logic from `shouldEventBeExcluded` into new helper
`checkEventAgainstFilter`
- Simplify the main loop in `shouldEventBeExcluded

It resolves a TODO from the comments in the code:
* `This seems like an overly complicated way to exclude events based on
the title.`

## 3. [refactor(calendar): extract recurring event expansion
logic](d510160bd2)

This change separates the expansion of recurring events from the main
filtering loop into a new helper function 'expandRecurringEvent'.

It resolves two TODOs from the comments in the code:
- `This should be a separate function`
- `This should create an event per moment so we can change anything we
want`

This improves code readability, reduces complexity in 'filterEvents',
and allows for cleaner handling of individual recurrence instances.

## 4. [refactor(calendar): simplify recurring event
handling](b04f716cc0)

- Simplify 'getMomentsFromRecurringEvent' using modern syntax
- Improve handling of full-day events across different timezones


## 5. [test(calendar): fix UNTIL date in fullday_until.ics
fixture](1d762b2ade)

The issue was with the UNTIL date being May 4th while DTSTART was May
5th. This created an invalid recurrence rule where the end date came
before the start date.

The fix only adjusts the UNTIL date from May 4th to May 5th, so it
matches the start date.
2025-12-08 10:07:04 +01:00
Veeck
fdac92d2e9 [core] bump dependencies into december (#3982)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-12-01 20:05:06 +01:00
Kristjan ESPERANTO
ca6e8b2857 [core] chore: simplify Wayland start script (#3974)
Remove `--enable-features=UseOzonePlatform` and
`--ozone-platform=wayland` flags as Electron 38+ changed the default
`--ozone-platform` to `auto`, which automatically detects and uses
Wayland when running in a Wayland session.

Source:
https://www.electronjs.org/blog/electron-38-0#removed-electron_ozone_platform_hint-environment-variable.
2025-11-29 09:39:16 +01:00
dependabot[bot]
a0f1a2c61e Bump actions/checkout from 5 to 6 (#3972)
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to
6.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/checkout/releases">actions/checkout's
releases</a>.</em></p>
<blockquote>
<h2>v6.0.0</h2>
<h2>What's Changed</h2>
<ul>
<li>Update README to include Node.js 24 support details and requirements
by <a href="https://github.com/salmanmkc"><code>@​salmanmkc</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/2248">actions/checkout#2248</a></li>
<li>Persist creds to a separate file by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2286">actions/checkout#2286</a></li>
<li>v6-beta by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2298">actions/checkout#2298</a></li>
<li>update readme/changelog for v6 by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2311">actions/checkout#2311</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/checkout/compare/v5.0.0...v6.0.0">https://github.com/actions/checkout/compare/v5.0.0...v6.0.0</a></p>
<h2>v6-beta</h2>
<h2>What's Changed</h2>
<p>Updated persist-credentials to store the credentials under
<code>$RUNNER_TEMP</code> instead of directly in the local git
config.</p>
<p>This requires a minimum Actions Runner version of <a
href="https://github.com/actions/runner/releases/tag/v2.329.0">v2.329.0</a>
to access the persisted credentials for <a
href="https://docs.github.com/en/actions/tutorials/use-containerized-services/create-a-docker-container-action">Docker
container action</a> scenarios.</p>
<h2>v5.0.1</h2>
<h2>What's Changed</h2>
<ul>
<li>Port v6 cleanup to v5 by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2301">actions/checkout#2301</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/checkout/compare/v5...v5.0.1">https://github.com/actions/checkout/compare/v5...v5.0.1</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/actions/checkout/blob/main/CHANGELOG.md">actions/checkout's
changelog</a>.</em></p>
<blockquote>
<h1>Changelog</h1>
<h2>V6.0.0</h2>
<ul>
<li>Persist creds to a separate file by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2286">actions/checkout#2286</a></li>
<li>Update README to include Node.js 24 support details and requirements
by <a href="https://github.com/salmanmkc"><code>@​salmanmkc</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/2248">actions/checkout#2248</a></li>
</ul>
<h2>V5.0.1</h2>
<ul>
<li>Port v6 cleanup to v5 by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2301">actions/checkout#2301</a></li>
</ul>
<h2>V5.0.0</h2>
<ul>
<li>Update actions checkout to use node 24 by <a
href="https://github.com/salmanmkc"><code>@​salmanmkc</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2226">actions/checkout#2226</a></li>
</ul>
<h2>V4.3.1</h2>
<ul>
<li>Port v6 cleanup to v4 by <a
href="https://github.com/ericsciple"><code>@​ericsciple</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2305">actions/checkout#2305</a></li>
</ul>
<h2>V4.3.0</h2>
<ul>
<li>docs: update README.md by <a
href="https://github.com/motss"><code>@​motss</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1971">actions/checkout#1971</a></li>
<li>Add internal repos for checking out multiple repositories by <a
href="https://github.com/mouismail"><code>@​mouismail</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1977">actions/checkout#1977</a></li>
<li>Documentation update - add recommended permissions to Readme by <a
href="https://github.com/benwells"><code>@​benwells</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2043">actions/checkout#2043</a></li>
<li>Adjust positioning of user email note and permissions heading by <a
href="https://github.com/joshmgross"><code>@​joshmgross</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2044">actions/checkout#2044</a></li>
<li>Update README.md by <a
href="https://github.com/nebuk89"><code>@​nebuk89</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2194">actions/checkout#2194</a></li>
<li>Update CODEOWNERS for actions by <a
href="https://github.com/TingluoHuang"><code>@​TingluoHuang</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/2224">actions/checkout#2224</a></li>
<li>Update package dependencies by <a
href="https://github.com/salmanmkc"><code>@​salmanmkc</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/2236">actions/checkout#2236</a></li>
</ul>
<h2>v4.2.2</h2>
<ul>
<li><code>url-helper.ts</code> now leverages well-known environment
variables by <a href="https://github.com/jww3"><code>@​jww3</code></a>
in <a
href="https://redirect.github.com/actions/checkout/pull/1941">actions/checkout#1941</a></li>
<li>Expand unit test coverage for <code>isGhes</code> by <a
href="https://github.com/jww3"><code>@​jww3</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1946">actions/checkout#1946</a></li>
</ul>
<h2>v4.2.1</h2>
<ul>
<li>Check out other refs/* by commit if provided, fall back to ref by <a
href="https://github.com/orhantoy"><code>@​orhantoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1924">actions/checkout#1924</a></li>
</ul>
<h2>v4.2.0</h2>
<ul>
<li>Add Ref and Commit outputs by <a
href="https://github.com/lucacome"><code>@​lucacome</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1180">actions/checkout#1180</a></li>
<li>Dependency updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a>- <a
href="https://redirect.github.com/actions/checkout/pull/1777">actions/checkout#1777</a>,
<a
href="https://redirect.github.com/actions/checkout/pull/1872">actions/checkout#1872</a></li>
</ul>
<h2>v4.1.7</h2>
<ul>
<li>Bump the minor-npm-dependencies group across 1 directory with 4
updates by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1739">actions/checkout#1739</a></li>
<li>Bump actions/checkout from 3 to 4 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1697">actions/checkout#1697</a></li>
<li>Check out other refs/* by commit by <a
href="https://github.com/orhantoy"><code>@​orhantoy</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1774">actions/checkout#1774</a></li>
<li>Pin actions/checkout's own workflows to a known, good, stable
version. by <a href="https://github.com/jww3"><code>@​jww3</code></a> in
<a
href="https://redirect.github.com/actions/checkout/pull/1776">actions/checkout#1776</a></li>
</ul>
<h2>v4.1.6</h2>
<ul>
<li>Check platform to set archive extension appropriately by <a
href="https://github.com/cory-miller"><code>@​cory-miller</code></a> in
<a
href="https://redirect.github.com/actions/checkout/pull/1732">actions/checkout#1732</a></li>
</ul>
<h2>v4.1.5</h2>
<ul>
<li>Update NPM dependencies by <a
href="https://github.com/cory-miller"><code>@​cory-miller</code></a> in
<a
href="https://redirect.github.com/actions/checkout/pull/1703">actions/checkout#1703</a></li>
<li>Bump github/codeql-action from 2 to 3 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1694">actions/checkout#1694</a></li>
<li>Bump actions/setup-node from 1 to 4 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1696">actions/checkout#1696</a></li>
<li>Bump actions/upload-artifact from 2 to 4 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/checkout/pull/1695">actions/checkout#1695</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1af3b93b68"><code>1af3b93</code></a>
update readme/changelog for v6 (<a
href="https://redirect.github.com/actions/checkout/issues/2311">#2311</a>)</li>
<li><a
href="71cf2267d8"><code>71cf226</code></a>
v6-beta (<a
href="https://redirect.github.com/actions/checkout/issues/2298">#2298</a>)</li>
<li><a
href="069c695914"><code>069c695</code></a>
Persist creds to a separate file (<a
href="https://redirect.github.com/actions/checkout/issues/2286">#2286</a>)</li>
<li><a
href="ff7abcd0c3"><code>ff7abcd</code></a>
Update README to include Node.js 24 support details and requirements (<a
href="https://redirect.github.com/actions/checkout/issues/2248">#2248</a>)</li>
<li>See full diff in <a
href="https://github.com/actions/checkout/compare/v5...v6">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/checkout&package-manager=github_actions&previous-version=5&new-version=6)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-24 13:07:52 +01:00
Kristjan ESPERANTO
7934e7aef8 [compliments] refactor: optimize loadComplimentFile method and add unit tests (#3969)
## Changes

- Replace `indexOf()` with `startsWith()` for cleaner protocol detection
- Use `URL` API for robust cache-busting parameter handling
- Add HTTP response validation and improved error logging
- Add JSDoc type annotations for better documentation
- Remove unused `urlSuffix` instance variable
- Add unit tests
- Fix `.gitignore` pattern

## Motivation

After merging #3967, I noticed some potential for improving reliability
and user experience related to the method `loadComplimentFile`. With
these changes the method now validates URLs upfront to catch
configuration errors early, checks HTTP status codes to detect server
issues (404/500), and provides specific error messages that help users
troubleshoot problems.

The complexity of the code does not really increase with the changes. On
the contrary, the method should now be more intuitive to understand.

## Testing

Added unit tests for `loadComplimentFile()` to validate the
improvements:
- HTTP error handling
- Cache-busting

Since E2E tests already cover the happy path, these unit tests focus on
error cases and edge cases.

## Additional Fix

While adding the test file, I discovered that the `.gitignore` pattern
`modules` was incorrectly matching `tests/unit/modules/`, preventing
test files from being tracked. Changed to `/modules` to only match the
root directory.
2025-11-23 17:13:13 +01:00
Samed Ozdemir
74b682fdf1 fix: set compliments remote file minimum delay to 15 minutes (#3970)
fix: set compliments remote file minimum delay to 15 minutes..extra *60
in there was making it 15 hours.
2025-11-21 13:27:37 +01:00
Kristjan ESPERANTO
854c954180 [gitignore] restore the old Git behavior for the default modules (#3968)
The pattern `modules` was too broad and prevented tracking files in
`modules/default/` despite the negation pattern. Changed to `modules/*`
to properly exclude only the content of the modules directory while
allowing the default modules to be tracked.

This issue was likely introduced during the cleanup in #3952.

Without this change there are now warn messages like this:

```bash
kristjan@debian:~/MagicMirror$ git add modules/default/compliments/compliments.js
The following paths are ignored by one of your .gitignore files:
modules
hint: Use -f if you really want to add them.
hint: Disable this message with "git config advice.addIgnoredFile false"
```
2025-11-19 11:40:53 +01:00
Samed Ozdemir
a52baa5874 [compliments] fix: duplicate query param "?" in compliments module refresh url (#3967)
Checks if `this.config.remoteFile.includes` already contains a `?`
- If it does, uses `&` to append the dummy parameter
- If it doesn't, uses `?` to start a new query string
2025-11-19 11:06:43 +01:00
Blackspirits
1796400ab9 Add new pt and pt-BR translations for Alert module and update global PT strings (#3965)
- Added new pt.json and pt-br.json in alert/translations
- Updated main pt.json (global translations)
- Updated alert.js to load new languages
- Added entry to CHANGELOG.md

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-11-16 09:59:41 +01:00
Kristjan ESPERANTO
3c4d69ea84 [calendar] refactor: migrate CalendarFetcher to ES6 class and improve error handling (#3959)
1. Convert CalendarFetcher from legacy constructor function pattern to
ES6 class (which simplifies future migration from CommonJS to ES
modules).
2. Implement targeted HTTP error handling with smart retry strategies
for common calendar feed issues:
   - 401/403: Extended retry delay (5× interval, min 30 min)
   - 429: Retry-After header parsing with 15 min fallback
   - 5xx: Exponential backoff (2^count, max 3 retries)
   - 4xx: Extended retry (2× interval, min 15 min)
   - Add serverErrorCount tracking for exponential backoff
- Error messages now include specific HTTP status codes and calculated
retry delays for better debugging and user feedback

Previously, CalendarFetcher did not respond appropriately to HTTP
errors, continuing to hammer endpoints without backoff, potentially
overloading servers and triggering rate limits. This refactoring
implements respectful retry strategies that adapt to server responses
and reduce unnecessary load.

Maybe we could later centralize the HTTP error handling and use it for
weather and newsfeed as well.

The PR was inspired by having worked on the calendar fetcher for
MMM-CalendarExt2, where there was already better error handling.
2025-11-14 20:14:23 +01:00
Jordan Welch
53df20f313 [weatherprovider] update subclass language use override (#3914) 2025-11-13 22:08:47 +01:00
Veeck
38a4d235e8 [weather] fix wind-icon not showing in pirateweather (#3957)
fixes #3956

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-11-10 21:41:24 +01:00
Kristjan ESPERANTO
f29f424a62 [core] refactor: replace XMLHttpRequest with fetch and migrate e2e tests to Playwright (#3950)
### 1. Replace `XMLHttpRequest` with the modern `fetch` API for loading
translation files

#### Changes
- **translator.js**: Use `fetch` with `async/await` instead of XHR
callbacks
- **loader.js**: Align URL handling and add error handling (follow-up to
fetch migration)
- **Tests**: Update infrastructure for `fetch` compatibility

#### Benefits
- Modern standard API
- Cleaner, more readable code
- Better error handling and fallback mechanisms

### 2. Migrate e2e tests to Playwright

This wasn't originally planned for this PR, but is related. While
investigating suspicious log entries which surfaced after the fetch
migration I kept running into JSDOM’s limitations. That pushed me to
migrate the E2E suite to Playwright instead.

#### Changes
- switch e2e harness to Playwright (`tests/e2e/helpers/global-setup.js`)
- rewrite specs to use Playwright locators + shared `expectTextContent`
- install Chromium via `npx playwright install --with-deps` in CI

#### Benefits
- much closer to real browser behaviour
- and no more fighting JSDOM’s quirks
2025-11-08 21:59:05 +01:00
Kristjan ESPERANTO
2b08288346 [core] configure cspell to check default modules only and fix typos (#3955)
When I saw PR #3951, I wondered why `cspell` didn't catch these typos
before. Unfortunately, the default modules were excluded from the check.
I have corrected this with these changes.

This even revealed a code error in
`modules/default/weather/providers/overrideWrapper.js`:

- before: `fetchEatherHourly`
- after: `fetchWeatherHourly`
2025-11-08 20:27:34 +01:00
Kristjan ESPERANTO
8e9ee8953a [gitignore] restoring the old Git behavior for the CSS directory (#3954)
The advantage of the old behavior is that users can keep backups, copies
or any other CSS files with different names in the directory without Git
interfering.

I suspect that this was not taken into account during the cleanup in PR
#3952 🙂
2025-11-08 20:25:47 +01:00
sam detweiler
c1aaea5913 [weather] add error handling to weather fetch functions, including cors (#3791)
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
fixes #3687
2025-11-08 14:21:31 +01:00
Jarno
3b79791a6b [calendar] Show repeatingCountTitle only if yearDiff > 0 (#3949) 2025-11-08 14:13:59 +01:00
Karsten Hassel
ab5f79a1be remove deprecated ukmetoffice datapoint provider, cleanup .gitignore (#3952)
- weather ukmetoffice see #3842 , I got a final reminder today per mail
that datapoint will be retired on Dec. 1st.
- cleanup/simplify `.gitignore`
2025-11-07 08:45:20 +01:00
Veeck
034f3c4b2a [newsfeed] fix header layout issue (#3946)
... fixes #3944 introduced with prettier njk linting

---------

Co-authored-by: veeck <gitkraken@veeck.de>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-11-05 18:09:30 +01:00
Kristjan ESPERANTO
9d713ffd69 [test] replace node-libgpiod with serialport in electron-rebuild workflow (#3945)
`node-libgpiod` uses deprecated NAN which is incompatible with Electron
v39+. `serialport` uses N-API ensuring compatibility with current and
future Electron versions.

`node-libgpiod` is only used by 1 of ~1300 3rd-party-modules
(MMM-PresenceScreenControl), while serialport is used by at least 4
modules (MMM-Serial-Notification, MMM-RadarPresence, MMM-LKY-TIC and
MMM-Gestures), making it a better test candidate.

Also updates Electron to v39.

Fixes #3933
2025-11-04 22:46:20 +01:00
Kristjan ESPERANTO
67fead74b4 [ci] Add concurrency to automated tests workflow to cancel outdated runs (#3943)
Add `concurrency` configuration to automatically cancel outdated test
runs when new commits are pushed to the same PR/branch.

Inspired by
[MagicMirrorOrg/MagicMirror-Documentation#335](https://github.com/MagicMirrorOrg/MagicMirror-Documentation/pull/335).
2025-11-04 18:04:29 +01:00
Kristjan ESPERANTO
d7348ed765 [tests] suppress debug logs in CI environment + improve calendar symbol test stability (#3941)
## CI Log Suppression

**Two-level approach for clean test output:**

1. **Suppress debug/info logs**: Call `logger.setLogLevel("ERROR")` in
CI to hide verbose logging
2. **Suppress intentional error logs**: Set `mmTestMode` flag and check
it before logging errors that are part of test assertions (e.g., testing
error handling in `git_helper.js` and `server_functions.js`)

This keeps CI output clean and makes genuine failures immediately
visible, while preserving full logging for local development.

**Before:** 1348 log lines with verbose debug/info output  
**After:** 168 log clean lines with only test results

## Calendar Symbol Test Stability

Convert the calendar symbol test from external URL (`calendarlabs.com`)
to existing local mock file (`12_events.ics`). This eliminates CI
timeouts caused by external dependencies and improves test reliability.

The test still validates the same symbol array feature but now runs
faster and deterministically without network dependencies.
2025-11-03 23:49:21 +01:00
Kristjan ESPERANTO
462abf7027 [tests] migrate from jest to vitest (#3940)
This is a big change, but I think it's a good move, as `vitest` is much
more modern than `jest`.

I'm excited about the UI watch feature (run `npm run test:ui`), for
example - it's really helpful and saves time when debugging tests. I had
to adjust a few tests because they had time related issues, but
basically we are now testing the same things - even a bit better and
less flaky (I hope).

What do you think?
2025-11-03 19:47:01 +01:00
Veeck
b542f33a0a Update deps, unpin parse5 (#3934)
seems we dont need the parse5 pin as long as jsdom is fixed to v27.0.0.

not sure if there is anything else we can do to the deps?

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
2025-11-01 22:29:40 +01:00
Karsten Hassel
1e5d127d44 fixes problems with daylight-saving-time in weather provider openmeteo (#3931)
fix for #3930
2025-11-01 13:46:58 +01:00
Jboucly
961b3c96d6 feat(core): add server:watch script with automatic restart on file changes (#3920)
## Description

This PR adds a new `server:watch` script that runs MagicMirror² in
server-only mode with automatic restart and browser reload capabilities.

Particularly helpful for:
- **Developers** who need to see changes immediately without manual
restarts.
- **Users setting up their mirror** who make many changes to `config.js`
or `custom.css` and need quick feedback.

### What it does

When you run `npm run server:watch`, the watcher monitors files you
specify in `config.watchTargets`. Whenever a monitored file changes:

1. The server automatically restarts
2. Waits for the port to become available
3. Sends a reload notification to all connected browsers via Socket.io
4. Browsers automatically refresh to show the changes

This creates a seamless development experience where you can edit code,
save, and see the results within seconds.

### Implementation highlights

**Zero dependencies:** Uses only Node.js built-ins (`fs.watch`,
`child_process.spawn`, `net`, `http`) - no nodemon or external watchers
needed.

**Smart file watching:** Monitors parent directories instead of files
directly to handle atomic writes from modern editors (VSCode, etc.) that
create temporary files during save operations.

**Port management:** Waits for the old server instance to fully release
the port before starting a new one, preventing "port already in use"
errors.

### Configuration

Users explicitly define which files to monitor in their `config.js`:

```js
let config = {
  watchTargets: [
    "config/config.js",
    "css/custom.css",
    "modules/MMM-MyModule/MMM-MyModule.js",
    "modules/MMM-MyModule/node_helper.js"
  ],
  // ... rest of config
};
```

This explicit approach keeps the implementation simple (~260 lines)
while giving users full control over what triggers restarts. If
`watchTargets` is empty or undefined, the watcher starts but monitors
nothing, logging a clear warning message.

---

**Note:** This PR description has been updated to reflect the final
implementation. During the review process, we refined the approach
multiple times based on feedback.

---------

Co-authored-by: Jboucly <contact@jboucly.fr>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-10-28 19:14:51 +01:00
Kristjan ESPERANTO
2e795f6552 [calendar] chore: remove requiresVersion: "2.1.0" (#3932)
This is just to reduce a little noise in the dev console. The following
line will not appear with this change:

```shell
module.js:480 Check MagicMirror² version for module 'calendar' - Minimum version:  2.1.0 - Current version: 2.34.0-
```

Since version 2.1.0 is so old, we can surely throw it out without
concern.
2025-10-27 09:48:17 +01:00
Kristjan ESPERANTO
9ad5618843 [check_config] refactor: improve error handling (#3927)
- Combine file existence and permission checks with better error
messages
- Replace thrown exceptions with clean error output (no stack traces)
- Support custom module positions by changing strict validation to
warnings
- Add missing process.exit(1) after validation errors

Users now see clear, actionable error messages without stack traces, and
custom region configurations work correctly.

## example before

```bash
$ npm run start

> magicmirror@2.34.0-develop start
> node --run start:x11

[2025-10-22 17:56:06.303] [LOG]   Starting MagicMirror: v2.34.0-develop 
[2025-10-22 17:56:06.304] [LOG]   Loading config ... 
[2025-10-22 17:56:06.304] [LOG]   config template file not exists, no envsubst 
[2025-10-22 17:56:06.356] [ERROR] File not found: /home/kristjan/MagicMirror/config/config.js
No config file present! 
[2025-10-22 17:56:06.356] [ERROR] [checkconfig] Error: Error: ENOENT: no such file or directory, access '/home/kristjan/MagicMirror/config/config.js'
No permission to access config file!
    at checkConfigFile (/home/kristjan/MagicMirror/js/check_config.js:43:9)
    at Object.<anonymous> (/home/kristjan/MagicMirror/js/check_config.js:138:2)
    at Module._compile (node:internal/modules/cjs/loader:1714:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1848:10)
    at Module.load (node:internal/modules/cjs/loader:1448:32)
    at Module._load (node:internal/modules/cjs/loader:1270:12)
    at c._load (node:electron/js2c/node_init:2:17993)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:244:24)
    at Module.require (node:internal/modules/cjs/loader:1470:12)
    at require (node:internal/modules/helpers:147:16)
    at loadConfig (/home/kristjan/MagicMirror/js/app.js:126:3)
    at App.start (/home/kristjan/MagicMirror/js/app.js:291:18)
    at Object.<anonymous> (/home/kristjan/MagicMirror/js/electron.js:228:7)
    at Module._compile (node:internal/modules/cjs/loader:1714:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1848:10) 
```

## example after

```bash
$ npm run start

> magicmirror@2.34.0-develop start
> node --run start:x11

[2025-10-22 21:33:27.930] [LOG]   Starting MagicMirror: v2.34.0-develop 
[2025-10-22 21:33:27.931] [LOG]   Loading config ... 
[2025-10-22 21:33:27.931] [LOG]   config template file not exists, no envsubst 
[2025-10-22 21:33:27.985] [ERROR] [check_config] File not found: /home/kristjan/MagicMirror/config/config.js 
```
2025-10-23 22:48:16 +02:00
Kristjan ESPERANTO
c9eecddf23 [calendar] test: remove "Recurring event per timezone" test (#3929)
Remove the "Recurring event per timezone" test that manipulated
Date.prototype.getTimezoneOffset to simulate 24 different timezones for
testing all-day recurring events.

Reasons for removal:
1. The test approach is incompatible with node-ical 0.22.0's Intl-based
timezone handling (which replaced moment-timezone). Manipulating
Date.prototype.getTimezoneOffset no longer affects Intl.DateTimeFormat,
which reads the system timezone directly.

2. node-ical 0.22.0 handles all-day events (VALUE=DATE) correctly by
preserving the calendar date without timezone conversions, making
cross-timezone testing unnecessary. The library includes comprehensive
tests for this behavior, particularly "keeps whole-day recurrence across
DST" in
[test/advanced.test.js](https://github.com/jens-maus/node-ical/blob/master/test/advanced.test.js).

3. The existing "Recurring event" test already verifies that recurring
events from the same ICS file are displayed correctly, so a simplified
version of "Recurring event per timezone" is not necessary.

The old test attempted to work around timezone conversion issues in
node-ical 0.21.0 that are now properly resolved upstream.

Closes #3928
2025-10-23 19:09:56 +02:00
Karsten Hassel
bc0d36503a logger: add calling filename as prefix on server side (#3926) 2025-10-22 22:50:31 +02:00
Veeck
a1c1e9560c [logger] Add prefixes to most Log messages (#3923)
Co-authored-by: veeck <gitkraken@veeck.de>
2025-10-21 20:32:48 +02:00
Veeck
f1c0c38c86 [core] Update deps and pin jsdom to v27.0.0 (#3925) 2025-10-20 19:12:42 +02:00
Kristjan ESPERANTO
64f78ea2f2 chore: update dependencies (#3921)
Normally, I wouldn't update the dependencies again so soon, but
`node-ical` underwent some major changes (see
https://github.com/jens-maus/node-ical/pull/404) with the last release,
and I'd like to use it here as early as possible to see if there are any
problems with it.
2025-10-19 23:58:59 +02:00
Kevin G.
2a4a056c84 Fix for envcanada Provider to use updated Env Canada URL (#3919)
The envcanada provider in the default Weather module was fixed in MM
v2.33.0 to use a new URL hierarchy that Environment Canada implemented
to access weather data for Canadian locations. Subsequent to this
provider update, Environment Canada has implemented one further update
to their URL hierarchy to make it easier to access 'current day' weather
data. Tis change was raised in Issue #3912 as a Bug, which is addressed
in this Provider update. There are no Magic Mirror UI changes from this
update.

The fix is to add one additional element to the URL used to access
Environment Canada XML-based weather data.

This PR is also taking the opportunity to make one further small fix to
how windspeed is handled in this Provider. Most of the time, Env Canada
provides an expected numeric value. There are instances, however, where
the value provided is 'calm', which the Weather module does not expect.
The Provider code has been changed to detect a 'calm' windspeed and
convert it to '0' for the purposes of the Weather module. Note that in
the world of weather/climate analysis, a windspeed of 'calm' is used as
a synonym for a windspeed of 0.

Note that a ChangeLog entry is included in this PR.
2025-10-19 19:06:44 +02:00
Kristjan ESPERANTO
96d3e8776d [weather] feat: add configurable forecast date format option (#3918)
I was a little disappointed that I couldn't change the date format in
the forecast because it was hard-coded. This PR introduces a new option
(`forecastDateFormat`) that allows the user to specify the format
themselves. The default remains `ddd`.

## Before

<img width="483" height="524" alt="Screenshot From 2025-10-18 18-26-13"
src="https://github.com/user-attachments/assets/2de6af55-e73c-42e8-a3fe-7386ef5f90e0"
/>

## After (examples)

### `forecastDateFormat: "dddd"`
<img width="483" height="524" alt="Screenshot From 2025-10-18 18-26-27"
src="https://github.com/user-attachments/assets/cd86c798-f1e4-4d75-adf9-c4e549aa2a51"
/>

### `forecastDateFormat: "ddd, D MMM"`
<img width="483" height="524" alt="Screenshot From 2025-10-18 18-28-02"
src="https://github.com/user-attachments/assets/79aaa7b3-810a-4ab1-833c-09dfab7f457a"
/>
2025-10-18 19:57:41 +02:00
Kristjan ESPERANTO
37d1a3ae8f refactor: replace express-ipfilter with lightweight custom middleware (#3917)
This fixes security issue
[CVE-2023-42282](https://github.com/advisories/GHSA-78xj-cgh5-2h22),
which is not very likely to be exploitable in MagicMirror² setups, but
still should be fixed.

The [express-ipfilter](https://www.npmjs.com/package/express-ipfilter)
package depends on the obviously unmaintained
[ip](https://github.com/indutny/node-ip) package, which has known
security vulnerabilities. Since no fix is available, this commit
replaces both dependencies with a custom middleware using the better
maintained [ipaddr.js](https://www.npmjs.com/package/ipaddr.js) library.

Changes:
- Add new `js/ip_access_control.js` with lightweight middleware
- Remove `express-ipfilter` dependency, add `ipaddr.js`
- Update `js/server.js` to use new middleware
- In addition, I have formulated the descriptions of the corresponding
tests a little more clearly.
2025-10-18 19:56:55 +02:00
Karsten Hassel
9ff716f4ab update deps, exclude node v23 (#3916) 2025-10-16 23:47:06 +02:00
Karsten Hassel
d39e686f7a remove eslint warnings, add npm publish process to Collaboration.md (#3913) 2025-10-14 22:44:37 +02:00
Kristjan ESPERANTO
5f1f5bd291 feat: add ESlint rule no-sparse-arrays for config check (#3911)
Adding a rule to the config checker config so that unexpected commas in
the middle of arrays (reported in issue #3910) are better detected.

Two commas in a row inside the modules array create an empty entry
(`undefined`). JavaScript accepts that syntax, but MagicMirror would
later try to load that “module” and fail.

Alternatively, we could filter out undefined entries, but with this PR,
the user receives a clear message indicating where the error lies, can
easily fix it, and thus has a cleaner configuration.

## Before

```
[2025-10-10 19:33:30.874] [INFO]  Checking config file /home/kristjan/MagicMirror/config/config.js ... 
[2025-10-10 19:33:30.944] [INFO]  Your configuration file doesn't contain syntax errors :) 
[2025-10-10 19:33:30.945] [INFO]  Checking modules structure configuration ... 
[2025-10-10 19:33:31.027] [ERROR] This module configuration contains errors:
undefinedmust be object
```

## After

```
[2025-10-10 19:41:20.030] [INFO]  Checking config file /home/kristjan/MagicMirror/config/config.js ... 
[2025-10-10 19:41:20.107] [ERROR] Your configuration file contains syntax errors :(
Line 91 column 1: Unexpected comma in middle of array.
```
2025-10-13 23:40:23 +02:00
Veeck
b09a27a83b chore: bump dependencies into october (#3909) 2025-10-01 19:13:54 +02:00
Kristjan ESPERANTO
787cc6bd1f refactor: replace module-alias dependency with internal alias resolver (#3893)
- removes the external unmaintained `module-alias` dependency ->
reducing complexity and risk
- introduces a small internal alias mechanism for `logger` and
`node_helper`
- preserves backward compatibility for existing 3rd‑party modules
- should simplify a future ESM migration of MagicMirror

I'm confident that it shouldn't cause any problems, but we could also
consider including it in the release after next. What do you think?

This PR is inspired by PR #2934 - so thanks to @thesebas! 🙇 😃
2025-09-30 20:12:58 +02:00
Kristjan ESPERANTO
b1a189b238 Prepare 2.34.0-develop 2025-09-30 18:14:08 +02:00
Kristjan ESPERANTO
593a4b95d6 Prepare Release 2.33.0 (#3902) 2025-09-30 16:15:50 +02:00
Karsten Hassel
1f2d1b92b5 update jsdoc and other deps (#3896)
other cosmetic code changes because of new `eslint-plugin-jsdoc` version
v60
2025-09-23 06:27:29 +02:00
Veeck
fbca0a0e55 [layout] update styles for weather and calendar (#3894) 2025-09-17 20:02:14 +02:00
Kevin G.
e8868217a9 Fix for envcanada Provider to use new Environment Canada weather data access (#3878)
Earlier in 2025, Environment Canada changed the process to access
weather data for Canadian cities. This change was raised in Issue #3822
as a Bug, which is addressed in this Provider update. There are no Magic
Mirror UI changes from this update.

The 'old' method to access Environment Canada involved accessing a
static URL based on a City identifier which would result in an XML
document containing the appropriate weather data.

The 'new' method is a 2 step process. The first step is to access a
time-sensitive URL that contains a list of links to various cities that
have weather data available. The second step requires finding the
correct city in that list based on a City identifier, and then accessing
that unique URL to access an XML document containing the appropriate
weather data.

The changes made to the envcanada Provider code are solely aimed at
using the new 2-step method to access a specified City's weather data.
Since the resulting XML document structure has not changed, no other
code in envcanada required changes.

Note that a ChangeLog entry is included in this PR.

---------

Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
2025-09-17 12:07:32 +02:00
Veeck
a49fbede18 [weather] better null value handling for weather type (#3892)
As mentioned
[here](https://github.com/MagicMirrorOrg/MagicMirror/pull/3878#issuecomment-3275344406)
our weather module needs a bit better handling for null values in the
type field.

This pr adds this and cleans up the layout a little.
2025-09-16 17:00:02 +02:00
Kristjan ESPERANTO
777b49c566 chore: update dependencies (#3891)
Since receiving a security warning about `axios` in `node-ical`
(https://github.com/MagicMirrorOrg/MagicMirror/security/dependabot/70),
I've created [a pull request to remove `axios` from
`node-ical`](https://github.com/jens-maus/node-ical/pull/397) — it was
accepted and we now have a new version 🙂
2025-09-15 23:58:55 +02:00
Kristjan ESPERANTO
fb2aa438d8 feat: add clear log for occupied port at startup (#3890)
Having repeatedly seen that users are unaware of the meaning of the
EADDRINUSE error message (see, for example, this [forum
thread](https://forum.magicmirror.builders/topic/19871/update-package-list/5)),
I thought we should intercept this message and provide clearer output.
This may help users identify the cause of the problem more quickly
themselves.

## before

```
[2025-09-13 09:54:32.903] [LOG]   Starting MagicMirror: v2.33.0-develop 
...
[2025-09-13 09:54:33.533] [LOG]   Starting server on port 8080 ...  
[2025-09-13 09:54:33.537] [WARN]  You're using a full whitelist configuration to allow for all IPs 
[2025-09-13 09:54:33.568] [ERROR] Whoops! There was an uncaught exception... 
[2025-09-13 09:54:33.574] [ERROR] Error: listen EADDRINUSE: address already in use 0.0.0.0:8080
    at Server.setupListenHandle [as _listen2] (node:net:1940:16)
    at listenInCluster (node:net:1997:12)
    at node:net:2206:7
    at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
  code: 'EADDRINUSE',
  errno: -98,
  syscall: 'listen',
  address: '0.0.0.0',
  port: 8080
} 
[2025-09-13 09:54:33.574] [ERROR] MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection? 
[2025-09-13 09:54:33.574] [ERROR] If you think this really is an issue, please open an issue on GitHub: https://github.com/MagicMirrorOrg/MagicMirror/issues 
[2025-09-13 09:54:35.235] [INFO]  
####  System Information  ####
...
```

## after

```
[2025-09-13 09:53:20.151] [LOG]   Starting MagicMirror: v2.33.0-develop 
...
[2025-09-13 09:53:20.928] [LOG]   Starting server on port 8080 ...  
[2025-09-13 09:53:20.931] [WARN]  You're using a full whitelist configuration to allow for all IPs 
[2025-09-13 09:53:20.970] [ERROR] 
────────────────────────────────────────────────────────────────
 PORT IN USE: 0.0.0.0:8080

 Another process (most likely another MagicMirror instance)
 is already using this port.

 Stop the other process (free the port) or use a different port.
──────────────────────────────────────────────────────────────── 
[2025-09-13 09:53:22.471] [INFO]  
####  System Information  ####
...
```
2025-09-13 13:01:55 +02:00
Karsten Hassel
aac85bbb54 improve config check tests (#3889)
see
https://github.com/MagicMirrorOrg/MagicMirror/pull/3886#issuecomment-3280414877
2025-09-11 21:50:11 +02:00
Kristjan ESPERANTO
d81386f3d9 chore: use prettier --write --ignore-unknown in lint-staged to avoid errors on unsupported files (#3888)
This prevents `prettier` from failing when `lint-staged` passes
unknown/binary files, making the pre-commit hook more robust.

In concrete terms this could happen, when we, for example, add a new PNG
file. Since we rarely do this, it has not been noticed so far.

This is recommended when using asterisk:
https://github.com/lint-staged/lint-staged#automatically-fix-code-style-with-prettier-for-any-format-prettier-supports

## before

```bash
$ npx lint-staged <-- after staging a new PNG file
✔ Backed up original state in git stash (c3247d4b)
✔ Hiding unstaged changes to partially staged files...
⚠ Running tasks for staged files...
  ❯ package.json — 2 files
    ❯ * — 2 files
      ✖ prettier --write [FAILED]
    ↓ *.js — no files
    ↓ *.css — no files
↓ Skipped because of errors from tasks.
↓ Skipped because of errors from tasks.
✔ Reverting to original state because of errors...
✔ Cleaning up temporary files...

✖ prettier --write:
[error] No parser could be inferred for file "~/MagicMirror/test.png".
...
```

## after

```bash
$ npx lint-staged <-- after staging a new PNG file
✔ Backed up original state in git stash (0c3fe285)
✔ Running tasks for staged files...
✔ Applying modifications from tasks...
✔ Cleaning up temporary files...
```
2025-09-11 18:34:08 +02:00
Veeck
08d29c3083 Add Prettier plugin for Nunjuck templates (#3887) 2025-09-11 13:10:53 +02:00
Karsten Hassel
3260b9dfe4 add test for config:check (#3886) 2025-09-11 13:08:56 +02:00
Karsten Hassel
2481bc621f revert changes breaking node --run config:check (#3885) 2025-09-10 07:55:05 +02:00
Karsten Hassel
b1865d8115 refactor: use global.root_path instead relative paths (#3883) 2025-09-09 08:09:45 +02:00
Veeck
31bafc3297 update default icon for calendars (#3879)
While looking at
https://github.com/MagicMirrorOrg/MagicMirror-Documentation/issues/114 I
noticed that the default icon is not named correctly.

`calendar-alt` should be called `calendar-days` which seems to be its
fallback anyways.

I also updated the link to the icon search

---------

Co-authored-by: veeck <gitkraken@veeck.de>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-09-08 14:42:13 +02:00
Veeck
d277a276e7 Bump github actions and dependencies (#3882)
as suggested by dependabot
[here](https://github.com/MagicMirrorOrg/MagicMirror/pull/3880) and
[here](https://github.com/MagicMirrorOrg/MagicMirror/pull/3881)
also bumped the dependencies while at it

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
2025-09-08 14:29:06 +02:00
Karsten Hassel
be957af6a6 bump minimal node version to v22.18.0 (#3877)
electron uses node v22.18 in its [current
releases](https://releases.electronjs.org/), so we should go hand in
hand and use that as the minimal node version
2025-09-04 07:07:15 +02:00
Karsten Hassel
93d5df8d04 update electron to v38 (#3876) 2025-09-03 23:59:54 +02:00
Veeck
6f4eab9535 [core] bump dependencies into september (#3872)
nothing fancy in these though

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
2025-09-01 21:23:24 +02:00
Veeck
25efe4204f Update feels_like temperature formula (#3869)
The current logic never showed any different temperature than the
current one, so I looked into a more "explained" formula and found one
in the HomeAssistant forums.
2025-09-01 15:12:52 +02:00
Veeck
f8679b6ba8 [weather] use 'apparent_temperature' in openmeteos data for feelsLike temperature (#3868) 2025-08-30 13:00:00 +02:00
Kristjan ESPERANTO
fad8bbaeb1 test: add alert module tests for different welcome_message configurations (#3867)
In this way, all options for `welcome_message` are tested.
2025-08-28 23:17:44 +02:00
Kristjan ESPERANTO
4c0a4689c3 [tests] refactor translation tests (#3866)
- Remove `sinon` dependency in favor of Jest native mocking
  - Unify test helper functions across translation test suites
- Rename `setupDOMEnvironment` to `createTranslationTestEnvironment` for
consistency
  - Simplify DOM setup by removing unnecessary Promise/async patterns
- Avoid potential port conflicts by using port 3001 for translator unit
tests
  - Improve test reliability and maintainability
2025-08-28 21:26:50 +02:00
sam detweiler
eb719429d4 fix for #3380, socket.io timeout closure (#3862)
socket.io times out and closes the client side socket without any
callback
sendSocntNotification() from the server side data is lost as the socket
is closed. but the client doesn't know

increase the timeout 

fixes #3380
2025-08-28 18:02:21 +02:00
sam detweiler
3387bf8db0 fix regression #3841 (#3865)
fixes #3841

this is a correction of the rewrite
2025-08-28 16:50:12 +02:00
sam detweiler
483d3cd4e6 Fix limitdays regression (#3863)
fixes #3840 

this is a rewrite

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-08-28 16:13:29 +02:00
Karsten Hassel
787fbda85b tests: update jest snapshot url (#3861)
This is not a cosmetic change because jest errors when run with
`CI=true`.

I got this error when running unit tests in gitlab:

```bash
FAIL unit tests/unit/functions/updatenotification_spec.js
  ● Test suite failed to run
    Outdated guide link: The snapshot guide link is outdated.Please update all snapshots while upgrading of Jest
    Expected: https://jestjs.io/docs/snapshot-testing
    Received: https://goo.gl/fbAQLP
      at validateSnapshotHeader (node_modules/@jest/snapshot-utils/build/index.js:104:12)
      at getSnapshotData (node_modules/@jest/snapshot-utils/build/index.js:156:28)
```

If you run the test without `CI=true` jest will update the file.
2025-08-27 21:16:38 +02:00
Marcel
76da0aa55e Make User-Agent configurable (#3255)
Fixes #3253 

Adds a configuration option to overwrite the default `User-Agent` header
that is send at least by the calendar and news module. Allows other
modules to use the individual user agent as well.

The configuration accepts either a string or a function:
```
var config =
	{
		...
		userAgent: 'Mozilla/5.0 (My User Agent)',
		...
	}
```
or
```
var config =
	{
		...
		userAgent: () => 'Mozilla/5.0 (My User Agent)',
		...
	}
```

---------

Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <gitkraken@veeck.de>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-08-27 13:50:37 +02:00
Kristjan ESPERANTO
83d15aaaaa tests: add setupDOMEnvironment helper function to eliminate repetitive JSDOM setup code (#3860)
The helper function allows to remove a lot of repetitive code, making
the tests clearer and easier to maintain.
2025-08-19 22:46:59 +02:00
Veeck
1b31cf19e9 Thoroughly check for precipitationAmount values in weathergov provider (#3859)
Fixes #3856

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-08-16 20:56:52 +02:00
Veeck
0ca7d23b69 update github actions (#3858)
actions/checkout got updated last night

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-08-12 21:14:41 +02:00
Veeck
839d074df1 Update dependencies (#3857)
Just some normal maintainance after the holidays

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
2025-08-11 12:49:03 +02:00
Karsten Hassel
e34ef0cb6e update dependencies (#3849) 2025-07-22 22:09:29 +02:00
Karsten Hassel
3fa2b96054 cleanup and try to stabilize weather e2e tests (#3848)
The weather e2e tests are failing sometimes, failing is not really
reproducable.

After changing `updateDom(0)` to `updateDom(300)` in `weather.js` it
seems to work (we will se if it really works in the long term).

This PR contains some other weather e2e changes/cleanups/simplifying.
2025-07-20 08:23:52 +02:00
Karsten Hassel
e7b669af34 e2e: decrease stop app waitTime (#3847) 2025-07-16 23:54:02 +02:00
Karsten Hassel
54752f10e8 replace console with Log in calendar debug.js (#3846)
to avoid exception in eslint config.

Background: If someone has a copy of the `modules` folder in his setup
eslint fails because the file `debug.js` uses `console` statements. I
need the `modules` folder renamed in my docker setup so this test always
fails. I think this is a simple solution which has no impact.
2025-07-16 00:38:03 +02:00
Kristjan ESPERANTO
02e76da196 refactor: extract constants for weather electron tests (#3845)
I find the tests with clear variable names much easier to understand.
2025-07-15 00:27:35 +02:00
Kristjan ESPERANTO
7f8935a34c refactor: simplify jest config (#3844)
- changed export from async to sync function - this removes unnecessary
complexity
- reformatted `collectCoverageFrom` to use `<rootDir>` for each pattern
and switch to multi-line style - this is just harmonization
2025-07-13 21:32:58 +02:00
Kristjan ESPERANTO
931fe55022 refactor: optimize system information logging (#3843)
Additionally to #3839 did some rework on the system logging.

- feat: include MagicMirror version (like Sam suggested in #3839)
- refactor: use more variables to get the string array less complex
- refactor: get `installedNodeVersion` from si.versions (with that it
was possible to drop the import of `execSync`)
- fix: `used node` was always the same as the installed one. Since
Electron comes with its own node version, this can differ. This is now
shown correctly (again?) with the use of `process.version`.
- a bit formatting

I think these changes make the code easier to understand and therefore
easier to maintain. Except for showing the MM version there is no big
difference for the user.

## before

```bash
#####  System Information  #####
- SYSTEM:    manufacturer: Notebook; model: N650DU; virtual: false; timeZone: Europe/Berlin
- OS:        platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
- VERSIONS:  electron: 36.3.2; used node: 22.15.0; installed node: 22.15.0; npm: 10.9.0; pm2: 6.0.6
- ENV:       XDG_SESSION_TYPE: wayland; MM_CONFIG_FILE: config/config_MMM-PublicTransportHafas.js;
             WAYLAND_DISPLAY:  wayland-0; DISPLAY: :0; ELECTRON_ENABLE_GPU: undefined
- RAM:       total: 15925.45 MB; free: 2716.90 MB; used: 13209.04 MB
- UPTIME:    259 minutes 
```

## after

```bash
####  System Information  ####
- SYSTEM:   manufacturer: Notebook; model: N650DU; virtual: false; MM: 2.33.0-develop
- OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
- VERSIONS: electron: 36.3.2; used node: 22.15.1; installed node: 22.15.0; npm: 10.9.0; pm2: 6.0.6
- ENV:      XDG_SESSION_TYPE: wayland; MM_CONFIG_FILE: config/config_MMM-PublicTransportHafas.js
            WAYLAND_DISPLAY:  wayland-0; DISPLAY: :0; ELECTRON_ENABLE_GPU: undefined
- RAM:      total: 15925.45 MB; free: 2814.49 MB; used: 13110.96 MB
- OTHERS:   uptime: 260 minutes; timeZone: Europe/Berlin 
```
2025-07-12 08:24:09 +02:00
Karsten Hassel
a05eb23306 refactor default modules: move scheduleTimer to one place (#3837)
see #3819

---------

Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
2025-07-10 08:12:09 +02:00
Kristjan ESPERANTO
e115475a9d feat: enhance system information logging format and include additional env and RAM details (#3839)
When we introduced the system information, I selected `###` as the
prefix for each line. While this doesn't cause any problems in the
terminal, when someone copies the output to an issue or the forum, every
line is formatted as a heading, which is not ideal. That's why I made
some rework and suggest these changes.

In addition to the formatting changes, I added some env and RAM details
plus the uptime. These are just suggestions – if you don't think they're
worth adding, I'm happy to remove them. We wanted to keep this block
compact.

@sdetweil, since you are often on the front line with the error messages
from users: Is there any information missing in the system block that
you often have to request additionally?

Feel free to request changes!

-----

## in the terminal

### before

```
[2025-07-09 21:58:36.943] [INFO]  System information:
### SYSTEM:   manufacturer: Notebook; model: N650DU; virtual: false
### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
### VERSIONS: electron: 36.3.2; used node: 24.2.0; installed node: 24.2.0; npm: 10.9.0; pm2: 6.0.6
### OTHER:    timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined 
```

-----

### after

```
[2025-07-09 21:57:47.604] [INFO]  
#####  System Information  #####
- SYSTEM:    manufacturer: Notebook; model: N650DU; virtual: false; timeZone: Europe/Berlin
- OS:        platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
- VERSIONS:  electron: 36.3.2; used node: 24.2.0; installed node: 24.2.0; npm: 10.9.0; pm2: 6.0.6
- ENV:       XDG_SESSION_TYPE: wayland; MM_CONFIG_FILE: undefined;
             WAYLAND_DISPLAY:  wayland-0; DISPLAY: :0; ELECTRON_ENABLE_GPU: undefined
- RAM:       total: 15925.45 MB; free: 967.75 MB; used: 14957.70 MB
- UPTIME:    172 minutes 
```

-----

## as markdown (in an issue or the forum)

### before

[2025-07-09 21:58:36.943] [INFO]  System information:
### SYSTEM:   manufacturer: Notebook; model: N650DU; virtual: false
### OS: platform: linux; distro: Debian GNU/Linux; release: 12; arch:
x64; kernel: 5.10.0-20-amd64
### VERSIONS: electron: 36.3.2; used node: 24.2.0; installed node:
24.2.0; npm: 10.9.0; pm2: 6.0.6
### OTHER:    timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined 

-----

### after

[2025-07-09 21:57:47.604] [INFO]  
#####  System Information  #####
- SYSTEM: manufacturer: Notebook; model: N650DU; virtual: false;
timeZone: Europe/Berlin
- OS: platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64;
kernel: 5.10.0-20-amd64
- VERSIONS: electron: 36.3.2; used node: 24.2.0; installed node: 24.2.0;
npm: 10.9.0; pm2: 6.0.6
- ENV:       XDG_SESSION_TYPE: wayland; MM_CONFIG_FILE: undefined;
WAYLAND_DISPLAY: wayland-0; DISPLAY: :0; ELECTRON_ENABLE_GPU: undefined
- RAM:       total: 15925.45 MB; free: 967.75 MB; used: 14957.70 MB
- UPTIME:    172 minutes
2025-07-10 07:39:23 +02:00
Veeck
e4ec8c3589 Fix missing icons in clock module (#3834)
Fixes #3818

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-07-05 22:47:38 +02:00
Koen Konst
d9e2e0272f Fix calendar unit test so it uses 1 day more than a full year for yearly recurring events test (#3833) 2025-07-02 22:03:41 +02:00
dathbe
3a2a52c864 Add CSS to clock module to prevent line breaking of sunrise/sunset information (#3816)
1. Base your pull requests against the `develop` branch.
Done
2. Include these infos in the description:
- Does the pull request solve a **related** issue?
No
- If so, can you reference the issue like this `Fixes #<issue_number>`?
N/A
- What does the pull request accomplish? Use a list if needed.
With some combinations of sunrise and sunset times (usually when the
time till rise/set is >9:59), the information will break across multiple
lines. This prevents that by adding CSS.
- If it includes major visual changes please add screenshots.
I don't consider it major.
3. Please run `npm run lint:prettier` before submitting so that style
issues are fixed.
Done
4. Don't forget to add an entry about your changes to the CHANGELOG.md
file.
Done

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-07-02 19:20:03 +02:00
Karsten Hassel
855b1d7cbf update dependencies incl. electron to v37, remove one failing unit test (#3831)
- see title and #3820
- remove failing unit calendar test until solved, see
https://github.com/MagicMirrorOrg/MagicMirror/issues/3830
2025-07-01 22:38:40 +02:00
Karsten Hassel
106b505f2c Prepare 2.33.0-develop 2025-07-01 00:22:16 +02:00
Karsten Hassel
b506bbb10b Merge remote-tracking branch 'origin/master' into develop 2025-07-01 00:15:11 +02:00
Karsten Hassel
26809725e5 Prepare Release 2.32.0 (#3825) 2025-06-30 23:52:58 +02:00
Karsten Hassel
5e506ea856 last dependency update before release (#3823) 2025-06-29 19:47:21 +02:00
Karsten Hassel
1e11d28224 fixes e2e tests (#3817)
- fix newsfeed and calendar e2e tests so they don't need `--forceExit`
anymore
- `--forceExit` should stay in test runs to avoid running until test
limit in case of errors
- remove mocking console, not needed anymore
- configFactory-stuff should not run in browser (otherwise we get errors
`[ReferenceError: exports is not defined]`)
2025-06-25 08:27:52 +02:00
Karsten Hassel
d2d4d7b37f update jest to v30 (#3815)
e2e:
- needed window.close(), otherwise the objects are not destroyed
- add missing `await` in clock test
- set maxListeners for all tests

remaining todo (comes with another PR if I find the problem):
- calendar e2e is now the only test which still needs `--forceExit`
2025-06-21 13:40:10 +02:00
Kristjan ESPERANTO
2809ed1750 [tests] Review and refactor translation tests (#3792)
I have refactored the translations tests, they should now be clearer and
easier to understand. There should be no functional impact.

I have discarded the original approach of also replacing
`XMLHttpRequest` with `fetch` in the file `js/translator.js`. I had
managed to get it to work functionally, but I couldn't get the tests to
work.
2025-06-21 00:37:15 +02:00
Bugsounet - Cédric
c7c0e67c1d review logger factory code part: use switch/case (#3812)
Styling code of `logger.js`:

Just use `switch/case` instead of `if/else if`

---------

Co-authored-by: Veeck <github@veeck.de>
2025-06-20 17:12:24 +02:00
Bugsounet - Cédric
9a3f4f098b Update package type to commonjs (#3814)
related to #3804 

added type to `commonjs` in package.json
2025-06-20 14:26:33 +02:00
Karsten Hassel
ee874836fe update deps and fix animateCSS_spec test (#3811)
- animateCSS_spec test did throw errors at least with newest
dependencies (running locally or on gitlab)
- dependency updates: New jest v30 breaks our tests so we have to stay
with v29 until fixed (will take a look)
2025-06-19 07:35:42 +02:00
Kristjan ESPERANTO
6501aabd2d [linter] Enable ESLint rule no-console (#3810)
In PR #3806 I noticed that ESLint did not complain about the use of
`console`. Then I realised that the rule `no-console` was not activated.
I have now changed this and replaced a few places where `console` was
used.

We can't apply the rule to all .js files because not all of them use our
logger. Therefore I had to add an extra config block for it.
2025-06-09 16:43:45 +02:00
Kristjan ESPERANTO
2194ffd929 [tests] Fix and refactor e2e test "Same keys" in "translations_spec.js" (#3809)
While working on the translations (in #3792 and #3794) I realised that
the e2e "Same keys" tests were not working entirely. There was also a
TODO entry for this in the test, as well as a try-catch-block
workaround. I therefore fixed and refactored it.

I also sorted the translations in `translations/translations.js`, so
that the test outputs are alphabetically.
2025-06-09 12:56:22 +02:00
Koen Konst
faf15ad211 Refactored calendarfetcherutils to fix many of the timezone and DST related issues and make debugging way easier (#3806)
Refactored calendarfetcherutils to remove as many of the date
conversions as possible and use moment tz when calculating recurring
events, this will make debugging a lot easier and fixes problems from
the past with offsets and DST not being handled properly. Also added
some tests to test the behavior of the refactored methodes to make sure
the correct event dates are returned.

Refactored calendar.js aswell to make sure the unix UTC start and end
date of events are properly converted to a local timezone and displayed
correctly for the user.

This PR relates to:
https://github.com/MagicMirrorOrg/MagicMirror/issues/3797

---------

Co-authored-by: Koen Konst <c.h.konst@avisi.nl>
Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-06-07 14:13:01 +02:00
Karsten Hassel
052ec1ca26 remove existing folders fonts and vendor from local installations (#3805)
see discussions
[here](https://github.com/MagicMirrorOrg/MagicMirror/pull/3795#issuecomment-2927804743).

The used command should work under windows too. I'm open to better
solutions.

Co-authored-by: Veeck <github@veeck.de>
2025-06-07 13:20:01 +02:00
Kristjan ESPERANTO
302b24c647 [l10n] Complete translations (#3794)
**Short description**: I completed the translations with the help of
translation tools.

**Long description**: I'm currently looking at the translation-tests and
I noticed the e2e-test `${language} should contain all base keys, ()`.
It is supposed to check whether all keys are present in each translation
file, but it doesn't actually work that way. When I fix it, a lot of
missing translations are reported. I have completed these translations
with the help of translation tools and packed them into this PR. I have
left out the modified test so that we can focus on the question if we
accept such amount of automatic translations or not.

rejas has already expressed in another PR
(https://github.com/MagicMirrorOrg/MagicMirror/pull/3775#discussion_r2083099252)
that he prefers human translators. I basically do too, but I don't see
how we can manage to have all translations completed by humans. And even
if a few translations are not correct, hopefully a user will get in
touch.

If we decide against the translations, we should at least remove the
test. If we go for the tranlsations, I'll add the test.

What do you think?

---------

Co-authored-by: Magnus <34011212+MagMar94@users.noreply.github.com>
2025-06-05 10:18:12 +02:00
Karsten Hassel
975ee9c97d update dependencies (#3804)
and add now required "type" to `package.json`
2025-06-01 17:51:31 +02:00
Karsten Hassel
c8625ff506 simplify install and maintaining dependencies (#3795)
I was always unhappy when maintaining dependency updates to have 3
`package.json` files.

This PR moves all deps into the main `package.json` and removes the
folders `fonts` and `vendor`.

If accepted I will update the docs too.

---------

Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
2025-06-01 17:03:11 +02:00
Kristjan ESPERANTO
e26aed927d [refactor] Replace ansis with built-in function util.styleText (#3793)
> What does the pull request accomplish?

One external dependency less.
2025-05-27 22:36:02 +02:00
Kristjan ESPERANTO
85b4ece767 [refactor] Replace deprecated constants (#3789)
`fs.F_OK` and `fs.R_OK` are [deprecated since a while node
20.8.0](https://nodejs.org/api/deprecations.html#DEP0176).

Node 24 now complains about them when running server mode (`node --run
server`):

```bash
[2025-05-23 23:11:44.932] [ERROR] (node:37733) [DEP0176] DeprecationWarning: fs.F_OK is deprecated, use fs.constants.F_OK instead
(Use `node --trace-deprecation ...` to show where the warning was created) 
```

The replacements have been in place for a while, and this change should
work without any issues.
2025-05-23 23:57:50 +02:00
Kristjan ESPERANTO
4e3821c2ff [workflow] Replace Node.js version v23 with v24 (#3770)
node v24 was released today and v23 will have reached EOL with our next
release.
2025-05-23 19:34:43 +02:00
Karsten Hassel
d07912d4b2 update dependencies incl. electron to v36 (#3788) 2025-05-23 06:52:28 +02:00
Karsten Hassel
d179051329 fix roboto.css to avoid error message (#3787) 2025-05-20 06:48:10 +02:00
BugHaver
2f9f4b6253 [feature] implement short syntax for clock week (#3775)
Hello and thank you for wanting to contribute to the MagicMirror²
project!

**Please make sure that you have followed these 4 rules before
submitting your Pull Request:**

> 1. Base your pull requests against the `develop` branch.
> 2. Include these infos in the description: implement short syntax for
clock week
>
> - Does the pull request solve a **related** issue? n/a
> - If so, can you reference the issue like this `Fixes
#<issue_number>`?
> - What does the pull request accomplish? Use a list if needed.
> - If it includes major visual changes please add screenshots.
>
> 3. Please run `npm run lint:prettier` before submitting so that
>    style issues are fixed.
> 4. Don't forget to add an entry about your changes to
>    the CHANGELOG.md file.


![image](https://github.com/user-attachments/assets/e6c16981-de0a-45be-b553-7a7a67977d55)


![image](https://github.com/user-attachments/assets/ebae32e7-e6fb-41aa-971a-908880acc7b9)


**Note**: Sometimes the development moves very fast. It is highly
recommended that you update your branch of `develop` before creating a
pull request to send us your changes. This makes everyone's lives
easier (including yours) and helps us out on the development team.

Thanks again and have a nice day!

---------

Co-authored-by: BugHaver <43462320+lsaadeh@users.noreply.github.com>
2025-05-16 08:04:18 +02:00
Kristjan ESPERANTO
554bb0ed5c [feat] Add rule no-undef in config file validation (#3786)
This should solve the problem #3785.
2025-05-15 00:15:54 +02:00
Kristjan ESPERANTO
965e935881 [linter] Review linter setup (#3783)
- [2b395b9f] Fix command to lint markdown in `CONTRIBUTING.md`
- [fed4c86c] Re-activate JSDoc ESLint plugin and fix linting issues (As
far as I remember, we deactivated it when we upgraded to ESLint 9
because it was not compatible with it. But its now.)
- [a3d2064b] Refactor ESLint config to use `defineConfig` and
`globalIgnores` ([these are like new
defaults](https://eslint.org/blog/2025/03/flat-config-extends-define-config-global-ignores/))
- [a3d2064b] Replace `eslint-plugin-import` with
`eslint-plugin-import-x`
(https://github.com/es-tooling/module-replacements/blob/main/docs/modules/eslint-plugin-import.md)
- [86a185b6] Switch Stylelint config to flat format and simplify
Stylelint scripts (like we already did for ESLint and prettier)
  - [f5a2c541] Fix some typos
2025-05-12 23:40:05 +02:00
sam detweiler
2422e847b1 Fix calendar rrule until where event is fullday but rrule until has a non-0 time (#3782)
This fixes #3781 

tests supplied

see
https://forum.magicmirror.builders/topic/19637/issue-with-outlook-recurring-events
2025-05-12 23:39:36 +02:00
dependabot[bot]
ed419ce5b3 Bump pm2 from 5.4.3 to 6.0.5 (#3776)
Bumps [pm2](https://github.com/Unitech/pm2) from 5.4.3 to 6.0.5.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/Unitech/pm2/releases">pm2's
releases</a>.</em></p>
<blockquote>
<h2>v6.0.5</h2>
<h1>6.0.5</h1>
<ul>
<li>Bun support - Fixes <a
href="https://redirect.github.com/Unitech/pm2/issues/5893">#5893</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5774">#5774</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5682">#5682</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5675">#5675</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5777">#5777</a></li>
<li>Disable git parsing by default <a
href="https://redirect.github.com/Unitech/pm2/issues/5909">#5909</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/2182">#2182</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5801">#5801</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5051">#5051</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5696">#5696</a></li>
<li>Add WEBP content type for pm2 serve <a
href="https://redirect.github.com/Unitech/pm2/issues/5900">#5900</a> <a
href="https://github.com/tbo47"><code>@​tbo47</code></a></li>
<li>Enable PM2 module update from tarball <a
href="https://redirect.github.com/Unitech/pm2/issues/5906">#5906</a> <a
href="https://github.com/AYOKINYA"><code>@​AYOKINYA</code></a></li>
<li>Fix treekil on FreeBSD <a
href="https://redirect.github.com/Unitech/pm2/issues/5896">#5896</a> <a
href="https://github.com/skeyby"><code>@​skeyby</code></a></li>
<li>fix allowing to update namespaced pm2 NPM module
(<code>@​org/module-name</code>) <a
href="https://redirect.github.com/Unitech/pm2/issues/5915">#5915</a> <a
href="https://github.com/endelendel"><code>@​endelendel</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/Unitech/pm2/blob/master/CHANGELOG.md">pm2's
changelog</a>.</em></p>
<blockquote>
<h2>6.0.5</h2>
<ul>
<li>Bun support - Fixes <a
href="https://redirect.github.com/Unitech/pm2/issues/5893">#5893</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5774">#5774</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5682">#5682</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5675">#5675</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5777">#5777</a></li>
<li>Disable git parsing by default <a
href="https://redirect.github.com/Unitech/pm2/issues/5909">#5909</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/2182">#2182</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5801">#5801</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5051">#5051</a> <a
href="https://redirect.github.com/Unitech/pm2/issues/5696">#5696</a></li>
<li>Add WEBP content type for pm2 serve <a
href="https://redirect.github.com/Unitech/pm2/issues/5900">#5900</a> <a
href="https://github.com/tbo47"><code>@​tbo47</code></a></li>
<li>Enable PM2 module update from tarball <a
href="https://redirect.github.com/Unitech/pm2/issues/5906">#5906</a> <a
href="https://github.com/AYOKINYA"><code>@​AYOKINYA</code></a></li>
<li>Fix treekil on FreeBSD <a
href="https://redirect.github.com/Unitech/pm2/issues/5896">#5896</a> <a
href="https://github.com/skeyby"><code>@​skeyby</code></a></li>
<li>fix allowing to update namespaced pm2 NPM module
(<code>@​org/module-name</code>) <a
href="https://redirect.github.com/Unitech/pm2/issues/5915">#5915</a> <a
href="https://github.com/endelendel"><code>@​endelendel</code></a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/Unitech/pm2/commits/v6.0.5">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=pm2&package-manager=npm_and_yarn&previous-version=5.4.3&new-version=6.0.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-05-09 22:47:20 +02:00
Karsten Hassel
53bff7243d update dependencies (#3774) 2025-05-09 22:35:09 +02:00
Bugsounet - Cédric
2831ae985c [Feature Request] Allow to make an display order of module position in config (#3762)
My proposal for #3761 

* I use `flex` box for create region container
* I have moved `container` definition to `main.css` (for css tunning,
maybe it can be useful)
* I create `order` in module config for define module order display from
position

# Advantage:

We don't have to move module config in another place in array of modules

# Another advantage that i did'nt think:

We can change dynamicaly module order of a container:

- So, in this case, for a module config builder, (I won't mention the
name because otherwise I'll get angry...)
It can be usefull for a config preview (before saving config)
--> just change style css `order` module value for see preview

- Or, change `order` value in dev console for testing

# Disadvantages

I don't see any ;)
2025-05-08 10:15:02 +02:00
Kristjan ESPERANTO
7b4d363b07 [fix] Fix start:dev script (#3773)
This will fix #3772 caused by #3764.

Since I work with `start:wayland:dev` instead of `start:dev`, I didn't
notice this, sorry.
2025-05-07 16:06:09 +02:00
Kristjan ESPERANTO
a5b85c4ab6 [workflow] Use LTS node version and split "Run test" step (#3767)
Two small changes to the workflows:

- Run linter and spellcheck workflows with LTS node version. The
advantage of this is that we no longer have to raise the node version
for them.
- Split "Run test" step into two steps for more clarity.
2025-05-07 07:51:01 +02:00
Kristjan ESPERANTO
b9d63d7252 Use "node --run" instead of "npm run" (#3764)
This has the advantage that the package manager is no longer involved
after the installation process.

However, previous start commands such as `npm run start` continue to
work. So we don't even have to adapt the documentation.
2025-05-06 20:33:42 +02:00
BugHaver
ff6682982f [feature] Introduce disableNextEvent to hide next sun event (#3769)
Hello and thank you for wanting to contribute to the MagicMirror²
project!

**Please make sure that you have followed these 4 rules before
submitting your Pull Request:**

> 1. Base your pull requests against the `develop` branch.
> 2. Include these infos in the description:
>
> - Does the pull request solve a **related** issue? No
> - If so, can you reference the issue like this `Fixes
#<issue_number>`? N/A
> - What does the pull request accomplish? Use a list if needed.
Introduce showNextEvent to show/hide next sun event
> - If it includes major visual changes please add screenshots.
>
![image](https://github.com/user-attachments/assets/410f6a82-e4fe-4c40-a477-8249149febf3)
> 3. Please run `npm run lint:prettier` before submitting so that
>    style issues are fixed.
> 4. Don't forget to add an entry about your changes to
>    the CHANGELOG.md file.

**Note**: Sometimes the development moves very fast. It is highly
recommended that you update your branch of `develop` before creating a
pull request to send us your changes. This makes everyone's lives
easier (including yours) and helps us out on the development team.

Thanks again and have a nice day!

---------

Co-authored-by: BugHaver <43462320+lsaadeh@users.noreply.github.com>
2025-04-27 18:37:17 +02:00
Kristjan ESPERANTO
e1a53ef2d5 [refactor] Simplify module loading process (#3766)
While debugging a 3rd party module, I looked at how modules are loaded
and realized that the `loadModules` method can be implemented much
simpler. This refactor makes the method easier to understand and
maintain.
2025-04-24 00:42:48 +02:00
veeck
86934c8375 Prepare v2.32.0-develop 2025-04-01 21:54:00 +02:00
veeck
7938c3a175 Merge branch 'mm_master' into mm_develop 2025-04-01 20:25:52 +02:00
veeck
a2c1daa667 Merge branch 'mm_master' into mm_develop 2025-04-01 19:18:19 +02:00
Veeck
01fd41c191 Prepare 2.31.0 release (#3757)
updated CHANGELOG and release process documentation

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-04-01 18:47:56 +02:00
Veeck
f80b1f1321 Update deps before release (#3756)
Co-authored-by: veeck <gitkraken@veeck.de>
2025-04-01 08:33:31 +02:00
Karsten Hassel
e546fedeb1 updatenotification: add param to get modules from modules-dir instead… (#3755)
… from config

implements #3739
2025-03-31 17:57:42 +02:00
Karsten Hassel
2e57d785ac update dependencies (#3754) 2025-03-28 07:31:36 +01:00
OWL4C
6d909d24e9 [weather] add humidity to hourly view, fix spacing error when using UV Index, add config option to hide precipitation entries that are zero [Rebased Version of PR #3526] (#3748)
Fixed Version of PR #3526 since that was against the wrong branch and
had issues.

Original PR Text: 
Basically the title. Just some existing weather data included into
hourly, some config option ("hideZeroes") to hide precipitation when it
is zero (this actually shrinks the entire table, removing columns that
are completely empty), and add a spacing column to fix the UV Index
column.

---------

Co-authored-by: Veeck <github@veeck.de>
2025-03-27 21:23:17 +01:00
Kristjan ESPERANTO
2ddb7859f6 Fix command to run spellcheck (#3753)
The command wasn't correct.
2025-03-27 11:59:59 +01:00
Karsten Hassel
791f77105a fix stale job (#3751)
exclude issues with label `ready (coming with next release)` from stale
job
2025-03-22 21:23:10 +01:00
Karsten Hassel
46d64abb4b update required node version and dependencies (#3747)
see discussion in
https://github.com/MagicMirrorOrg/MagicMirror/pull/3746

As [electron v35 requires node js
v22.14.0](https://www.electronjs.org/blog/electron-35-0) we should
update this here too.
2025-03-21 12:30:08 +01:00
Kristjan ESPERANTO
68ec696c25 Update ESLint and prettier (#3746)
This will fix #3745.
2025-03-18 22:30:20 +01:00
Karsten Hassel
0cfe2730ea newsfeed: add specific ignoreOlderThan value (override) per feed (#3742)
fixes #3360 

superseeds https://github.com/MagicMirrorOrg/MagicMirror/pull/3429

had to open a new PR because getting `permission denied` when trying to
push to the old one.
2025-03-18 10:19:05 +01:00
sam detweiler
51d11bf26c add support for digital clock time color (#3737)
see
https://forum.magicmirror.builders/topic/19440/digital-clock-minutes-darker

changelog added

question.. 

we have a config parm for seconds color, but not hour/minute
I have used css here.. is that too inconsistent?

---------

Co-authored-by: Kristjan ESPERANTO <35647502+KristjanESPERANTO@users.noreply.github.com>
Co-authored-by: Veeck <github@veeck.de>
2025-03-16 15:33:27 +01:00
mixasgr
0afc1ed58d Updated Greek Translations (#3741)
Hello,

we have updated the core Greek translation and added Greek translation
to Alerts module.

Thank you!

---------

Co-authored-by: Savvas Adamtziloglou <savvas-gr@greeklug.gr>
Co-authored-by: Konstantinos <geraki@gmail.com>
Co-authored-by: Veeck <github@veeck.de>
2025-03-15 21:54:20 +01:00
Kristjan ESPERANTO
2adf341fef Add Esperanto translation (#3740)
I've had this on my agenda for a long time 🙂
2025-03-13 13:02:02 +01:00
Karsten Hassel
1fcc028e49 update dependencies incl. electron to v35 (#3733) 2025-03-05 12:28:25 +01:00
Nathan
66b8656595 Fix icons, add hourly support, add other weatherflow changes (#3729)
I have updated weatherflow.js to implement the following changes (as
described in #3728)

- Fixed: Weather icons now show up properly
- Added: Location Name support
- Added: Hourly weather forecast support
- Added to current conditions:
  - "Feels like" temp
- Fixed icon for current conditions to be sourced from current
conditions (rather than daily forecast)
  - UV index
- Added to daily forecast
  - Precipitation amount and UV index (via hourly forecast data)

Before:

![image](https://github.com/user-attachments/assets/cfef043c-75ef-4571-8bdc-462e75d3ed81)

After:

![image](https://github.com/user-attachments/assets/e36118bb-a508-4ab1-a7ad-a775bd7a9bb3)
2025-03-01 10:34:02 +01:00
Veeck
4a398f03eb Fix empty part-of-day logic (#3726)
Fixes #3727

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-02-27 19:31:00 +01:00
Kristjan ESPERANTO
28bcee7de6 Update ESLint and simplify config (#3724)
This does not change the rules of ESLint. It's just a little cosmetic
fine-tuning.
2025-02-22 19:12:01 +01:00
DevIncomin
62c22d785c Arabic Translation (#3719)
Hello and thank you for wanting to contribute to the MagicMirror²
project!

**Please make sure that you have followed these 4 rules before
submitting your Pull Request:**

> 1. Base your pull requests against the `develop` branch.
> 2. Include these infos in the description:
>
> - Does the pull request solve a **related** issue?
> - If so, can you reference the issue like this `Fixes
#<issue_number>`?
> - What does the pull request accomplish? Use a list if needed.
> - If it includes major visual changes please add screenshots.
>
> 3. Please run `npm run lint:prettier` before submitting so that
>    style issues are fixed.
> 4. Don't forget to add an entry about your changes to
>    the CHANGELOG.md file.

**Note**: Sometimes the development moves very fast. It is highly
recommended that you update your branch of `develop` before creating a
pull request to send us your changes. This makes everyone's lives
easier (including yours) and helps us out on the development team.

Thanks again and have a nice day!
2025-02-06 10:00:41 +01:00
Veeck
aa20eadca3 Monthly update to dependencies (#3717)
nothing to see here really

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
2025-02-01 22:24:49 +01:00
Ikko Eltociear Ashimine
e00a666795 chore: update newsfeed.js (#3692)
Therefor -> Therefore

refs: #3690
2025-02-01 07:02:29 +01:00
Karsten Hassel
f34c8f2993 update github workflows (#3709)
to call `sudo apt-get update` before `sudo apt-get install`

I had problems running the tests on my fork, while running the `apt-get
install` command in automated tests workflow I got

```bash
E: Failed to fetch http://security.ubuntu.com/ubuntu/pool/main/m/mesa/libegl-mesa0_24.0.9-0ubuntu0.3_amd64.deb  404  Not Found [IP: 52.147.219.192 80]
```

Found a similar
[Issue](https://github.com/actions/runner-images/issues/10785#issuecomment-2420741561)
with a solution which is to run `sudo apt-get update` before.
2025-01-31 14:54:48 -07:00
Magnus
d6f2e7165f Fix frozen Yr weather-module (#3706)
Fixes #3296 

The problem was that the fetch-methods threw errors when something went
wrong instead of calling `updateAvailable()`. `updateAvailable()` must
be called in order to schedule the next update.

I added some filtering for the hourly forecast that removes hours in the
past. If the API call fails we use the cached data, but we should only
display hours in the future.
2025-01-27 22:41:51 +01:00
sam detweiler
af77b7b628 fix #3701, calculation wrong, added testcase, ics, config (#3702)
fixes #3701 

offset calculation wrong when user looking back at east coast event

added testcase
2025-01-23 08:37:41 +01:00
Kristjan ESPERANTO
53ac31dcf3 Adapt start:x11:dev script (#3700)
This doesn't actually change anything functionally, but with this we use
the same schema as for `start:wayland:dev` and `start:windows:dev`.
2025-01-19 16:29:28 +01:00
Kristjan ESPERANTO
77fe01175c Use different issue templates (#3695)
This PR will introduce different issue templates for bug reports,
feature requests and so on on GitHub. There is still room for
fine-tuning, but it's reached a state to show it to you and get
feedback.

I think that this can lead to better bug reports.

You can see the result in my repo:
https://github.com/KristjanESPERANTO/MagicMirror/issues/new/choose

Feel free to create new issues for testing.

What do you think? Do we want to pursue this further?
2025-01-17 19:03:28 +01:00
Karsten Hassel
6e40c446f4 fix wrong port in log message when starting server only (#3697)
fixes #3696
2025-01-14 22:58:14 +01:00
Karsten Hassel
2400e2045f update dependencies and formatting (#3693)
after updating deps 2 files needed formatting updates
2025-01-13 21:36:44 +01:00
Veeck
99dda821d3 Fix unknown (n/a) icon in openmeteo provider (#3691)
Due to a typo the icon displayed in the openmeteo provider was "N/A" for
a certain weather condition

<img width="284" alt="Bildschirmfoto 2025-01-13 um 16 35 40"
src="https://github.com/user-attachments/assets/e64bf0f8-32d9-44a5-a2b0-42d4f2d6b6df"
/>

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2025-01-13 20:09:33 +01:00
Kristjan ESPERANTO
a7f814d76b Optimize systeminformation calls and output string (#3689)
Since we don't use the `raspberry` information, calling it in `si.get`
is useless.

I also made the string construction in the code a bit more readable. The
output remains the same.
2025-01-12 23:27:31 +01:00
Karsten Hassel
553d2d4a21 electron tests (#3684)
- fix setup to run with xserver and labwc
- remove electronParams from calendar_spec.js (forgotten in
https://github.com/MagicMirrorOrg/MagicMirror/pull/3680)

fixes [running tests locally without labwc
installed](https://github.com/MagicMirrorOrg/MagicMirror/pull/3681#issuecomment-2571736233)

follow up to https://github.com/MagicMirrorOrg/MagicMirror/pull/3680
2025-01-08 11:46:42 +01:00
Kristjan ESPERANTO
b1bc554729 Update year (#3686)
I also added a few new words to the cspell dictionary that were added in
the changelog.

I have not made an extra entry in the changelog for these tiny things.
2025-01-06 21:20:19 +01:00
sam detweiler
5e337f8b5f fix #3267, CORRECTLY, add testcase, add testcase for #3279 (#3681)
fixes #3267 AGAIN, correctly, add testcase
add testcase for #3679 , broadcast clipping incorrectly

I added a test module (tests/testNotification) to catch the notification
and check the count. (one way to configure)
i put this module in the tests folder, and added /tests to the server
paths.
(can't have a module in a nested folder, like tests/modules/xxx)

but I have a problem. i can run the test config (MM_CONFIG_FILE), and
the two modules work correctly,
but in the spec runner, the calendar module times out on the broadcast
test.. there is only local ics file access, no outside hosts

I forced my system date to 1/1/24 (same as runner) and again the manual
testcase works fine

I added two test config.js,(configs/calendar) one works great (symbols)
, one fails (broadcast test)
I added additional delay in the calendarspec runner to try to debug the
module, but it still not long enough.. no messages of trouble when I get
into the browser.. BUT, this may be because of the log being turned
off... (just thought of this)

I created a special ICS (in mocks) that has 12 events, 1 for each
month.. (so I can check clipping and broadcast) the US holidays one is
sensitive to the current date, and I couldn't get it to work on
1/1/2024..

also, in general, is there a mechanism to run test:just_one_runner?
waiting thru the electron test to get to one testcase.. ugh..
2025-01-05 22:25:32 +01:00
Karsten Hassel
8fdd865cb1 electron tests: fixes for running under new github image ubuntu-24.04 (#3680)
and replace xserver with labwc, fixes #3676
2025-01-05 11:07:34 +01:00
Karsten Hassel
0f6efac8e6 clientonly and wayland, hotfix electron tests (#3677)
clientonly:
- did work only with xserver and `DISPLAY` env var
- now checks for `WAYLAND_DISPLAY` or `DISPLAY` env var before running
- if `WAYLAND_DISPLAY` is set now starts with wayland parameters

electron tests see #3676
2025-01-03 21:52:10 +01:00
sam detweiler
75dbe67167 Fix calendar clipping before broadcast (#3679)
-fixes #3678
2025-01-03 19:10:29 +01:00
sam detweiler
6f50a7b3bd Release 2.31.0 (#3674)
begin next release
2025-01-01 10:33:17 -06:00
sam detweiler
9be625c72b ready for release 2.30.0 (#3672)
Update files impacted for release
2025-01-01 15:18:25 +01:00
Veeck
c92fbb8a7e Final dependency updates for v2.30 (#3671)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <gitkraken@veeck.de>
2025-01-01 14:30:18 +01:00
Kristjan ESPERANTO
143dfd6b67 Add some ESLint rules + minor changes (#3665)
Main point was to enable ESLint `dot-notation` and `no-unneeded-ternary`
rules for more code consistency.

I took the occasion to add two minor commits:
- Fix a problem found by running `test:spelling
- Minor dependency update

It wouldn't be a problem if the PR didn't arrive in the next release,
the changes are cosmetic.
2024-12-30 12:24:51 +01:00
Karsten Hassel
d41ce81469 update dependencies, fix typo in Collaboration.md (#3664)
last dependency update before release
2024-12-28 20:18:45 +01:00
sam detweiler
93a0c24c22 fix #3662 line parse on windows with linux line ends (#3663)
line parse used os.EOL, which failed with linux line ends in index.html,
change to '\n'
2024-12-28 18:57:39 +01:00
Bugsounet - Cédric
9d0501f240 Fix: package-lock.json after PR #3660 (#3661)
continue from #3660 

Fix: package-lock.json (check node engine)
2024-12-27 14:20:24 +01:00
sam detweiler
6a09bc4ec4 add support for fetch timeout control for node_helpers, fix timeouts on armv6l (#3660)
user reporting slow/no connection/timeout errors on armv6l for calendar,
and newsfeed

we can increase the timeout by adding calls to the undici lib, but it
requires node 20.18.1 or above.

this adds the support for timeout
(also environment variable to override if needed,, mmFetchTimeout
(default 30 seconds)

and updates the base node version
2024-12-26 00:28:16 +01:00
Bugsounet - Cédric
2fb51436a5 delete exception allow-ghsas: GHSA-8hc4-vh64-cxmj in dep-review.yaml (#3659)
node needed with new version of `node-ical`
2024-12-24 15:20:29 +01:00
Kristjan ESPERANTO
0b3a04c520 Switch to 'npx' for lint-staged in pre-commit hook (#3658)
This way we get rid of the script entry in the `package.json` and the
whole thing becomes a little less complex.
2024-12-22 07:26:01 +01:00
Bugsounet - Cédric
c485ff670d path resolve and sub/sub folder module (#3653)
Fix:
 - use `path.resolve` for `moduleFolder` and `defaultModuleFolder` path
- Fix module path in case of sub/sub folder is used (sample
`module/test/test`)
 
---
case of module installation on `module/test/test`:

config will be:
```js
 {
    module: "test/test",
    ...
 }
```

module core will be:
```js
Module.register("test", {
...
```
`test.js` is used for module core (no change)

---

case of module installation on `module/test` (no change):
config will be:
```js
 {
    module: "test",
    ...
 }
```

module core will be:
```js
Module.register("test", {
...
```
so `test.js` is used for module core

---

In reality, with this patch, `module` config feature have 2
functionalites:
 -  determinate module path with more precision
 -  allow to use sub/sub folder in modules folder

---------

Co-authored-by: Veeck <github@veeck.de>
2024-12-18 22:07:09 +01:00
Karsten Hassel
b910c60eb2 update dependencies (#3657) 2024-12-18 22:04:16 +01:00
sam detweiler
24d9b70c4c fix access denied fault error writing js/positions.js (#3652)
if the MagicMirror js folder is not writable (synology nas created by
different user than docker container) there is an uncaught throw

```
[ERROR] EACCES: permission denied, open 'js/positions.js' 
```

add try/catch, output new message, console.error
```text
unable to write js/positions.js with the discovered module positions
make the MagicMirror/js folder writeable by the user starting MagicMirror 
```

MM will start, but no modules will show, as no positions were discovered
this file is used to pass the list from the server side to the browser
side

fixes #3651
2024-12-18 17:37:51 +01:00
sam detweiler
786eacf41a update config.js.sample about locale variable (#3655)
add text to config.js.sample about usage of locale variable/property

Co-authored-by: Veeck <github@veeck.de>
2024-12-18 13:43:20 +01:00
Kristjan ESPERANTO
5b3b40da66 Use project URL in fallback config (#3656) 2024-12-18 08:00:00 +01:00
sam detweiler
5232f46d44 fix #3267 again this time, dropped from big cal update (#3650)
this change was dropped from #3267 by mistake
2024-12-08 21:23:53 +01:00
sam detweiler
39ab651319 Show animations, fix export only on server side (#3649)
fix #3644 so only on server side
2024-12-08 16:24:39 +01:00
Kristjan ESPERANTO
76fac78909 Run code style checks in workflow only once (#3648)
It's enough if the code style checks are successful once, it's not
necessary to run them with every node version.

Also, if there is an error, we can see more quickly whether it is a code
style or a test-runner issue.
2024-12-07 18:29:49 +01:00
Kristjan ESPERANTO
5b7b76c877 Add linting for markdown files (#3646)
I also reworked the Linters section in `CONTRIBUTING.md` a bit and
switched the `prettier` config to a flat config.

Co-authored-by: Veeck <github@veeck.de>
2024-12-07 10:12:28 +01:00
sam detweiler
19bd76ab93 Fixcaldates2 fix calendar module date processing, using node-ical@0.20.1 (#3587)
here is an updated test version of the fixes for all kinds of calendar
date problems.

NOTE: the changed branch name
NOTE: this used the node-cal@0.19.0 library UNCHANGED

best to make a new folder and git clone there

git clone https://github.com/sdetweil/MagicMirror
cd MagicMirror
git checkout fixcaldates2 // <------ note this is a changed branch name
npm run install-mm
copy your config.js and custom.css from the prior folder
and the non-default modules you have installed…

this ONLY changes the default calendar
but DOES ship an updated node-ical library too

if you need to fall back, just rename the folders around again so that
your original is called MagicMirror

all the testcases for node-ical and MagicMirror execute successfully.

the ‘BIG’ change here is to get the local NON-TZ dates for the
rrule.between()

all the checking and conversion code is commented out or not used
the node-ical fixes are for excluded dates (exdate) values being
adjusted for DST/STD time… waiting to submit that PR

one fix in calendar.js for checking if a past date was too far back,
but it never checked to see IF the event date was in the past… (before
today) so it chopped off too many

and one change in calendarfetcher.js to put out a better diagnostic
message of the parsed data… (exdate was excluded cause JSON stringify
couldn’t convert the complex structure)

I added the tests you all have documented

please re-pull and checkout the new branch (I deleted the old branch)
and npm run install-mm again

---------

Co-authored-by: Veeck <github@veeck.de>
2024-12-07 09:51:11 +01:00
Kristjan ESPERANTO
291ae8546c Handle "module is not defined" in e2e tests (#3647)
Even in successful tests, there are many module not defined` error
entries. Like this:
https://github.com/MagicMirrorOrg/MagicMirror/actions/runs/12199106844/job/34032254241#step:5:353

I think we can suppress them.
2024-12-07 08:17:04 +01:00
sam detweiler
63178eba72 Export animations (#3644)
I am adding the animateIn/Out support to MMM-Config, but I need the list
of animations..
but they are not visible in js/animateCSS.js (from require)

adding an export satisfies that

side issue, these would go in a dropdown list
what value can I use for the default behavior? none/default?
don't want an error produced..
should I add code to check for this value to prevent error?
2024-12-02 10:17:19 +01:00
Kristjan ESPERANTO
07768c3a88 Reactivate eslint-plugin-package-json (#3643)
Somehow the plugin get lost when we moved to ESLint flat config. Now I
reactivated it.

One rules caused sorting the scripts. If this is not okay, I can undo
this and switch off the rule.

Thank's @bugsounet for the pinging in
https://github.com/MagicMirrorOrg/MagicMirror/pull/3637#issuecomment-2509771362.
2024-12-01 15:26:23 +01:00
dependabot[bot]
8d61336e8b Bump @fortawesome/fontawesome-free from 6.6.0 to 6.7.1 in /vendor (#3641)
Bumps
[@fortawesome/fontawesome-free](https://github.com/FortAwesome/Font-Awesome)
from 6.6.0 to 6.7.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/FortAwesome/Font-Awesome/releases"><code>@​fortawesome/fontawesome-free</code>'s
releases</a>.</em></p>
<blockquote>
<h2>Release 6.7.1</h2>
<p><strong>Change log available at <a
href="https://fontawesome.com/docs/changelog/">https://fontawesome.com/docs/changelog/</a></strong></p>
<h2>Release 6.7.0</h2>
<p><strong>Change log available at <a
href="https://fontawesome.com/docs/changelog/">https://fontawesome.com/docs/changelog/</a></strong></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3447c58c6b"><code>3447c58</code></a>
Release 6.7.1 (<a
href="https://redirect.github.com/FortAwesome/Font-Awesome/issues/20426">#20426</a>)</li>
<li><a
href="a03a91d681"><code>a03a91d</code></a>
Release 6.7.0 (<a
href="https://redirect.github.com/FortAwesome/Font-Awesome/issues/20418">#20418</a>)</li>
<li>See full diff in <a
href="https://github.com/FortAwesome/Font-Awesome/compare/6.6.0...6.7.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@fortawesome/fontawesome-free&package-manager=npm_and_yarn&previous-version=6.6.0&new-version=6.7.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 12:27:20 +01:00
dependabot[bot]
28341d4a54 Bump eslint-plugin-package-json from 0.15.4 to 0.17.0 (#3637)
Bumps
[eslint-plugin-package-json](https://github.com/JoshuaKGoldberg/eslint-plugin-package-json)
from 0.15.4 to 0.17.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/releases">eslint-plugin-package-json's
releases</a>.</em></p>
<blockquote>
<h2>v0.17.0</h2>
<h2>What's Changed</h2>
<ul>
<li>docs: add sasial-dev as a contributor for code by <a
href="https://github.com/allcontributors"><code>@​allcontributors</code></a>
in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/669">JoshuaKGoldberg/eslint-plugin-package-json#669</a></li>
<li>feat: sort alphabetically with co-located hooks for
<code>scripts</code> by <a
href="https://github.com/sasial-dev"><code>@​sasial-dev</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/632">JoshuaKGoldberg/eslint-plugin-package-json#632</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.16.0...v0.17.0">https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.16.0...v0.17.0</a></p>
<h2>v0.16.0</h2>
<h2>What's Changed</h2>
<ul>
<li>chore(deps): update dependency cspell to v8.16.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/617">JoshuaKGoldberg/eslint-plugin-package-json#617</a></li>
<li>chore(deps): update dependency eslint-plugin-jsonc to v2.17.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/618">JoshuaKGoldberg/eslint-plugin-package-json#618</a></li>
<li>docs: add unique dependencies rule by <a
href="https://github.com/davidlj95"><code>@​davidlj95</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/620">JoshuaKGoldberg/eslint-plugin-package-json#620</a></li>
<li>docs: add rakleed as a contributor for ideas by <a
href="https://github.com/allcontributors"><code>@​allcontributors</code></a>
in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/622">JoshuaKGoldberg/eslint-plugin-package-json#622</a></li>
<li>docs: add davidlj95 as a contributor for doc by <a
href="https://github.com/allcontributors"><code>@​allcontributors</code></a>
in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/621">JoshuaKGoldberg/eslint-plugin-package-json#621</a></li>
<li>chore(deps): update dependency eslint-plugin-jsonc to v2.18.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/623">JoshuaKGoldberg/eslint-plugin-package-json#623</a></li>
<li>chore(deps): update dependency knip to v5.36.4 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/624">JoshuaKGoldberg/eslint-plugin-package-json#624</a></li>
<li>chore(deps): update dependency knip to v5.36.5 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/625">JoshuaKGoldberg/eslint-plugin-package-json#625</a></li>
<li>chore(deps): update dependency eslint-plugin-jsonc to v2.18.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/626">JoshuaKGoldberg/eslint-plugin-package-json#626</a></li>
<li>chore(deps): update dependency knip to v5.36.6 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/627">JoshuaKGoldberg/eslint-plugin-package-json#627</a></li>
<li>chore(deps): update dependency
<code>@​typescript-eslint/parser</code> to v8.14.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/628">JoshuaKGoldberg/eslint-plugin-package-json#628</a></li>
<li>chore(deps): update dependency knip to v5.36.7 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/629">JoshuaKGoldberg/eslint-plugin-package-json#629</a></li>
<li>chore(deps): update dependency
<code>@​release-it/conventional-changelog</code> to v9.0.3 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/630">JoshuaKGoldberg/eslint-plugin-package-json#630</a></li>
<li>chore(deps): update dependency eslint-plugin-jsdoc to v50.5.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/631">JoshuaKGoldberg/eslint-plugin-package-json#631</a></li>
<li>chore(deps): update pnpm to v9.13.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/633">JoshuaKGoldberg/eslint-plugin-package-json#633</a></li>
<li>chore(deps): update dependency knip to v5.37.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/634">JoshuaKGoldberg/eslint-plugin-package-json#634</a></li>
<li>chore(deps): update pnpm to v9.13.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/635">JoshuaKGoldberg/eslint-plugin-package-json#635</a></li>
<li>chore(deps): update dependency eslint-plugin-regexp to v2.7.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/636">JoshuaKGoldberg/eslint-plugin-package-json#636</a></li>
<li>chore(deps): update pnpm to v9.13.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/637">JoshuaKGoldberg/eslint-plugin-package-json#637</a></li>
<li>chore(deps): update codecov/codecov-action action to v5 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/638">JoshuaKGoldberg/eslint-plugin-package-json#638</a></li>
<li>chore(deps): update dependency knip to v5.37.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/639">JoshuaKGoldberg/eslint-plugin-package-json#639</a></li>
<li>chore(deps): update dependency eslint-plugin-jsonc to v2.18.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/640">JoshuaKGoldberg/eslint-plugin-package-json#640</a></li>
<li>chore(deps): update dependency husky to v9.1.7 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/641">JoshuaKGoldberg/eslint-plugin-package-json#641</a></li>
<li>chore(deps): update dependency
<code>@​typescript-eslint/parser</code> to v8.15.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/642">JoshuaKGoldberg/eslint-plugin-package-json#642</a></li>
<li>chore(deps): update dependency <code>@​types/node</code> to v22.9.1
by <a href="https://github.com/renovate"><code>@​renovate</code></a> in
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/644">JoshuaKGoldberg/eslint-plugin-package-json#644</a></li>
<li>chore(deps): update pnpm to v9.14.1 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/645">JoshuaKGoldberg/eslint-plugin-package-json#645</a></li>
<li>chore(deps): update pnpm to v9.14.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/646">JoshuaKGoldberg/eslint-plugin-package-json#646</a></li>
<li>chore(deps): update dependency prettier-plugin-packagejson to v2.5.5
by <a href="https://github.com/renovate"><code>@​renovate</code></a> in
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/647">JoshuaKGoldberg/eslint-plugin-package-json#647</a></li>
<li>chore(deps): update dependency knip to v5.37.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/649">JoshuaKGoldberg/eslint-plugin-package-json#649</a></li>
<li>chore(deps): update dependency typescript to v5.7.2 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/650">JoshuaKGoldberg/eslint-plugin-package-json#650</a></li>
<li>chore(deps): update dependency <code>@​types/node</code> to v22.9.2
by <a href="https://github.com/renovate"><code>@​renovate</code></a> in
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/651">JoshuaKGoldberg/eslint-plugin-package-json#651</a></li>
<li>chore(deps): update dependency <code>@​types/node</code> to v22.9.3
by <a href="https://github.com/renovate"><code>@​renovate</code></a> in
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/652">JoshuaKGoldberg/eslint-plugin-package-json#652</a></li>
<li>chore(deps): update dependency markdownlint-cli to ^0.43.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/653">JoshuaKGoldberg/eslint-plugin-package-json#653</a></li>
<li>docs: fix jsonc-eslint-parser installation instructions by <a
href="https://github.com/JoshuaKGoldberg"><code>@​JoshuaKGoldberg</code></a>
in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/654">JoshuaKGoldberg/eslint-plugin-package-json#654</a></li>
<li>chore(deps): update dependency prettier-plugin-packagejson to v2.5.6
by <a href="https://github.com/renovate"><code>@​renovate</code></a> in
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/648">JoshuaKGoldberg/eslint-plugin-package-json#648</a></li>
<li>chore(deps): update dependency
<code>@​typescript-eslint/parser</code> to v8.16.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/656">JoshuaKGoldberg/eslint-plugin-package-json#656</a></li>
<li>chore(deps): update dependency <code>@​types/node</code> to v22.9.4
by <a href="https://github.com/renovate"><code>@​renovate</code></a> in
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/657">JoshuaKGoldberg/eslint-plugin-package-json#657</a></li>
<li>chore(deps): update dependency <code>@​types/node</code> to v22.10.0
by <a href="https://github.com/renovate"><code>@​renovate</code></a> in
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/658">JoshuaKGoldberg/eslint-plugin-package-json#658</a></li>
<li>chore(deps): update dependency knip to v5.38.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/659">JoshuaKGoldberg/eslint-plugin-package-json#659</a></li>
<li>chore(deps): update dependency eslint-plugin-jsdoc to v50.6.0 by <a
href="https://github.com/renovate"><code>@​renovate</code></a> in <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/pull/662">JoshuaKGoldberg/eslint-plugin-package-json#662</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/blob/main/CHANGELOG.md">eslint-plugin-package-json's
changelog</a>.</em></p>
<blockquote>
<h1><a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.16.0...v0.17.0">0.17.0</a>
(2024-11-30)</h1>
<h3>Features</h3>
<ul>
<li>sort alphabetically with co-located hooks for <code>scripts</code>
(<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/632">#632</a>)
(<a
href="4ccae4f58e">4ccae4f</a>),
closes <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/499">#499</a>
<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/499">#499</a></li>
</ul>
<h1><a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.15.6...v0.16.0">0.16.0</a>
(2024-11-30)</h1>
<h3>Features</h3>
<ul>
<li><strong>sort-collections:</strong> should sort
<code>overrides</code> (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/668">#668</a>)
(<a
href="18129cd5c4">18129cd</a>),
closes <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/619">#619</a></li>
</ul>
<h2><a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.15.5...v0.15.6">0.15.6</a>
(2024-11-09)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>add sorting exports field (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/615">#615</a>)
(<a
href="116c74be65">116c74b</a>),
closes <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/000">#000</a></li>
</ul>
<h2><a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.15.4...v0.15.5">0.15.5</a>
(2024-11-06)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>add plugin export (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/609">#609</a>)
(<a
href="a2c83b42c2">a2c83b4</a>),
closes <a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/000">#000</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="a16b6ba552"><code>a16b6ba</code></a>
chore: release v0.17.0</li>
<li><a
href="4ccae4f58e"><code>4ccae4f</code></a>
feat: sort alphabetically with co-located hooks for <code>scripts</code>
(<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/632">#632</a>)</li>
<li><a
href="100ce08a05"><code>100ce08</code></a>
docs: add sasial-dev as a contributor for code (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/669">#669</a>)</li>
<li><a
href="79a18e278c"><code>79a18e2</code></a>
chore: release v0.16.0</li>
<li><a
href="18129cd5c4"><code>18129cd</code></a>
feat(sort-collections): should sort <code>overrides</code> (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/668">#668</a>)</li>
<li><a
href="36e68b70fb"><code>36e68b7</code></a>
chore(deps): update dependency cspell to v8.16.1 (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/667">#667</a>)</li>
<li><a
href="189345dfb9"><code>189345d</code></a>
docs: add rakleed as a contributor for doc (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/666">#666</a>)</li>
<li><a
href="3b23f4a054"><code>3b23f4a</code></a>
docs: add <code>Development</code> section in README (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/665">#665</a>)</li>
<li><a
href="383fe630b8"><code>383fe63</code></a>
docs: add rakleed as a contributor for tool (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/664">#664</a>)</li>
<li><a
href="4a6e3c4c4f"><code>4a6e3c4</code></a>
chore(deps): update dependency knip to v5.38.1 (<a
href="https://redirect.github.com/JoshuaKGoldberg/eslint-plugin-package-json/issues/663">#663</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/JoshuaKGoldberg/eslint-plugin-package-json/compare/v0.15.4...v0.17.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-package-json&package-manager=npm_and_yarn&previous-version=0.15.4&new-version=0.17.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 12:01:50 +01:00
dependabot[bot]
f417bc0204 Bump prettier from 3.3.3 to 3.4.1 (#3638)
Bumps [prettier](https://github.com/prettier/prettier) from 3.3.3 to
3.4.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/releases">prettier's
releases</a>.</em></p>
<blockquote>
<h2>3.4.1</h2>
<p>🔗 <a
href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md#341">Changelog</a></p>
<h2>3.4.0</h2>
<p><a
href="https://github.com/prettier/prettier/compare/3.3.3...3.4.0">diff</a></p>
<p>🔗 <a href="https://prettier.io/blog/2024/11/26/3.4.0.html">Release
note</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/prettier/prettier/blob/main/CHANGELOG.md">prettier's
changelog</a>.</em></p>
<blockquote>
<h1>3.4.1</h1>
<p><a
href="https://github.com/prettier/prettier/compare/3.4.0...3.4.1">diff</a></p>
<h4>Remove unnecessary parentheses around assignment in
<code>v-on</code> (<a
href="https://redirect.github.com/prettier/prettier/pull/16887">#16887</a>
by <a href="https://github.com/fisker"><code>@​fisker</code></a>)</h4>
<!-- raw HTML omitted -->
<pre lang="vue"><code>&lt;!-- Input --&gt;
\&lt;template&gt;
  &lt;button @click=&quot;foo += 2&quot;&gt;Click&lt;/button&gt;
&lt;/template&gt;
<p>&lt;!-- Prettier 3.4.0 --&gt;<br />
&amp;lt;template&gt;<br />
&lt;button <a
href="https://github.com/click"><code>@​click</code></a>=&quot;(foo +=
2)&quot;&gt;Click&lt;/button&gt;<br />
&lt;/template&gt;</p>
<p>&lt;!-- Prettier 3.4.1 --&gt;<br />
&amp;lt;template&gt;<br />
&lt;button <a
href="https://github.com/click"><code>@​click</code></a>=&quot;foo +=
2&quot;&gt;Click&lt;/button&gt;<br />
&lt;/template&gt;<br />
</code></pre></p>
<h1>3.4.0</h1>
<p><a
href="https://github.com/prettier/prettier/compare/3.3.3...3.4.0">diff</a></p>
<p>🔗 <a href="https://prettier.io/blog/2024/11/26/3.4.0.html">Release
Notes</a></p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="37fd1774d1"><code>37fd177</code></a>
Release 3.4.1</li>
<li><a
href="1fb629709a"><code>1fb6297</code></a>
Update ts-api-utils to v1.4.2 (<a
href="https://redirect.github.com/prettier/prettier/issues/16888">#16888</a>)</li>
<li><a
href="f6fccadbc7"><code>f6fccad</code></a>
Remove unnecessary parentheses around assignment in <code>v-on</code>
(<a
href="https://redirect.github.com/prettier/prettier/issues/16887">#16887</a>)</li>
<li><a
href="5fef089377"><code>5fef089</code></a>
Minor improvements in v3.4.0 blog post (<a
href="https://redirect.github.com/prettier/prettier/issues/16886">#16886</a>)</li>
<li><a
href="3542f13845"><code>3542f13</code></a>
3.4 release blog (<a
href="https://redirect.github.com/prettier/prettier/issues/16851">#16851</a>)</li>
<li><a
href="f53791a2c8"><code>f53791a</code></a>
Clean changelog_unreleased</li>
<li><a
href="2b41c937fc"><code>2b41c93</code></a>
Bump Prettier dependency to 3.4.0</li>
<li><a
href="10baab2f57"><code>10baab2</code></a>
Update dependents count</li>
<li><a
href="7999e10265"><code>7999e10</code></a>
Release 3.4.0</li>
<li><a
href="2262d1e4a3"><code>2262d1e</code></a>
chore(config): migrate renovate config (<a
href="https://redirect.github.com/prettier/prettier/issues/16884">#16884</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/prettier/prettier/compare/3.3.3...3.4.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=prettier&package-manager=npm_and_yarn&previous-version=3.3.3&new-version=3.4.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 12:00:28 +01:00
dependabot[bot]
3627bebc3a Bump stylelint from 16.10.0 to 16.11.0 (#3639)
Bumps [stylelint](https://github.com/stylelint/stylelint) from 16.10.0
to 16.11.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/stylelint/stylelint/releases">stylelint's
releases</a>.</em></p>
<blockquote>
<h2>16.11.0</h2>
<ul>
<li>Added: <code>--report-unscoped-disables</code> CLI flag and
<code>reportUnscopedDisables</code> option to Node.js API and
configuration object (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8024">#8024</a>)
(<a
href="https://github.com/Mouvedia"><code>@​Mouvedia</code></a>).</li>
<li>Added: <code>ignoreFunctions: []</code> to
<code>media-query-no-invalid</code> (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8060">#8060</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Added: <code>name</code> configuration property under
<code>overrides</code> (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8095">#8095</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>benchmark-rule</code> script to resolve
<code>TypeError</code> (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8090">#8090</a>)
(<a
href="https://github.com/ybiquitous"><code>@​ybiquitous</code></a>).</li>
<li>Fixed: <code>github</code> formatter deprecation warning link to
<code>https://stylelint.io/awesome-stylelint#formatters</code> (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8115">#8115</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>function-calc-no-unspaced-operator</code> false
negatives for <code>calc-size</code> (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8026">#8026</a>)
(<a href="https://github.com/azat-io"><code>@​azat-io</code></a>).</li>
<li>Fixed: <code>max-nesting-depth</code> false positives when the
<code>&amp;</code> selector is being ignored (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8048">#8048</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>media-feature-name-value-no-unknown</code> false
positives for <code>display-mode: picture-in-picture</code> (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8136">#8136</a>)
(<a
href="https://github.com/Mouvedia"><code>@​Mouvedia</code></a>).</li>
<li>Fixed: <code>no-irregular-whitespace</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8066">#8066</a>)
(<a
href="https://github.com/romainmenke"><code>@​romainmenke</code></a>).</li>
<li>Fixed: <code>selector-attribute-name-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8037">#8037</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-attribute-operator-allowed-list</code>
reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8038">#8038</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-attribute-operator-disallowed-list</code>
reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8039">#8039</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-class-pattern</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8042">#8042</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-combinator-allowed-list</code> reported ranges
(<a
href="https://redirect.github.com/stylelint/stylelint/issues/8046">#8046</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-combinator-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8047">#8047</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-disallowed-list</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8067">#8067</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-id-pattern</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8045">#8045</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-attribute</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8052">#8052</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-class</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8053">#8053</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-combinators</code> reported-ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8055">#8055</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-compound-selectors</code> reported ranges
(<a
href="https://redirect.github.com/stylelint/stylelint/issues/8056">#8056</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-id</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8054">#8054</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-pseudo-class</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8057">#8057</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-specificity</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8058">#8058</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-universal</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8059">#8059</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-nested-pattern</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8072">#8072</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-no-vendor-prefix</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8073">#8073</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-not-notation</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8074">#8074</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-class-allowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8061">#8061</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-class-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8062">#8062</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-class-no-unknown</code> reported ranges
(<a
href="https://redirect.github.com/stylelint/stylelint/issues/8063">#8063</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-allowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8068">#8068</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-colon-notation</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8069">#8069</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8070">#8070</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-no-unknown</code> false
positives for <code>::scroll-marker</code> and
<code>::scroll-marker-group</code> (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8110">#8110</a>)
(<a
href="https://github.com/Mouvedia"><code>@​Mouvedia</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-no-unknown</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8071">#8071</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-type-no-unknown</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8076">#8076</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/stylelint/stylelint/blob/main/CHANGELOG.md">stylelint's
changelog</a>.</em></p>
<blockquote>
<h2>16.11.0</h2>
<ul>
<li>Added: <code>--report-unscoped-disables</code> CLI flag and
<code>reportUnscopedDisables</code> option to Node.js API and
configuration object (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8024">#8024</a>)
(<a
href="https://github.com/Mouvedia"><code>@​Mouvedia</code></a>).</li>
<li>Added: <code>ignoreFunctions: []</code> to
<code>media-query-no-invalid</code> (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8060">#8060</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Added: <code>name</code> configuration property under
<code>overrides</code> (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8095">#8095</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>benchmark-rule</code> script to resolve
<code>TypeError</code> (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8090">#8090</a>)
(<a
href="https://github.com/ybiquitous"><code>@​ybiquitous</code></a>).</li>
<li>Fixed: <code>github</code> formatter deprecation warning link to
<code>https://stylelint.io/awesome-stylelint#formatters</code> (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8115">#8115</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>function-calc-no-unspaced-operator</code> false
negatives for <code>calc-size</code> (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8026">#8026</a>)
(<a href="https://github.com/azat-io"><code>@​azat-io</code></a>).</li>
<li>Fixed: <code>max-nesting-depth</code> false positives when the
<code>&amp;</code> selector is being ignored (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8048">#8048</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>media-feature-name-value-no-unknown</code> false
positives for <code>display-mode: picture-in-picture</code> (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8136">#8136</a>)
(<a
href="https://github.com/Mouvedia"><code>@​Mouvedia</code></a>).</li>
<li>Fixed: <code>no-irregular-whitespace</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8066">#8066</a>)
(<a
href="https://github.com/romainmenke"><code>@​romainmenke</code></a>).</li>
<li>Fixed: <code>selector-attribute-name-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8037">#8037</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-attribute-operator-allowed-list</code>
reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8038">#8038</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-attribute-operator-disallowed-list</code>
reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8039">#8039</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-class-pattern</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8042">#8042</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-combinator-allowed-list</code> reported ranges
(<a
href="https://redirect.github.com/stylelint/stylelint/pull/8046">#8046</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-combinator-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8047">#8047</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-disallowed-list</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8067">#8067</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-id-pattern</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8045">#8045</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-attribute</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8052">#8052</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-class</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8053">#8053</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-combinators</code> reported-ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8055">#8055</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-compound-selectors</code> reported ranges
(<a
href="https://redirect.github.com/stylelint/stylelint/pull/8056">#8056</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-id</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8054">#8054</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-pseudo-class</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8057">#8057</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-specificity</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8058">#8058</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-max-universal</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8059">#8059</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-nested-pattern</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8072">#8072</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-no-vendor-prefix</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8073">#8073</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-not-notation</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8074">#8074</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-class-allowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8061">#8061</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-class-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8062">#8062</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-class-no-unknown</code> reported ranges
(<a
href="https://redirect.github.com/stylelint/stylelint/pull/8063">#8063</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-allowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8068">#8068</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-colon-notation</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8069">#8069</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-disallowed-list</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8070">#8070</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-no-unknown</code> false
positives for <code>::scroll-marker</code> and
<code>::scroll-marker-group</code> (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8110">#8110</a>)
(<a
href="https://github.com/Mouvedia"><code>@​Mouvedia</code></a>).</li>
<li>Fixed: <code>selector-pseudo-element-no-unknown</code> reported
ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8071">#8071</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
<li>Fixed: <code>selector-type-no-unknown</code> reported ranges (<a
href="https://redirect.github.com/stylelint/stylelint/pull/8076">#8076</a>)
(<a
href="https://github.com/ryo-manba"><code>@​ryo-manba</code></a>).</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="4385d8fcbf"><code>4385d8f</code></a>
16.11.0</li>
<li><a
href="d24438b924"><code>d24438b</code></a>
Prepare 16.11.0 (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8049">#8049</a>)</li>
<li><a
href="cce8a86596"><code>cce8a86</code></a>
Fix <code>font-family-no-missing-generic-family-keyword</code> false
positives for `font...</li>
<li><a
href="49f32a5089"><code>49f32a5</code></a>
Bump typescript from 5.6.3 to 5.7.2 in the typescript group (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8141">#8141</a>)</li>
<li><a
href="25cf2b306d"><code>25cf2b3</code></a>
Bump rollup from 4.27.2 to 4.27.4 (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8142">#8142</a>)</li>
<li><a
href="4a82b50a1d"><code>4a82b50</code></a>
Fix <code>media-feature-name-value-no-unknown</code> false positives for
`display-mode: ...</li>
<li><a
href="e1460bdbbd"><code>e1460bd</code></a>
Bump <code>@​changesets/cli</code> from 2.27.9 to 2.27.10 in the
changesets group (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8140">#8140</a>)</li>
<li><a
href="aefbb7afb4"><code>aefbb7a</code></a>
Bump rollup from 4.25.0 to 4.27.2 (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8130">#8130</a>)</li>
<li><a
href="3de7212316"><code>3de7212</code></a>
Enable tokenless upload for Codecov (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8131">#8131</a>)</li>
<li><a
href="bda98abd99"><code>bda98ab</code></a>
Bump eslint from 9.14.0 to 9.15.0 in the eslint group (<a
href="https://redirect.github.com/stylelint/stylelint/issues/8128">#8128</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/stylelint/stylelint/compare/16.10.0...16.11.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=stylelint&package-manager=npm_and_yarn&previous-version=16.10.0&new-version=16.11.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-12-01 11:59:23 +01:00
Bugsounet - Cédric
bd1324cc42 Remove @eslint/js dependency. Already installed with eslint in deep (#3636)
I lint my modules and just see this:

`@eslint/js` is now not needed.
it's installed by `eslint` it self
2024-11-17 13:15:51 +01:00
Kristjan ESPERANTO
15baffdede Adapt to "Keep a Changelog" (#3634)
- Adapt heading and description to "Keep a Changelog" guideline v1.1.0
- Add missing links at the end - with this, users can click on the
version number to see the diffs (I think this was intended from the
beginning)
- Fix two bare URLs

## The link fix
Before (the link on the version number doesn't work):
![Screenshot from 2024-11-14
01-15-07](https://github.com/user-attachments/assets/e0ff4eee-abc8-4ba8-9fb7-f18fd3279ddf)

After (the link on the version number works):
![Screenshot from 2024-11-14
01-15-52](https://github.com/user-attachments/assets/7b2997e7-cf6d-4e23-b4fc-50536174f4c6)
2024-11-14 19:05:41 +01:00
sam detweiler
bd620e0061 Enhance compliments remote file with refresh support (#3630)
add support to refresh the compliments remotefile
add testcases for both without refresh (testcase missing) and with
refresh

doc to be updated
2024-11-13 09:57:55 +01:00
Kristjan ESPERANTO
f1522da153 Fix eslint ignores (#3633)
This will fix #3632.
2024-11-12 21:05:31 +01:00
sam detweiler
56cb536df1 add support for test mode detection in modulename.js via index.html (#3631)
in some cases the modulename.js may need to detect running in test mode
(compliments pr #3630)

window.name is not set  web mode

add a new field to the index.html 
window.intest 
and use the server_function to replace the hard coded string like we do
for window.mmversion=#VERSION#
then change the two  test helpers to set the env variable
app.js detects and sets global.intest=true
server func replace with value of global.intest

then module can use   if(window.intest)
2024-11-12 15:58:36 +01:00
Bugsounet - Cédric
4259d7c075 updatenotification: some fixes (#3628)
continue from #3626 

Is it ok for you ?
2024-11-09 09:59:12 +01:00
Bugsounet - Cédric
cd6f10c843 PM2 Fix (again): add pm2_env.unique_id checking and cleaning (#3626)
#3605 : new purpose code with `pm2_env.unique_id` checking
2024-11-07 11:38:46 +01:00
dependabot[bot]
b250cfa0ee Bump croner from 8.1.2 to 9.0.0 in /vendor (#3614)
Bumps [croner](https://github.com/hexagon/croner) from 8.1.2 to 9.0.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/hexagon/croner/releases">croner's
releases</a>.</em></p>
<blockquote>
<h2>9.0.0</h2>
<h2>Croner 9.0.0</h2>
<p>This major release brings significant changes to Croner, improving
consistency, fixing bugs, and modernizing the codebase.</p>
<h3>Changes</h3>
<ul>
<li>
<p><strong>Bug Fixes:</strong></p>
<ul>
<li>Fixed an issue where &quot;every X seconds&quot; crons would fail
with a &quot;maximum call stack exceeded&quot; error (<a
href="https://redirect.github.com/hexagon/croner/issues/260">#260</a>).</li>
<li>Fixed an issue where types were not supported when using ES module
via <a href="https://jsr.io">jsr.io</a> (<a
href="https://redirect.github.com/hexagon/croner/issues/258">#258</a>).</li>
</ul>
</li>
<li>
<p><strong>API Changes:</strong></p>
<ul>
<li>The <code>new</code> keyword is now mandatory when instantiating
Croner (e.g., <code>new Cron(/* ... */)</code>).</li>
<li>The default export has been removed. You now need to use
<code>import { Cron } from 'croner';</code> or <code>const { Cron } =
require('croner');</code>.</li>
</ul>
</li>
<li>
<p><strong>File Structure Changes</strong> <em>(relevant for direct file
access)</em>:</p>
<ul>
<li>All files in the <code>/dist</code> directory are now minified.
<code>croner.min.js</code> has been renamed to
<code>croner.js</code>.</li>
<li>Typings have been moved from <code>/types</code> to
<code>/dist</code>.</li>
<li>Only the <code>/src</code> directory is exposed in the jsr module <a
href="https://jsr.io/@hexagon/croner">jsr.io/<code>@​hexagon/croner</code></a>.</li>
</ul>
</li>
<li>
<p><strong>Codebase Modernization:</strong></p>
<ul>
<li>The entire codebase has been migrated from JavaScript with JSDoc to
TypeScript.</li>
<li>Deno is now used for formatting, type checking, and linting,
resulting in a cleaner and more maintainable repository. Esbuild is used
to build the <a href="https://www.npmjs.com/package/croner">npm
module</a> and typings.</li>
</ul>
</li>
</ul>
<p><strong>Upgrade Notice:</strong></p>
<p>Due to the API and file structure changes, upgrading from 8.x to 9.x
may require modifications to your existing code. Please review the above
changes carefully before migrating.</p>
<h2>9.0.0-dev.12</h2>
<ul>
<li>Test new release workflow</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="244a439e6e"><code>244a439</code></a>
Merge pull request <a
href="https://redirect.github.com/hexagon/croner/issues/263">#263</a>
from Hexagon/dev</li>
<li><a
href="7e280b5b8a"><code>7e280b5</code></a>
Bump version to 9.0.0 stable</li>
<li><a
href="c99144fe95"><code>c99144f</code></a>
Remove CodeQl. Rename dev release workflow.</li>
<li><a
href="4847b7d097"><code>4847b7d</code></a>
Merge pull request <a
href="https://redirect.github.com/hexagon/croner/issues/262">#262</a>
from Hexagon/dev</li>
<li><a
href="7bfefc49ed"><code>7bfefc4</code></a>
Fix workflow name</li>
<li><a
href="020cf92959"><code>020cf92</code></a>
Bump version.</li>
<li><a
href="40dabf4fa5"><code>40dabf4</code></a>
Fix npm release ci. Improve tsdoc. Refactor build script.</li>
<li><a
href="c45e868a92"><code>c45e868</code></a>
Increase timeout</li>
<li><a
href="df7974a13b"><code>df7974a</code></a>
Re-enable more async tests</li>
<li><a
href="8304e287cf"><code>8304e28</code></a>
Re-add async tests</li>
<li>Additional commits viewable in <a
href="https://github.com/hexagon/croner/compare/8.1.2...9.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=croner&package-manager=npm_and_yarn&previous-version=8.1.2&new-version=9.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 17:50:09 +01:00
sam detweiler
7e6349c093 Fix compliments croner (#3625)
croner changed the filename we need to use in the latest version
fix the alias table in vendor/vendor.js

fixes #3624
2024-11-04 17:41:48 +01:00
Kristjan ESPERANTO
6ce3622c61 Add spelling check to GitHub workflow (#3623)
Besides updating cspell and handling spelling issues, the important
change is adding the spelling check to the GitHub workflow.

I'm not sure if it will bother us too much when people create PRs. But I
wanted to give it a try. Or do you have any other ideas on how we can
run the spelling check on a regular basis?
2024-11-03 21:49:00 +01:00
Veeck
0aae771799 Update dependencies reported by Dependabot (#3621)
... maybe we should group those dependabot PRs someday (see
https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups)

---------

Co-authored-by: veeck <gitkraken@veeck.de>
2024-11-02 15:58:20 +01:00
Karsten Hassel
9114aefecc fix missing basePath (#3620)
fixes #3613 

wanted to write a test for `basePath` but have no idea at the moment to
simulate this without a reverse proxy.

Here my test setup for documentation:
```yaml
networks:
  proxy:
    driver: bridge

services:
  socket-proxy:
    privileged: true
    image: tecnativa/docker-socket-proxy:edge
    container_name: socket-proxy
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock:ro
    environment:
      CONTAINERS: 1
    ports:
      - "127.0.0.1:2375:2375"
    networks:
      - proxy

  traefik:
    image: traefik:latest
    container_name: traefik
    restart: unless-stopped
    user: 1000:1000
    command:
      - "--providers.docker=true"
      - "--providers.docker.network=traefik_proxy"
      - "--providers.docker.endpoint=tcp://socket-proxy:2375"
      - "--entryPoints.http.address=:80"
      - "--global.sendAnonymousUsage=false"
      - "--log.level=INFO"
      - "--api=true"
      - "--api.dashboard=true"
#      - "--accessLog=true"
#      - "--accesslog.fields.defaultmode=keep"
#      - "--accesslog.fields.headers.defaultmode=keep"
    networks:
      - proxy
    ports:
      - "80:80"

  magicmirror:
    image: karsten13/magicmirror:develop
    container_name: mm
    restart: unless-stopped
    entrypoint:
      - sleep
      - infinity
    networks:
      - proxy
    labels:
      - "traefik.http.services.karsten13.loadbalancer.server.port=8080"
      - "traefik.http.routers.k13-http.service=karsten13"
      - "traefik.http.routers.k13-http.entrypoints=http"
      - "traefik.http.routers.k13-http.rule=Host(`localhost`) && PathPrefix(`/testbasepath`)"
      - "traefik.http.middlewares.k13-stripprefix.stripprefix.prefixes=/testbasepath"
      - "traefik.http.routers.k13-http.middlewares=k13-stripprefix"
```
2024-11-02 08:22:27 +01:00
Bugsounet - Cédric
399e2ae1da [updatenotification] Fix pm2 using detection when pm2 script is inside or outside MagicMirror root folder (#3605)
This will fix #3576 

@FrankBlackMG: 

I don't use `*env.unique_id` because some others modules can use pm2 too
for starting a service and unique_id is the same (this will make
confusion)
So I check `name` and `pm_id` for found it
2024-10-28 10:32:39 +01:00
sam detweiler
c96326b760 Cleanup testcases that had hard coded Date() values which override the testcase runner (#3601)
cleanup testcases with hard coded Date settings after #3597
2024-10-25 20:52:00 +02:00
Karsten Hassel
cfa5c0d127 fix electron tests mocking dates (#3599)
fixes #3597 

Changes:
- electron tests: add mocking to `electron.js` for mocking the server
side, before only the browser side was mocked
- publish "/tests/configs" and "/tests/mocks" always in `server.js`,
this reverts a change done with latest release, we need this for
debugging (otherwise you get on the screen that your config has errors
but config check is successful ...)
- revert hotfix in
`tests/configs/modules/calendar/show-duplicates-in-calendar.js`
- fix `tests/configs/modules/calendar/custom.js` to allow events in the
past (~~I don't know how this could work before~~ when testing css
classes `yesterday` and `dayBeforeYesterday` --> it worked before
because the server side did not mock and therefore was not in the past)
2024-10-25 11:34:35 +02:00
sam detweiler
6946b49977 Fixtestcase calendar testcase failure (#3596)
fix calendar testcase failing after date change (exposes helper failure)
2024-10-23 23:46:32 +02:00
Kristjan ESPERANTO
aa7e856170 Add wayland and windows start options (#3594)
This PR adds start options for Wayland and Windows.

This would solve issue #3582.

**To Do if this PR is merged:**

- [ ] Adjust [Windows
section](https://docs.magicmirror.builders/getting-started/installation.html#windows)
in documentation
- [ ] Add Wayland section to the documentation
2024-10-23 21:42:29 +02:00
Veeck
b54fc08da7 Add npm publishing step to release process (#3595)
so that the npm version also stays in sync and
https://github.com/MagicMirrorOrg/MagicMirror/issues/2876 can be closed
for good
2024-10-23 20:47:01 +02:00
Kristjan ESPERANTO
0f024cff4e Run and test with node 23 (#3588) 2024-10-19 12:11:20 +02:00
Veeck
fff31068ab Re-add eslint-plugin-import (#3586)
eslint-plugin-import was missing since the switch to
[v9](https://github.com/MagicMirrorOrg/MagicMirror/pull/3558). They
finally
[support](https://github.com/import-js/eslint-plugin-import/pull/2996)
it so we can re-add it.
2024-10-13 15:22:02 +02:00
Karsten Hassel
3d1e8ab849 add address and ipWhitelist to all test configs (#3585)
All test configs have been updated to allow full external access,
allowing for easier debugging (especially when running as a container)
2024-10-12 07:53:58 +02:00
Bugsounet - Cédric
1b80e87563 [core] test electron v32 and electron rebuild (#3584)
test deps: nan v2.22.0 and electron v32
2024-10-11 11:57:34 +02:00
HeikoGr
7489e51a67 Change default for weatherEndpoint according to API 3.0 (#3583)
since API 3.0 is default, weatherEndpoint should be set to "/onecall"
Fixes #3574

ATTENTION: since lat / lon defaults to 0 / 0, the weather plugins works
after this patch, but shows the weather from
https://de.wikipedia.org/wiki/Null_Island if lat / lon is not manually
set.

---------

Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: Pedro Lamas <pedrolamas@gmail.com>
2024-10-11 08:51:00 +02:00
Karsten Hassel
0130dc45ab stale workflow: increase operations-per-run (default=30) so that all … (#3581)
…issues can be processed
2024-10-05 22:41:41 +02:00
Karsten Hassel
c7dcf542cf allow manually running stale workflow (#3580) 2024-10-05 19:47:34 +02:00
Bugsounet - Cédric
961bae637c [core] add try / catch on mode_helper loading (#3578)
When a library is missing on an 3rd party module, MM² stop loading and
display a black screen. (I'm sure it's happened to everyone.)

So, I have added a try/catch block and it's avoid black screen, display
errors and allow continue loading with next module
2024-10-05 15:23:36 +02:00
Karsten Hassel
f51fbe39c4 reactivated stale.yaml as github action (#3577)
The old `stale.yaml` seems not to work anymore, so I set up the same
content in a new github workflow.

I think we should use it again to get rid of old issues.
2024-10-04 21:47:07 +02:00
dependabot[bot]
f91340ceca Bump helmet from 7.1.0 to 8.0.0 (#3570)
Bumps [helmet](https://github.com/helmetjs/helmet) from 7.1.0 to 8.0.0.
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/helmetjs/helmet/blob/main/CHANGELOG.md">helmet's
changelog</a>.</em></p>
<blockquote>
<h2>8.0.0</h2>
<h3>Changed</h3>
<ul>
<li><strong>Breaking:</strong> <code>Strict-Transport-Security</code>
now has a max-age of 365 days, up from 180</li>
<li><strong>Breaking:</strong> <code>Content-Security-Policy</code>
middleware now throws an error if a directive should have quotes but
does not, such as <code>self</code> instead of <code>'self'</code>. See
<a
href="https://redirect.github.com/helmetjs/helmet/issues/454">#454</a></li>
<li><strong>Breaking:</strong> <code>Content-Security-Policy</code>'s
<code>getDefaultDirectives</code> now returns a deep copy. This only
affects users who were mutating the result</li>
<li><strong>Breaking:</strong> <code>Strict-Transport-Security</code>
now throws an error when &quot;includeSubDomains&quot; option is
misspelled. This was previously a warning</li>
</ul>
<h3>Removed</h3>
<ul>
<li><strong>Breaking:</strong> Drop support for Node 16 and 17. Node 18+
is now required</li>
</ul>
<h2>7.2.0 - 2024-09-28</h2>
<h3>Changed</h3>
<ul>
<li><code>Content-Security-Policy</code> middleware now warns if a
directive should have quotes but does not, such as <code>self</code>
instead of <code>'self'</code>. This will be an error in future
versions. See <a
href="https://redirect.github.com/helmetjs/helmet/issues/454">#454</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="9a8e6d5322"><code>9a8e6d5</code></a>
8.0.0</li>
<li><a
href="6562cd7074"><code>6562cd7</code></a>
CSP: speed up <code>getDefaultDirectives</code></li>
<li><a
href="a8befb3b9d"><code>a8befb3</code></a>
<code>getDefaultDirectives</code> should do a deep copy</li>
<li><a
href="558ef2ce90"><code>558ef2c</code></a>
HSTS: throw when misspelling &quot;includeSubDomains&quot; option</li>
<li><a
href="73e75952fe"><code>73e7595</code></a>
Content-Security-Policy: throw if directive value lacks necessary
quotes</li>
<li><a
href="76410e1093"><code>76410e1</code></a>
Content-Security-Policy can now use Object.hasOwn</li>
<li><a
href="293bd18bf5"><code>293bd18</code></a>
Strict-Transport-Security: increase max-age to 1 year</li>
<li><a
href="898cdc4c61"><code>898cdc4</code></a>
Require Node 18+</li>
<li><a
href="7e2b06947f"><code>7e2b069</code></a>
7.2.0</li>
<li><a
href="7bea9158d4"><code>7bea915</code></a>
Update changelog for 7.2.0 release</li>
<li>Additional commits viewable in <a
href="https://github.com/helmetjs/helmet/compare/v7.1.0...v8.0.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=helmet&package-manager=npm_and_yarn&previous-version=7.1.0&new-version=8.0.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 18:42:05 +02:00
dependabot[bot]
0eafa19096 Bump eslint-plugin-jsdoc from 50.3.0 to 50.3.1 (#3571)
Bumps
[eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from
50.3.0 to 50.3.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/gajus/eslint-plugin-jsdoc/releases">eslint-plugin-jsdoc's
releases</a>.</em></p>
<blockquote>
<h2>v50.3.1</h2>
<h2><a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.3.0...v50.3.1">50.3.1</a>
(2024-10-01)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong><code>check-alignment</code>:</strong> handle zero indent;
fixes <a
href="https://redirect.github.com/gajus/eslint-plugin-jsdoc/issues/1322">#1322</a>
(<a
href="34866bc988">34866bc</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="34866bc988"><code>34866bc</code></a>
fix(<code>check-alignment</code>): handle zero indent; fixes <a
href="https://redirect.github.com/gajus/eslint-plugin-jsdoc/issues/1322">#1322</a></li>
<li>See full diff in <a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v50.3.0...v50.3.1">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-jsdoc&package-manager=npm_and_yarn&previous-version=50.3.0&new-version=50.3.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-02 18:41:36 +02:00
Bugsounet - Cédric
ee98a0c7e5 [UpdateNotification] Fix pm2 using detection when pm2 script is in MagicMirror root folder (#3576)
I discover this bug:

When pm2 `sh` script is on MagicMirror root folder, updatenotification
is not able to detect pm2 using

```
0|MagicMirror  | [2024-10-02 17:23:09.215] [DEBUG]   Version Compare: 2.30.0-develop 2.30.0-develop --> true 
0|MagicMirror  | [2024-10-02 17:23:09.216] [DEBUG]   Status: online 
0|MagicMirror  | [2024-10-02 17:23:09.216] [DEBUG]   PM2 MagicMirror starting  from Path: /home/bugsounet/MagicMirror-dev 
0|MagicMirror  | [2024-10-02 17:23:09.216] [DEBUG]   MagicMirror Path /home/bugsounet/MagicMirror-dev/
0|MagicMirror  | [2024-10-02 17:23:09.216] [DEBUG]   Compare: false
0|MagicMirror  | [2024-10-02 17:23:09.216] [INFO]  updatenotification: [PM2] You are not using pm2 
```
2024-10-02 18:33:46 +02:00
Bugsounet - Cédric
4c7c859ae6 [Electron rebuild] Removed node-pty and drivelist from rebuilded test (#3575)
Related to #3573 

I think it's better to keep new library node-libgpiod for testing
(library to manage RPI gpio for pir sensor management) and delete others
Only one test is better
2024-10-02 18:31:57 +02:00
Karsten Hassel
d1be92a426 Prepare v2.30.0-develop 2024-10-01 00:09:29 +02:00
Karsten Hassel
15a934641d Merge remote-tracking branch 'origin/master' into develop 2024-10-01 00:06:36 +02:00
Karsten Hassel
d84d612df5 Release 2.29.0 2024-09-30 23:49:05 +02:00
Karsten Hassel
719eca49fe update dependencies, nail down node-ical version to 0.18.0 (#3566)
- node-ical use `0.18.0` instead of `^0.18.0` in `package.json`
- cleanup `package-lock.json`
2024-09-28 15:33:53 -05:00
sam detweiler
d9eefff066 fix double load of positions now that check:config at startup is active (#3565)
after adding check:config to the MM startup process, #3450, we
accidentally discover module positions more than once, and write the
file each time..

add a check to see if we have done this work already
2024-09-28 15:52:09 +02:00
Bugsounet - Cédric
731512c2e5 Electron rebuild tests update (#3563)
# Update electron-rebuild.yaml
* remove onoff library: Not updated since 3 years, don't work with last
rpi Os
 * add node-libgpiod library in replacement
2024-09-26 19:09:39 +02:00
Bugsounet - Cédric
ebaeed935f Engine except on node v21 (#3561)
in addition of #3559 

except with node v21: no security updates and EOL
2024-09-26 19:09:10 +02:00
Marc Landis
2e6e86887b fix calendar showing previous day when using sliceMultiDayEvents (#3555)
This bug is caused by #3543.

The calculation for midnight adds a day but for endDate we want the day
to be subtracted again.
2024-09-25 21:16:43 +02:00
Kristjan ESPERANTO
d3187689f0 Switch to ESLint v9 and flat config (#3558)
Since PR #3551 was not yet complete, I made my own attempt.

1. Update to ESLint v9.
2. Replace deprecated `.eslintrc.json` and `.eslintignore` by flat
config `eslint.config.mjs`.
3. Adapt `check_config.js` to use flat config.
4. Since `eslint-plugin-import` still doesn't support ESLint v9 I
removed it. We can add it back when it does support v9.
5. Run tests `npm run check:js` and `npm run config:check`.
6. In order not to overload this PR, I have not yet activated more
additional rules - there are some useful ones in the new plugin
`@eslint/js`.

@bugsounet, please don't take it as an offence that I have created a
competing PR. The migration to ESLint v9 has been burning under my nails
for some time.
2024-09-25 21:05:11 +02:00
Bugsounet - Cédric
5ffdf9af09 Updated minimal needed node version in package.json (currently v20.9.0) (#3559)
Update of package*.json for minimal node verion requirement (v20.9.0)

 * it's an addition to #3556
* According to changelog v2.28.0: `⚠️ This release needs nodejs version
>= v20.9.0`
2024-09-25 09:03:09 +02:00
Karsten Hassel
08116b8e64 fixes for running tests for MM_MODULES_DIR (#3550)
and ignore `js/positions.js` when linting (because this file is
generated at runtime).
2024-09-24 22:38:00 +02:00
Karsten Hassel
fa6a7521b4 add tests for minimal node version (currently v20.9.0) (#3556)
Beside testing against node version `v20.x` and `v22.x` we should also
test against the minimal node version, currently `v20.9.0`.

This is for seeing changes in dependencies which needs higher node
version as with the July-24-release, where we wrote `node >=20` but
shipped an `eslint` version which required `node>=20.9.0`.
2024-09-24 22:09:28 +02:00
Veeck
06a8b517aa Cleanup github actions (#3549)
- should now correct itself when one changes from (accidentaly selected)
master to develop
- also fixes wrong CHANGELOG entry from
https://github.com/MagicMirrorOrg/MagicMirror/pull/3481
- update deps a little
2024-09-19 12:25:41 +02:00
Ryan Williams
1823f5a130 Updated to new notification name DOM_OBJECTS_UPDATED -> MODULE_DOM_UPDATED (#3548)
This is an update to #3535. See #3534 for discussion and context. Fixes
#3534 (again).
2024-09-19 07:29:43 +02:00
Karsten Hassel
8f5aa50d79 added test for MM_MODULES_DIR (#3546)
uses newsfeed test after copying this module to config dir

addition for #3530
2024-09-19 07:29:04 +02:00
Karsten Hassel
65d7e2d067 fix CHANGELOG.md 2024-09-18 21:53:18 +02:00
Kristjan ESPERANTO
06f6fbf49b Review config_check.js (#3545)
Only details changes. No functional changes.

- remove superfluous colors in Log.error
- invert negative if
- update ESLint env
- use camel case variable name
- optimize Log strings
2024-09-18 21:39:02 +02:00
Ryan Williams
c6e05c9fec Added DOM_OBJECTS_UPDATED notification when the DOM is re-rendered via updateDom (#3535)
- [x] Base your pull requests against the `develop` branch.
- [x] Include these infos in the description:
> - Does the pull request solve a **related** issue?
Yes - solves #3534

> - If so, can you reference the issue like this `Fixes
#<issue_number>`?
Fixes #3534 (also mentioned in commit message)

> - What does the pull request accomplish? Use a list if needed.

> > - Adds a new notification (`DOM_OBJECTS_UPDATED`) when the DOM is
updated via `updateDom`

- [x] Please run `npm run lint:prettier` before submitting
- [x] Don't forget to add an entry about your changes to the
CHANGELOG.md file.

More info can be found in #3534, but as a summary:

The `updateDom` function is not synchronous - there is an undetermined
amount of time between when it completes and when the DOM has actually
been re-rendered and is ready for interaction. The existing notification
(`MODULE_DOM_CREATED`) only fires once on the initial DOM render. This
PR solves the issue of subsequent re-renders by adding a new
notification that fires whenever the DOM is ready after an update. This
notification falls within expected lifecycle notifications (very similar
to other libraries that provide DOM lifecycle notifications).
2024-09-18 19:40:46 +02:00
Kristjan ESPERANTO
866419eb95 Check config before starting MM (#3450)
I think it might be a good idea to check the config at every start.
2024-09-18 19:37:25 +02:00
Karsten Hassel
659e0c74cb add new env vars MM_MODULES_DIR and MM_CUSTOMCSS_FILE … (#3530)
… for setting these things from outside (and overriding corresponding
config.js properties `config.foreignModulesDir` and `customCss`)

- remove elements from index.html when loading script or stylesheet
files fails
- removed `config.paths.vendor` (could never work because `vendor` is
hardcoded in `index.html`) and renamed `config.paths.modules` to
`config.foreignModulesDir`. The `config.paths. ...` properties were
implemented in the initial commit in `js/defaults.js` but were never
functional.
- fixes `app.js` which didn't respect `config.paths.modules` before
- as `modules/defaults` is directly set in many places in the source
code restrict `config.paths.modules` to foreign modules (it has never
worked for default modules), now renamed to `config.foreignModulesDir`
- adds new `/env` section in `server.js` for getting the new env vars in
the browser
- fixes TODO in `server.js` so test directories are now only published
when running tests

These changes allow changing some main paths from outside mm with the
new env vars. You now **can** put all user stuff into one directory,
e.g. the `config` dir:
- `config.js` as before
- `custom.css`
- foreign modules

This would simplify other setups e.g. the docker setup. At the moment we
have to deal with 3 directories where 2 of them (`modules` and `css`)
contains mixed stuff, which means mm owned files and user files. This
can now simplified and leads to cleaner setups (if wanted).
2024-09-18 19:10:46 +02:00
Kristjan ESPERANTO
d9f9f41e98 Add spell check (#3544)
I felt like adding a spell checker, but it's okay if you find it
superfluous. At least then we could fix the found spell issues.

What is still missing is an automatic integration so that the spell
checker does not have to be called manually. Would it perhaps make sense
to always do it before a release?
2024-09-18 07:37:09 +02:00
sam detweiler
ea3a323581 add fix for sliceMultiDayEvents (#3543)
sliceMultiDayEvents occasionally gets the number of events wrong and
produces too many rows

Math.ceil() rounds up over 1.04 so we get an abnormal count

then the calcs for the midnight loop control used different moment()
functions, producing different results

fixes #3542
2024-09-17 08:01:49 +02:00
Karsten Hassel
0faefd109a fixes calendar test by moving it from e2e to electron with fixed date (#3540)
and refactor tests/electron/modules/calendar_spec.js

fixes #3532
2024-09-15 08:36:11 +02:00
Karsten Hassel
81351fb4cc update dependencies (#3536) 2024-09-14 22:05:20 +02:00
Karsten Hassel
3380314c11 hotfix for calendar_spec.js (used data now returns 20 events) (#3533)
fixes #3532
2024-09-13 16:52:34 -05:00
Kristjan ESPERANTO
bca5d9c845 Ignore positions.js (#3531)
This file is generated when MM is started. As I understand it, it should
not be included in the repository.

Should probably have been part of #3518.
2024-09-11 23:12:34 +02:00
Karsten Hassel
7915de3149 update dependencies (#3527)
We cannot upgrade to electron v32 because electron-rebuild is failing
with epoll, so staying at v31.
2024-08-31 07:14:30 +02:00
sam detweiler
2b97e0d26e add support for custom regions, by detecting what is used in index.html (#3518)
read index.html to discover the regions used, make them the list checked
by app.js and check:config test

fixes #3504   supercedes #3506 

no config.js param required
2024-08-27 22:52:59 +02:00
Panagiotis Skias
56736786fd Bug in Weather Units for Broadcasted Notification (#3519)
This PR resolve Issue number #3419 .

I have added the method `convertWeatherObjectToImperial()` which
converts the units of the `notificationPayload` to imperial if needed,
in order to pass the object in `sendNotification()`.

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2024-08-18 10:04:51 +02:00
Ryan Williams
cc1d4ab240 Improve duplicate module filtering. Update SocketIO catch-all API. (#3523)
- [x] Base your pull requests against the `develop` branch.
- [x] Include these infos in the description:
> - Does the pull request solve a **related** issue?
Yes - solves #3521

> - If so, can you reference the issue like this `Fixes
#<issue_number>`?
Fixes #3521 (also mentioned in commit message)

> - What does the pull request accomplish? Use a list if needed.

> > - Updates duplicate module filter method (upstream vs downstream -
see #3502)
> > - Updates socket io catchall functionality to new API
[[docs](https://socket.io/docs/v4/listening-to-events/)].

- [x] Please run `npm run lint:prettier` before submitting
- [x] Don't forget to add an entry about your changes to the
CHANGELOG.md file.
2024-08-18 09:25:01 +02:00
Veeck
976c8ae00a Bump stylistic-eslint (#3520)
updates plugin and adjust docs and config for smooth cleaning :-D

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-08-12 22:52:43 +02:00
sam detweiler
780e4e2e06 Fix loading of multiple instances of node_helper when multiple instances of a module are in config.js (#3517)
adds a check for already loaded/loading for node helper of a each
module, only does once

fixes #3502
2024-08-04 21:28:20 +02:00
Karsten Hassel
76d8f98969 allow custom module positions by setting allowCustomModulePositions… (#3506)
… in `config.js`

fixes #3504, related to
https://github.com/MagicMirrorOrg/MagicMirror/pull/3445
2024-08-01 21:24:16 +02:00
Veeck
4182c2129f Update dependencies (#3515)
its the start of the month so dependabot is waking up :-)
2024-08-01 19:00:36 +02:00
Karsten Hassel
d22d0e1f87 remove raspberry object from systeminformation (#3507)
fixes #3505
2024-07-29 12:22:59 +02:00
sam detweiler
d9665b35df Update compliments with support for cron type date/time for selections, addition to just date. (#3481)
> - What does the pull request accomplish? Use a list if needed.

this change allows uses to configure date/time events for compliments..
also linked site that will build the cron entry..

and example was Happy hour in a pub, on fri/sat between 5 and 7 pm. 

or just after midnight on Halloween (Boooooo!)

I also added testcases for #3478 

(and added support for this in MMM-Config), with a custom, drop down
selection list of the types.. )

|  if this is approved I will update the module doc
2024-07-15 19:51:05 +02:00
Daniel
974a1da9f0 [weather] update provider openweathermap to new apiVersion (#3496)
Co-authored-by: Karsten Hassel <hassel@gmx.de>
2024-07-11 13:37:44 +02:00
jargordon
4d14f4a2c1 Fixes the UK Met Office Datahub provider (#3499)
Fixes #3384

Changed the UKMetOfficeDataHub provider to the new API structure as per
the documentation.

API Base URL updated.
Header information amended to the correct key name.
API Secret no longer required so removed.

Changelog updated to reflect the change.
2024-07-07 16:36:59 -05:00
Karsten Hassel
3b22622054 fixes checks badge in README.md (#3494)
old url: 

![grafik](https://github.com/MagicMirrorOrg/MagicMirror/assets/25914086/025597f2-c1f1-4879-a76c-5a20c7b7099e)


new url:

![grafik](https://github.com/MagicMirrorOrg/MagicMirror/assets/25914086/f3b8850e-3fe4-4cb0-aa07-7525eb8f82eb)
2024-07-04 22:47:21 +02:00
sam detweiler
160d95ac34 Cleanup folders for #3492 (#3493)
remove installer only files. into installer

addresses #3492
2024-07-02 00:09:50 +02:00
Karsten Hassel
f7369a7e85 Prepare v2.29.0-develop 2024-06-30 23:53:28 +02:00
Karsten Hassel
7389a33f80 Merge remote-tracking branch 'origin/master' into develop 2024-06-30 23:50:35 +02:00
Karsten Hassel
795e5c76c1 Release 2.28.0 2024-06-30 23:25:27 +02:00
Karsten Hassel
92ac3895a7 updatenotification: avoid using pm2 when running in docker container (#3484)
related to #3480 

Change module updatenotification so that it can work without `pm2` in a
docker container.

It now tests if file `/.dockerenv` exists and if so `require("pm2")` is
never called.
2024-06-28 22:33:21 +02:00
Jason Stieber
c89c3edf97 Fix weathergov api precipitationLastHour (#3125)
Pull request fixes small big in weathergov api format mismatch #3124

---------

Co-authored-by: Karsten Hassel <hassel@gmx.de>
2024-06-28 22:21:38 +02:00
Karsten Hassel
74c6bb30b0 Update dependencies (#3487)
and minor fixes in changelog.
2024-06-28 22:09:44 +02:00
Bugsounet - Cédric
cfc0bc617f Update CHANGELOG.md (#3486)
Adjust my own ChangeLog entry
2024-06-27 21:37:22 +02:00
Karsten Hassel
4aafa32875 fixes e2e tests running in docker container (#3485)
which needs `address: "0.0.0.0"`

fixes #3479
2024-06-27 10:38:29 +02:00
Bugsounet - Cédric
f28b4bd709 Use latest@version of node for automated-tests.yaml (#3483)
Maybe it's a good idea to use latest@node version for automated-tests

Actually it's an "random" version

Note: it's already used [there in
electronRebuild](https://github.com/MagicMirrorOrg/MagicMirror/blob/develop/.github/workflows/electronRebuild.yaml#L19)
2024-06-26 21:43:41 +02:00
WallysWellies
aefb3a0b6d Update compliments module (#3471)
`Fixes #3465`

Add config option `specialDayUnique` that defaults to `false` and causes
special day compliments to be added to the existing compliments array.
Setting this option to `true` will only show the compliments that have
been configured for that day.

---------

Co-authored-by: Veeck <github@veeck.de>
Co-authored-by: veeck <michael.veeck@nebenan.de>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
2024-06-24 22:40:59 +02:00
Brian O'Connor
3d9d72e64e Open-Meteo: Fix forecast and hourly weather to use real temperatures, not apparent temperatures (#3468)
As discussed in #3466, the Open-Meteo provider is using the apparent
temperature ("Feels like") in the forecast and hourly weather reporting.
This is contrary to expected behavior.

Note: I'm a little unclear on how I should be editing the `CHANGELOG.md`
file with this PR - happy to update this PR with a little guidance. This
is my first attempted PR in this project.

Let me know if there are any questions.

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2024-06-24 22:18:49 +02:00
Karsten Hassel
8d20832bc5 [calendar] add config option "showEndsOnlyWithDuration" (#3477)
redo and rebase changes made in PR
https://github.com/MagicMirrorOrg/MagicMirror/pull/2968 by
https://github.com/kleinmantara
2024-06-24 21:52:19 +02:00
Bugsounet - Cédric
e95c144c3e Fix crash possibility if module: <name> is not defined and on mistake position: <position> (#3445)
Fix #3442
2024-06-24 21:51:54 +02:00
Karsten Hassel
4c748a4d32 update config.js.sample to use openmeteo as weather provider (#3476)
which needs no api key.

I think this is a better choice than the old one because new users which
use this config as starting point will now see weather data instead of
`loading...`
2024-06-22 21:23:58 +02:00
Karsten Hassel
9cbd30f296 update dependencies incl. electron v31 (#3473) 2024-06-19 22:21:46 +02:00
Bugsounet - Cédric
bc27c46723 MM² Main core use node >= v20 // delete node v18 from test suite (#3463)
#3462
2024-06-19 22:11:04 +02:00
Karsten Hassel
63324454a9 update dependencies (#3460)
see
https://github.com/MagicMirrorOrg/MagicMirror/pull/3457#issuecomment-2159316713
2024-06-11 06:54:17 +02:00
Karsten Hassel
4bd66cb121 fixed type=daily for provider openmeteo showing nightly icons (#3459)
in forecast when current time is "nightly"

Fixes #3458
2024-06-08 11:48:31 +02:00
Karsten Hassel
cd0bc5b160 fixed type=daily for provider openmeteo having no data … (#3451)
… when running after 23:00

Fixes #3449
2024-05-20 09:36:03 +02:00
Karsten Hassel
d1c17e7fc0 weather module: Fixed precipitationProbability in forecast … (#3448)
…for provider openmeteo, fixed #3446
2024-05-13 22:36:35 +02:00
Karsten Hassel
3b0035760d Update deps (#3439)
- update dependencies including electron to v30
- replace node v21 with v22 in tests
2024-05-01 19:54:38 +02:00
dependabot[bot]
1fa17883bc Bump ansis from 2.3.0 to 3.0.1 (#3417)
Bumps [ansis](https://github.com/webdiscus/ansis) from 2.3.0 to 3.0.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/webdiscus/ansis/releases">ansis's
releases</a>.</em></p>
<blockquote>
<h2>v3.0.0</h2>
<h1>Features</h1>
<ul>
<li>Added detection of color spaces support: TrueColor, 256 colors, 16
colors, no color (black &amp; white).</li>
<li>Added fallback for supported color space: truecolor —&gt; 256 colors
—&gt; 16 colors —&gt; no colors.</li>
<li>Improved  performance for the <code>hex()</code> function.</li>
</ul>
<h1>BREAKING CHANGE</h1>
<p>In the new major version <code>3.x</code> are removed unused styles
and methods.</p>
<blockquote>
<p>⚠️ Warning</p>
<p>Before update, please check your code whether is used deleted styles
and methods.</p>
</blockquote>
<h3>Support Node.js</h3>
<p>Drop supports for Node &lt;= <code>14</code>. Minimal supported
version is <code>15.0.0</code> (Released 2020-10-20).
In the theory the <code>v3</code> can works with Node<code>12</code>,
but we can't test it.</p>
<h3>Deleted styles</h3>
<p>The <code>not widely supported</code> styles are deleted:</p>
<ul>
<li><code>faint</code> (alias for dim), replace in your code with
<code>dim</code></li>
<li><code>doubleUnderline</code>, replace in your code with
<code>underline</code></li>
<li><code>frame</code>, replace in your code with
<code>underline</code></li>
<li><code>encircle</code>, replace in your code with
<code>underline</code></li>
<li><code>overline</code>, replace in your code with
<code>underline</code></li>
</ul>
<h3>Deleted methods</h3>
<p>The methods are deleted:</p>
<ul>
<li><code>ansi</code>, replace in your code with <code>ansi256</code> or
<code>fg</code></li>
<li><code>bgAnsi</code>, replace in your code with
<code>bgAnsi256</code> or <code>bg</code></li>
</ul>
<h3>Deleted clamp in functions</h3>
<p>The clamp (0, 255) for the ANSI 256 codes and RGB values is removed,
because is unused.
You should self check the function arguments.</p>
<p>The affected functions:</p>
<ul>
<li><code>ansi256</code> and <code>fg</code> (alias to ansi256) -
expected a code in the range <code>0 - 255</code></li>
<li><code>bgAnsi256</code> and <code>bg</code> (alias to bgAnsi256) -
expected a code in the range<code>0 - 255</code></li>
<li><code>rgb</code> - expected r, g, b values in the range <code>0 -
255</code></li>
<li><code>bgRgb</code> - expected r, g, b values in the range <code>0 -
255</code></li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/webdiscus/ansis/blob/master/CHANGELOG.md">ansis's
changelog</a>.</em></p>
<blockquote>
<h2>3.0.1 (2024-04-01)</h2>
<ul>
<li>refactor: improve code</li>
<li>chore: reduce code bundle size from 3.8 KB to 3.4 KB</li>
<li>chore: update benchmark</li>
<li>chore: update compare tests</li>
<li>test: add more tests</li>
<li>docs: improve readme</li>
</ul>
<h2>3.0.0 (2024-03-29)</h2>
<ul>
<li>feat: add detection of color spaces support: TrueColor, 256 colors,
16 colors, no color</li>
<li>feat: add fallback for supported color space: truecolor —&gt; 256
colors —&gt; 16 colors —&gt; no colors</li>
<li>perform: improve performance for <code>hex()</code> function</li>
<li>chore: size increased from 3.2 KB to 3.8 KB as new features were
added</li>
<li>test: switch from jest to vitest</li>
<li>test: add tests for new features</li>
<li>docs: update readme for color spaces support</li>
</ul>
<h3>BREAKING CHANGE</h3>
<p>In the new major version <code>3.x</code> are removed unused styles
and methods.</p>
<blockquote>
<p>⚠️ Warning</p>
<p>Before update, please check your code whether is used deleted styles
and methods.</p>
</blockquote>
<h3>Support Node.js</h3>
<p>Drop supports for Node &lt;= <code>14</code>. Minimal supported
version is <code>15.0.0</code> (Released 2020-10-20).
In the theory the <code>v3</code> can works with Node<code>12</code>,
but we can't test it.</p>
<h3>Deleted styles</h3>
<p>The <code>not widely supported</code> styles are deleted:</p>
<ul>
<li><code>faint</code> (alias for dim), replace in your code with
<code>dim</code></li>
<li><code>doubleUnderline</code>, replace in your code with
<code>underline</code></li>
<li><code>frame</code>, replace in your code with
<code>underline</code></li>
<li><code>encircle</code>, replace in your code with
<code>underline</code></li>
<li><code>overline</code>, replace in your code with
<code>underline</code></li>
</ul>
<h3>Deleted methods</h3>
<p>The methods are deleted:</p>
<ul>
<li><code>ansi</code>, replace in your code with <code>ansi256</code> or
<code>fg</code></li>
<li><code>bgAnsi</code>, replace in your code with
<code>bgAnsi256</code> or <code>bg</code></li>
</ul>
<h3>Deleted clamp in functions</h3>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/webdiscus/ansis/commits">compare view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=ansis&package-manager=npm_and_yarn&previous-version=2.3.0&new-version=3.0.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-01 22:11:52 +02:00
veeck
8aaad8e7ec Prepare v2.28.0-develop 2024-04-01 22:05:54 +02:00
veeck
1981601f0a Merge branch 'mm_master' into mm_develop 2024-04-01 22:03:49 +02:00
Veeck
2a883c393c Remove codecov yaml (#3416)
CodeCov isnt used at the moment and MAYBE this blocks our release
2024-04-01 20:08:31 +02:00
Veeck
53420f5be9 Fix check for mastermerge label (#3415)
Mastermerge label wasnt checked correctly, this PR should hopefully
fixes it for good

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-01 18:16:20 +02:00
veeck
b262bf6144 Release 2.27.0 2024-04-01 12:01:44 +02:00
Karsten Hassel
72ef8235b1 update Collaboration.md (added infos from discord) (#3408) 2024-03-30 23:29:57 +01:00
Paranoid93
e004b33fab Change multiday fullDay Event behaviour (#3396)
Hey!

This PR should change the behaviour of starting fullDay events that last
several days. The goal was to change the behavior of the "Starting
today, ends T" (T=Tomorrow) event, so it should show how many days it
will occur from the first day on

Before situation:

a fullDay event that started 'today' and ends several days later showed
Today on the first day. The rest of the days it showed X days left.


![grafik](https://github.com/MagicMirrorOrg/MagicMirror/assets/6515818/da4e06cf-3122-44d9-b78a-88f9970c57d4)

Y => Yesterday
T => Tomorrow


Target situation with this commit:
a fullDay event that started 'today' shows 'X days left' from the first
day on and 'Today' on the last day.


![grafik](https://github.com/MagicMirrorOrg/MagicMirror/assets/6515818/c42b9a27-35cf-47b7-9a8f-937a6009f904)

---------

Co-authored-by: Veeck <github@veeck.de>
2024-03-28 22:02:22 +01:00
Bugsounet - Cédric
d9926fad79 MM² Icon (#3407)
* Create `MM²` icon
 * Allow to change default electron icon to this icon
2024-03-28 12:37:18 +01:00
Karsten Hassel
fd44445ec3 update deps and package.json's (eslint) (#3406) 2024-03-27 23:13:01 +01:00
Bugsounet - Cédric
be63e365bd Add electron-rebuild to suite test (#3392)
because actually i'm not able to rebuild any libraries to works with
electron v29.x
I write a suite test to check `electron-rebuild`

Note: works with
[v28.x](https://github.com/MagicMirrorOrg/MagicMirror/actions/runs/8122468177/job/22201931385)
2024-03-27 22:45:01 +01:00
Veeck
57549fa19c Fix compliments module bringing mirror to a halt (#3402)
... when no compliments are to be displayed. We shouldnt even try to
randomize when the array has no elements...

Fixes #3385
2024-03-23 12:16:57 +01:00
Paranoid93
52cfbacd4d Changes the layout of the current weather module, targetting indoor values (#3397)
Hi,

this PR should change the layout of the indoor values in the
current_weather module.

Since the Indoor values are being passed into the module via a
notification, I sadly do not know exactly how to write a test for this.
Can you link me an example or tell me, how I can mock indoor values into
this test?

Before:

![grafik](https://github.com/MagicMirrorOrg/MagicMirror/assets/6515818/b1b2afcc-0a35-48c3-9cf8-3e7b041c7727)

After:

![grafik](https://github.com/MagicMirrorOrg/MagicMirror/assets/6515818/311d3051-45e9-450d-afd5-c90a4d4ffd63)
2024-03-23 10:53:42 +01:00
sam detweiler
6de578edb3 move suncalc dependency out of dev, as it is used by the clock module (#3401)
user reported problem with clock module, checking code found dependency
on suncalc library, but it is not loaded in production mode.. move
dependency

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
2024-03-22 19:49:40 +01:00
vppencilsharpener
d970214a0e Fix for #3345 - precipitation probability not displayed when it is 0% (#3346)
Fixes issue #3345. 

I think I submitted this correctly, but don't do this often so let me
know if anything needs to be corrected.

---------

Co-authored-by: Veeck <github@veeck.de>
2024-03-21 14:11:23 +01:00
Bugsounet - Cédric
c5f90501ef [calendar] deny fetch interval < 60000 and set 60000 in this case (prevent fetch loop failed) (#3382)
Hi, I had the case of some users who set a very small fetchinterval (10
sec for example)
in some cases, it may be that the request did not have time to complete
correctly and that the next one has already been sent (generally on
start of MM²)
I think that lock min fetchInterval to 60000 is a good idea
2024-03-21 13:43:04 +01:00
Bugsounet - Cédric
16af809559 Update .npmrc (#3399)
Don't display `npm WARN <....>`  on install

Only Error will be displayed
2024-03-16 13:06:27 +01:00
jkriegshauser
1a745cfb92 Fix issue 3393 (#3395)
Fix for #3393
2024-03-13 20:59:21 +01:00
dependabot[bot]
90ff3402cb Bump node-ical from 0.17.2 to 0.18.0 (#3387)
Bumps [node-ical](https://github.com/jens-maus/node-ical) from 0.17.2 to
0.18.0.
<details>
<summary>Commits</summary>
<ul>
<li>See full diff in <a
href="https://github.com/jens-maus/node-ical/commits/0.18.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=node-ical&package-manager=npm_and_yarn&previous-version=0.17.2&new-version=0.18.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 20:05:37 +01:00
dependabot[bot]
e5678f0291 Bump playwright from 1.41.2 to 1.42.0 (#3388)
Bumps [playwright](https://github.com/microsoft/playwright) from 1.41.2
to 1.42.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/microsoft/playwright/releases">playwright's
releases</a>.</em></p>
<blockquote>
<h2>v1.42.0</h2>
<h2>New APIs</h2>
<ul>
<li>
<p><strong>Test tags</strong></p>
<p><a href="https://playwright.dev/docs/test-annotations#tag-tests">New
tag syntax</a> for adding tags to the tests (@-tokens in the test title
are still supported).</p>
<pre lang="js"><code>test('test customer login', { tag: ['@fast',
'@login'] }, async ({ page }) =&gt; {
  // ...
});
</code></pre>
<p>Use <code>--grep</code> command line option to run only tests with
certain tags.</p>
<pre lang="sh"><code>npx playwright test --grep @fast
</code></pre>
</li>
<li>
<p><strong>Annotating skipped tests</strong></p>
<p><a
href="https://playwright.dev/docs/test-annotations#annotate-tests">New
annotation syntax</a> for test annotations allows annotating the tests
that do not run.</p>
<pre lang="js"><code>test('test full report', {
  annotation: [
{ type: 'issue', description:
'https://github.com/microsoft/playwright/issues/23180' },
{ type: 'docs', description:
'https://playwright.dev/docs/test-annotations#tag-tests' },
  ],
}, async ({ page }) =&gt; {
  // ...
});
</code></pre>
</li>
<li>
<p><strong>page.addLocatorHandler()</strong></p>
<p>New method <a
href="https://playwright.dev/docs/api/class-page#page-add-locator-handler">page.addLocatorHandler()</a>
registers a callback that will be invoked when specified element becomes
visible and may block Playwright actions. The callback can get rid of
the overlay. Here is an example that closes a cookie dialog when it
appears.</p>
<pre lang="js"><code>// Setup the handler.
await page.addLocatorHandler(
page.getByRole('heading', { name: 'Hej! You are in control of your
cookies.' }),
    async () =&gt; {
      await page.getByRole('button', { name: 'Accept all' }).click();
    });
// Write the test as usual.
await page.goto('https://www.ikea.com/');
await page.getByRole('link', { name: 'Collection of blue and white'
}).click();
await expect(page.getByRole('heading', { name: 'Light and easy'
})).toBeVisible();
</code></pre>
</li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="e7f0635c17"><code>e7f0635</code></a>
cherry-pick(<a
href="https://redirect.github.com/microsoft/playwright/issues/29692">#29692</a>):
docs: better addLocatorHandler example in release notes ...</li>
<li><a
href="8709a3a24b"><code>8709a3a</code></a>
cherry-pick(<a
href="https://redirect.github.com/microsoft/playwright/issues/29687">#29687</a>):
chore: fix docs roll for functions without args follow-u...</li>
<li><a
href="aa9f6fb718"><code>aa9f6fb</code></a>
cherry-pick(<a
href="https://redirect.github.com/microsoft/playwright/issues/29669">#29669</a>):
chore: strengthen linting (<a
href="https://redirect.github.com/microsoft/playwright/issues/29674">#29674</a>)</li>
<li><a
href="f5899c1556"><code>f5899c1</code></a>
chore: set version to 1.42.0 (<a
href="https://redirect.github.com/microsoft/playwright/issues/29671">#29671</a>)</li>
<li><a
href="77e1b02552"><code>77e1b02</code></a>
docs: 1.42 release notes (<a
href="https://redirect.github.com/microsoft/playwright/issues/29666">#29666</a>)</li>
<li><a
href="c1421bc9f2"><code>c1421bc</code></a>
docs: typescript compiler invocation before tests (<a
href="https://redirect.github.com/microsoft/playwright/issues/29667">#29667</a>)</li>
<li><a
href="bd8d044433"><code>bd8d044</code></a>
feat(uimode) uses relative paths to establish websocket connection (<a
href="https://redirect.github.com/microsoft/playwright/issues/29617">#29617</a>)</li>
<li><a
href="56028269bb"><code>5602826</code></a>
devops: add a hint how to create a repro (<a
href="https://redirect.github.com/microsoft/playwright/issues/29665">#29665</a>)</li>
<li><a
href="015a1bcc1c"><code>015a1bc</code></a>
feat(ct): double unmounting component throws error (<a
href="https://redirect.github.com/microsoft/playwright/issues/29650">#29650</a>)</li>
<li><a
href="303d7fdac9"><code>303d7fd</code></a>
chore(ct): vue resolve internal type errors (<a
href="https://redirect.github.com/microsoft/playwright/issues/29649">#29649</a>)</li>
<li>Additional commits viewable in <a
href="https://github.com/microsoft/playwright/compare/v1.41.2...v1.42.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=playwright&package-manager=npm_and_yarn&previous-version=1.41.2&new-version=1.42.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 20:05:23 +01:00
dependabot[bot]
c7d94a069e Bump express from 4.18.2 to 4.18.3 (#3389)
Bumps [express](https://github.com/expressjs/express) from 4.18.2 to
4.18.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/expressjs/express/releases">express's
releases</a>.</em></p>
<blockquote>
<h2>4.18.3</h2>
<h2>Main Changes</h2>
<ul>
<li>Fix routing requests without method</li>
<li>deps: body-parser@1.20.2
<ul>
<li>Fix strict json error message on Node.js 19+</li>
<li>deps: content-type@~1.0.5</li>
<li>deps: raw-body@2.5.2</li>
</ul>
</li>
</ul>
<h2>Other Changes</h2>
<ul>
<li>Use https: protocol instead of deprecated git: protocol by <a
href="https://github.com/vcsjones"><code>@​vcsjones</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5032">expressjs/express#5032</a></li>
<li>build: Node.js@16.18 and Node.js@18.12 by <a
href="https://github.com/abenhamdine"><code>@​abenhamdine</code></a> in
<a
href="https://redirect.github.com/expressjs/express/pull/5034">expressjs/express#5034</a></li>
<li>ci: update actions/checkout to v3 by <a
href="https://github.com/armujahid"><code>@​armujahid</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5027">expressjs/express#5027</a></li>
<li>test: remove unused function arguments in params by <a
href="https://github.com/raksbisht"><code>@​raksbisht</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5124">expressjs/express#5124</a></li>
<li>Remove unused originalIndex from acceptParams by <a
href="https://github.com/raksbisht"><code>@​raksbisht</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5119">expressjs/express#5119</a></li>
<li>Fixed typos by <a
href="https://github.com/raksbisht"><code>@​raksbisht</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5117">expressjs/express#5117</a></li>
<li>examples: remove unused params by <a
href="https://github.com/raksbisht"><code>@​raksbisht</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5113">expressjs/express#5113</a></li>
<li>fix: parameter str is not described in JSDoc by <a
href="https://github.com/raksbisht"><code>@​raksbisht</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5130">expressjs/express#5130</a></li>
<li>fix: typos in History.md by <a
href="https://github.com/raksbisht"><code>@​raksbisht</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5131">expressjs/express#5131</a></li>
<li>build : add Node.js@19.7 by <a
href="https://github.com/abenhamdine"><code>@​abenhamdine</code></a> in
<a
href="https://redirect.github.com/expressjs/express/pull/5028">expressjs/express#5028</a></li>
<li>test: remove unused function arguments in params by <a
href="https://github.com/raksbisht"><code>@​raksbisht</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5137">expressjs/express#5137</a></li>
<li>use random port in test so it won't fail on already listening by <a
href="https://github.com/rluvaton"><code>@​rluvaton</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5162">expressjs/express#5162</a></li>
<li>tests: use cb() instead of done() by <a
href="https://github.com/kristof-low"><code>@​kristof-low</code></a> in
<a
href="https://redirect.github.com/expressjs/express/pull/5233">expressjs/express#5233</a></li>
<li>examples: remove multipart example by <a
href="https://github.com/riddlew"><code>@​riddlew</code></a> in <a
href="https://redirect.github.com/expressjs/express/pull/5195">expressjs/express#5195</a></li>
<li>Update support Node.js@18 in the CI by <a
href="https://github.com/UlisesGascon"><code>@​UlisesGascon</code></a>
in <a
href="https://redirect.github.com/expressjs/express/pull/5490">expressjs/express#5490</a></li>
<li>Fix favicon-related bug in cookie-sessions example by <a
href="https://github.com/DmytroKondrashov"><code>@​DmytroKondrashov</code></a>
in <a
href="https://redirect.github.com/expressjs/express/pull/5414">expressjs/express#5414</a></li>
<li>Release 4.18.3 by <a
href="https://github.com/UlisesGascon"><code>@​UlisesGascon</code></a>
in <a
href="https://redirect.github.com/expressjs/express/pull/5505">expressjs/express#5505</a></li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/vcsjones"><code>@​vcsjones</code></a>
made their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5032">expressjs/express#5032</a></li>
<li><a
href="https://github.com/abenhamdine"><code>@​abenhamdine</code></a>
made their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5034">expressjs/express#5034</a></li>
<li><a href="https://github.com/armujahid"><code>@​armujahid</code></a>
made their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5027">expressjs/express#5027</a></li>
<li><a href="https://github.com/raksbisht"><code>@​raksbisht</code></a>
made their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5124">expressjs/express#5124</a></li>
<li><a href="https://github.com/rluvaton"><code>@​rluvaton</code></a>
made their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5162">expressjs/express#5162</a></li>
<li><a
href="https://github.com/kristof-low"><code>@​kristof-low</code></a>
made their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5233">expressjs/express#5233</a></li>
<li><a href="https://github.com/riddlew"><code>@​riddlew</code></a> made
their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5195">expressjs/express#5195</a></li>
<li><a
href="https://github.com/DmytroKondrashov"><code>@​DmytroKondrashov</code></a>
made their first contribution in <a
href="https://redirect.github.com/expressjs/express/pull/5414">expressjs/express#5414</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/expressjs/express/compare/4.18.2...4.18.3">https://github.com/expressjs/express/compare/4.18.2...4.18.3</a></p>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/expressjs/express/blob/master/History.md">express's
changelog</a>.</em></p>
<blockquote>
<h1>4.18.3 / 2024-02-26</h1>
<ul>
<li>Fix routing requests without method</li>
<li>deps: body-parser@1.20.2
<ul>
<li>Fix strict json error message on Node.js 19+</li>
<li>deps: content-type@~1.0.5</li>
<li>deps: raw-body@2.5.2</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="1b51edac7c"><code>1b51eda</code></a>
4.18.3</li>
<li><a
href="b625132864"><code>b625132</code></a>
build: pin Node 21.x to minor</li>
<li><a
href="e3eca80584"><code>e3eca80</code></a>
build: pin Node 21.x to minor</li>
<li><a
href="23b44b3ddd"><code>23b44b3</code></a>
build: support Node.js 21.6.2</li>
<li><a
href="b9fea12245"><code>b9fea12</code></a>
build: support Node.js 21.x in appveyor</li>
<li><a
href="c259c3407f"><code>c259c34</code></a>
build: support Node.js 21.x</li>
<li><a
href="fdeb1d3176"><code>fdeb1d3</code></a>
build: support Node.js 20.x in appveyor</li>
<li><a
href="734b281900"><code>734b281</code></a>
build: support Node.js 20.x</li>
<li><a
href="0e3ab6ec21"><code>0e3ab6e</code></a>
examples: improve view count in cookie-sessions</li>
<li><a
href="59af63ac2e"><code>59af63a</code></a>
build: Node.js@18.19</li>
<li>Additional commits viewable in <a
href="https://github.com/expressjs/express/compare/4.18.2...4.18.3">compare
view</a></li>
</ul>
</details>
<details>
<summary>Maintainer changes</summary>
<p>This version was pushed to npm by <a
href="https://www.npmjs.com/~ulisesgascon">ulisesgascon</a>, a new
releaser for express since your current version.</p>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=express&package-manager=npm_and_yarn&previous-version=4.18.2&new-version=4.18.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 20:05:12 +01:00
dependabot[bot]
2f2d84bb5c Bump electron from 29.0.1 to 29.1.0 (#3390)
Bumps [electron](https://github.com/electron/electron) from 29.0.1 to
29.1.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/electron/electron/releases">electron's
releases</a>.</em></p>
<blockquote>
<h2>electron v29.1.0</h2>
<h1>Release Notes for v29.1.0</h1>
<h2>Features</h2>
<ul>
<li>Added proxy configuring support for requests made with net module
from utility process. <a
href="https://redirect.github.com/electron/electron/pull/41416">#41416</a>
<!-- raw HTML omitted -->(Also in <a
href="https://redirect.github.com/electron/electron/pull/41417">30</a>)<!--
raw HTML omitted --></li>
</ul>
<h2>Fixes</h2>
<ul>
<li>Ensured ScreenCaptureKit is used exclusively on macOS 14.4 and
higher to avoid permission prompts. <a
href="https://redirect.github.com/electron/electron/pull/41403">#41403</a>
<!-- raw HTML omitted -->(Also in <a
href="https://redirect.github.com/electron/electron/pull/41404">30</a>)<!--
raw HTML omitted --></li>
</ul>
<h2>Other Changes</h2>
<ul>
<li>Updated Chromium to 122.0.6261.70. <a
href="https://redirect.github.com/electron/electron/pull/41446">#41446</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="2d9c5a62c6"><code>2d9c5a6</code></a>
chore: bump chromium to 122.0.6261.70 (29-x-y) (<a
href="https://redirect.github.com/electron/electron/issues/41446">#41446</a>)</li>
<li><a
href="23f690ffd0"><code>23f690f</code></a>
chore: bump chromium to 122.0.6261.69 (29-x-y) (<a
href="https://redirect.github.com/electron/electron/issues/41425">#41425</a>)</li>
<li><a
href="8f4e94694e"><code>8f4e946</code></a>
chore: fix import from patches.py in script/lib/git.py (<a
href="https://redirect.github.com/electron/electron/issues/41437">#41437</a>)</li>
<li><a
href="af47434dc8"><code>af47434</code></a>
feat: add support for configuring system network context proxies (<a
href="https://redirect.github.com/electron/electron/issues/41416">#41416</a>)</li>
<li><a
href="8ab99e2d8e"><code>8ab99e2</code></a>
refactor: prefer using <code>base::NoDestructor</code> to
`base::{Singleton,LazyInstance...</li>
<li><a
href="ffcccdcf37"><code>ffcccdc</code></a>
perf: omit unnecessary work from
`ElectronRenderFrameObserver::ShouldNotifyCl...</li>
<li><a
href="ce2ac1c0c2"><code>ce2ac1c</code></a>
fix: use ScreenCaptureKit exclusively on macOS 14.4 and higher (<a
href="https://redirect.github.com/electron/electron/issues/41403">#41403</a>)</li>
<li><a
href="1c3feddef8"><code>1c3fedd</code></a>
docs: update breaking changes language (<a
href="https://redirect.github.com/electron/electron/issues/41398">#41398</a>)</li>
<li>See full diff in <a
href="https://github.com/electron/electron/compare/v29.0.1...v29.1.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=electron&package-manager=npm_and_yarn&previous-version=29.0.1&new-version=29.1.0)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 20:04:56 +01:00
dependabot[bot]
313531d623 Bump @stylistic/eslint-plugin from 1.6.2 to 1.6.3 (#3391)
Bumps
[@stylistic/eslint-plugin](https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin)
from 1.6.2 to 1.6.3.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/eslint-stylistic/eslint-stylistic/releases"><code>@​stylistic/eslint-plugin</code>'s
releases</a>.</em></p>
<blockquote>
<h2>v1.6.3</h2>
<h3>   🐞 Bug Fixes</h3>
<ul>
<li>Type error on <code>UnprefixedRuleOptions</code>  -  by <a
href="https://github.com/JstnMcBrd"><code>@​JstnMcBrd</code></a> in <a
href="https://redirect.github.com/eslint-stylistic/eslint-stylistic/issues/284">eslint-stylistic/eslint-stylistic#284</a>
<a
href="https://github.com/eslint-stylistic/eslint-stylistic/commit/f7bc3a9"><!--
raw HTML omitted -->(f7bc3)<!-- raw HTML omitted --></a></li>
</ul>
<h5>    <a
href="https://github.com/eslint-stylistic/eslint-stylistic/compare/v1.6.2...v1.6.3">View
changes on GitHub</a></h5>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="413d1bba7d"><code>413d1bb</code></a>
chore: release v1.6.3</li>
<li><a
href="f7bc3a9817"><code>f7bc3a9</code></a>
fix: type error on <code>UnprefixedRuleOptions</code> (<a
href="https://github.com/eslint-stylistic/eslint-stylistic/tree/HEAD/packages/eslint-plugin/issues/284">#284</a>)</li>
<li>See full diff in <a
href="https://github.com/eslint-stylistic/eslint-stylistic/commits/v1.6.3/packages/eslint-plugin">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=@stylistic/eslint-plugin&package-manager=npm_and_yarn&previous-version=1.6.2&new-version=1.6.3)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-03-01 20:04:42 +01:00
Karsten Hassel
73140cdf37 update electron to v29 and other deps (#3386) 2024-02-24 13:04:43 +01:00
sam detweiler
08f8a5107a add error message if config.js appears empty after loading w require() in app.js (#3383)
from forum,
https://forum.magicmirror.builders/topic/18493/node_helper-js-is-not-working
user created own config.js, did not copy the module exports line..

this caused the js/defaults.js list of modules to be processed for
node_helpers
but the physical config.js to be loaded for the web page (hard coded in
index.html)

so user modules needing node_helper didn't have that ..

this adds a warning message in npm start output to help user resolve..
took two days to debug without message
2024-02-13 08:02:02 +01:00
dependabot[bot]
88a96fb529 Bump husky from 9.0.7 to 9.0.10 (#3379)
Bumps [husky](https://github.com/typicode/husky) from 9.0.7 to 9.0.10.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/typicode/husky/releases">husky's
releases</a>.</em></p>
<blockquote>
<h2>v9.0.10</h2>
<ul>
<li>fix: rename index.d.ts to index.d.mts by <a
href="https://github.com/mrkjdy"><code>@​mrkjdy</code></a> in <a
href="https://redirect.github.com/typicode/husky/pull/1379">typicode/husky#1379</a></li>
</ul>
<h2>v9.0.9</h2>
<ul>
<li>refactor: rename files by <a
href="https://github.com/typicode"><code>@​typicode</code></a> in <a
href="https://redirect.github.com/typicode/husky/pull/1378">typicode/husky#1378</a></li>
</ul>
<h2>v9.0.8</h2>
<ul>
<li>docs: update index.md by <a
href="https://github.com/khaledYS"><code>@​khaledYS</code></a> in <a
href="https://redirect.github.com/typicode/husky/pull/1369">typicode/husky#1369</a></li>
<li>Fix tab detection on install command by <a
href="https://github.com/glensc"><code>@​glensc</code></a> in <a
href="https://redirect.github.com/typicode/husky/pull/1376">typicode/husky#1376</a></li>
<li>refactor: reduce file size by <a
href="https://github.com/typicode"><code>@​typicode</code></a> in <a
href="https://redirect.github.com/typicode/husky/pull/1377">typicode/husky#1377</a></li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="c042d9b4d4"><code>c042d9b</code></a>
9.0.10</li>
<li><a
href="e5293680b9"><code>e529368</code></a>
fix: rename index.d.ts to index.d.mts (<a
href="https://redirect.github.com/typicode/husky/issues/1379">#1379</a>)</li>
<li><a
href="6219cac421"><code>6219cac</code></a>
9.0.9</li>
<li><a
href="d8377feddc"><code>d8377fe</code></a>
refactor: rename files (<a
href="https://redirect.github.com/typicode/husky/issues/1378">#1378</a>)</li>
<li><a
href="211b80ada3"><code>211b80a</code></a>
9.0.8</li>
<li><a
href="a5a45fc3ce"><code>a5a45fc</code></a>
refactor: reduce file size (<a
href="https://redirect.github.com/typicode/husky/issues/1377">#1377</a>)</li>
<li><a
href="d09132834b"><code>d091328</code></a>
fix: tab detection on install command (<a
href="https://redirect.github.com/typicode/husky/issues/1376">#1376</a>)</li>
<li><a
href="798f1ad7b5"><code>798f1ad</code></a>
docs: update list</li>
<li><a
href="b98985d411"><code>b98985d</code></a>
test: expect init to exit with 0</li>
<li><a
href="3e1365614b"><code>3e13656</code></a>
docs: fix links</li>
<li>Additional commits viewable in <a
href="https://github.com/typicode/husky/compare/v9.0.7...v9.0.10">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=husky&package-manager=npm_and_yarn&previous-version=9.0.7&new-version=9.0.10)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 20:40:12 +01:00
Veeck
db65cd60eb Bundle all Dependabot updates (#3378)
and also node-ical

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-02-01 18:57:18 +01:00
illimarkangur
5fb5ef6cc7 Improved, fixed and added translations for estonian (#3371)
Improved wording, fixed grammatical errors and added new translations to
the et.json file.

---------

Co-authored-by: Veeck <github@veeck.de>
2024-02-01 12:16:55 +01:00
Ross Younger
57de389e01 [cosmetic] Weather module humidity positioning (#3330)
This PR adds an option to tweak the layout of the weather module. When
set, the humidity appears alongside the temperature:

![Screenshot from 2024-01-03
11-56-55](https://github.com/MagicMirrorOrg/MagicMirror/assets/551990/2a9fdf9a-21e4-49f5-8a48-68ea21902592)
2024-01-29 07:45:49 +01:00
Kristjan ESPERANTO
431bf22adb Update husky and let lint-staged fix ESLint issues (#3370)
The new version of husky makes it possible to simplify the pre-commit
hook a little.

And since prettier no longer takes care of the JavaScript files in our
project, it can no longer come into conflict with ESLint while running
lint-staged. Therefore we can activate the correction of ESLint issues
here.
2024-01-28 23:15:18 +01:00
Veeck
3bf848075d Correct apibase of weathergov weatherprovider to match documentation (#2927)
Fixes part of #2926
2024-01-27 22:31:50 +01:00
Veeck
fb5fab8145 Cleanups (#3369)
- Remove useless css class in clock
- Fix typo in calendar
- Changelog also got a little screwed after last merge
- updated dependencies
2024-01-27 21:11:57 +01:00
jkriegshauser
7f0b8e4054 Better fixes for #3291 and the underlying exdate issues (#3342)
* Worked around several issues in the RRULE library that were causing
deleted calender events to still show, some initial and recurring events
to not show, and some event times to be off an hour. (#3291)
* Renamed variables in *calendarfetcherutils.js* to be more clear about
use of `moment` and js's `Date` class.
* Added calendar config option `forceUseCurrentTime` (default:`false`)
which will ignore overridden `Date.now` in the config in order to keep
some tests consistent.
* Added several unit tests for crossing DST in different timezones with
excluded events.
2024-01-27 07:56:54 +01:00
Karsten Hassel
27f3c86c41 remove all useless header comments (#3363)
see #3358

used command: `find ./ -type f -exec perl -i -0pe
's/\/\*\s*magicmirror.*?\*\/\s*//si' {} \;`

This is a first draft, I think we should preserve some of the comments.
2024-01-24 21:39:06 +01:00
Kristjan ESPERANTO
b0161fe011 Lint package.json files (#3368)
Notable changes in this context:

- simplification of the ESLint calls - there is no longer a combination
of two file/directory lists (one in `package.json` and one in
`.eslintignore`)
- removal of a non-existent path from the `.eslintignore`
- use shorthand declaration for GitHub repository

Normally the new plugin would also sort the scripts in the package.json
alphabetically, but I think the current order is fine, so I deactivated
it.

Is it overkill to introduce a linter plugin just for the `package.json`
files?

In other projects I have seen that such internal changes were marked
with "chore" in the changelog. That's what I've done here. These chore
changes are less interesting for "normal" users.

Please feel free to give me feedback.
2024-01-24 20:43:59 +01:00
dependabot[bot]
f88b92fb1f Bump follow-redirects from 1.15.3 to 1.15.5 (#3367)
Bumps
[follow-redirects](https://github.com/follow-redirects/follow-redirects)
from 1.15.3 to 1.15.5.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b1677ce001"><code>b1677ce</code></a>
Release version 1.15.5 of the npm package.</li>
<li><a
href="d8914f7982"><code>d8914f7</code></a>
Preserve fragment in responseUrl.</li>
<li><a
href="65858205e5"><code>6585820</code></a>
Release version 1.15.4 of the npm package.</li>
<li><a
href="7a6567e16d"><code>7a6567e</code></a>
Disallow bracketed hostnames.</li>
<li><a
href="05629af696"><code>05629af</code></a>
Prefer native URL instead of deprecated url.parse.</li>
<li><a
href="1cba8e85fa"><code>1cba8e8</code></a>
Prefer native URL instead of legacy url.resolve.</li>
<li><a
href="72bc2a4229"><code>72bc2a4</code></a>
Simplify _processResponse error handling.</li>
<li><a
href="3d42aecdca"><code>3d42aec</code></a>
Add bracket tests.</li>
<li><a
href="bcbb096b32"><code>bcbb096</code></a>
Do not directly set Error properties.</li>
<li>See full diff in <a
href="https://github.com/follow-redirects/follow-redirects/compare/v1.15.3...v1.15.5">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.15.3&new-version=1.15.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/MagicMirrorOrg/MagicMirror/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-22 20:54:29 +01:00
dependabot[bot]
339aaf4c01 Bump actions/dependency-review-action from 3 to 4 (#3366)
Bumps
[actions/dependency-review-action](https://github.com/actions/dependency-review-action)
from 3 to 4.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/actions/dependency-review-action/releases">actions/dependency-review-action's
releases</a>.</em></p>
<blockquote>
<h2>v4.0.0</h2>
<ul>
<li>Update action to Node 20 by <a
href="https://github.com/takost"><code>@​takost</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/639">actions/dependency-review-action#639</a></li>
<li>Dependabot updates, see the full changelog for more details.</li>
</ul>
<h2>New Contributors</h2>
<ul>
<li><a href="https://github.com/takost"><code>@​takost</code></a> made
their first contribution in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/639">actions/dependency-review-action#639</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/dependency-review-action/compare/v3.1.5...v4.0.0">https://github.com/actions/dependency-review-action/compare/v3.1.5...v4.0.0</a></p>
<h2>3.1.5</h2>
<h2>What's Changed</h2>
<ul>
<li>Smaller <code>per_page</code> when requesting diff by <a
href="https://github.com/hmaurer"><code>@​hmaurer</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/649">actions/dependency-review-action#649</a></li>
<li>Update dependencies:
<ul>
<li>Bump <code>@​typescript-eslint/parser</code> from 6.10.0 to 6.13.1
by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>
in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/630">actions/dependency-review-action#630</a></li>
<li>Bump prettier from 3.0.3 to 3.1.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/629">actions/dependency-review-action#629</a></li>
<li>Bump <code>@​types/jest</code> from 29.5.8 to 29.5.11 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/637">actions/dependency-review-action#637</a></li>
<li>Bump nodemon from 3.0.1 to 3.0.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/636">actions/dependency-review-action#636</a></li>
<li>Replace pip -&gt; pypi in PURL examples by <a
href="https://github.com/febuiles"><code>@​febuiles</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/638">actions/dependency-review-action#638</a></li>
<li>Bump <code>@​typescript-eslint/eslint-plugin</code> from 6.12.0 to
6.15.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/644">actions/dependency-review-action#644</a></li>
<li>Bump eslint from 8.53.0 to 8.56.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/640">actions/dependency-review-action#640</a></li>
<li>Bump <code>@​typescript-eslint/parser</code> from 6.13.1 to 6.16.0
by <a href="https://github.com/dependabot"><code>@​dependabot</code></a>
in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/645">actions/dependency-review-action#645</a></li>
<li>Bump prettier from 3.1.0 to 3.1.1 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/646">actions/dependency-review-action#646</a></li>
</ul>
</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/dependency-review-action/compare/v3.1.4...v3.1.5">https://github.com/actions/dependency-review-action/compare/v3.1.4...v3.1.5</a></p>
<h2>3.1.4</h2>
<h2>What's Changed</h2>
<ul>
<li>
<p>Fixed a <a
href="https://redirect.github.com/actions/dependency-review-action/issues/618">bug</a>
with severity filtering when using the <code>allow_ghsas</code> option:
<a
href="https://redirect.github.com/actions/dependency-review-action/pull/623">actions/dependency-review-action#623</a>.</p>
</li>
<li>
<p>Updates dependencies:</p>
<ul>
<li>Bump <code>@​types/node</code> from 16.18.61 to 16.18.62 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/619">actions/dependency-review-action#619</a>
action/pull/620</li>
<li>Bump <code>@​typescript-eslint/eslint-plugin</code> from 6.11.0 to
6.12.0 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/625">actions/dependency-review-action#625</a></li>
<li>Bump typescript from 5.2.2 to 5.3.2 by <a
href="https://github.com/dependabot"><code>@​dependabot</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/624">actions/dependency-review-action#624</a></li>
</ul>
</li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/dependency-review-action/compare/v3...v3.1.4">https://github.com/actions/dependency-review-action/compare/v3...v3.1.4</a></p>
<h2>3.1.3</h2>
<h2>What's Changed</h2>
<ul>
<li>Fixes purl &quot;version must be percent-encoded&quot; by <a
href="https://github.com/theztefan"><code>@​theztefan</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/617">actions/dependency-review-action#617</a></li>
</ul>
<p><strong>Full Changelog</strong>: <a
href="https://github.com/actions/dependency-review-action/compare/v3...v3.1.3">https://github.com/actions/dependency-review-action/compare/v3...v3.1.3</a></p>
<h2>3.1.2</h2>
<h2>What's Changed</h2>
<ul>
<li>Fix a regression for setups using self-hosted runners behind HTTP
proxies:<a
href="https://github.com/febuiles"><code>@​febuiles</code></a> in <a
href="https://redirect.github.com/actions/dependency-review-action/pull/611">actions/dependency-review-action#611</a></li>
</ul>
<!-- raw HTML omitted -->
</blockquote>
<p>... (truncated)</p>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="4cd9eb2d23"><code>4cd9eb2</code></a>
Updating docs to point to v4.</li>
<li><a
href="4901385134"><code>4901385</code></a>
bump to 4.0.0</li>
<li><a
href="dbf82a4a5e"><code>dbf82a4</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/dependency-review-action/issues/639">#639</a>
from takost/takost/update-to-node-20</li>
<li><a
href="78aeb2a948"><code>78aeb2a</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/dependency-review-action/issues/663">#663</a>
from actions/dependabot/npm_and_yarn/typescript-eslin...</li>
<li><a
href="4e510006f5"><code>4e51000</code></a>
Bump <code>@​typescript-eslint/parser</code> from 6.18.0 to 6.18.1</li>
<li><a
href="9560737c5e"><code>9560737</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/dependency-review-action/issues/661">#661</a>
from actions/dependabot/npm_and_yarn/typescript-eslin...</li>
<li><a
href="4125f47f7e"><code>4125f47</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/dependency-review-action/issues/660">#660</a>
from actions/dependabot/npm_and_yarn/types/node-16.18.70</li>
<li><a
href="07cc93e0c8"><code>07cc93e</code></a>
Bump <code>@​typescript-eslint/eslint-plugin</code> from 6.18.0 to
6.18.1</li>
<li><a
href="e2c203b8b7"><code>e2c203b</code></a>
Bump <code>@​types/node</code> from 16.18.62 to 16.18.70</li>
<li><a
href="f0b304d0bc"><code>f0b304d</code></a>
Merge pull request <a
href="https://redirect.github.com/actions/dependency-review-action/issues/653">#653</a>
from actions/dependabot/npm_and_yarn/got-14.0.0</li>
<li>Additional commits viewable in <a
href="https://github.com/actions/dependency-review-action/compare/v3...v4">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=actions/dependency-review-action&package-manager=github_actions&previous-version=3&new-version=4)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-22 19:04:32 +01:00
Bugsounet - Cédric
c75b7d4a70 pm2 update ;) (#3364)
`pm2` just updated to v5.3.1 with `0 vulnerabilities`

let's delete `allow-ghsas` in depsreview and update dependencies
2024-01-20 22:55:01 +01:00
Bugsounet - Cédric
c96ced9137 updatenotification: update_helper.js recode with pm2 library (v2.27.x) (#3332)
#3285

Because there is so many conflit with package,
I have rewrite the code with v2.27.0-develop

For remember:

 * recode: `update_helper.js` with `pm2` library
 * fix: default config -> `updates` is a array
 * delete: `command-exists` library (not used)
 * delete: `PM2_GetList()`  function (not used)
 * add: check `updates.length` (prevent crash)
 * add: `[PM2]` tag in log (for better visibility)
 * add: `pm2` library
 
advantage:
  * we use the pm2 library directly
* avoids weird returns from child_process.exec when requesting a json
format from pm2
  * simplified the code

inconvenient:
  * we have vulnerabilities with axios

240120 Fix:
* use `pm2_env.pm_cwd` instead of `pm2_env.PWD` : prevent using `pm2
restart <id> --update-env` in other directory (for enable GPU rendering
for exemple)
 * resolve packages (again)
2024-01-20 17:38:22 +01:00
dependabot[bot]
995b61b689 Bump follow-redirects from 1.15.3 to 1.15.5 (#3356)
Bumps
[follow-redirects](https://github.com/follow-redirects/follow-redirects)
from 1.15.3 to 1.15.5.
<details>
<summary>Commits</summary>
<ul>
<li><a
href="b1677ce001"><code>b1677ce</code></a>
Release version 1.15.5 of the npm package.</li>
<li><a
href="d8914f7982"><code>d8914f7</code></a>
Preserve fragment in responseUrl.</li>
<li><a
href="65858205e5"><code>6585820</code></a>
Release version 1.15.4 of the npm package.</li>
<li><a
href="7a6567e16d"><code>7a6567e</code></a>
Disallow bracketed hostnames.</li>
<li><a
href="05629af696"><code>05629af</code></a>
Prefer native URL instead of deprecated url.parse.</li>
<li><a
href="1cba8e85fa"><code>1cba8e8</code></a>
Prefer native URL instead of legacy url.resolve.</li>
<li><a
href="72bc2a4229"><code>72bc2a4</code></a>
Simplify _processResponse error handling.</li>
<li><a
href="3d42aecdca"><code>3d42aec</code></a>
Add bracket tests.</li>
<li><a
href="bcbb096b32"><code>bcbb096</code></a>
Do not directly set Error properties.</li>
<li>See full diff in <a
href="https://github.com/follow-redirects/follow-redirects/compare/v1.15.3...v1.15.5">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=follow-redirects&package-manager=npm_and_yarn&previous-version=1.15.3&new-version=1.15.5)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
You can disable automated security fix PRs for this repo from the
[Security Alerts
page](https://github.com/MagicMirrorOrg/MagicMirror/network/alerts).

</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-20 17:35:49 +01:00
Karsten Hassel
c09338ab80 changed log.debug to log.log in app.js (#3362)
where logLevel is not set because config is not loaded at this time, see
#3353
2024-01-18 19:18:58 +01:00
Ross Younger
b005a8f30e [newsfeed] Fix bug where the newsfeed sometimes stops (#3361)
It appears that #3336 introduced a bug where a newsfeed with >1 items
would stop updating after a while (usually after `activeItem` wraps
around the end of the list). Sorry! My bad, I hadn't tested that case
well enough.
2024-01-18 12:05:26 +01:00
Kristjan ESPERANTO
35e4dfb3fe Ignore all custom css files (#3359)
For experimenting, I sometimes work with different CSS files. I can
imagine that others do this too.

This setting for the css folder corresponds to the setting we already
have for the config folder.
2024-01-16 23:16:47 +01:00
Kristjan ESPERANTO
6dbacbb773 Rework logging colors (#3350)
- Replacing old package `colors` by drop-in replacement `ansis`
- Rework `console-stamp` config to show all Log outputs in same color
(errors = red, warnings = yellow, debug = blue background (only for the
label), info = blue)
- This also fixes `npm run config:check` (broken since
6097547c10)

Feel free to let me know if the PR is too big and you want me to do
individual PRs for the changes.

Before:

![before](https://github.com/MagicMirrorOrg/MagicMirror/assets/35647502/88e48ec3-102c-40f3-9e9b-5d14fe446a43)

After:

![after](https://github.com/MagicMirrorOrg/MagicMirror/assets/35647502/4c8c4bad-08c9-46a3-92c9-14b996c13a7d)

---------

Co-authored-by: Veeck <github@veeck.de>
2024-01-16 21:54:55 +01:00
Karsten Hassel
098757f248 update dependencies including electron to v28 (#3357) 2024-01-16 21:45:04 +01:00
Kristjan ESPERANTO
58bc14e8c0 Request only required information instead of all (#3338)
Hopefully this solves the problem with arm64 (reported in PR #3337).
2024-01-14 09:15:30 +01:00
Karsten Hassel
f890f14df7 ignore strange errors from systeminformation under aarch64 (#3349)
by excluding them from global error handling, see discussions in
https://github.com/MagicMirrorOrg/MagicMirror/pull/3337
2024-01-14 09:13:01 +01:00
Ross Younger
dadc7ba0a2 [newsfeed] Suppress unsightly animation edge cases when there are 0 or 1 active news items (#3336)
When the newsfeed module has an items list of size 1, every
`updateInterval` the animation runs to transition from the active story
to itself. This is unsightly. This PR suppresses that.

To reproduce: configure newsfeed with a single news source,
`ignoreOldItems` true, a short `updateInterval` (e.g. 3000), and a
carefully-chosen small `ignoreOlderThan` lining up with the current
contents of your news source.
2024-01-14 09:12:32 +01:00
Kristjan ESPERANTO
b47600e0d8 Remove lodash (#3339)
Removing lodash dependency by replacing merge by spread operator.

I have also split the return into two variables to make it easier to
understand what is happening.
2024-01-08 20:16:26 +01:00
Kristjan ESPERANTO
4bbd35fa6a Use node prefix for build-in modules (#3340)
It is basically a cosmetic thing, but has the following advantages:

1. Consistency with the official node documentation. The prefix is used
there.
2. It is easier to recognize the build-in modules.
2024-01-08 17:45:54 +01:00
Kristjan ESPERANTO
407072d12d Update system information (#3337)
- Add ELECTRON_ENABLE_GPU
- Remove docker version
- Differentiation between installed and used node version
- Highlight "Ready to go!" for server mode (Since we display system
information in the console, it is easy to overlook this important line.)

## Electron mode

### Before

```bash
[07.01.2024 16:37.30.591] [INFO]  System information:
 ### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
 ### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
 ### VERSIONS: electron: 27.2.0; node: 18.17.1; npm: 10.2.4; pm2: 5.3.0; docker: 20.10.24+dfsg1
 ### OTHER:    timeZone: Europe/Berlin
```

### After

```bash
[07.01.2024 16:39.04.736] [INFO]  System information:
### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
### VERSIONS: electron: 27.2.0; used node: 18.17.1; installed node: 21.1.0; npm: 10.2.4; pm2: 5.3.0
### OTHER:    timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined
```

## server mode

### Before

```bash
[07.01.2024 16:36.49.106] [LOG]   
Ready to go! Please point your browser to: http://localhost:8080
[07.01.2024 16:36.49.287] [INFO]  System information:
 ### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
 ### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
 ### VERSIONS: electron: undefined; node: 21.1.0; npm: 10.2.4; pm2: 5.3.0; docker: 20.10.24+dfsg1
 ### OTHER:    timeZone: Europe/Berlin
```

### After

```bash
[2024-01-07 16:33:53.804] [INFO]  
>>>   Ready to go! Please point your browser to: http://localhost:8080   <<< 
[2024-01-07 16:33:53.997] [INFO]  System information:
### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
### OS:       platform: linux; distro: Debian GNU/Linux; release: 12; arch: x64; kernel: 5.10.0-20-amd64
### VERSIONS: electron: undefined; used node: 21.1.0; installed node: 21.1.0; npm: 10.2.4; pm2: 5.3.0
### OTHER:    timeZone: Europe/Berlin; ELECTRON_ENABLE_GPU: undefined 
```
2024-01-07 17:28:17 +01:00
Kristjan ESPERANTO
6097547c10 Add systeminfo (#3331)
This is a first attempt to bring additional system information into the
console (see #3328). It's certainly not yet perfect, but with the PR we
have a better basis for discussion.

I tried to keep the output small so that we get as much information as
possible in screenshots.

This is how it looks on my development system.

```bash
[03.01.2024 00:50.19.226] [INFO] System information:
 ### SYSTEM:   manufacturer: Notebook; model: N650DU; raspberry: undefined; virtual: false
 ### OS:       platform: linux; distro: Debian GNU/Linux; release: 12
 ### VERSIONS: MagicMirror: 2.27.0-develop; electron: 27.2.0; kernel: 5.10.0-20-amd64; node: 21.1.0; npm: 10.2.4; pm2: 5.3.0; docker: 20.10.24+dfsg1
 ```
 
 Why is it still a draft:
- [x] I have doubts that utils.js is the right place for the function. What do you think?
=> Update: As long as there is no better idea, it stays there.
- [x] Instead of working through all wishes you expressed in the issue #3328, I only implemented what was easy to achieve. And wanted to hear what you think about this approach.
=> Update: Some added. Of course, more information could be added later, as soon as experience has been gained in productive use.
- [x] I don't quite like the introductory line ("The following lines provide information..."). Should I perhaps simply replace it with "System information:"?
=> Update: Changed to "System information:"
 
 [Here](https://github.com/sebhildebrandt/systeminformation#function-reference-and-os-support) you can see what information we could easily add with the systeminformation package.
 
 It would be interesting how the raspberry field is filled on a raspi system and with docker there should be another line, but I can't easily test that now.
2024-01-04 22:38:53 +01:00
dependabot[bot]
5f7b56e645 Bump eslint-plugin-jsdoc from 46.9.1 to 47.0.2 (#3315)
Bumps
[eslint-plugin-jsdoc](https://github.com/gajus/eslint-plugin-jsdoc) from
46.9.1 to 47.0.2.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/gajus/eslint-plugin-jsdoc/releases">eslint-plugin-jsdoc's
releases</a>.</em></p>
<blockquote>
<h2>v47.0.2</h2>
<h2><a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v47.0.1...v47.0.2">47.0.2</a>
(2024-01-01)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>TS:</strong> use flat config; fixes <a
href="https://redirect.github.com/gajus/eslint-plugin-jsdoc/issues/1130">#1130</a>
(<a
href="3677e43322">3677e43</a>)</li>
</ul>
<h2>v47.0.1</h2>
<h2><a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v47.0.0...v47.0.1">47.0.1</a>
(2023-12-31)</h2>
<h3>Bug Fixes</h3>
<ul>
<li><strong>TS:</strong> make configs explicit (<a
href="47f316160d">47f3161</a>)</li>
</ul>
<h2>v47.0.0</h2>
<h1><a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v46.10.1...v47.0.0">47.0.0</a>
(2023-12-31)</h1>
<h3>Features</h3>
<ul>
<li>expose TS types for index file; fixes <a
href="https://redirect.github.com/gajus/eslint-plugin-jsdoc/issues/1130">#1130</a>
(<a
href="dd9e71daa2">dd9e71d</a>)</li>
</ul>
<h3>BREAKING CHANGES</h3>
<ul>
<li>Adds types</li>
</ul>
<h2>v46.10.1</h2>
<h2><a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v46.10.0...v46.10.1">46.10.1</a>
(2023-12-30)</h2>
<h3>Bug Fixes</h3>
<ul>
<li>revert change to engines for now (<a
href="5e6280ffd4">5e6280f</a>)</li>
</ul>
<h2>v46.10.0</h2>
<h1><a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v46.9.1...v46.10.0">46.10.0</a>
(2023-12-30)</h1>
<h3>Features</h3>
<ul>
<li>support ESLint 9 (<a
href="eec9d9532b">eec9d95</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="3677e43322"><code>3677e43</code></a>
fix(TS): use flat config; fixes <a
href="https://redirect.github.com/gajus/eslint-plugin-jsdoc/issues/1130">#1130</a></li>
<li><a
href="5f61575951"><code>5f61575</code></a>
chore(lint): handle disable directives in config</li>
<li><a
href="47f316160d"><code>47f3161</code></a>
fix(TS): make configs explicit</li>
<li><a
href="dd9e71daa2"><code>dd9e71d</code></a>
feat: expose TS types for index file; fixes <a
href="https://redirect.github.com/gajus/eslint-plugin-jsdoc/issues/1130">#1130</a></li>
<li><a
href="eb3f4b47e1"><code>eb3f4b4</code></a>
chore(linting): add ignores properly and disable directives for now</li>
<li><a
href="5e6280ffd4"><code>5e6280f</code></a>
fix: revert change to engines for now</li>
<li><a
href="eec9d9532b"><code>eec9d95</code></a>
feat: support ESLint 9</li>
<li><a
href="5c4ccb9752"><code>5c4ccb9</code></a>
chore: update devDeps.</li>
<li>See full diff in <a
href="https://github.com/gajus/eslint-plugin-jsdoc/compare/v46.9.1...v47.0.2">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-jsdoc&package-manager=npm_and_yarn&previous-version=46.9.1&new-version=47.0.2)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 22:36:34 +01:00
Karsten Hassel
bcab8ebd26 skip changelog requirement when running tests for dependency updates (#3326)
solution for #3320
2024-01-01 22:14:05 +01:00
dependabot[bot]
ae1f9d0468 Bump moment-timezone from 0.5.43 to 0.5.44 in /vendor (#3317)
Bumps [moment-timezone](https://github.com/moment/moment-timezone) from
0.5.43 to 0.5.44.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/moment/moment-timezone/releases">moment-timezone's
releases</a>.</em></p>
<blockquote>
<h2>Release 0.5.44</h2>
<ul>
<li>Updated data to IANA TZDB <code>2023d</code>.</li>
<li>Fixed <code>.valueOf()</code> to return <code>NaN</code> for invalid
zoned objects (matching default <code>moment</code>) <a
href="https://redirect.github.com/moment/moment-timezone/pull/1082">#1082</a>.</li>
<li>Performance improvements:
<ul>
<li>Use binary search when looking up zone information <a
href="https://redirect.github.com/moment/moment-timezone/pull/720">#720</a>.</li>
<li>Avoid redundant checks in <code>tz.guess()</code>.</li>
<li>Avoid redundant <code>getZone()</code> calls in
<code>.tz()</code>.</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/moment/moment-timezone/blob/develop/changelog.md">moment-timezone's
changelog</a>.</em></p>
<blockquote>
<h3><code>0.5.44</code> <em>2023-12-29</em></h3>
<ul>
<li>Updated data to IANA TZDB <code>2023d</code>.</li>
<li>Fixed <code>.valueOf()</code> to return <code>NaN</code> for invalid
zoned objects (matching default <code>moment</code>) <a
href="https://redirect.github.com/moment/moment-timezone/pull/1082">#1082</a>.</li>
<li>Performance improvements:
<ul>
<li>Use binary search when looking up zone information <a
href="https://redirect.github.com/moment/moment-timezone/pull/720">#720</a>.</li>
<li>Avoid redundant checks in <code>tz.guess()</code>.</li>
<li>Avoid redundant <code>getZone()</code> calls in
<code>.tz()</code>.</li>
</ul>
</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="25f19b6190"><code>25f19b6</code></a>
Build moment-timezone 0.5.44</li>
<li><a
href="4734cb2515"><code>4734cb2</code></a>
Bump version to 0.5.44</li>
<li><a
href="585fabfcbd"><code>585fabf</code></a>
Merge pull request <a
href="https://redirect.github.com/moment/moment-timezone/issues/1085">#1085</a>
from moment/data/2023d</li>
<li><a
href="ece926a59f"><code>ece926a</code></a>
Add test for valueOf behaviour with invalid moments (<a
href="https://redirect.github.com/moment/moment-timezone/issues/1075">#1075</a>)</li>
<li><a
href="341beac0fb"><code>341beac</code></a>
Ensure valueOf returns NaN for invalid instances (<a
href="https://redirect.github.com/moment/moment-timezone/issues/1082">#1082</a>)</li>
<li><a
href="69d856d5aa"><code>69d856d</code></a>
data: Add 2023d</li>
<li><a
href="dc53e6cdec"><code>dc53e6c</code></a>
build(deps): bump <code>@​babel/traverse</code> (<a
href="https://redirect.github.com/moment/moment-timezone/issues/1076">#1076</a>)</li>
<li><a
href="dffed7a8a9"><code>dffed7a</code></a>
perf: Reduce unnecessary getZone() calls in moment.tz()</li>
<li><a
href="f7d8fc2d42"><code>f7d8fc2</code></a>
docs: Add note about maintenance mode in contributing guide</li>
<li><a
href="4b1419b51f"><code>4b1419b</code></a>
docs: Update contributing guide to reflect the latest data process</li>
<li>Additional commits viewable in <a
href="https://github.com/moment/moment-timezone/compare/0.5.43...0.5.44">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=moment-timezone&package-manager=npm_and_yarn&previous-version=0.5.43&new-version=0.5.44)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)

Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot show <dependency name> ignore conditions` will show all
of the ignore conditions of the specified dependency
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)


</details>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-01 22:03:25 +01:00
Kristjan ESPERANTO
367d02f1b6 Update URLs to MagicMirrorOrg (#3321) 2024-01-01 21:56:13 +01:00
Michael Teeuw
5e346e7c0a Start of 2.27.0 develop branch. 2024-01-01 15:43:38 +01:00
287 changed files with 35044 additions and 9998 deletions

View File

@@ -18,7 +18,7 @@ concurrency:
jobs:
code-style-check:
runs-on: ubuntu-latest
runs-on: ubuntu-slim
timeout-minutes: 15
steps:
- name: "Checkout code"
@@ -42,7 +42,7 @@ jobs:
timeout-minutes: 30
strategy:
matrix:
node-version: [22.21.1, 22.x, 24.x]
node-version: [22.x, 24.x, 25.x]
steps:
- name: Install electron dependencies and labwc
run: |
@@ -69,7 +69,7 @@ jobs:
sudo chmod 4755 ./node_modules/electron/dist/chrome-sandbox
# Start labwc
WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 WLR_RENDERER=pixman labwc &
touch css/custom.css
touch config/custom.css
- name: "Run tests"
run: |
export WAYLAND_DISPLAY=wayland-0

View File

@@ -10,7 +10,7 @@ permissions:
jobs:
dependency-review:
runs-on: ubuntu-latest
runs-on: ubuntu-slim
steps:
- name: "Checkout code"
uses: actions/checkout@v6

View File

@@ -5,10 +5,10 @@ on: [pull_request]
jobs:
rebuild:
name: Run electron-rebuild
runs-on: ubuntu-latest
runs-on: ubuntu-slim
strategy:
matrix:
node-version: [22.21.1, 22.x, 24.x]
node-version: [22.x, 24.x, 25.x]
steps:
- name: Checkout code
uses: actions/checkout@v6

View File

@@ -12,7 +12,7 @@ on:
jobs:
check:
runs-on: ubuntu-latest
runs-on: ubuntu-slim
if: github.event_name == 'pull_request'
timeout-minutes: 10
steps:

View File

@@ -15,7 +15,7 @@ concurrency:
jobs:
release-notes:
runs-on: ubuntu-latest
runs-on: ubuntu-slim
timeout-minutes: 15
steps:
- name: "Checkout code"

View File

@@ -12,7 +12,7 @@ permissions:
jobs:
spellcheck:
runs-on: ubuntu-latest
runs-on: ubuntu-slim
steps:
- name: Checkout code
uses: actions/checkout@v6

View File

@@ -10,7 +10,7 @@ permissions:
jobs:
stale:
runs-on: ubuntu-latest
runs-on: ubuntu-slim
steps:
- uses: actions/stale@v10
with:

13
.gitignore vendored
View File

@@ -54,20 +54,13 @@ Temporary Items
.directory
.Trash-*
# Ignore all modules except the default modules.
# Ignore all modules
/modules/*
!/modules/default
# Ignore changes to the custom css files but keep the sample and main.
/css/*
!/css/custom.css.sample
!/css/font-awesome.css
!/css/main.css
!/css/roboto.css
# Ignore users config file but keep the sample.
# Ignore users config file but keep the samples.
config
!config/config.js.sample
!config/custom.css.sample
# Vim
## swap

View File

@@ -46,6 +46,7 @@ Are done by
- [ ] add label `mastermerge`
- [ ] title of the PR is `Release 2.xx.0`
- [ ] description of the PR is the body of the draft release with name `v2.xx.0`
- [ ] check if new PR has merge conflicts, if so, merge `master` into the new PR and solve the conflicts
- [ ] after PR tests run without issues, merge PR
- [ ] edit draft release with name `v2.xx.0`
- [ ] set corresponding version tag `v2.xx.0` (with `Select tag` and then `Create new tag`)
@@ -61,11 +62,24 @@ Are done by
### After release
- [ ] publish release notes with link to github release on forum in new locked topic
- [ ] publish release notes with link to github release on forum in new locked topic (use edit release on github to copy the content with markdown syntax)
- [ ] close all issues with label `ready (coming with next release)`
- [ ] release new documentation by merging `develop` on `master` in documentation repository
- [ ] publish new version on [npm](https://www.npmjs.com/package/magicmirror)
- [ ] use a clean environment (e.g. container)
- [ ] clone this repository with the new `master` branch and `cd` into the local repository directory
- [ ] log in to npm with `npm login --auth-type legacy` which will ask for username and password and one-time-password which is sent via mail
- [ ] execute `npm publish`
- [ ] **Method 1 (recommended): With browser and 2FA**
- [ ] execute `npm login` which will open a browser window
- [ ] log in with your npm credentials and enter your 2FA code
- [ ] execute `npm publish`
- [ ] **Method 2 (fallback for headless environments): With token (bypasses 2FA)**
- [ ] ⚠️ Note: This method bypasses 2FA and should only be used when a browser is not available
- [ ] goto `https://www.npmjs.com/settings/<username>/tokens/` and click `generate new token`
- [ ] enable `Bypass two-factor authentication (2FA)` and under `Packages and scopes` give `Read and write` permission to the `magicmirror` package, press `Generate token`
- [ ] execute:
```bash
NPM_TOKEN="npm_xxxxxx"
npm set "//registry.npmjs.org/:_authToken=$NPM_TOKEN"
npm publish
```

View File

@@ -51,5 +51,10 @@ If we receive enough donations we might even be able to free up some working hou
To donate, please follow [this](https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=G5D8E9MR5DTD2&source=url) link.
<p style="text-align: center">
<a href="https://forum.magicmirror.builders/topic/728/magicmirror-is-voted-number-1-in-the-magpi-top-50"><img src="https://magicmirror.builders/img/magpi-best-watermark-custom.png" width="150" alt="MagPi Top 50"></a>
<a href="https://forum.magicmirror.builders/topic/728/magicmirror-is-voted-number-1-in-the-magpi-top-50">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://magicmirror.builders/img/magpi-best-watermark.png">
<img src="https://magicmirror.builders/img/magpi-best-watermark-custom.png" width="150" alt="MagPi Top 50">
</picture>
</a>
</p>

View File

@@ -1,136 +1,167 @@
"use strict";
// Use separate scope to prevent global scope pollution
(function () {
const http = require("node:http");
const https = require("node:https");
/**
* Get command line parameters
* Assumes that a cmdline parameter is defined with `--key [value]`
*
* example: `node clientonly --address localhost --port 8080 --use-tls`
* @param {string} key key to look for at the command line
* @param {string} defaultValue value if no key is given at the command line
* @returns {string} the value of the parameter
*/
function getCommandLineParameter (key, defaultValue = undefined) {
const index = process.argv.indexOf(`--${key}`);
const value = index > -1 ? process.argv[index + 1] : undefined;
return value !== undefined ? String(value) : defaultValue;
}
/**
* Helper function to get server address/hostname from either the commandline or env
* @returns {object} config object containing address, port, and tls properties
*/
function getServerParameters () {
const config = {};
/**
* Helper function to get server address/hostname from either the commandline or env
*/
function getServerAddress () {
// Prefer command line arguments over environment variables
config.address = getCommandLineParameter("address", process.env.ADDRESS);
const portValue = getCommandLineParameter("port", process.env.PORT);
config.port = portValue ? parseInt(portValue, 10) : undefined;
/**
* Get command line parameters
* Assumes that a cmdline parameter is defined with `--key [value]`
* @param {string} key key to look for at the command line
* @param {string} defaultValue value if no key is given at the command line
* @returns {string} the value of the parameter
*/
function getCommandLineParameter (key, defaultValue = undefined) {
const index = process.argv.indexOf(`--${key}`);
const value = index > -1 ? process.argv[index + 1] : undefined;
return value !== undefined ? String(value) : defaultValue;
}
// determine if "--use-tls"-flag was provided
config.tls = process.argv.includes("--use-tls");
// Prefer command line arguments over environment variables
["address", "port"].forEach((key) => {
config[key] = getCommandLineParameter(key, process.env[key.toUpperCase()]);
});
return config;
}
// determine if "--use-tls"-flag was provided
config.tls = process.argv.indexOf("--use-tls") > 0;
}
/**
* Gets the config from the specified server url
* @param {string} url location where the server is running.
* @returns {Promise} the config
*/
function getServerConfig (url) {
// Return new pending promise
return new Promise((resolve, reject) => {
// Select http or https module, depending on requested url
const lib = url.startsWith("https") ? https : http;
const request = lib.get(url, (response) => {
let configData = "";
/**
* Gets the config from the specified server url
* @param {string} url location where the server is running.
* @returns {Promise} the config
*/
function getServerConfig (url) {
// Return new pending promise
return new Promise((resolve, reject) => {
// Select http or https module, depending on requested url
const lib = url.startsWith("https") ? require("node:https") : require("node:http");
const request = lib.get(url, (response) => {
let configData = "";
// Gather incoming data
response.on("data", function (chunk) {
configData += chunk;
});
// Resolve promise at the end of the HTTP/HTTPS stream
response.on("end", function () {
// Gather incoming data
response.on("data", function (chunk) {
configData += chunk;
});
// Resolve promise at the end of the HTTP/HTTPS stream
response.on("end", function () {
try {
resolve(JSON.parse(configData));
});
});
request.on("error", function (error) {
reject(new Error(`Unable to read config from server (${url} (${error.message}`));
} catch (parseError) {
reject(new Error(`Failed to parse server response as JSON: ${parseError.message}`));
}
});
});
}
/**
* Print a message to the console in case of errors
* @param {string} message error message to print
* @param {number} code error code for the exit call
*/
function fail (message, code = 1) {
if (message !== undefined && typeof message === "string") {
console.log(message);
} else {
console.log("Usage: 'node clientonly --address 192.168.1.10 --port 8080 [--use-tls]'");
}
process.exit(code);
}
request.on("error", function (error) {
reject(new Error(`Unable to read config from server (${url}) (${error.message})`));
});
});
}
getServerAddress();
(config.address && config.port) || fail();
const prefix = config.tls ? "https://" : "http://";
// Only start the client if a non-local server was provided
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
getServerConfig(`${prefix}${config.address}:${config.port}/config/`)
.then(function (configReturn) {
// check environment for DISPLAY or WAYLAND_DISPLAY
const elecParams = ["js/electron.js"];
if (process.env.WAYLAND_DISPLAY) {
console.log(`Client: Using WAYLAND_DISPLAY=${process.env.WAYLAND_DISPLAY}`);
elecParams.push("--enable-features=UseOzonePlatform");
elecParams.push("--ozone-platform=wayland");
} else if (process.env.DISPLAY) {
console.log(`Client: Using DISPLAY=${process.env.DISPLAY}`);
} else {
fail("Error: Requires environment variable WAYLAND_DISPLAY or DISPLAY, none is provided.");
}
// Pass along the server config via an environment variable
const env = Object.create(process.env);
env.clientonly = true; // set to pass to electron.js
const options = { env: env };
configReturn.address = config.address;
configReturn.port = config.port;
configReturn.tls = config.tls;
env.config = JSON.stringify(configReturn);
// Spawn electron application
const electron = require("electron");
const child = require("node:child_process").spawn(electron, elecParams, options);
// Pipe all child process output to current stdout
child.stdout.on("data", function (buf) {
process.stdout.write(`Client: ${buf}`);
});
// Pipe all child process errors to current stderr
child.stderr.on("data", function (buf) {
process.stderr.write(`Client: ${buf}`);
});
child.on("error", function (err) {
process.stdout.write(`Client: ${err}`);
});
child.on("close", (code) => {
if (code !== 0) {
console.log(`There something wrong. The clientonly is not running code ${code}`);
}
});
})
.catch(function (reason) {
fail(`Unable to connect to server: (${reason})`);
});
/**
* Print a message to the console in case of errors
* @param {string} message error message to print
* @param {number} code error code for the exit call
*/
function fail (message, code = 1) {
if (message !== undefined && typeof message === "string") {
console.error(message);
} else {
fail();
console.error("Usage: 'node clientonly --address 192.168.1.10 --port 8080 [--use-tls]'");
}
}());
process.exit(code);
}
/**
* Starts the client by connecting to the server and launching the Electron application
* @param {object} config server configuration
* @param {string} prefix http or https prefix
* @async
*/
async function startClient (config, prefix) {
try {
const serverUrl = `${prefix}${config.address}:${config.port}/config/`;
console.log(`Client: Connecting to server at ${serverUrl}`);
const configReturn = await getServerConfig(serverUrl);
console.log("Client: Successfully retrieved config from server");
// check environment for DISPLAY or WAYLAND_DISPLAY
const elecParams = ["js/electron.js"];
if (process.env.WAYLAND_DISPLAY) {
console.log(`Client: Using WAYLAND_DISPLAY=${process.env.WAYLAND_DISPLAY}`);
elecParams.push("--enable-features=UseOzonePlatform");
elecParams.push("--ozone-platform=wayland");
} else if (process.env.DISPLAY) {
console.log(`Client: Using DISPLAY=${process.env.DISPLAY}`);
} else {
fail("Error: Requires environment variable WAYLAND_DISPLAY or DISPLAY, none is provided.");
}
// Pass along the server config via an environment variable
const env = { ...process.env };
env.clientonly = true;
const options = { env: env };
configReturn.address = config.address;
configReturn.port = config.port;
configReturn.tls = config.tls;
env.config = JSON.stringify(configReturn);
// Spawn electron application
const electron = require("electron");
const child = require("node:child_process").spawn(electron, elecParams, options);
// Pipe all child process output to current stdout
child.stdout.on("data", function (buf) {
process.stdout.write(`Client: ${buf}`);
});
// Pipe all child process errors to current stderr
child.stderr.on("data", function (buf) {
process.stderr.write(`Client: ${buf}`);
});
child.on("error", function (err) {
process.stderr.write(`Client: ${err}`);
});
child.on("close", (code) => {
if (code !== 0) {
fail(`There is something wrong. The clientonly process exited with code ${code}.`);
}
});
} catch (reason) {
fail(`Unable to connect to server: (${reason})`);
}
}
// Main execution
const config = getServerParameters();
const prefix = config.tls ? "https://" : "http://";
// Validate port
if (config.port !== undefined && (isNaN(config.port) || config.port < 1 || config.port > 65535)) {
fail(`Invalid port number: ${config.port}. Port must be between 1 and 65535.`);
}
// Only start the client if a non-local server was provided and address/port are set
const LOCAL_ADDRESSES = ["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1"];
if (
config.address
&& config.port
&& !LOCAL_ADDRESSES.includes(config.address)
) {
startClient(config, prefix);
} else {
fail();
}

View File

@@ -179,6 +179,7 @@
"Lightspeed",
"loadingcircle",
"locationforecast",
"logg",
"lockstring",
"lstrip",
"Luciella",
@@ -247,6 +248,7 @@
"Reis",
"rejas",
"relativehumidity",
"resultstring",
"Resig",
"roboto",
"rohitdharavath",
@@ -285,6 +287,9 @@
"Teeuw",
"Teil",
"TESTMODE",
"testpass",
"testuser",
"teststring",
"thomasrockhu",
"thumbslider",
"timeformat",
@@ -307,6 +312,7 @@
"VEVENT",
"vgtu",
"Vitest",
"VCALENDAR",
"Voelt",
"Vorberechnung",
"vppencilsharpener",
@@ -326,6 +332,7 @@
"winddirection",
"windgusts",
"windspeed",
"WKST",
"Woolridge",
"worktree",
"Wsymb",
@@ -343,11 +350,11 @@
"ignorePaths": [
"css/roboto.css",
"node_modules/**",
"modules/!(default)/**",
"modules/default/**/translations/!(en).json",
"modules/default/calendar/windowsZones.json",
"modules/default/clock/faces/*.svg",
"modules/default/weather/providers/yr.js",
"modules/**",
"defaultmodules/**/translations/!(en).json",
"defaultmodules/calendar/windowsZones.json",
"defaultmodules/clock/faces/*.svg",
"defaultmodules/weather/providers/yr.js",
"tests/mocks/**",
"tests/e2e/modules/clock_es_spec.js",
"translations/**"

View File

@@ -169,9 +169,7 @@ Module.register("calendar", {
notificationReceived (notification, payload, sender) {
if (notification === "FETCH_CALENDAR") {
if (this.hasCalendarURL(payload.url)) {
this.sendSocketNotification(notification, { url: payload.url, id: this.identifier });
}
this.sendSocketNotification(notification, { url: payload.url, id: this.identifier });
}
},
@@ -183,40 +181,38 @@ Module.register("calendar", {
}
if (notification === "CALENDAR_EVENTS") {
if (this.hasCalendarURL(payload.url)) {
// have we received events for this url
if (!this.calendarData[payload.url]) {
// no, setup the structure to hold the info
this.calendarData[payload.url] = { events: null, checksum: null };
}
// save the event list
this.calendarData[payload.url].events = payload.events;
// have we received events for this url
if (!this.calendarData[payload.url]) {
// no, setup the structure to hold the info
this.calendarData[payload.url] = { events: null, checksum: null };
}
// save the event list
this.calendarData[payload.url].events = payload.events;
this.error = null;
this.loaded = true;
this.error = null;
this.loaded = true;
if (this.config.broadcastEvents) {
this.broadcastEvents();
}
// if the checksum is the same
if (this.calendarData[payload.url].checksum === payload.checksum) {
// then don't update the UI
return;
}
// haven't seen or the checksum is different
this.calendarData[payload.url].checksum = payload.checksum;
if (this.config.broadcastEvents) {
this.broadcastEvents();
}
// if the checksum is the same
if (this.calendarData[payload.url].checksum === payload.checksum) {
// then don't update the UI
return;
}
// haven't seen or the checksum is different
this.calendarData[payload.url].checksum = payload.checksum;
if (!this.config.updateOnFetch) {
if (this.calendarDisplayer[payload.url] === undefined) {
// calendar will never displayed, so display it
this.updateDom(this.config.animationSpeed);
// set this calendar as displayed
this.calendarDisplayer[payload.url] = true;
} else {
Log.debug("[calendar] DOM not updated waiting self update()");
}
return;
if (!this.config.updateOnFetch) {
if (this.calendarDisplayer[payload.url] === undefined) {
// calendar will never displayed, so display it
this.updateDom(this.config.animationSpeed);
// set this calendar as displayed
this.calendarDisplayer[payload.url] = true;
} else {
Log.debug("[calendar] DOM not updated waiting self update()");
}
return;
}
} else if (notification === "CALENDAR_ERROR") {
let error_message = this.translate(payload.error_type);
@@ -580,21 +576,6 @@ Module.register("calendar", {
return wrapper;
},
/**
* Checks if this config contains the calendar url.
* @param {string} url The calendar url
* @returns {boolean} True if the calendar config contains the url, False otherwise
*/
hasCalendarURL (url) {
for (const calendar of this.config.calendars) {
if (calendar.url === url) {
return true;
}
}
return false;
},
/**
* converts the given timestamp to a moment with a timezone
* @param {number} timestamp timestamp from an event

View File

@@ -0,0 +1,129 @@
const ical = require("node-ical");
const Log = require("logger");
const { Agent } = require("undici");
const CalendarFetcherUtils = require("./calendarfetcherutils");
const HTTPFetcher = require("#http_fetcher");
/**
* CalendarFetcher - Fetches and parses iCal calendar data
* Uses HTTPFetcher for HTTP handling with intelligent error handling
* @class
*/
class CalendarFetcher {
/**
* Creates a new CalendarFetcher instance
* @param {string} url - The URL of the calendar to fetch
* @param {number} reloadInterval - Time in ms between fetches
* @param {string[]} excludedEvents - Event titles to exclude
* @param {number} maximumEntries - Maximum number of events to return
* @param {number} maximumNumberOfDays - Maximum days in the future to fetch
* @param {object} auth - Authentication options {method: 'basic'|'bearer', user, pass}
* @param {boolean} includePastEvents - Whether to include past events
* @param {boolean} selfSignedCert - Whether to accept self-signed certificates
*/
constructor (url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, includePastEvents, selfSignedCert) {
this.url = url;
this.excludedEvents = excludedEvents;
this.maximumEntries = maximumEntries;
this.maximumNumberOfDays = maximumNumberOfDays;
this.includePastEvents = includePastEvents;
this.events = [];
this.lastFetch = null;
this.fetchFailedCallback = () => {};
this.eventsReceivedCallback = () => {};
// Use HTTPFetcher for HTTP handling (Composition)
this.httpFetcher = new HTTPFetcher(url, {
reloadInterval,
auth,
selfSignedCert
});
// Wire up HTTPFetcher events
this.httpFetcher.on("response", (response) => this.#handleResponse(response));
this.httpFetcher.on("error", (errorInfo) => this.fetchFailedCallback(this, errorInfo));
}
/**
* Handles successful HTTP response
* @param {Response} response - The fetch Response object
*/
async #handleResponse (response) {
try {
const responseData = await response.text();
const parsed = ical.parseICS(responseData);
Log.debug(`Parsed iCal data from ${this.url} with ${Object.keys(parsed).length} entries.`);
this.events = CalendarFetcherUtils.filterEvents(parsed, {
excludedEvents: this.excludedEvents,
includePastEvents: this.includePastEvents,
maximumEntries: this.maximumEntries,
maximumNumberOfDays: this.maximumNumberOfDays
});
this.lastFetch = Date.now();
this.broadcastEvents();
} catch (error) {
Log.error(`${this.url} - iCal parsing failed: ${error.message}`);
this.fetchFailedCallback(this, {
message: `iCal parsing failed: ${error.message}`,
status: null,
errorType: "PARSE_ERROR",
translationKey: "MODULE_ERROR_UNSPECIFIED",
retryAfter: this.httpFetcher.reloadInterval,
retryCount: 0,
url: this.url,
originalError: error
});
}
}
/**
* Starts fetching calendar data
*/
fetchCalendar () {
this.httpFetcher.startPeriodicFetch();
}
/**
* Check if enough time has passed since the last fetch to warrant a new one.
* Uses reloadInterval as the threshold to respect user's configured fetchInterval.
* @returns {boolean} True if a new fetch should be performed
*/
shouldRefetch () {
if (!this.lastFetch) {
return true;
}
const timeSinceLastFetch = Date.now() - this.lastFetch;
return timeSinceLastFetch >= this.httpFetcher.reloadInterval;
}
/**
* Broadcasts the current events to listeners
*/
broadcastEvents () {
Log.info(`Broadcasting ${this.events.length} events from ${this.url}.`);
this.eventsReceivedCallback(this);
}
/**
* Sets the callback for successful event fetches
* @param {(fetcher: CalendarFetcher) => void} callback - Called when events are received
*/
onReceive (callback) {
this.eventsReceivedCallback = callback;
}
/**
* Sets the callback for fetch failures
* @param {(fetcher: CalendarFetcher, error: Error) => void} callback - Called when a fetch fails
*/
onError (callback) {
this.fetchFailedCallback = callback;
}
}
module.exports = CalendarFetcher;

View File

@@ -0,0 +1,276 @@
/**
* @external Moment
*/
const moment = require("moment-timezone");
const ical = require("node-ical");
const Log = require("logger");
const CalendarFetcherUtils = {
/**
* Determine based on the title of an event if it should be excluded from the list of events
* @param {object} config the global config
* @param {string} title the title of the event
* @returns {object} excluded: true if the event should be excluded, false otherwise
* until: the date until the event should be excluded.
*/
shouldEventBeExcluded (config, title) {
for (const filterConfig of config.excludedEvents) {
const match = CalendarFetcherUtils.checkEventAgainstFilter(title, filterConfig);
if (match) {
return {
excluded: !match.until,
until: match.until
};
}
}
return {
excluded: false,
until: null
};
},
/**
* Get local timezone.
* This method makes it easier to test if different timezones cause problems by changing this implementation.
* @returns {string} timezone
*/
getLocalTimezone () {
return moment.tz.guess();
},
/**
* Filter the events from ical according to the given config
* @param {object} data the calendar data from ical
* @param {object} config The configuration object
* @returns {object[]} the filtered events
*/
filterEvents (data, config) {
const newEvents = [];
Log.debug(`There are ${Object.entries(data).length} calendar entries.`);
const now = moment();
const pastLocalMoment = config.includePastEvents ? now.clone().startOf("day").subtract(config.maximumNumberOfDays, "days") : now;
const futureLocalMoment
= now
.clone()
.startOf("day")
.add(config.maximumNumberOfDays, "days")
// Subtract 1 second so that events that start on the middle of the night will not repeat.
.subtract(1, "seconds");
Object.entries(data).forEach(([key, event]) => {
if (event.type !== "VEVENT") {
return;
}
const title = CalendarFetcherUtils.getTitleFromEvent(event);
Log.debug(`title: ${title}`);
// Return quickly if event should be excluded.
const { excluded, until: eventFilterUntil } = CalendarFetcherUtils.shouldEventBeExcluded(config, title);
if (excluded) {
return;
}
Log.debug(`Event: ${title} | start: ${event.start} | end: ${event.end} | recurring: ${!!event.rrule}`);
const location = CalendarFetcherUtils.unwrapParameterValue(event.location) || false;
const geo = event.geo || false;
const description = CalendarFetcherUtils.unwrapParameterValue(event.description) || false;
let instances;
try {
instances = CalendarFetcherUtils.expandRecurringEvent(event, pastLocalMoment, futureLocalMoment);
} catch (error) {
Log.error(`Could not expand event "${title}": ${error.message}`);
return;
}
for (const instance of instances) {
const { event: instanceEvent, startMoment, endMoment, isRecurring, isFullDay } = instance;
// Filter logic
if (endMoment.isBefore(pastLocalMoment) || startMoment.isAfter(futureLocalMoment)) {
continue;
}
if (CalendarFetcherUtils.timeFilterApplies(now, endMoment, eventFilterUntil)) {
continue;
}
const instanceTitle = CalendarFetcherUtils.getTitleFromEvent(instanceEvent);
Log.debug(`saving event: ${instanceTitle}, start: ${startMoment.toDate()}, end: ${endMoment.toDate()}`);
newEvents.push({
title: instanceTitle,
startDate: startMoment.format("x"),
endDate: endMoment.format("x"),
fullDayEvent: isFullDay,
recurringEvent: isRecurring,
class: event.class,
firstYear: event.start.getFullYear(),
location: CalendarFetcherUtils.unwrapParameterValue(instanceEvent.location) || location,
geo: instanceEvent.geo || geo,
description: CalendarFetcherUtils.unwrapParameterValue(instanceEvent.description) || description
});
}
});
newEvents.sort(function (a, b) {
return a.startDate - b.startDate;
});
return newEvents;
},
/**
* Gets the title from the event.
* @param {object} event The event object to check.
* @returns {string} The title of the event, or "Event" if no title is found.
*/
getTitleFromEvent (event) {
return CalendarFetcherUtils.unwrapParameterValue(event.summary || event.description) || "Event";
},
/**
* Extracts the string value from a node-ical ParameterValue object ({val, params})
* or returns the value as-is if it is already a plain string.
* This handles ICS properties with parameters, e.g. DESCRIPTION;LANGUAGE=de:Text.
* @param {string|object} value The raw value from node-ical
* @returns {string|object} The unwrapped string value, or the original value if not a ParameterValue
*/
unwrapParameterValue (value) {
if (value && typeof value === "object" && typeof value.val !== "undefined") {
return value.val;
}
return value;
},
/**
* Determines if the user defined time filter should apply
* @param {moment.Moment} now Date object using previously created object for consistency
* @param {moment.Moment} endDate Moment object representing the event end date
* @param {string} filter The time to subtract from the end date to determine if an event should be shown
* @returns {boolean} True if the event should be filtered out, false otherwise
*/
timeFilterApplies (now, endDate, filter) {
if (filter) {
const until = filter.split(" "),
value = parseInt(until[0]),
increment = until[1].slice(-1) === "s" ? until[1] : `${until[1]}s`, // Massage the data for moment js
filterUntil = moment(endDate.format()).subtract(value, increment);
return now.isBefore(filterUntil);
}
return false;
},
/**
* Determines if the user defined title filter should apply
* @param {string} title the title of the event
* @param {string} filter the string to look for, can be a regex also
* @param {boolean} useRegex true if a regex should be used, otherwise it just looks for the filter as a string
* @param {string} regexFlags flags that should be applied to the regex
* @returns {boolean} True if the title should be filtered out, false otherwise
*/
titleFilterApplies (title, filter, useRegex, regexFlags) {
if (useRegex) {
let regexFilter = filter;
// Assume if leading slash, there is also trailing slash
if (filter[0] === "/") {
// Strip leading and trailing slashes
regexFilter = filter.slice(1, -1);
}
return new RegExp(regexFilter, regexFlags).test(title);
} else {
return title.includes(filter);
}
},
/**
* Expands a recurring event into individual event instances using node-ical.
* Handles RRULE expansion, EXDATE filtering, RECURRENCE-ID overrides, and ongoing events.
* @param {object} event The recurring event object
* @param {moment.Moment} pastLocalMoment The past date limit
* @param {moment.Moment} futureLocalMoment The future date limit
* @returns {object[]} Array of event instances with startMoment/endMoment in the local timezone
*/
expandRecurringEvent (event, pastLocalMoment, futureLocalMoment) {
const localTimezone = CalendarFetcherUtils.getLocalTimezone();
return ical
.expandRecurringEvent(event, {
from: pastLocalMoment.toDate(),
to: futureLocalMoment.toDate(),
includeOverrides: true,
excludeExdates: true,
expandOngoing: true
})
.map((inst) => {
let startMoment, endMoment;
if (inst.isFullDay) {
startMoment = moment.tz([inst.start.getFullYear(), inst.start.getMonth(), inst.start.getDate()], localTimezone);
endMoment = moment.tz([inst.end.getFullYear(), inst.end.getMonth(), inst.end.getDate()], localTimezone);
} else {
startMoment = moment(inst.start).tz(localTimezone);
endMoment = moment(inst.end).tz(localTimezone);
}
// Events without DTEND (e.g. reminders) get start === end from node-ical;
// extend to end-of-day so they remain visible on the calendar.
if (startMoment.valueOf() === endMoment.valueOf()) endMoment = endMoment.endOf("day");
return { event: inst.event, startMoment, endMoment, isRecurring: inst.isRecurring, isFullDay: inst.isFullDay };
});
},
/**
* Checks if an event title matches a specific filter configuration.
* @param {string} title The event title to check
* @param {string|object} filterConfig The filter configuration (string or object)
* @returns {object|null} Object with {until: string|null} if matched, null otherwise
*/
checkEventAgainstFilter (title, filterConfig) {
let filter = filterConfig;
let testTitle = title.toLowerCase();
let until = null;
let useRegex = false;
let regexFlags = "g";
if (filter instanceof Object) {
if (typeof filter.until !== "undefined") {
until = filter.until;
}
if (typeof filter.regex !== "undefined") {
useRegex = filter.regex;
}
if (filter.caseSensitive) {
filter = filter.filterBy;
testTitle = title;
} else if (useRegex) {
filter = filter.filterBy;
testTitle = title;
regexFlags += "i";
} else {
filter = filter.filterBy.toLowerCase();
}
} else {
filter = filter.toLowerCase();
}
if (CalendarFetcherUtils.titleFilterApplies(testTitle, filter, useRegex, regexFlags)) {
return { until };
}
return null;
}
};
if (typeof module !== "undefined") {
module.exports = CalendarFetcherUtils;
}

View File

@@ -4,7 +4,7 @@
* of starting the MagicMirror² core. Adjust the values below to your desire.
*/
// Load internal alias resolver
require("../../../js/alias-resolver");
require("../../js/alias-resolver");
const Log = require("logger");
const CalendarFetcher = require("./calendarfetcher");

View File

@@ -61,12 +61,11 @@ module.exports = NodeHelper.create({
this.broadcastEvents(fetcher, identifier);
});
fetcher.onError((fetcher, error) => {
Log.error("Calendar Error. Could not fetch calendar: ", fetcher.url, error);
let error_type = NodeHelper.checkFetchError(error);
fetcher.onError((fetcher, errorInfo) => {
Log.error("Calendar Error. Could not fetch calendar: ", fetcher.url, errorInfo.message || errorInfo);
this.sendSocketNotification("CALENDAR_ERROR", {
id: identifier,
error_type
error_type: errorInfo.translationKey
});
});

View File

Before

Width:  |  Height:  |  Size: 4.2 KiB

After

Width:  |  Height:  |  Size: 4.2 KiB

View File

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 6.8 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 18 KiB

View File

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

Before

Width:  |  Height:  |  Size: 7.2 KiB

After

Width:  |  Height:  |  Size: 7.2 KiB

View File

Before

Width:  |  Height:  |  Size: 7.1 KiB

After

Width:  |  Height:  |  Size: 7.1 KiB

View File

@@ -0,0 +1,36 @@
.newsfeed-fullarticle-container {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
overflow-y: auto;
scrollbar-width: none;
z-index: 1000;
background: black;
}
.newsfeed-fullarticle-container::-webkit-scrollbar {
display: none;
}
iframe.newsfeed-fullarticle {
display: block;
width: 100%;
height: 5000px;
border: none;
}
.region.bottom.bar.newsfeed-fullarticle {
bottom: inherit;
top: -90px;
}
.newsfeed-list {
list-style: none;
}
.newsfeed-list li {
text-align: justify;
margin-bottom: 0.5em;
}

View File

@@ -74,6 +74,10 @@ Module.register("newsfeed", {
this.error = null;
this.activeItem = 0;
this.scrollPosition = 0;
this.articleIframe = null;
this.articleContainer = null;
this.articleFrameCheckPending = false;
this.articleUnavailable = false;
this.registerFeeds();
@@ -97,15 +101,60 @@ Module.register("newsfeed", {
} else if (notification === "NEWSFEED_ERROR") {
this.error = this.translate(payload.error_type);
this.scheduleUpdateInterval();
} else if (notification === "ARTICLE_URL_STATUS") {
if (this.config.showFullArticle) {
this.articleFrameCheckPending = false;
this.articleUnavailable = !payload.canFrame;
if (!this.articleUnavailable) {
// Article can be framed — now shift the bottom bar to allow scrolling
document.getElementsByClassName("region bottom bar")[0].classList.add("newsfeed-fullarticle");
}
this.updateDom(100);
if (this.articleUnavailable) {
// Briefly show the unavailable message, then return to normal newsfeed view
setTimeout(() => {
this.resetDescrOrFullArticleAndTimer();
this.updateDom(500);
}, 3000);
}
}
}
},
//Override getDom to handle the full article case with error handling
getDom () {
if (this.config.showFullArticle) {
this.activeItemHash = this.newsItems[this.activeItem]?.hash;
const wrapper = document.createElement("div");
if (this.articleFrameCheckPending) {
// Still waiting for the server-side framing check
wrapper.innerHTML = `<div class="small dimmed">${this.translate("LOADING")}</div>`;
} else if (this.articleUnavailable) {
wrapper.innerHTML = `<div class="small dimmed">${this.translate("NEWSFEED_ARTICLE_UNAVAILABLE")}</div>`;
} else {
const container = document.createElement("div");
container.className = "newsfeed-fullarticle-container";
container.scrollTop = this.scrollPosition;
const iframe = document.createElement("iframe");
iframe.className = "newsfeed-fullarticle";
// Always use the direct article URL — the CORS proxy is for server-side
// RSS feed fetching, not for browser iframes.
const item = this.newsItems[this.activeItem];
iframe.src = item ? (typeof item.url === "string" ? item.url : item.url.href) : "";
this.articleIframe = iframe;
this.articleContainer = container;
container.appendChild(iframe);
wrapper.appendChild(container);
}
return Promise.resolve(wrapper);
}
return this._super();
},
//Override fetching of template name
getTemplate () {
if (this.config.feedUrl) {
return "oldconfig.njk";
} else if (this.config.showFullArticle) {
return "fullarticle.njk";
}
return "newsfeed.njk";
},
@@ -116,13 +165,6 @@ Module.register("newsfeed", {
this.activeItem = 0;
}
this.activeItemCount = this.newsItems.length;
// this.config.showFullArticle is a run-time configuration, triggered by optional notifications
if (this.config.showFullArticle) {
this.activeItemHash = this.newsItems[this.activeItem]?.hash;
return {
url: this.getActiveItemURL()
};
}
if (this.error) {
this.activeItemHash = undefined;
return {
@@ -358,6 +400,10 @@ Module.register("newsfeed", {
this.isShowingDescription = this.config.showDescription;
this.config.showFullArticle = false;
this.scrollPosition = 0;
this.articleIframe = null;
this.articleContainer = null;
this.articleFrameCheckPending = false;
this.articleUnavailable = false;
// reset bottom bar alignment
document.getElementsByClassName("region bottom bar")[0].classList.remove("newsfeed-fullarticle");
if (!this.timer) {
@@ -386,23 +432,26 @@ Module.register("newsfeed", {
Log.debug(`[newsfeed] going from article #${before} to #${this.activeItem} (of ${this.newsItems.length})`);
this.updateDom(100);
}
// if "more details" is received the first time: show article summary, on second time show full article
else if (notification === "ARTICLE_MORE_DETAILS") {
// full article is already showing, so scrolling down
if (this.config.showFullArticle === true) {
// iframe already showing — scroll down
this.scrollPosition += this.config.scrollLength;
window.scrollTo(0, this.scrollPosition);
Log.debug("[newsfeed] scrolling down");
Log.debug(`[newsfeed] ARTICLE_MORE_DETAILS, scroll position: ${this.config.scrollLength}`);
} else {
if (this.articleContainer) this.articleContainer.scrollTop = this.scrollPosition;
Log.debug(`[newsfeed] scrolling down, offset: ${this.scrollPosition}`);
} else if (this.isShowingDescription) {
// description visible — step up to full article
this.showFullArticle();
} else {
// only title visible — show description first
this.isShowingDescription = true;
Log.debug("[newsfeed] showing article description");
this.updateDom(100);
}
} else if (notification === "ARTICLE_SCROLL_UP") {
if (this.config.showFullArticle === true) {
this.scrollPosition -= this.config.scrollLength;
window.scrollTo(0, this.scrollPosition);
Log.debug("[newsfeed] scrolling up");
Log.debug(`[newsfeed] ARTICLE_SCROLL_UP, scroll position: ${this.config.scrollLength}`);
this.scrollPosition = Math.max(0, this.scrollPosition - this.config.scrollLength);
if (this.articleContainer) this.articleContainer.scrollTop = this.scrollPosition;
Log.debug(`[newsfeed] scrolling up, offset: ${this.scrollPosition}`);
}
} else if (notification === "ARTICLE_LESS_DETAILS") {
this.resetDescrOrFullArticleAndTimer();
@@ -416,26 +465,37 @@ Module.register("newsfeed", {
this.showFullArticle();
}
} else if (notification === "ARTICLE_INFO_REQUEST") {
this.sendNotification("ARTICLE_INFO_RESPONSE", {
title: this.newsItems[this.activeItem].title,
source: this.newsItems[this.activeItem].sourceTitle,
date: this.newsItems[this.activeItem].pubdate,
desc: this.newsItems[this.activeItem].description,
url: this.getActiveItemURL()
});
const infoItem = this.newsItems[this.activeItem];
if (infoItem) {
this.sendNotification("ARTICLE_INFO_RESPONSE", {
title: infoItem.title,
source: infoItem.sourceTitle,
date: infoItem.pubdate,
desc: infoItem.description,
url: typeof infoItem.url === "string" ? infoItem.url : infoItem.url.href
});
}
}
},
showFullArticle () {
this.isShowingDescription = !this.isShowingDescription;
this.config.showFullArticle = !this.isShowingDescription;
// make bottom bar align to top to allow scrolling
if (this.config.showFullArticle === true) {
document.getElementsByClassName("region bottom bar")[0].classList.add("newsfeed-fullarticle");
const item = this.newsItems[this.activeItem];
const hasUrl = item && item.url && (typeof item.url === "string" ? item.url : item.url.href);
if (!hasUrl) {
Log.debug("[newsfeed] no article URL available, skipping full article view");
return;
}
this.isShowingDescription = false;
this.config.showFullArticle = true;
// Check server-side whether the article URL allows framing.
// The bottom bar CSS class is only added once we know the iframe will be shown.
this.articleFrameCheckPending = true;
this.articleUnavailable = false;
const rawUrl = typeof item.url === "string" ? item.url : item.url.href;
this.sendSocketNotification("CHECK_ARTICLE_URL", { url: rawUrl });
clearInterval(this.timer);
this.timer = null;
Log.debug(`[newsfeed] showing ${this.isShowingDescription ? "article description" : "full article"}`);
Log.debug("[newsfeed] showing full article");
this.updateDom(100);
}
});

View File

@@ -0,0 +1,167 @@
const crypto = require("node:crypto");
const stream = require("node:stream");
const FeedMe = require("feedme");
const iconv = require("iconv-lite");
const { htmlToText } = require("html-to-text");
const Log = require("logger");
const HTTPFetcher = require("#http_fetcher");
/**
* NewsfeedFetcher - Fetches and parses RSS/Atom feed data
* Uses HTTPFetcher for HTTP handling with intelligent error handling
* @class
*/
class NewsfeedFetcher {
/**
* Creates a new NewsfeedFetcher instance
* @param {string} url - The URL of the news feed to fetch
* @param {number} reloadInterval - Time in ms between fetches
* @param {string} encoding - Encoding of the feed (e.g., 'UTF-8')
* @param {boolean} logFeedWarnings - If true log warnings when there is an error parsing a news article
* @param {boolean} useCorsProxy - If true cors proxy is used for article url's
*/
constructor (url, reloadInterval, encoding, logFeedWarnings, useCorsProxy) {
this.url = url;
this.encoding = encoding;
this.logFeedWarnings = logFeedWarnings;
this.useCorsProxy = useCorsProxy;
this.items = [];
this.fetchFailedCallback = () => {};
this.itemsReceivedCallback = () => {};
// Use HTTPFetcher for HTTP handling (Composition)
this.httpFetcher = new HTTPFetcher(url, {
reloadInterval: Math.max(reloadInterval, 1000),
headers: {
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
Pragma: "no-cache"
}
});
// Wire up HTTPFetcher events
this.httpFetcher.on("response", (response) => this.#handleResponse(response));
this.httpFetcher.on("error", (errorInfo) => this.fetchFailedCallback(this, errorInfo));
}
/**
* Creates a parse error info object
* @param {string} message - Error message
* @param {Error} error - Original error
* @returns {object} Error info object
*/
#createParseError (message, error) {
return {
message,
status: null,
errorType: "PARSE_ERROR",
translationKey: "MODULE_ERROR_UNSPECIFIED",
retryAfter: this.httpFetcher.reloadInterval,
retryCount: 0,
url: this.url,
originalError: error
};
}
/**
* Handles successful HTTP response
* @param {Response} response - The fetch Response object
*/
#handleResponse (response) {
this.items = [];
const parser = new FeedMe();
parser.on("item", (item) => {
const title = item.title;
let description = item.description || item.summary || item.content || "";
const pubdate = item.pubdate || item.published || item.updated || item["dc:date"] || item["a10:updated"];
const url = item.url || item.link || "";
if (title && pubdate) {
// Convert HTML entities, codes and tag
description = htmlToText(description, {
wordwrap: false,
selectors: [
{ selector: "a", options: { ignoreHref: true, noAnchorUrl: true } },
{ selector: "br", format: "inlineSurround", options: { prefix: " " } },
{ selector: "img", format: "skip" }
]
});
this.items.push({
title,
description,
pubdate,
url,
useCorsProxy: this.useCorsProxy,
hash: crypto.createHash("sha256").update(`${pubdate} :: ${title} :: ${url}`).digest("hex")
});
} else if (this.logFeedWarnings) {
Log.warn("Can't parse feed item:", item);
Log.warn(`Title: ${title}`);
Log.warn(`Description: ${description}`);
Log.warn(`Pubdate: ${pubdate}`);
}
});
parser.on("end", () => this.broadcastItems());
parser.on("error", (error) => {
Log.error(`${this.url} - Feed parsing failed: ${error.message}`);
this.fetchFailedCallback(this, this.#createParseError(`Feed parsing failed: ${error.message}`, error));
});
parser.on("ttl", (minutes) => {
const ttlms = Math.min(minutes * 60 * 1000, 86400000);
if (ttlms > this.httpFetcher.reloadInterval) {
this.httpFetcher.reloadInterval = ttlms;
Log.info(`reloadInterval set to ttl=${ttlms} for url ${this.url}`);
}
});
try {
const nodeStream = response.body instanceof stream.Readable
? response.body
: stream.Readable.fromWeb(response.body);
nodeStream.pipe(iconv.decodeStream(this.encoding)).pipe(parser);
} catch (error) {
Log.error(`${this.url} - Stream processing failed: ${error.message}`);
this.fetchFailedCallback(this, this.#createParseError(`Stream processing failed: ${error.message}`, error));
}
}
/**
* Update the reload interval, but only if we need to increase the speed.
* @param {number} interval - Interval for the update in milliseconds.
*/
setReloadInterval (interval) {
if (interval > 1000 && interval < this.httpFetcher.reloadInterval) {
this.httpFetcher.reloadInterval = interval;
}
}
startFetch () {
this.httpFetcher.startPeriodicFetch();
}
broadcastItems () {
if (this.items.length <= 0) {
Log.info("No items to broadcast yet.");
return;
}
Log.info(`Broadcasting ${this.items.length} items.`);
this.itemsReceivedCallback(this);
}
/** @param {function(NewsfeedFetcher): void} callback - Called when items are received */
onReceive (callback) {
this.itemsReceivedCallback = callback;
}
/** @param {function(NewsfeedFetcher, object): void} callback - Called on fetch error */
onError (callback) {
this.fetchFailedCallback = callback;
}
}
module.exports = NewsfeedFetcher;

View File

@@ -13,6 +13,28 @@ module.exports = NodeHelper.create({
socketNotificationReceived (notification, payload) {
if (notification === "ADD_FEED") {
this.createFetcher(payload.feed, payload.config);
} else if (notification === "CHECK_ARTICLE_URL") {
this.checkArticleUrl(payload.url);
}
},
/**
* Checks whether a URL can be displayed in an iframe by inspecting
* X-Frame-Options and Content-Security-Policy headers server-side.
* @param {string} url The article URL to check.
*/
async checkArticleUrl (url) {
try {
const response = await fetch(url, { method: "HEAD" });
const xfo = response.headers.get("x-frame-options");
const csp = response.headers.get("content-security-policy");
// sameorigin also blocks since the article is on a different origin than MM
const blockedByXFO = xfo && ["deny", "sameorigin"].includes(xfo.toLowerCase().trim());
const blockedByCSP = csp && (/frame-ancestors\s+['"]?none['"]?/).test(csp);
this.sendSocketNotification("ARTICLE_URL_STATUS", { url, canFrame: !blockedByXFO && !blockedByCSP });
} catch {
// Network error or HEAD not supported — let the browser try the iframe anyway
this.sendSocketNotification("ARTICLE_URL_STATUS", { url, canFrame: true });
}
},
@@ -26,8 +48,7 @@ module.exports = NodeHelper.create({
const url = feed.url || "";
const encoding = feed.encoding || "UTF-8";
const reloadInterval = feed.reloadInterval || config.reloadInterval || 5 * 60 * 1000;
let useCorsProxy = feed.useCorsProxy;
if (useCorsProxy === undefined) useCorsProxy = true;
const useCorsProxy = feed.useCorsProxy ?? true;
try {
new URL(url);
@@ -46,11 +67,10 @@ module.exports = NodeHelper.create({
this.broadcastFeeds();
});
fetcher.onError((fetcher, error) => {
Log.error("Error: Could not fetch newsfeed: ", url, error);
let error_type = NodeHelper.checkFetchError(error);
fetcher.onError((fetcher, errorInfo) => {
Log.error("Error: Could not fetch newsfeed: ", fetcher.url, errorInfo.message || errorInfo);
this.sendSocketNotification("NEWSFEED_ERROR", {
error_type
error_type: errorInfo.translationKey
});
});
@@ -71,8 +91,8 @@ module.exports = NodeHelper.create({
*/
broadcastFeeds () {
const feeds = {};
for (let f in this.fetchers) {
feeds[f] = this.fetchers[f].items();
for (const url in this.fetchers) {
feeds[url] = this.fetchers[url].items;
}
this.sendSocketNotification("NEWS_ITEMS", feeds);
}

View File

@@ -2,7 +2,7 @@ const fs = require("node:fs");
const path = require("node:path");
const NodeHelper = require("node_helper");
const defaultModules = require(`${global.root_path}/modules/default/defaultmodules`);
const defaultModules = require(`${global.root_path}/${global.defaultModulesDir}/defaultmodules`);
const GitHelper = require("./git_helper");
const UpdateHelper = require("./update_helper");

31
defaultmodules/utils.js Normal file
View File

@@ -0,0 +1,31 @@
/**
* Format the time according to the config
* @param {object} config The config of the module
* @param {object} time time to format
* @returns {string} The formatted time string
*/
const formatTime = (config, time) => {
let date = moment(time);
if (config.timezone) {
date = date.tz(config.timezone);
}
if (config.timeFormat !== 24) {
if (config.showPeriod) {
if (config.showPeriodUpper) {
return date.format("h:mm A");
} else {
return date.format("h:mm a");
}
} else {
return date.format("h:mm");
}
}
return date.format("HH:mm");
};
if (typeof module !== "undefined") module.exports = {
formatTime
};

View File

@@ -25,7 +25,7 @@
{% if config.showHumidity === "wind" %}
{{ humidity() }}
{% endif %}
{% if config.showSun %}
{% if config.showSun and current.nextSunAction() %}
<span class="wi dimmed wi-{{ current.nextSunAction() }}"></span>
<span>
{% if current.nextSunAction() === "sunset" %}

View File

@@ -0,0 +1,103 @@
const path = require("node:path");
const NodeHelper = require("node_helper");
const Log = require("logger");
module.exports = NodeHelper.create({
providers: {},
start () {
Log.log(`Starting node helper for: ${this.name}`);
},
socketNotificationReceived (notification, payload) {
if (notification === "INIT_WEATHER") {
Log.log(`Received INIT_WEATHER for instance ${payload.instanceId}`);
this.initWeatherProvider(payload);
} else if (notification === "STOP_WEATHER") {
Log.log(`Received STOP_WEATHER for instance ${payload.instanceId}`);
this.stopWeatherProvider(payload.instanceId);
}
// FETCH_WEATHER is no longer needed - HTTPFetcher handles periodic fetching
},
/**
* Initialize a weather provider
* @param {object} config The configuration object
*/
async initWeatherProvider (config) {
const identifier = config.weatherProvider.toLowerCase();
const instanceId = config.instanceId;
Log.log(`Attempting to initialize provider ${identifier} for instance ${instanceId}`);
if (this.providers[instanceId]) {
Log.log(`Weather provider ${identifier} already initialized for instance ${instanceId}`);
return;
}
try {
// Dynamically load the provider module
const providerPath = path.join(__dirname, "providers", `${identifier}.js`);
Log.log(`Loading provider from: ${providerPath}`);
const ProviderClass = require(providerPath);
// Create provider instance
const provider = new ProviderClass(config);
// Set up callbacks before initializing
provider.setCallbacks(
(data) => {
// On data received
this.sendSocketNotification("WEATHER_DATA", {
instanceId,
type: config.type,
data
});
},
(errorInfo) => {
// On error
this.sendSocketNotification("WEATHER_ERROR", {
instanceId,
error: errorInfo.message || "Unknown error",
translationKey: errorInfo.translationKey
});
}
);
await provider.initialize();
this.providers[instanceId] = provider;
this.sendSocketNotification("WEATHER_INITIALIZED", {
instanceId,
locationName: provider.locationName
});
// Start periodic fetching
provider.start();
Log.log(`Weather provider ${identifier} initialized for instance ${instanceId}`);
} catch (error) {
Log.error(`Failed to initialize weather provider ${identifier}:`, error);
this.sendSocketNotification("WEATHER_ERROR", {
instanceId,
error: error.message
});
}
},
/**
* Stop and cleanup a weather provider
* @param {string} instanceId The instance identifier
*/
stopWeatherProvider (instanceId) {
const provider = this.providers[instanceId];
if (provider) {
Log.log(`Stopping weather provider for instance ${instanceId}`);
provider.stop();
delete this.providers[instanceId];
} else {
Log.warn(`No provider found for instance ${instanceId}`);
}
}
});

View File

@@ -0,0 +1,181 @@
/**
* Shared utility functions for weather providers
*/
const SunCalc = require("suncalc");
/**
* Convert OpenWeatherMap icon codes to internal weather types
* @param {string} weatherType - OpenWeatherMap icon code (e.g., "01d", "02n")
* @returns {string|null} Internal weather type
*/
function convertWeatherType (weatherType) {
const weatherTypes = {
"01d": "day-sunny",
"02d": "day-cloudy",
"03d": "cloudy",
"04d": "cloudy-windy",
"09d": "showers",
"10d": "rain",
"11d": "thunderstorm",
"13d": "snow",
"50d": "fog",
"01n": "night-clear",
"02n": "night-cloudy",
"03n": "night-cloudy",
"04n": "night-cloudy",
"09n": "night-showers",
"10n": "night-rain",
"11n": "night-thunderstorm",
"13n": "night-snow",
"50n": "night-alt-cloudy-windy"
};
return weatherTypes.hasOwnProperty(weatherType) ? weatherTypes[weatherType] : null;
}
/**
* Apply timezone offset to a date
* @param {Date} date - The date to apply offset to
* @param {number} offsetMinutes - Timezone offset in minutes
* @returns {Date} Date with applied offset
*/
function applyTimezoneOffset (date, offsetMinutes) {
const utcTime = date.getTime() + (date.getTimezoneOffset() * 60000);
return new Date(utcTime + (offsetMinutes * 60000));
}
/**
* Limit decimal places for coordinates (truncate, not round)
* @param {number} value - The coordinate value
* @param {number} decimals - Maximum number of decimal places
* @returns {number} Value with limited decimal places
*/
function limitDecimals (value, decimals) {
const str = value.toString();
if (str.includes(".")) {
const parts = str.split(".");
if (parts[1].length > decimals) {
return parseFloat(`${parts[0]}.${parts[1].substring(0, decimals)}`);
}
}
return value;
}
/**
* Get sunrise and sunset times for a given date and location
* @param {Date} date - The date to calculate for
* @param {number} lat - Latitude
* @param {number} lon - Longitude
* @returns {object} Object with sunrise and sunset Date objects
*/
function getSunTimes (date, lat, lon) {
const sunTimes = SunCalc.getTimes(date, lat, lon);
return {
sunrise: sunTimes.sunrise,
sunset: sunTimes.sunset
};
}
/**
* Check if a given time is during daylight hours
* @param {Date} date - The date/time to check
* @param {Date} sunrise - Sunrise time
* @param {Date} sunset - Sunset time
* @returns {boolean} True if during daylight hours
*/
function isDayTime (date, sunrise, sunset) {
if (!sunrise || !sunset) {
return true; // Default to day if times unavailable
}
return date >= sunrise && date < sunset;
}
/**
* Format timezone offset as string (e.g., "+01:00", "-05:30")
* @param {number} offsetMinutes - Timezone offset in minutes (use -new Date().getTimezoneOffset() for local)
* @returns {string} Formatted offset string
*/
function formatTimezoneOffset (offsetMinutes) {
const hours = Math.floor(Math.abs(offsetMinutes) / 60);
const minutes = Math.abs(offsetMinutes) % 60;
const sign = offsetMinutes >= 0 ? "+" : "-";
return `${sign}${String(hours).padStart(2, "0")}:${String(minutes).padStart(2, "0")}`;
}
/**
* Get date string in YYYY-MM-DD format (local time)
* @param {Date} date - The date to format
* @returns {string} Date string in YYYY-MM-DD format
*/
function getDateString (date) {
const year = date.getFullYear();
const month = String(date.getMonth() + 1).padStart(2, "0");
const day = String(date.getDate()).padStart(2, "0");
return `${year}-${month}-${day}`;
}
/**
* Convert wind speed from km/h to m/s
* @param {number} kmh - Wind speed in km/h
* @returns {number} Wind speed in m/s
*/
function convertKmhToMs (kmh) {
return kmh / 3.6;
}
/**
* Convert cardinal wind direction string to degrees
* @param {string} direction - Cardinal direction (e.g., "N", "NNE", "SW")
* @returns {number|null} Direction in degrees (0-360) or null if unknown
*/
function cardinalToDegrees (direction) {
const directions = {
N: 0,
NNE: 22.5,
NE: 45,
ENE: 67.5,
E: 90,
ESE: 112.5,
SE: 135,
SSE: 157.5,
S: 180,
SSW: 202.5,
SW: 225,
WSW: 247.5,
W: 270,
WNW: 292.5,
NW: 315,
NNW: 337.5
};
return directions[direction] ?? null;
}
/**
* Validate and limit coordinate precision
* @param {object} config - Configuration object with lat/lon properties
* @param {number} maxDecimals - Maximum decimal places to preserve
* @throws {Error} If coordinates are missing or invalid
*/
function validateCoordinates (config, maxDecimals = 4) {
if (config.lat == null || config.lon == null
|| !Number.isFinite(config.lat) || !Number.isFinite(config.lon)) {
throw new Error("Latitude and longitude are required");
}
config.lat = limitDecimals(config.lat, maxDecimals);
config.lon = limitDecimals(config.lon, maxDecimals);
}
module.exports = {
convertWeatherType,
applyTimezoneOffset,
limitDecimals,
getSunTimes,
isDayTime,
formatTimezoneOffset,
getDateString,
convertKmhToMs,
cardinalToDegrees,
validateCoordinates
};

View File

@@ -1,3 +1,3 @@
# Weather Module Weather Provider Development Documentation
For how to develop your own weather provider, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/development/weather-provider.html).
For how to develop your own weather provider, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/module-development/weather-provider.html).

View File

@@ -0,0 +1,450 @@
const Log = require("logger");
const { convertKmhToMs } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
/**
* Server-side weather provider for Environment Canada MSC Datamart
* Canada only, no API key required (anonymous access)
*
* Documentation:
* https://dd.weather.gc.ca/citypage_weather/schema/
* https://eccc-msc.github.io/open-data/msc-datamart/readme_en/
*
* Requires siteCode and provCode config parameters
* See https://dd.weather.gc.ca/citypage_weather/docs/site_list_en.csv
*/
class EnvCanadaProvider {
constructor (config) {
this.config = {
siteCode: "s0000000",
provCode: "ON",
type: "current",
updateInterval: 10 * 60 * 1000,
...config
};
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
this.lastCityPageURL = null;
this.cacheCurrentTemp = null;
this.currentHour = null; // Track current hour for URL updates
}
initialize () {
this.#validateConfig();
this.#initializeFetcher();
}
setCallbacks (onData, onError) {
this.onDataCallback = onData;
this.onErrorCallback = onError;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
#validateConfig () {
if (!this.config.siteCode || !this.config.provCode) {
throw new Error("siteCode and provCode are required");
}
}
#initializeFetcher () {
this.currentHour = new Date().toISOString().substring(11, 13);
const indexURL = this.#getIndexUrl();
this.fetcher = new HTTPFetcher(indexURL, {
reloadInterval: this.config.updateInterval,
logContext: "weatherprovider.envcanada"
});
this.fetcher.on("response", async (response) => {
try {
// Check if hour changed - restart fetcher with new URL
const newHour = new Date().toISOString().substring(11, 13);
if (newHour !== this.currentHour) {
Log.info("[envcanada] Hour changed, reinitializing fetcher");
this.stop();
this.#initializeFetcher();
this.start();
return;
}
const html = await response.text();
const cityPageURL = this.#extractCityPageURL(html);
if (!cityPageURL) {
// This can happen during hour transitions when old responses arrive
Log.debug("[envcanada] Could not find city page URL (may be stale response from previous hour)");
return;
}
if (cityPageURL === this.lastCityPageURL) {
Log.debug("[envcanada] City page unchanged");
return;
}
this.lastCityPageURL = cityPageURL;
await this.#fetchCityPage(cityPageURL);
} catch (error) {
Log.error("[envcanada] Error:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
async #fetchCityPage (url) {
try {
const response = await fetch(url);
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const xml = await response.text();
const weatherData = this.#parseWeatherData(xml);
if (this.onDataCallback) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[envcanada] Fetch city page error:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to fetch city data",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#parseWeatherData (xml) {
switch (this.config.type) {
case "current":
return this.#generateCurrentWeather(xml);
case "forecast":
case "daily":
return this.#generateForecast(xml);
case "hourly":
return this.#generateHourly(xml);
default:
Log.error(`[envcanada] Unknown weather type: ${this.config.type}`);
return null;
}
}
#generateCurrentWeather (xml) {
const current = { date: new Date() };
// Try to get temperature from currentConditions first
const currentTempStr = this.#extract(xml, /<currentConditions>.*?<temperature[^>]*>(.*?)<\/temperature>/s);
if (currentTempStr && currentTempStr !== "") {
current.temperature = parseFloat(currentTempStr);
this.cacheCurrentTemp = current.temperature;
} else {
// Fallback: extract from first forecast period if currentConditions is empty
const firstForecast = xml.match(/<forecast>(.*?)<\/forecast>/s);
if (firstForecast) {
const forecastXml = firstForecast[1];
const temp = this.#extract(forecastXml, /<temperature[^>]*>(.*?)<\/temperature>/);
if (temp && temp !== "") {
current.temperature = parseFloat(temp);
this.cacheCurrentTemp = current.temperature;
} else if (this.cacheCurrentTemp !== null) {
current.temperature = this.cacheCurrentTemp;
} else {
current.temperature = null;
}
}
}
// Wind chill / humidex for feels like temperature
const windChill = this.#extract(xml, /<windChill[^>]*>(.*?)<\/windChill>/);
const humidex = this.#extract(xml, /<humidex[^>]*>(.*?)<\/humidex>/);
if (windChill) {
current.feelsLikeTemp = parseFloat(windChill);
} else if (humidex) {
current.feelsLikeTemp = parseFloat(humidex);
}
// Get wind and icon from currentConditions or first forecast
const firstForecast = xml.match(/<forecast>(.*?)<\/forecast>/s);
if (!firstForecast) {
Log.warn("[envcanada] No forecast data available");
return current;
}
const forecastXml = firstForecast[1];
// Wind speed - try currentConditions first, fallback to forecast
let windSpeed = this.#extract(xml, /<currentConditions>.*?<wind>.*?<speed[^>]*>(.*?)<\/speed>/s);
if (!windSpeed) {
windSpeed = this.#extract(forecastXml, /<speed[^>]*>(.*?)<\/speed>/);
}
if (windSpeed) {
current.windSpeed = (windSpeed === "calm") ? 0 : convertKmhToMs(parseFloat(windSpeed));
}
// Wind bearing - try currentConditions first, fallback to forecast
let windBearing = this.#extract(xml, /<currentConditions>.*?<wind>.*?<bearing[^>]*>(.*?)<\/bearing>/s);
if (!windBearing) {
windBearing = this.#extract(forecastXml, /<bearing[^>]*>(.*?)<\/bearing>/);
}
if (windBearing) current.windFromDirection = parseFloat(windBearing);
// Try icon from currentConditions first, fallback to forecast
let iconCode = this.#extract(xml, /<currentConditions>.*?<iconCode[^>]*>(.*?)<\/iconCode>/s);
if (!iconCode) {
iconCode = this.#extract(forecastXml, /<iconCode[^>]*>(.*?)<\/iconCode>/);
}
if (iconCode) current.weatherType = this.#convertWeatherType(iconCode);
// Humidity from currentConditions
const humidity = this.#extract(xml, /<currentConditions>.*?<relativeHumidity[^>]*>(.*?)<\/relativeHumidity>/s);
if (humidity) current.humidity = parseFloat(humidity);
// Precipitation probability from forecast
const pop = this.#extract(forecastXml, /<pop[^>]*>(.*?)<\/pop>/);
if (pop && pop !== "") {
current.precipitationProbability = parseFloat(pop);
}
// Sunrise/sunset (from riseSet, independent of currentConditions)
const sunriseTime = this.#extract(xml, /<dateTime[^>]*name="sunrise"[^>]*>.*?<timeStamp>(.*?)<\/timeStamp>/s);
const sunsetTime = this.#extract(xml, /<dateTime[^>]*name="sunset"[^>]*>.*?<timeStamp>(.*?)<\/timeStamp>/s);
if (sunriseTime) current.sunrise = this.#parseECTime(sunriseTime);
if (sunsetTime) current.sunset = this.#parseECTime(sunsetTime);
return current;
}
#generateForecast (xml) {
const days = [];
const forecasts = xml.match(/<forecast>(.*?)<\/forecast>/gs) || [];
if (forecasts.length === 0) return days;
// Get current temp
const currentTempStr = this.#extract(xml, /<currentConditions>.*?<temperature[^>]*>(.*?)<\/temperature>/s);
const currentTemp = currentTempStr ? parseFloat(currentTempStr) : null;
// Check if first forecast is Today or Tonight
const isToday = forecasts[0].includes("textForecastName=\"Today\"");
let nextDay = isToday ? 2 : 1;
const lastDay = isToday ? 12 : 11;
// Process first day
const firstDay = {
date: new Date(),
precipitationProbability: null
};
this.#extractForecastTemps(firstDay, forecasts, 0, isToday, currentTemp);
this.#extractForecastPrecip(firstDay, forecasts, 0);
const firstIcon = this.#extract(forecasts[0], /<iconCode[^>]*>(.*?)<\/iconCode>/);
if (firstIcon) firstDay.weatherType = this.#convertWeatherType(firstIcon);
days.push(firstDay);
// Process remaining days
let date = new Date();
for (let i = nextDay; i < lastDay && i < forecasts.length; i += 2) {
date = new Date(date);
date.setDate(date.getDate() + 1);
const day = {
date: new Date(date),
precipitationProbability: null
};
this.#extractForecastTemps(day, forecasts, i, true, currentTemp);
this.#extractForecastPrecip(day, forecasts, i);
const icon = this.#extract(forecasts[i], /<iconCode[^>]*>(.*?)<\/iconCode>/);
if (icon) day.weatherType = this.#convertWeatherType(icon);
days.push(day);
}
return days;
}
#extractForecastTemps (weather, forecasts, index, hasToday, currentTemp) {
let tempToday = null;
let tempTonight = null;
if (hasToday && forecasts[index]) {
const temp = this.#extract(forecasts[index], /<temperature[^>]*>(.*?)<\/temperature>/);
if (temp) tempToday = parseFloat(temp);
}
if (forecasts[index + 1]) {
const temp = this.#extract(forecasts[index + 1], /<temperature[^>]*>(.*?)<\/temperature>/);
if (temp) tempTonight = parseFloat(temp);
}
if (tempToday !== null && tempTonight !== null) {
weather.maxTemperature = Math.max(tempToday, tempTonight);
weather.minTemperature = Math.min(tempToday, tempTonight);
} else if (tempToday !== null) {
weather.maxTemperature = tempToday;
weather.minTemperature = currentTemp || tempToday;
} else if (tempTonight !== null) {
weather.maxTemperature = currentTemp || tempTonight;
weather.minTemperature = tempTonight;
}
}
#extractForecastPrecip (weather, forecasts, index) {
const precips = [];
if (forecasts[index]) {
const pop = this.#extract(forecasts[index], /<pop[^>]*>(.*?)<\/pop>/);
if (pop) precips.push(parseFloat(pop));
}
if (forecasts[index + 1]) {
const pop = this.#extract(forecasts[index + 1], /<pop[^>]*>(.*?)<\/pop>/);
if (pop) precips.push(parseFloat(pop));
}
if (precips.length > 0) {
weather.precipitationProbability = Math.max(...precips);
}
}
#generateHourly (xml) {
const hours = [];
const hourlyMatches = xml.matchAll(/<hourlyForecast[^>]*dateTimeUTC="([^"]*)"[^>]*>(.*?)<\/hourlyForecast>/gs);
for (const [, dateTimeUTC, hourXML] of hourlyMatches) {
const weather = {};
weather.date = this.#parseECTime(dateTimeUTC);
const temp = this.#extract(hourXML, /<temperature[^>]*>(.*?)<\/temperature>/);
if (temp) weather.temperature = parseFloat(temp);
const lop = this.#extract(hourXML, /<lop[^>]*>(.*?)<\/lop>/);
if (lop) weather.precipitationProbability = parseFloat(lop);
const icon = this.#extract(hourXML, /<iconCode[^>]*>(.*?)<\/iconCode>/);
if (icon) weather.weatherType = this.#convertWeatherType(icon);
hours.push(weather);
if (hours.length >= 24) break;
}
return hours;
}
#extract (text, pattern) {
const match = text.match(pattern);
return match ? match[1].trim() : null;
}
#getIndexUrl () {
const hour = new Date().toISOString().substring(11, 13);
return `https://dd.weather.gc.ca/today/citypage_weather/${this.config.provCode}/${hour}/`;
}
#extractCityPageURL (html) {
// New format: {timestamp}_MSC_CitypageWeather_{siteCode}_en.xml
const pattern = `[^"]*_MSC_CitypageWeather_${this.config.siteCode}_en\\.xml`;
const match = html.match(new RegExp(`href="(${pattern})"`));
if (match && match[1]) {
return this.#getIndexUrl() + match[1];
}
return null;
}
#parseECTime (timeStr) {
if (!timeStr || timeStr.length < 12) return new Date();
const y = parseInt(timeStr.substring(0, 4), 10);
const m = parseInt(timeStr.substring(4, 6), 10) - 1;
const d = parseInt(timeStr.substring(6, 8), 10);
const h = parseInt(timeStr.substring(8, 10), 10);
const min = parseInt(timeStr.substring(10, 12), 10);
const s = timeStr.length >= 14 ? parseInt(timeStr.substring(12, 14), 10) : 0;
// Create UTC date since input timestamps are in UTC
return new Date(Date.UTC(y, m, d, h, min, s));
}
#convertWeatherType (iconCode) {
const code = parseInt(iconCode, 10);
const map = {
0: "day-sunny",
1: "day-sunny",
2: "day-sunny-overcast",
3: "day-cloudy",
4: "day-cloudy",
5: "day-cloudy",
6: "day-sprinkle",
7: "day-showers",
8: "snow",
9: "day-thunderstorm",
10: "cloud",
11: "showers",
12: "rain",
13: "rain",
14: "sleet",
15: "sleet",
16: "snow",
17: "snow",
18: "snow",
19: "thunderstorm",
20: "cloudy",
21: "cloudy",
22: "day-cloudy",
23: "day-haze",
24: "fog",
25: "snow-wind",
26: "sleet",
27: "sleet",
28: "rain",
29: "na",
30: "night-clear",
31: "night-clear",
32: "night-partly-cloudy",
33: "night-alt-cloudy",
34: "night-alt-cloudy",
35: "night-partly-cloudy",
36: "night-alt-showers",
37: "night-rain-mix",
38: "night-alt-snow",
39: "night-thunderstorm",
40: "snow-wind",
41: "tornado",
42: "tornado",
43: "windy",
44: "smoke",
45: "sandstorm",
46: "thunderstorm",
47: "thunderstorm",
48: "tornado"
};
return map[code] || null;
}
}
module.exports = EnvCanadaProvider;

View File

@@ -0,0 +1,560 @@
const Log = require("logger");
const { getDateString } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
// https://www.bigdatacloud.com/docs/api/free-reverse-geocode-to-city-api
const GEOCODE_BASE = "https://api.bigdatacloud.net/data/reverse-geocode-client";
const OPEN_METEO_BASE = "https://api.open-meteo.com/v1";
/**
* Server-side weather provider for Open-Meteo
* see https://open-meteo.com/
*/
class OpenMeteoProvider {
// https://open-meteo.com/en/docs
hourlyParams = [
"temperature_2m",
"relativehumidity_2m",
"dewpoint_2m",
"apparent_temperature",
"pressure_msl",
"surface_pressure",
"cloudcover",
"cloudcover_low",
"cloudcover_mid",
"cloudcover_high",
"windspeed_10m",
"windspeed_80m",
"windspeed_120m",
"windspeed_180m",
"winddirection_10m",
"winddirection_80m",
"winddirection_120m",
"winddirection_180m",
"windgusts_10m",
"shortwave_radiation",
"direct_radiation",
"direct_normal_irradiance",
"diffuse_radiation",
"vapor_pressure_deficit",
"cape",
"evapotranspiration",
"et0_fao_evapotranspiration",
"precipitation",
"snowfall",
"precipitation_probability",
"rain",
"showers",
"weathercode",
"snow_depth",
"freezinglevel_height",
"visibility",
"soil_temperature_0cm",
"soil_temperature_6cm",
"soil_temperature_18cm",
"soil_temperature_54cm",
"soil_moisture_0_1cm",
"soil_moisture_1_3cm",
"soil_moisture_3_9cm",
"soil_moisture_9_27cm",
"soil_moisture_27_81cm",
"uv_index",
"uv_index_clear_sky",
"is_day",
"terrestrial_radiation",
"terrestrial_radiation_instant",
"shortwave_radiation_instant",
"diffuse_radiation_instant",
"direct_radiation_instant",
"direct_normal_irradiance_instant"
];
dailyParams = [
"temperature_2m_max",
"temperature_2m_min",
"apparent_temperature_min",
"apparent_temperature_max",
"precipitation_sum",
"rain_sum",
"showers_sum",
"snowfall_sum",
"precipitation_hours",
"weathercode",
"sunrise",
"sunset",
"windspeed_10m_max",
"windgusts_10m_max",
"winddirection_10m_dominant",
"shortwave_radiation_sum",
"uv_index_max",
"et0_fao_evapotranspiration"
];
constructor (config) {
this.config = {
apiBase: OPEN_METEO_BASE,
lat: 0,
lon: 0,
pastDays: 0,
type: "current",
maxNumberOfDays: 5,
updateInterval: 10 * 60 * 1000,
...config
};
this.locationName = null;
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
}
async initialize () {
await this.#fetchLocation();
this.#initializeFetcher();
}
/**
* Set callbacks for data/error events
* @param {(data: object) => void} onData - Called with weather data
* @param {(error: object) => void} onError - Called with error info
*/
setCallbacks (onData, onError) {
this.onDataCallback = onData;
this.onErrorCallback = onError;
}
/**
* Start periodic fetching
*/
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
/**
* Stop periodic fetching
*/
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
async #fetchLocation () {
const url = `${GEOCODE_BASE}?latitude=${this.config.lat}&longitude=${this.config.lon}&localityLanguage=${this.config.lang || "en"}`;
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 10000);
const response = await fetch(url, { signal: controller.signal });
clearTimeout(timeoutId);
if (!response.ok) {
throw new Error(`HTTP ${response.status}`);
}
const data = await response.json();
if (data && data.city) {
this.locationName = `${data.city}, ${data.principalSubdivisionCode}`;
}
} catch (error) {
Log.debug("[openmeteo] Could not load location data:", error.message);
}
}
#initializeFetcher () {
const url = this.#getUrl();
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers: { "Cache-Control": "no-cache" },
logContext: "weatherprovider.openmeteo"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[openmeteo] Failed to parse JSON:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#handleResponse (data) {
const parsedData = this.#parseWeatherApiResponse(data);
if (!parsedData) {
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Invalid API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
try {
let weatherData;
switch (this.config.type) {
case "current":
weatherData = this.#generateWeatherDayFromCurrentWeather(parsedData);
break;
case "forecast":
case "daily":
weatherData = this.#generateWeatherObjectsFromForecast(parsedData);
break;
case "hourly":
weatherData = this.#generateWeatherObjectsFromHourly(parsedData);
break;
default:
Log.error(`[openmeteo] Unknown type: ${this.config.type}`);
throw new Error(`Unknown weather type: ${this.config.type}`);
}
if (weatherData && this.onDataCallback) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[openmeteo] Error processing weather data:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#getQueryParameters () {
let maxNumberOfDays = this.config.maxNumberOfDays;
if (this.config.maxNumberOfDays !== undefined && !isNaN(parseFloat(this.config.maxNumberOfDays))) {
const maxEntriesLimit = ["daily", "forecast"].includes(this.config.type) ? 7 : this.config.type === "hourly" ? 48 : 0;
const daysFactor = ["daily", "forecast"].includes(this.config.type) ? 1 : this.config.type === "hourly" ? 24 : 0;
const maxEntries = Math.max(1, Math.min(Math.round(parseFloat(this.config.maxNumberOfDays)) * daysFactor, maxEntriesLimit));
maxNumberOfDays = Math.ceil(maxEntries / Math.max(1, daysFactor));
}
const params = {
latitude: this.config.lat,
longitude: this.config.lon,
timeformat: "unixtime",
timezone: "auto",
past_days: this.config.pastDays ?? 0,
daily: this.dailyParams,
hourly: this.hourlyParams,
temperature_unit: "celsius",
windspeed_unit: "ms",
precipitation_unit: "mm"
};
const now = new Date();
const startDate = new Date(now.getFullYear(), now.getMonth(), now.getDate());
const endDate = new Date(startDate);
endDate.setDate(endDate.getDate() + Math.max(0, Math.min(7, maxNumberOfDays)));
params.start_date = getDateString(startDate);
switch (this.config.type) {
case "hourly":
case "daily":
case "forecast":
params.end_date = getDateString(endDate);
break;
case "current":
params.current_weather = true;
params.end_date = params.start_date;
break;
default:
return "";
}
return Object.keys(params)
.filter((key) => params[key] !== undefined && params[key] !== null && params[key] !== "")
.map((key) => {
switch (key) {
case "hourly":
case "daily":
return `${encodeURIComponent(key)}=${params[key].join(",")}`;
default:
return `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`;
}
})
.join("&");
}
#getUrl () {
return `${this.config.apiBase}/forecast?${this.#getQueryParameters()}`;
}
#transposeDataMatrix (data) {
return data.time.map((_, index) => Object.keys(data).reduce((row, key) => {
const value = data[key][index];
return {
...row,
// Convert Unix timestamps to Date objects
// timezone: "auto" returns times already in location timezone
[key]: ["time", "sunrise", "sunset"].includes(key) ? new Date(value * 1000) : value
};
}, {}));
}
#parseWeatherApiResponse (data) {
const validByType = {
current: data.current_weather && data.current_weather.time,
hourly: data.hourly && data.hourly.time && Array.isArray(data.hourly.time) && data.hourly.time.length > 0,
daily: data.daily && data.daily.time && Array.isArray(data.daily.time) && data.daily.time.length > 0
};
const type = ["daily", "forecast"].includes(this.config.type) ? "daily" : this.config.type;
if (!validByType[type]) return null;
if (type === "current" && !validByType.daily && !validByType.hourly) {
return null;
}
for (const key of ["hourly", "daily"]) {
if (typeof data[key] === "object") {
data[key] = this.#transposeDataMatrix(data[key]);
}
}
if (data.current_weather) {
data.current_weather.time = new Date(data.current_weather.time * 1000);
}
return data;
}
#convertWeatherType (weathercode, isDayTime) {
const weatherConditions = {
0: "clear",
1: "mainly-clear",
2: "partly-cloudy",
3: "overcast",
45: "fog",
48: "depositing-rime-fog",
51: "drizzle-light-intensity",
53: "drizzle-moderate-intensity",
55: "drizzle-dense-intensity",
56: "freezing-drizzle-light-intensity",
57: "freezing-drizzle-dense-intensity",
61: "rain-slight-intensity",
63: "rain-moderate-intensity",
65: "rain-heavy-intensity",
66: "freezing-rain-light-intensity",
67: "freezing-rain-heavy-intensity",
71: "snow-fall-slight-intensity",
73: "snow-fall-moderate-intensity",
75: "snow-fall-heavy-intensity",
77: "snow-grains",
80: "rain-showers-slight",
81: "rain-showers-moderate",
82: "rain-showers-violent",
85: "snow-showers-slight",
86: "snow-showers-heavy",
95: "thunderstorm",
96: "thunderstorm-slight-hail",
99: "thunderstorm-heavy-hail"
};
if (!(weathercode in weatherConditions)) return null;
const mappings = {
clear: isDayTime ? "day-sunny" : "night-clear",
"mainly-clear": isDayTime ? "day-cloudy" : "night-alt-cloudy",
"partly-cloudy": isDayTime ? "day-cloudy" : "night-alt-cloudy",
overcast: isDayTime ? "day-sunny-overcast" : "night-alt-partly-cloudy",
fog: isDayTime ? "day-fog" : "night-fog",
"depositing-rime-fog": isDayTime ? "day-fog" : "night-fog",
"drizzle-light-intensity": isDayTime ? "day-sprinkle" : "night-sprinkle",
"rain-slight-intensity": isDayTime ? "day-sprinkle" : "night-sprinkle",
"rain-showers-slight": isDayTime ? "day-sprinkle" : "night-sprinkle",
"drizzle-moderate-intensity": isDayTime ? "day-showers" : "night-showers",
"rain-moderate-intensity": isDayTime ? "day-showers" : "night-showers",
"rain-showers-moderate": isDayTime ? "day-showers" : "night-showers",
"drizzle-dense-intensity": isDayTime ? "day-thunderstorm" : "night-thunderstorm",
"rain-heavy-intensity": isDayTime ? "day-thunderstorm" : "night-thunderstorm",
"rain-showers-violent": isDayTime ? "day-thunderstorm" : "night-thunderstorm",
"freezing-rain-light-intensity": isDayTime ? "day-rain-mix" : "night-rain-mix",
"freezing-drizzle-light-intensity": "snowflake-cold",
"freezing-drizzle-dense-intensity": "snowflake-cold",
"snow-grains": isDayTime ? "day-sleet" : "night-sleet",
"snow-fall-slight-intensity": isDayTime ? "day-snow-wind" : "night-snow-wind",
"snow-fall-moderate-intensity": isDayTime ? "day-snow-wind" : "night-snow-wind",
"snow-fall-heavy-intensity": isDayTime ? "day-snow-thunderstorm" : "night-snow-thunderstorm",
"freezing-rain-heavy-intensity": isDayTime ? "day-snow-thunderstorm" : "night-snow-thunderstorm",
"snow-showers-slight": isDayTime ? "day-rain-mix" : "night-rain-mix",
"snow-showers-heavy": isDayTime ? "day-rain-mix" : "night-rain-mix",
thunderstorm: isDayTime ? "day-thunderstorm" : "night-thunderstorm",
"thunderstorm-slight-hail": isDayTime ? "day-sleet" : "night-sleet",
"thunderstorm-heavy-hail": isDayTime ? "day-sleet-storm" : "night-sleet-storm"
};
return mappings[weatherConditions[`${weathercode}`]] || "na";
}
#isDayTime (date, sunrise, sunset) {
const time = date.getTime();
return time >= sunrise.getTime() && time < sunset.getTime();
}
#generateWeatherDayFromCurrentWeather (parsedData) {
// Basic current weather data
const current = {
date: parsedData.current_weather.time,
windSpeed: parsedData.current_weather.windspeed,
windFromDirection: parsedData.current_weather.winddirection,
temperature: parsedData.current_weather.temperature,
weatherType: this.#convertWeatherType(parsedData.current_weather.weathercode, true)
};
// Add hourly data if available
if (parsedData.hourly) {
let h;
const currentTime = parsedData.current_weather.time;
// Handle both data shapes: object with arrays or array of objects (after transpose)
if (Array.isArray(parsedData.hourly)) {
// Array of objects (after transpose)
const hourlyIndex = parsedData.hourly.findIndex((hour) => hour.time.getTime() === currentTime.getTime());
h = hourlyIndex !== -1 ? hourlyIndex : 0;
if (hourlyIndex === -1) {
Log.debug("[openmeteo] Could not find current time in hourly data, using index 0");
}
const hourData = parsedData.hourly[h];
if (hourData) {
current.humidity = hourData.relativehumidity_2m;
current.feelsLikeTemp = hourData.apparent_temperature;
current.rain = hourData.rain;
current.snow = hourData.snowfall ? hourData.snowfall * 10 : undefined;
current.precipitationAmount = hourData.precipitation;
current.precipitationProbability = hourData.precipitation_probability;
current.uvIndex = hourData.uv_index;
}
} else if (parsedData.hourly.time) {
// Object with arrays (before transpose - shouldn't happen in normal flow)
const hourlyIndex = parsedData.hourly.time.findIndex((time) => time === currentTime);
h = hourlyIndex !== -1 ? hourlyIndex : 0;
if (hourlyIndex === -1) {
Log.debug("[openmeteo] Could not find current time in hourly data, using index 0");
}
current.humidity = parsedData.hourly.relativehumidity_2m?.[h];
current.feelsLikeTemp = parsedData.hourly.apparent_temperature?.[h];
current.rain = parsedData.hourly.rain?.[h];
current.snow = parsedData.hourly.snowfall?.[h] ? parsedData.hourly.snowfall[h] * 10 : undefined;
current.precipitationAmount = parsedData.hourly.precipitation?.[h];
current.precipitationProbability = parsedData.hourly.precipitation_probability?.[h];
current.uvIndex = parsedData.hourly.uv_index?.[h];
}
}
// Add daily data if available (after transpose, daily is array of objects)
if (parsedData.daily && Array.isArray(parsedData.daily) && parsedData.daily[0]) {
const today = parsedData.daily[0];
if (today.sunrise) {
current.sunrise = today.sunrise;
}
if (today.sunset) {
current.sunset = today.sunset;
// Update weatherType with correct day/night status
if (current.sunrise && current.sunset) {
current.weatherType = this.#convertWeatherType(
parsedData.current_weather.weathercode,
this.#isDayTime(parsedData.current_weather.time, current.sunrise, current.sunset)
);
}
}
if (today.temperature_2m_min !== undefined) {
current.minTemperature = today.temperature_2m_min;
}
if (today.temperature_2m_max !== undefined) {
current.maxTemperature = today.temperature_2m_max;
}
}
return current;
}
#generateWeatherObjectsFromForecast (parsedData) {
return parsedData.daily.map((weather) => ({
date: weather.time,
windSpeed: weather.windspeed_10m_max,
windFromDirection: weather.winddirection_10m_dominant,
sunrise: weather.sunrise,
sunset: weather.sunset,
temperature: parseFloat((weather.temperature_2m_max + weather.temperature_2m_min) / 2),
minTemperature: parseFloat(weather.temperature_2m_min),
maxTemperature: parseFloat(weather.temperature_2m_max),
weatherType: this.#convertWeatherType(weather.weathercode, true),
rain: weather.rain_sum != null ? parseFloat(weather.rain_sum) : null,
snow: weather.snowfall_sum != null ? parseFloat(weather.snowfall_sum * 10) : null,
precipitationAmount: weather.precipitation_sum != null ? parseFloat(weather.precipitation_sum) : null,
precipitationProbability: weather.precipitation_hours != null ? parseFloat(weather.precipitation_hours * 100 / 24) : null,
uvIndex: weather.uv_index_max != null ? parseFloat(weather.uv_index_max) : null
}));
}
#generateWeatherObjectsFromHourly (parsedData) {
const hours = [];
const now = new Date();
parsedData.hourly.forEach((weather, i) => {
// Skip past entries
if (weather.time <= now) {
return;
}
// Calculate daily index with bounds check
const h = Math.ceil((i + 1) / 24) - 1;
const safeH = Math.max(0, Math.min(h, parsedData.daily.length - 1));
const dailyData = parsedData.daily[safeH];
const hourlyWeather = {
date: weather.time,
windSpeed: weather.windspeed_10m,
windFromDirection: weather.winddirection_10m,
sunrise: dailyData.sunrise,
sunset: dailyData.sunset,
temperature: parseFloat(weather.temperature_2m),
minTemperature: parseFloat(dailyData.temperature_2m_min),
maxTemperature: parseFloat(dailyData.temperature_2m_max),
weatherType: this.#convertWeatherType(
weather.weathercode,
this.#isDayTime(weather.time, dailyData.sunrise, dailyData.sunset)
),
humidity: weather.relativehumidity_2m != null ? parseFloat(weather.relativehumidity_2m) : null,
rain: weather.rain != null ? parseFloat(weather.rain) : null,
snow: weather.snowfall != null ? parseFloat(weather.snowfall * 10) : null,
precipitationAmount: weather.precipitation != null ? parseFloat(weather.precipitation) : null,
precipitationProbability: weather.precipitation_probability != null ? parseFloat(weather.precipitation_probability) : null,
uvIndex: weather.uv_index != null ? parseFloat(weather.uv_index) : null
};
hours.push(hourlyWeather);
});
return hours;
}
}
module.exports = OpenMeteoProvider;

View File

@@ -0,0 +1,276 @@
const Log = require("logger");
const weatherUtils = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
/**
* Server-side weather provider for OpenWeatherMap
* see https://openweathermap.org/
*/
class OpenWeatherMapProvider {
constructor (config) {
this.config = {
apiVersion: "3.0",
apiBase: "https://api.openweathermap.org/data/",
weatherEndpoint: "/onecall",
locationID: false,
location: false,
lat: 0,
lon: 0,
apiKey: "",
type: "current",
updateInterval: 10 * 60 * 1000,
...config
};
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
this.locationName = null;
}
initialize () {
// Validate callbacks exist
if (typeof this.onErrorCallback !== "function") {
throw new Error("setCallbacks() must be called before initialize()");
}
if (!this.config.apiKey) {
Log.error("[openweathermap] API key is required");
this.onErrorCallback({
message: "API key is required",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
return;
}
this.#initializeFetcher();
}
setCallbacks (onData, onError) {
this.onDataCallback = onData;
this.onErrorCallback = onError;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
#initializeFetcher () {
const url = this.#getUrl();
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers: { "Cache-Control": "no-cache" },
logContext: "weatherprovider.openweathermap"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[openweathermap] Failed to parse JSON:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#handleResponse (data) {
try {
// Set location name from timezone
if (data.timezone) {
this.locationName = data.timezone;
}
let weatherData;
const onecallData = this.#generateWeatherObjectsFromOnecall(data);
switch (this.config.type) {
case "current":
weatherData = onecallData.current;
break;
case "forecast":
case "daily":
weatherData = onecallData.days;
break;
case "hourly":
weatherData = onecallData.hours;
break;
default:
Log.error(`[openweathermap] Unknown type: ${this.config.type}`);
throw new Error(`Unknown weather type: ${this.config.type}`);
}
if (weatherData && this.onDataCallback) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[openweathermap] Error processing weather data:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#generateWeatherObjectsFromOnecall (data) {
let precip;
// Get current weather
const current = {};
if (data.hasOwnProperty("current")) {
const timezoneOffset = data.timezone_offset / 60;
current.date = weatherUtils.applyTimezoneOffset(new Date(data.current.dt * 1000), timezoneOffset);
current.windSpeed = data.current.wind_speed;
current.windFromDirection = data.current.wind_deg;
current.sunrise = weatherUtils.applyTimezoneOffset(new Date(data.current.sunrise * 1000), timezoneOffset);
current.sunset = weatherUtils.applyTimezoneOffset(new Date(data.current.sunset * 1000), timezoneOffset);
current.temperature = data.current.temp;
current.weatherType = weatherUtils.convertWeatherType(data.current.weather[0].icon);
current.humidity = data.current.humidity;
current.uvIndex = data.current.uvi;
precip = false;
if (data.current.hasOwnProperty("rain") && !isNaN(data.current.rain["1h"])) {
current.rain = data.current.rain["1h"];
precip = true;
}
if (data.current.hasOwnProperty("snow") && !isNaN(data.current.snow["1h"])) {
current.snow = data.current.snow["1h"];
precip = true;
}
if (precip) {
current.precipitationAmount = (current.rain ?? 0) + (current.snow ?? 0);
}
current.feelsLikeTemp = data.current.feels_like;
}
// Get hourly weather
const hours = [];
if (data.hasOwnProperty("hourly")) {
const timezoneOffset = data.timezone_offset / 60;
for (const hour of data.hourly) {
const weather = {};
weather.date = weatherUtils.applyTimezoneOffset(new Date(hour.dt * 1000), timezoneOffset);
weather.temperature = hour.temp;
weather.feelsLikeTemp = hour.feels_like;
weather.humidity = hour.humidity;
weather.windSpeed = hour.wind_speed;
weather.windFromDirection = hour.wind_deg;
weather.weatherType = weatherUtils.convertWeatherType(hour.weather[0].icon);
weather.precipitationProbability = hour.pop !== undefined ? hour.pop * 100 : undefined;
weather.uvIndex = hour.uvi;
precip = false;
if (hour.hasOwnProperty("rain") && !isNaN(hour.rain["1h"])) {
weather.rain = hour.rain["1h"];
precip = true;
}
if (hour.hasOwnProperty("snow") && !isNaN(hour.snow["1h"])) {
weather.snow = hour.snow["1h"];
precip = true;
}
if (precip) {
weather.precipitationAmount = (weather.rain ?? 0) + (weather.snow ?? 0);
}
hours.push(weather);
}
}
// Get daily weather
const days = [];
if (data.hasOwnProperty("daily")) {
const timezoneOffset = data.timezone_offset / 60;
for (const day of data.daily) {
const weather = {};
weather.date = weatherUtils.applyTimezoneOffset(new Date(day.dt * 1000), timezoneOffset);
weather.sunrise = weatherUtils.applyTimezoneOffset(new Date(day.sunrise * 1000), timezoneOffset);
weather.sunset = weatherUtils.applyTimezoneOffset(new Date(day.sunset * 1000), timezoneOffset);
weather.minTemperature = day.temp.min;
weather.maxTemperature = day.temp.max;
weather.humidity = day.humidity;
weather.windSpeed = day.wind_speed;
weather.windFromDirection = day.wind_deg;
weather.weatherType = weatherUtils.convertWeatherType(day.weather[0].icon);
weather.precipitationProbability = day.pop !== undefined ? day.pop * 100 : undefined;
weather.uvIndex = day.uvi;
precip = false;
if (!isNaN(day.rain)) {
weather.rain = day.rain;
precip = true;
}
if (!isNaN(day.snow)) {
weather.snow = day.snow;
precip = true;
}
if (precip) {
weather.precipitationAmount = (weather.rain ?? 0) + (weather.snow ?? 0);
}
days.push(weather);
}
}
return { current, hours, days };
}
#getUrl () {
return this.config.apiBase + this.config.apiVersion + this.config.weatherEndpoint + this.#getParams();
}
#getParams () {
let params = "?";
if (this.config.weatherEndpoint === "/onecall") {
params += `lat=${this.config.lat}`;
params += `&lon=${this.config.lon}`;
if (this.config.type === "current") {
params += "&exclude=minutely,hourly,daily";
} else if (this.config.type === "hourly") {
params += "&exclude=current,minutely,daily";
} else if (this.config.type === "daily" || this.config.type === "forecast") {
params += "&exclude=current,minutely,hourly";
} else {
params += "&exclude=minutely";
}
} else if (this.config.lat && this.config.lon) {
params += `lat=${this.config.lat}&lon=${this.config.lon}`;
} else if (this.config.locationID) {
params += `id=${this.config.locationID}`;
} else if (this.config.location) {
params += `q=${this.config.location}`;
}
params += "&units=metric";
params += `&lang=${this.config.lang || "en"}`;
params += `&APPID=${this.config.apiKey}`;
return params;
}
}
module.exports = OpenWeatherMapProvider;

View File

@@ -0,0 +1,270 @@
const Log = require("logger");
const HTTPFetcher = require("#http_fetcher");
class PirateweatherProvider {
constructor (config) {
this.config = {
apiBase: "https://api.pirateweather.net",
weatherEndpoint: "/forecast",
apiKey: "",
lat: 0,
lon: 0,
type: "current",
updateInterval: 10 * 60 * 1000,
lang: "en",
...config
};
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
}
setCallbacks (onDataCallback, onErrorCallback) {
this.onDataCallback = onDataCallback;
this.onErrorCallback = onErrorCallback;
}
initialize () {
if (!this.config.apiKey) {
Log.error("[pirateweather] No API key configured");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "API key required",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
this.#initializeFetcher();
}
#initializeFetcher () {
const url = this.#getUrl();
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers: {
"Cache-Control": "no-cache",
Accept: "application/json"
},
logContext: "weatherprovider.pirateweather"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[pirateweather] Parse error:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#handleResponse (data) {
if (!data || (!data.currently && !data.daily && !data.hourly)) {
Log.error("[pirateweather] No usable data received");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "No usable data in API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
let weatherData;
switch (this.config.type) {
case "current":
weatherData = this.#generateCurrent(data);
break;
case "forecast":
case "daily":
weatherData = this.#generateDaily(data);
break;
case "hourly":
weatherData = this.#generateHourly(data);
break;
default:
Log.error(`[pirateweather] Unknown weather type: ${this.config.type}`);
if (this.onErrorCallback) {
this.onErrorCallback({
message: `Unknown weather type: ${this.config.type}`,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
if (weatherData && this.onDataCallback) {
this.onDataCallback(weatherData);
}
}
#generateCurrent (data) {
if (!data.currently || typeof data.currently.temperature === "undefined") {
return null;
}
const current = {
date: new Date(),
humidity: data.currently.humidity != null ? parseFloat(data.currently.humidity) * 100 : null,
temperature: parseFloat(data.currently.temperature),
feelsLikeTemp: data.currently.apparentTemperature != null ? parseFloat(data.currently.apparentTemperature) : null,
windSpeed: data.currently.windSpeed != null ? parseFloat(data.currently.windSpeed) : null,
windFromDirection: data.currently.windBearing || null,
weatherType: this.#convertWeatherType(data.currently.icon),
sunrise: null,
sunset: null
};
// Add sunrise/sunset from daily data if available
if (data.daily && data.daily.data && data.daily.data.length > 0) {
const today = data.daily.data[0];
if (today.sunriseTime) {
current.sunrise = new Date(today.sunriseTime * 1000);
}
if (today.sunsetTime) {
current.sunset = new Date(today.sunsetTime * 1000);
}
}
return current;
}
#generateDaily (data) {
if (!data.daily || !data.daily.data || !data.daily.data.length) {
return [];
}
const days = [];
for (const forecast of data.daily.data) {
const day = {
date: new Date(forecast.time * 1000),
minTemperature: forecast.temperatureMin != null ? parseFloat(forecast.temperatureMin) : null,
maxTemperature: forecast.temperatureMax != null ? parseFloat(forecast.temperatureMax) : null,
weatherType: this.#convertWeatherType(forecast.icon),
snow: 0,
rain: 0,
precipitationAmount: 0,
precipitationProbability: forecast.precipProbability != null ? parseFloat(forecast.precipProbability) * 100 : null
};
// Handle precipitation
let precip = 0;
if (forecast.hasOwnProperty("precipAccumulation")) {
precip = forecast.precipAccumulation * 10; // cm to mm
}
day.precipitationAmount = precip;
if (forecast.precipType) {
if (forecast.precipType === "snow") {
day.snow = precip;
} else {
day.rain = precip;
}
}
days.push(day);
}
return days;
}
#generateHourly (data) {
if (!data.hourly || !data.hourly.data || !data.hourly.data.length) {
return [];
}
const hours = [];
for (const forecast of data.hourly.data) {
const hour = {
date: new Date(forecast.time * 1000),
temperature: forecast.temperature !== undefined ? parseFloat(forecast.temperature) : null,
feelsLikeTemp: forecast.apparentTemperature !== undefined ? parseFloat(forecast.apparentTemperature) : null,
weatherType: this.#convertWeatherType(forecast.icon),
windSpeed: forecast.windSpeed !== undefined ? parseFloat(forecast.windSpeed) : null,
windFromDirection: forecast.windBearing || null,
precipitationProbability: forecast.precipProbability ? parseFloat(forecast.precipProbability) * 100 : null,
snow: 0,
rain: 0,
precipitationAmount: 0
};
// Handle precipitation
let precip = 0;
if (forecast.hasOwnProperty("precipAccumulation")) {
precip = forecast.precipAccumulation * 10; // cm to mm
}
hour.precipitationAmount = precip;
if (forecast.precipType) {
if (forecast.precipType === "snow") {
hour.snow = precip;
} else {
hour.rain = precip;
}
}
hours.push(hour);
}
return hours;
}
#getUrl () {
const apiBase = this.config.apiBase || "https://api.pirateweather.net";
const weatherEndpoint = this.config.weatherEndpoint || "/forecast";
const lang = this.config.lang || "en";
return `${apiBase}${weatherEndpoint}/${this.config.apiKey}/${this.config.lat},${this.config.lon}?units=si&lang=${lang}`;
}
#convertWeatherType (weatherType) {
const weatherTypes = {
"clear-day": "day-sunny",
"clear-night": "night-clear",
rain: "rain",
snow: "snow",
sleet: "snow",
wind: "windy",
fog: "fog",
cloudy: "cloudy",
"partly-cloudy-day": "day-cloudy",
"partly-cloudy-night": "night-cloudy"
};
return weatherTypes[weatherType] || null;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
}
module.exports = PirateweatherProvider;

View File

@@ -0,0 +1,397 @@
const Log = require("logger");
const { getSunTimes, isDayTime, validateCoordinates } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
/**
* Server-side weather provider for SMHI (Swedish Meteorological and Hydrological Institute)
* Sweden only, metric system
* API: https://opendata.smhi.se/apidocs/metfcst/
*/
class SMHIProvider {
constructor (config) {
this.config = {
lat: 0,
lon: 0,
precipitationValue: "pmedian", // pmin, pmean, pmedian, pmax
type: "current",
updateInterval: 5 * 60 * 1000,
...config
};
// Validate precipitationValue
if (!["pmin", "pmean", "pmedian", "pmax"].includes(this.config.precipitationValue)) {
Log.warn(`[smhi] Invalid precipitationValue: ${this.config.precipitationValue}, using pmedian`);
this.config.precipitationValue = "pmedian";
}
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
}
initialize () {
try {
// SMHI requires max 6 decimal places
validateCoordinates(this.config, 6);
this.#initializeFetcher();
} catch (error) {
Log.error("[smhi] Initialization failed:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
setCallbacks (onData, onError) {
this.onDataCallback = onData;
this.onErrorCallback = onError;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
#initializeFetcher () {
const url = this.#getUrl();
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
logContext: "weatherprovider.smhi"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[smhi] Failed to parse JSON:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#handleResponse (data) {
try {
if (!data.timeSeries || !Array.isArray(data.timeSeries)) {
throw new Error("Invalid weather data");
}
const coordinates = this.#resolveCoordinates(data);
let weatherData;
switch (this.config.type) {
case "current":
weatherData = this.#generateCurrentWeather(data.timeSeries, coordinates);
break;
case "forecast":
case "daily":
weatherData = this.#generateForecast(data.timeSeries, coordinates);
break;
case "hourly":
weatherData = this.#generateHourly(data.timeSeries, coordinates);
break;
default:
Log.error(`[smhi] Unknown weather type: ${this.config.type}`);
if (this.onErrorCallback) {
this.onErrorCallback({
message: `Unknown weather type: ${this.config.type}`,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
if (this.onDataCallback) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[smhi] Error processing weather data:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#generateCurrentWeather (timeSeries, coordinates) {
const closest = this.#getClosestToCurrentTime(timeSeries);
return this.#convertWeatherDataToObject(closest, coordinates);
}
#generateForecast (timeSeries, coordinates) {
const filled = this.#fillInGaps(timeSeries);
return this.#convertWeatherDataGroupedBy(filled, coordinates, "day");
}
#generateHourly (timeSeries, coordinates) {
const filled = this.#fillInGaps(timeSeries);
return this.#convertWeatherDataGroupedBy(filled, coordinates, "hour");
}
#getClosestToCurrentTime (times) {
const now = new Date();
let minDiff = null;
let closest = times[0];
for (const time of times) {
const validTime = new Date(time.validTime);
const diff = Math.abs(validTime - now);
if (minDiff === null || diff < minDiff) {
minDiff = diff;
closest = time;
}
}
return closest;
}
#convertWeatherDataToObject (weatherData, coordinates) {
const date = new Date(weatherData.validTime);
const { sunrise, sunset } = getSunTimes(date, coordinates.lat, coordinates.lon);
const isDay = isDayTime(date, sunrise, sunset);
const current = {
date: date,
humidity: this.#paramValue(weatherData, "r"),
temperature: this.#paramValue(weatherData, "t"),
windSpeed: this.#paramValue(weatherData, "ws"),
windFromDirection: this.#paramValue(weatherData, "wd"),
weatherType: this.#convertWeatherType(this.#paramValue(weatherData, "Wsymb2"), isDay),
feelsLikeTemp: this.#calculateApparentTemperature(weatherData),
sunrise: sunrise,
sunset: sunset,
snow: 0,
rain: 0,
precipitationAmount: 0
};
// Determine precipitation amount and category
const precipitationValue = this.#paramValue(weatherData, this.config.precipitationValue);
const pcat = this.#paramValue(weatherData, "pcat");
switch (pcat) {
case 1: // Snow
current.snow = precipitationValue;
current.precipitationAmount = precipitationValue;
break;
case 2: // Snow and rain (50/50 split)
current.snow = precipitationValue / 2;
current.rain = precipitationValue / 2;
current.precipitationAmount = precipitationValue;
break;
case 3: // Rain
case 4: // Drizzle
case 5: // Freezing rain
case 6: // Freezing drizzle
current.rain = precipitationValue;
current.precipitationAmount = precipitationValue;
break;
// case 0: No precipitation - defaults already set to 0
}
return current;
}
#convertWeatherDataGroupedBy (allWeatherData, coordinates, groupBy = "day") {
const result = [];
let currentWeather = null;
let dayWeatherTypes = [];
const allWeatherObjects = allWeatherData.map((data) => this.#convertWeatherDataToObject(data, coordinates));
for (const weatherObject of allWeatherObjects) {
const objDate = new Date(weatherObject.date);
// Check if we need a new group (day or hour change)
const needNewGroup = !currentWeather || !this.#isSamePeriod(currentWeather.date, objDate, groupBy);
if (needNewGroup) {
currentWeather = {
date: objDate,
temperature: weatherObject.temperature,
minTemperature: Infinity,
maxTemperature: -Infinity,
snow: 0,
rain: 0,
precipitationAmount: 0,
sunrise: weatherObject.sunrise,
sunset: weatherObject.sunset
};
dayWeatherTypes = [];
result.push(currentWeather);
}
// Track weather types during daytime
const { sunrise: daySunrise, sunset: daySunset } = getSunTimes(objDate, coordinates.lat, coordinates.lon);
const isDay = isDayTime(objDate, daySunrise, daySunset);
if (isDay) {
dayWeatherTypes.push(weatherObject.weatherType);
}
// Use median weather type from daytime hours
if (dayWeatherTypes.length > 0) {
currentWeather.weatherType = dayWeatherTypes[Math.floor(dayWeatherTypes.length / 2)];
} else {
currentWeather.weatherType = weatherObject.weatherType;
}
// Aggregate min/max and precipitation
currentWeather.minTemperature = Math.min(currentWeather.minTemperature, weatherObject.temperature);
currentWeather.maxTemperature = Math.max(currentWeather.maxTemperature, weatherObject.temperature);
currentWeather.snow += weatherObject.snow;
currentWeather.rain += weatherObject.rain;
currentWeather.precipitationAmount += weatherObject.precipitationAmount;
}
return result;
}
#isSamePeriod (date1, date2, groupBy) {
if (groupBy === "hour") {
return date1.getFullYear() === date2.getFullYear()
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate()
&& date1.getHours() === date2.getHours();
} else { // day
return date1.getFullYear() === date2.getFullYear()
&& date1.getMonth() === date2.getMonth()
&& date1.getDate() === date2.getDate();
}
}
#fillInGaps (data) {
if (data.length === 0) return [];
const result = [];
result.push(data[0]); // Keep first data point
for (let i = 1; i < data.length; i++) {
const from = new Date(data[i - 1].validTime);
const to = new Date(data[i].validTime);
const hours = Math.floor((to - from) / (1000 * 60 * 60));
// Fill gaps with previous data point (start at j=1 since j=0 is already pushed)
for (let j = 1; j < hours; j++) {
const current = { ...data[i - 1] };
const newTime = new Date(from);
newTime.setHours(from.getHours() + j);
current.validTime = newTime.toISOString();
result.push(current);
}
// Push original data point
result.push(data[i]);
}
return result;
}
#resolveCoordinates (data) {
// SMHI returns coordinates in [lon, lat] format
// Fall back to config if response structure is unexpected
if (data?.geometry?.coordinates?.[0] && Array.isArray(data.geometry.coordinates[0]) && data.geometry.coordinates[0].length >= 2) {
return {
lat: data.geometry.coordinates[0][1],
lon: data.geometry.coordinates[0][0]
};
}
Log.warn("[smhi] Invalid coordinate structure in response, using config values");
return {
lat: this.config.lat,
lon: this.config.lon
};
}
#calculateApparentTemperature (weatherData) {
const Ta = this.#paramValue(weatherData, "t");
const rh = this.#paramValue(weatherData, "r");
const ws = this.#paramValue(weatherData, "ws");
const p = (rh / 100) * 6.105 * Math.exp((17.27 * Ta) / (237.7 + Ta));
return Ta + 0.33 * p - 0.7 * ws - 4;
}
#paramValue (weatherData, name) {
const param = weatherData.parameters.find((p) => p.name === name);
return param ? param.values[0] : null;
}
#convertWeatherType (input, isDayTime) {
switch (input) {
case 1:
return isDayTime ? "day-sunny" : "night-clear"; // Clear sky
case 2:
return isDayTime ? "day-sunny-overcast" : "night-partly-cloudy"; // Nearly clear sky
case 3:
case 4:
return isDayTime ? "day-cloudy" : "night-cloudy"; // Variable/halfclear cloudiness
case 5:
case 6:
return "cloudy"; // Cloudy/overcast
case 7:
return "fog";
case 8:
case 9:
case 10:
return "showers"; // Light/moderate/heavy rain showers
case 11:
case 21:
return "thunderstorm";
case 12:
case 13:
case 14:
case 22:
case 23:
case 24:
return "sleet"; // Light/moderate/heavy sleet (showers)
case 15:
case 16:
case 17:
case 25:
case 26:
case 27:
return "snow"; // Light/moderate/heavy snow (showers/fall)
case 18:
case 19:
case 20:
return "rain"; // Light/moderate/heavy rain
default:
return null;
}
}
#getUrl () {
const lon = this.config.lon.toFixed(6);
const lat = this.config.lat.toFixed(6);
return `https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/${lon}/lat/${lat}/data.json`;
}
}
module.exports = SMHIProvider;

View File

@@ -0,0 +1,329 @@
const Log = require("logger");
const { getSunTimes } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
/**
* UK Met Office Data Hub provider
* For more information: https://www.metoffice.gov.uk/services/data/datapoint/notifications/weather-datahub
*
* Data available:
* - Hourly data for next 2 days (for current weather)
* - 3-hourly data for next 7 days (for hourly forecasts)
* - Daily data for next 7 days (for daily forecasts)
*
* Free accounts limited to 360 requests/day per service (once every 4 minutes)
*/
class UkMetOfficeDataHubProvider {
constructor (config) {
this.config = {
apiBase: "https://data.hub.api.metoffice.gov.uk/sitespecific/v0/point/",
apiKey: "",
lat: 0,
lon: 0,
type: "current",
updateInterval: 10 * 60 * 1000,
...config
};
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
}
setCallbacks (onDataCallback, onErrorCallback) {
this.onDataCallback = onDataCallback;
this.onErrorCallback = onErrorCallback;
}
initialize () {
if (!this.config.apiKey || this.config.apiKey === "YOUR_API_KEY_HERE") {
Log.error("[ukmetofficedatahub] No API key configured");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "UK Met Office DataHub API key required. Get one at https://datahub.metoffice.gov.uk/",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
this.#initializeFetcher();
}
#initializeFetcher () {
const forecastType = this.#getForecastType();
const url = this.#getUrl(forecastType);
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers: {
Accept: "application/json",
apikey: this.config.apiKey
},
logContext: "weatherprovider.ukmetofficedatahub"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[ukmetofficedatahub] Parse error:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#getForecastType () {
switch (this.config.type) {
case "hourly":
return "three-hourly";
case "forecast":
case "daily":
return "daily";
case "current":
default:
return "hourly";
}
}
#getUrl (forecastType) {
const base = this.config.apiBase.endsWith("/") ? this.config.apiBase : `${this.config.apiBase}/`;
const queryStrings = `?latitude=${this.config.lat}&longitude=${this.config.lon}&includeLocationName=true`;
return `${base}${forecastType}${queryStrings}`;
}
#handleResponse (data) {
if (!data || !data.features || !data.features[0] || !data.features[0].properties || !data.features[0].properties.timeSeries || data.features[0].properties.timeSeries.length === 0) {
Log.error("[ukmetofficedatahub] No usable data received");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "No usable data in API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
let weatherData;
switch (this.config.type) {
case "current":
weatherData = this.#generateCurrent(data);
break;
case "forecast":
case "daily":
weatherData = this.#generateDaily(data);
break;
case "hourly":
weatherData = this.#generateHourly(data);
break;
default:
Log.error(`[ukmetofficedatahub] Unknown weather type: ${this.config.type}`);
if (this.onErrorCallback) {
this.onErrorCallback({
message: `Unknown weather type: ${this.config.type}`,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
if (weatherData && this.onDataCallback) {
this.onDataCallback(weatherData);
}
}
#generateCurrent (data) {
const timeSeries = data.features[0].properties.timeSeries;
const now = new Date();
// Find the hour that contains current time
for (const hour of timeSeries) {
const forecastTime = new Date(hour.time);
const oneHourLater = new Date(forecastTime.getTime() + 60 * 60 * 1000);
if (now >= forecastTime && now < oneHourLater) {
const current = {
date: forecastTime,
temperature: hour.screenTemperature || null,
minTemperature: hour.minScreenAirTemp || null,
maxTemperature: hour.maxScreenAirTemp || null,
windSpeed: hour.windSpeed10m || null,
windFromDirection: hour.windDirectionFrom10m || null,
weatherType: this.#convertWeatherType(hour.significantWeatherCode),
humidity: hour.screenRelativeHumidity || null,
rain: hour.totalPrecipAmount || 0,
snow: hour.totalSnowAmount || 0,
precipitationAmount: (hour.totalPrecipAmount || 0) + (hour.totalSnowAmount || 0),
precipitationProbability: hour.probOfPrecipitation || null,
feelsLikeTemp: hour.feelsLikeTemperature || null,
sunrise: null,
sunset: null
};
// Calculate sunrise/sunset using SunCalc
const { sunrise, sunset } = getSunTimes(now, this.config.lat, this.config.lon);
current.sunrise = sunrise;
current.sunset = sunset;
return current;
}
}
// Fallback to first hour if no match found
const firstHour = timeSeries[0];
const current = {
date: new Date(firstHour.time),
temperature: firstHour.screenTemperature || null,
windSpeed: firstHour.windSpeed10m || null,
windFromDirection: firstHour.windDirectionFrom10m || null,
weatherType: this.#convertWeatherType(firstHour.significantWeatherCode),
humidity: firstHour.screenRelativeHumidity || null,
rain: firstHour.totalPrecipAmount || 0,
snow: firstHour.totalSnowAmount || 0,
precipitationAmount: (firstHour.totalPrecipAmount || 0) + (firstHour.totalSnowAmount || 0),
precipitationProbability: firstHour.probOfPrecipitation || null,
feelsLikeTemp: firstHour.feelsLikeTemperature || null,
sunrise: null,
sunset: null
};
const { sunrise, sunset } = getSunTimes(now, this.config.lat, this.config.lon);
current.sunrise = sunrise;
current.sunset = sunset;
return current;
}
#generateDaily (data) {
const timeSeries = data.features[0].properties.timeSeries;
const days = [];
const today = new Date();
today.setHours(0, 0, 0, 0);
for (const day of timeSeries) {
const forecastDate = new Date(day.time);
forecastDate.setHours(0, 0, 0, 0);
// Only include today and future days
if (forecastDate >= today) {
days.push({
date: new Date(day.time),
minTemperature: day.nightMinScreenTemperature || null,
maxTemperature: day.dayMaxScreenTemperature || null,
temperature: day.dayMaxScreenTemperature || null,
windSpeed: day.midday10MWindSpeed || null,
windFromDirection: day.midday10MWindDirection || null,
weatherType: this.#convertWeatherType(day.daySignificantWeatherCode),
humidity: day.middayRelativeHumidity || null,
rain: day.dayProbabilityOfRain || 0,
snow: day.dayProbabilityOfSnow || 0,
precipitationAmount: 0,
precipitationProbability: day.dayProbabilityOfPrecipitation || null,
feelsLikeTemp: day.dayMaxFeelsLikeTemp || null
});
}
}
return days;
}
#generateHourly (data) {
const timeSeries = data.features[0].properties.timeSeries;
const hours = [];
for (const hour of timeSeries) {
// 3-hourly data uses maxScreenAirTemp/minScreenAirTemp, not screenTemperature
const temp = hour.screenTemperature !== undefined
? hour.screenTemperature
: (hour.maxScreenAirTemp !== undefined && hour.minScreenAirTemp !== undefined)
? (hour.maxScreenAirTemp + hour.minScreenAirTemp) / 2
: null;
hours.push({
date: new Date(hour.time),
temperature: temp,
windSpeed: hour.windSpeed10m || null,
windFromDirection: hour.windDirectionFrom10m || null,
weatherType: this.#convertWeatherType(hour.significantWeatherCode),
humidity: hour.screenRelativeHumidity || null,
rain: hour.totalPrecipAmount || 0,
snow: hour.totalSnowAmount || 0,
precipitationAmount: (hour.totalPrecipAmount || 0) + (hour.totalSnowAmount || 0),
precipitationProbability: hour.probOfPrecipitation || null,
feelsLikeTemp: hour.feelsLikeTemp || null
});
}
return hours;
}
/**
* Convert Met Office significant weather code to weathericons.css icon
* See: https://metoffice.apiconnect.ibmcloud.com/metoffice/production/node/264
* @param {number} weatherType - Met Office weather code
* @returns {string|null} Weathericons.css icon name or null
*/
#convertWeatherType (weatherType) {
const weatherTypes = {
0: "night-clear",
1: "day-sunny",
2: "night-alt-cloudy",
3: "day-cloudy",
5: "fog",
6: "fog",
7: "cloudy",
8: "cloud",
9: "night-sprinkle",
10: "day-sprinkle",
11: "raindrops",
12: "sprinkle",
13: "night-alt-showers",
14: "day-showers",
15: "rain",
16: "night-alt-sleet",
17: "day-sleet",
18: "sleet",
19: "night-alt-hail",
20: "day-hail",
21: "hail",
22: "night-alt-snow",
23: "day-snow",
24: "snow",
25: "night-alt-snow",
26: "day-snow",
27: "snow",
28: "night-alt-thunderstorm",
29: "day-thunderstorm",
30: "thunderstorm"
};
return weatherTypes[weatherType] || null;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
}
module.exports = UkMetOfficeDataHubProvider;

View File

@@ -0,0 +1,490 @@
const Log = require("logger");
const { convertKmhToMs, cardinalToDegrees } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
const WEATHER_API_BASE = "https://api.weatherapi.com/v1";
class WeatherAPIProvider {
constructor (config) {
this.config = {
apiBase: WEATHER_API_BASE,
lat: 0,
lon: 0,
type: "current",
apiKey: "",
lang: "en",
maxEntries: 5,
maxNumberOfDays: 5,
updateInterval: 10 * 60 * 1000,
...config
};
this.locationName = null;
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
}
initialize () {
this.#validateConfig();
this.#initializeFetcher();
}
setCallbacks (onData, onError) {
this.onDataCallback = onData;
this.onErrorCallback = onError;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
#validateConfig () {
this.config.type = `${this.config.type ?? ""}`.trim().toLowerCase();
if (this.config.type === "forecast") {
this.config.type = "daily";
}
if (!["hourly", "daily", "current"].includes(this.config.type)) {
throw new Error(`Unknown weather type: ${this.config.type}`);
}
if (!this.config.apiKey || `${this.config.apiKey}`.trim() === "") {
throw new Error("apiKey is required");
}
if (!Number.isFinite(this.config.lat) || !Number.isFinite(this.config.lon)) {
throw new Error("Latitude and longitude are required");
}
}
#initializeFetcher () {
const url = this.#getUrl();
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers: { "Cache-Control": "no-cache" },
logContext: "weatherprovider.weatherapi"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[weatherapi] Failed to parse JSON:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#handleResponse (data) {
let parsedData;
try {
parsedData = this.#parseResponse(data);
} catch (error) {
Log.error("[weatherapi] Invalid API response:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Invalid API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
try {
let weatherData;
switch (this.config.type) {
case "current":
weatherData = this.#generateCurrent(parsedData);
break;
case "daily":
weatherData = this.#generateDaily(parsedData);
break;
case "hourly":
weatherData = this.#generateHourly(parsedData);
break;
default:
throw new Error(`Unknown weather type: ${this.config.type}`);
}
if (this.onDataCallback && weatherData) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[weatherapi] Error processing weather data:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#getQueryParameters () {
const maxEntries = Number.isFinite(this.config.maxEntries)
? Math.max(1, this.config.maxEntries)
: 5;
const requestedDays = Number.isFinite(this.config.maxNumberOfDays)
? Math.max(1, this.config.maxNumberOfDays)
: 5;
const hourlyDays = Math.max(1, Math.ceil(maxEntries / 24));
const days = this.config.type === "hourly"
? Math.min(14, Math.max(requestedDays, hourlyDays))
: this.config.type === "daily"
? Math.min(14, requestedDays)
: 1;
const params = {
q: `${this.config.lat},${this.config.lon}`,
days,
lang: this.config.lang,
key: this.config.apiKey
};
return Object.keys(params)
.filter((key) => params[key] !== undefined && params[key] !== null && `${params[key]}`.trim() !== "")
.map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(params[key])}`)
.join("&");
}
#getUrl () {
return `${this.config.apiBase}/forecast.json?${this.#getQueryParameters()}`;
}
#parseResponse (responseData) {
responseData.location ??= {};
responseData.current ??= {};
responseData.current.condition ??= {};
responseData.forecast ??= {};
responseData.forecast.forecastday ??= [];
responseData.forecast.forecastday = responseData.forecast.forecastday.map((forecastDay) => ({
...forecastDay,
astro: forecastDay.astro ?? {},
day: forecastDay.day ?? {},
hour: forecastDay.hour ?? []
}));
const locationParts = [
responseData.location.name,
responseData.location.region,
responseData.location.country
]
.map((value) => `${value}`.trim())
.filter((value) => value !== "");
if (locationParts.length > 0) {
this.locationName = locationParts.join(", ").trim();
}
if (
!responseData.location
|| !responseData.current
|| !responseData.forecast
|| !Array.isArray(responseData.forecast.forecastday)
) {
throw new Error("Invalid API response");
}
return responseData;
}
#parseSunDatetime (forecastDay, key) {
const timeValue = forecastDay?.astro?.[key];
if (!timeValue || !forecastDay?.date) {
return null;
}
const match = (/^\s*(\d{1,2}):(\d{2})\s*(AM|PM)\s*$/i).exec(timeValue);
if (!match) {
return null;
}
let hour = parseInt(match[1], 10);
const minute = parseInt(match[2], 10);
const period = match[3].toUpperCase();
if (period === "PM" && hour !== 12) hour += 12;
if (period === "AM" && hour === 12) hour = 0;
const date = new Date(`${forecastDay.date}T00:00:00`);
date.setHours(hour, minute, 0, 0);
return date;
}
#toNumber (value) {
const number = parseFloat(value);
return Number.isFinite(number) ? number : null;
}
#generateCurrent (data) {
const weather = data.forecast.forecastday[0] ?? {};
const current = data.current ?? {};
const currentWeather = {
date: current.last_updated_epoch ? new Date(current.last_updated_epoch * 1000) : new Date()
};
const humidity = this.#toNumber(current.humidity);
if (humidity !== null) currentWeather.humidity = humidity;
const temperature = this.#toNumber(current.temp_c);
if (temperature !== null) currentWeather.temperature = temperature;
const feelsLikeTemp = this.#toNumber(current.feelslike_c);
if (feelsLikeTemp !== null) currentWeather.feelsLikeTemp = feelsLikeTemp;
const windSpeed = this.#toNumber(current.wind_kph);
if (windSpeed !== null) currentWeather.windSpeed = convertKmhToMs(windSpeed);
const windFromDirection = this.#toNumber(current.wind_degree);
if (windFromDirection !== null) currentWeather.windFromDirection = windFromDirection;
if (current.condition?.code !== undefined) {
currentWeather.weatherType = this.#convertWeatherType(current.condition.code, current.is_day === 1);
}
const sunrise = this.#parseSunDatetime(weather, "sunrise");
const sunset = this.#parseSunDatetime(weather, "sunset");
if (sunrise) currentWeather.sunrise = sunrise;
if (sunset) currentWeather.sunset = sunset;
const minTemperature = this.#toNumber(weather.day?.mintemp_c);
if (minTemperature !== null) currentWeather.minTemperature = minTemperature;
const maxTemperature = this.#toNumber(weather.day?.maxtemp_c);
if (maxTemperature !== null) currentWeather.maxTemperature = maxTemperature;
const snow = this.#toNumber(current.snow_cm);
if (snow !== null) currentWeather.snow = snow * 10;
const rain = this.#toNumber(current.precip_mm);
if (rain !== null) currentWeather.rain = rain;
if (rain !== null || snow !== null) {
currentWeather.precipitationAmount = (rain ?? 0) + ((snow ?? 0) * 10);
}
return currentWeather;
}
#generateDaily (data) {
const days = [];
const forecastDays = data.forecast.forecastday ?? [];
for (const forecastDay of forecastDays) {
const weather = {};
const dayDate = forecastDay.date_epoch
? new Date(forecastDay.date_epoch * 1000)
: new Date(`${forecastDay.date}T00:00:00`);
const precipitationProbability = forecastDay.hour?.length > 0
? (forecastDay.hour.reduce((sum, hourData) => {
const rain = this.#toNumber(hourData.will_it_rain) ?? 0;
const snow = this.#toNumber(hourData.will_it_snow) ?? 0;
return sum + ((rain + snow) / 2);
}, 0) / forecastDay.hour.length) * 100
: null;
const avgWindDegree = forecastDay.hour?.length > 0
? forecastDay.hour.reduce((sum, hourData) => {
return sum + (this.#toNumber(hourData.wind_degree) ?? 0);
}, 0) / forecastDay.hour.length
: null;
weather.date = dayDate;
weather.minTemperature = this.#toNumber(forecastDay.day?.mintemp_c);
weather.maxTemperature = this.#toNumber(forecastDay.day?.maxtemp_c);
weather.weatherType = this.#convertWeatherType(forecastDay.day?.condition?.code, true);
const maxWind = this.#toNumber(forecastDay.day?.maxwind_kph);
if (maxWind !== null) weather.windSpeed = convertKmhToMs(maxWind);
if (avgWindDegree !== null) {
weather.windFromDirection = avgWindDegree;
}
const sunrise = this.#parseSunDatetime(forecastDay, "sunrise");
const sunset = this.#parseSunDatetime(forecastDay, "sunset");
if (sunrise) weather.sunrise = sunrise;
if (sunset) weather.sunset = sunset;
weather.temperature = this.#toNumber(forecastDay.day?.avgtemp_c);
weather.humidity = this.#toNumber(forecastDay.day?.avghumidity);
const snow = this.#toNumber(forecastDay.day?.totalsnow_cm);
if (snow !== null) weather.snow = snow * 10;
const rain = this.#toNumber(forecastDay.day?.totalprecip_mm);
if (rain !== null) weather.rain = rain;
if (rain !== null || snow !== null) {
weather.precipitationAmount = (rain ?? 0) + ((snow ?? 0) * 10);
}
if (precipitationProbability !== null) {
weather.precipitationProbability = precipitationProbability;
}
weather.uv_index = this.#toNumber(forecastDay.day?.uv);
days.push(weather);
if (days.length >= this.config.maxEntries) {
break;
}
}
return days;
}
#generateHourly (data) {
const hours = [];
const nowStart = new Date();
nowStart.setMinutes(0, 0, 0);
nowStart.setHours(nowStart.getHours() + 1);
for (const forecastDay of data.forecast.forecastday ?? []) {
for (const hourData of forecastDay.hour ?? []) {
const date = hourData.time_epoch
? new Date(hourData.time_epoch * 1000)
: new Date(hourData.time);
if (date < nowStart) {
continue;
}
const weather = { date };
const sunrise = this.#parseSunDatetime(forecastDay, "sunrise");
const sunset = this.#parseSunDatetime(forecastDay, "sunset");
if (sunrise) weather.sunrise = sunrise;
if (sunset) weather.sunset = sunset;
weather.minTemperature = this.#toNumber(forecastDay.day?.mintemp_c);
weather.maxTemperature = this.#toNumber(forecastDay.day?.maxtemp_c);
weather.humidity = this.#toNumber(hourData.humidity);
const windSpeed = this.#toNumber(hourData.wind_kph);
if (windSpeed !== null) weather.windSpeed = convertKmhToMs(windSpeed);
const windDegree = this.#toNumber(hourData.wind_degree);
weather.windFromDirection = windDegree !== null
? windDegree
: cardinalToDegrees(hourData.wind_dir);
weather.weatherType = this.#convertWeatherType(hourData.condition?.code, hourData.is_day === 1);
const snow = this.#toNumber(hourData.snow_cm);
if (snow !== null) weather.snow = snow * 10;
weather.temperature = this.#toNumber(hourData.temp_c);
weather.precipitationAmount = this.#toNumber(hourData.precip_mm);
const willRain = this.#toNumber(hourData.will_it_rain) ?? 0;
const willSnow = this.#toNumber(hourData.will_it_snow) ?? 0;
weather.precipitationProbability = (willRain + willSnow) * 50;
weather.uv_index = this.#toNumber(hourData.uv);
hours.push(weather);
if (hours.length >= this.config.maxEntries) {
break;
}
}
if (hours.length >= this.config.maxEntries) {
break;
}
}
return hours;
}
#convertWeatherType (weatherCode, isDayTime) {
const weatherConditions = {
1000: { day: "day-sunny", night: "night-clear" },
1003: { day: "day-cloudy", night: "night-alt-cloudy" },
1006: { day: "day-cloudy", night: "night-alt-cloudy" },
1009: { day: "day-sunny-overcast", night: "night-alt-partly-cloudy" },
1030: { day: "day-fog", night: "night-fog" },
1063: { day: "day-sprinkle", night: "night-sprinkle" },
1066: { day: "day-snow-wind", night: "night-snow-wind" },
1069: { day: "day-sleet", night: "night-sleet" },
1072: { day: "day-sprinkle", night: "night-sprinkle" },
1087: { day: "day-thunderstorm", night: "night-thunderstorm" },
1114: { day: "day-snow-wind", night: "night-snow-wind" },
1117: { day: "windy", night: "windy" },
1135: { day: "day-fog", night: "night-fog" },
1147: { day: "day-fog", night: "night-fog" },
1150: { day: "day-sprinkle", night: "night-sprinkle" },
1153: { day: "day-sprinkle", night: "night-sprinkle" },
1168: { day: "day-sprinkle", night: "night-sprinkle" },
1171: { day: "day-sprinkle", night: "night-sprinkle" },
1180: { day: "day-sprinkle", night: "night-sprinkle" },
1183: { day: "day-sprinkle", night: "night-sprinkle" },
1186: { day: "day-showers", night: "night-showers" },
1189: { day: "day-showers", night: "night-showers" },
1192: { day: "day-showers", night: "night-showers" },
1195: { day: "day-showers", night: "night-showers" },
1198: { day: "day-thunderstorm", night: "night-thunderstorm" },
1201: { day: "day-thunderstorm", night: "night-thunderstorm" },
1204: { day: "day-sprinkle", night: "night-sprinkle" },
1207: { day: "day-showers", night: "night-showers" },
1210: { day: "snowflake-cold", night: "snowflake-cold" },
1213: { day: "snowflake-cold", night: "snowflake-cold" },
1216: { day: "snowflake-cold", night: "snowflake-cold" },
1219: { day: "snowflake-cold", night: "snowflake-cold" },
1222: { day: "snowflake-cold", night: "snowflake-cold" },
1225: { day: "snowflake-cold", night: "snowflake-cold" },
1237: { day: "day-sleet", night: "night-sleet" },
1240: { day: "day-sprinkle", night: "night-sprinkle" },
1243: { day: "day-showers", night: "night-showers" },
1246: { day: "day-showers", night: "night-showers" },
1249: { day: "day-showers", night: "night-showers" },
1252: { day: "day-showers", night: "night-showers" },
1255: { day: "day-snow-wind", night: "night-snow-wind" },
1258: { day: "day-snow-wind", night: "night-snow-wind" },
1261: { day: "day-sleet", night: "night-sleet" },
1264: { day: "day-sleet", night: "night-sleet" },
1273: { day: "day-thunderstorm", night: "night-thunderstorm" },
1276: { day: "day-thunderstorm", night: "night-thunderstorm" },
1279: { day: "day-snow-thunderstorm", night: "night-snow-thunderstorm" },
1282: { day: "day-snow-thunderstorm", night: "night-snow-thunderstorm" }
};
if (!Object.prototype.hasOwnProperty.call(weatherConditions, weatherCode)) {
return "na";
}
return weatherConditions[weatherCode][isDayTime ? "day" : "night"];
}
}
module.exports = WeatherAPIProvider;

View File

@@ -0,0 +1,292 @@
const Log = require("logger");
const HTTPFetcher = require("#http_fetcher");
/**
* Weatherbit weather provider
* See: https://www.weatherbit.io/
*/
class WeatherbitProvider {
constructor (config) {
this.config = {
apiBase: "https://api.weatherbit.io/v2.0",
apiKey: "",
lat: 0,
lon: 0,
type: "current",
updateInterval: 10 * 60 * 1000,
...config
};
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
}
setCallbacks (onDataCallback, onErrorCallback) {
this.onDataCallback = onDataCallback;
this.onErrorCallback = onErrorCallback;
}
initialize () {
if (!this.config.apiKey || this.config.apiKey === "YOUR_API_KEY_HERE") {
Log.error("[weatherbit] No API key configured");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Weatherbit API key required. Get one at https://www.weatherbit.io/",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
this.#initializeFetcher();
}
#initializeFetcher () {
const url = this.#getUrl();
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers: {
Accept: "application/json"
},
logContext: "weatherprovider.weatherbit"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[weatherbit] Parse error:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#getUrl () {
const endpoint = this.#getWeatherEndpoint();
return `${this.config.apiBase}${endpoint}?lat=${this.config.lat}&lon=${this.config.lon}&units=M&key=${this.config.apiKey}`;
}
#getWeatherEndpoint () {
switch (this.config.type) {
case "hourly":
return "/forecast/hourly";
case "daily":
case "forecast":
return "/forecast/daily";
case "current":
default:
return "/current";
}
}
#handleResponse (data) {
if (!data || !data.data || data.data.length === 0) {
Log.error("[weatherbit] No usable data received");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "No usable data in API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
let weatherData = null;
switch (this.config.type) {
case "current":
weatherData = this.#generateCurrent(data);
break;
case "forecast":
case "daily":
weatherData = this.#generateDaily(data);
break;
case "hourly":
weatherData = this.#generateHourly(data);
break;
default:
Log.error(`[weatherbit] Unknown weather type: ${this.config.type}`);
break;
}
if (weatherData && this.onDataCallback) {
this.onDataCallback(weatherData);
}
}
#generateCurrent (data) {
if (!data.data[0] || typeof data.data[0].temp === "undefined") {
return null;
}
const current = data.data[0];
const weather = {
date: new Date(current.ts * 1000),
temperature: parseFloat(current.temp),
humidity: parseFloat(current.rh),
windSpeed: parseFloat(current.wind_spd),
windFromDirection: current.wind_dir || null,
weatherType: this.#convertWeatherType(current.weather.icon),
sunrise: null,
sunset: null
};
// Parse sunrise/sunset from HH:mm format (already in local time)
if (current.sunrise) {
const [hours, minutes] = current.sunrise.split(":");
const sunrise = new Date(current.ts * 1000);
sunrise.setHours(parseInt(hours), parseInt(minutes), 0, 0);
weather.sunrise = sunrise;
}
if (current.sunset) {
const [hours, minutes] = current.sunset.split(":");
const sunset = new Date(current.ts * 1000);
sunset.setHours(parseInt(hours), parseInt(minutes), 0, 0);
weather.sunset = sunset;
}
return weather;
}
#generateDaily (data) {
const days = [];
for (const forecast of data.data) {
days.push({
date: new Date(forecast.datetime),
minTemperature: forecast.min_temp !== undefined ? parseFloat(forecast.min_temp) : null,
maxTemperature: forecast.max_temp !== undefined ? parseFloat(forecast.max_temp) : null,
precipitationAmount: forecast.precip !== undefined ? parseFloat(forecast.precip) : 0,
precipitationProbability: forecast.pop !== undefined ? parseFloat(forecast.pop) : null,
weatherType: this.#convertWeatherType(forecast.weather.icon)
});
}
return days;
}
#generateHourly (data) {
const hours = [];
for (const forecast of data.data) {
hours.push({
date: new Date(forecast.timestamp_local),
temperature: forecast.temp !== undefined ? parseFloat(forecast.temp) : null,
precipitationAmount: forecast.precip !== undefined ? parseFloat(forecast.precip) : 0,
precipitationProbability: forecast.pop !== undefined ? parseFloat(forecast.pop) : null,
windSpeed: forecast.wind_spd !== undefined ? parseFloat(forecast.wind_spd) : null,
windFromDirection: forecast.wind_dir || null,
weatherType: this.#convertWeatherType(forecast.weather.icon)
});
}
return hours;
}
/**
* Convert Weatherbit icon codes to weathericons.css icons
* See: https://www.weatherbit.io/api/codes
* @param {string} weatherType - Weatherbit icon code
* @returns {string|null} Weathericons.css icon name or null
*/
#convertWeatherType (weatherType) {
const weatherTypes = {
t01d: "day-thunderstorm",
t01n: "night-alt-thunderstorm",
t02d: "day-thunderstorm",
t02n: "night-alt-thunderstorm",
t03d: "thunderstorm",
t03n: "thunderstorm",
t04d: "day-thunderstorm",
t04n: "night-alt-thunderstorm",
t05d: "day-sleet-storm",
t05n: "night-alt-sleet-storm",
d01d: "day-sprinkle",
d01n: "night-alt-sprinkle",
d02d: "day-sprinkle",
d02n: "night-alt-sprinkle",
d03d: "day-showers",
d03n: "night-alt-showers",
r01d: "day-showers",
r01n: "night-alt-showers",
r02d: "day-rain",
r02n: "night-alt-rain",
r03d: "day-rain",
r03n: "night-alt-rain",
r04d: "day-sprinkle",
r04n: "night-alt-sprinkle",
r05d: "day-showers",
r05n: "night-alt-showers",
r06d: "day-showers",
r06n: "night-alt-showers",
f01d: "day-sleet",
f01n: "night-alt-sleet",
s01d: "day-snow",
s01n: "night-alt-snow",
s02d: "day-snow-wind",
s02n: "night-alt-snow-wind",
s03d: "snowflake-cold",
s03n: "snowflake-cold",
s04d: "day-rain-mix",
s04n: "night-alt-rain-mix",
s05d: "day-sleet",
s05n: "night-alt-sleet",
s06d: "day-snow",
s06n: "night-alt-snow",
a01d: "day-haze",
a01n: "dust",
a02d: "smoke",
a02n: "smoke",
a03d: "day-haze",
a03n: "dust",
a04d: "dust",
a04n: "dust",
a05d: "day-fog",
a05n: "night-fog",
a06d: "fog",
a06n: "fog",
c01d: "day-sunny",
c01n: "night-clear",
c02d: "day-sunny-overcast",
c02n: "night-alt-partly-cloudy",
c03d: "day-cloudy",
c03n: "night-alt-cloudy",
c04d: "cloudy",
c04n: "cloudy",
u00d: "rain-mix",
u00n: "rain-mix"
};
return weatherTypes[weatherType] || null;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
}
module.exports = WeatherbitProvider;

View File

@@ -0,0 +1,298 @@
const Log = require("logger");
const { convertKmhToMs } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
/**
* WeatherFlow weather provider
* This class is a provider for WeatherFlow personal weather stations.
* Note that the WeatherFlow API does not provide snowfall.
*/
class WeatherFlowProvider {
/**
* @param {object} config - Provider configuration
*/
constructor (config) {
this.config = config;
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
}
/**
* Set the callbacks for data and errors
* @param {(data: object) => void} onDataCallback - Called when new data is available
* @param {(error: object) => void} onErrorCallback - Called when an error occurs
*/
setCallbacks (onDataCallback, onErrorCallback) {
this.onDataCallback = onDataCallback;
this.onErrorCallback = onErrorCallback;
}
/**
* Initialize the provider
*/
initialize () {
if (!this.config.token || this.config.token === "YOUR_API_TOKEN_HERE") {
Log.error("[weatherflow] No API token configured. Get one at https://tempestwx.com/");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "WeatherFlow API token required. Get one at https://tempestwx.com/",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
if (!this.config.stationid) {
Log.error("[weatherflow] No station ID configured");
if (this.onErrorCallback) {
this.onErrorCallback({
message: "WeatherFlow station ID required",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return;
}
this.#initializeFetcher();
}
/**
* Initialize the HTTP fetcher
*/
#initializeFetcher () {
const url = this.#getUrl();
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers: {
"Cache-Control": "no-cache",
Accept: "application/json"
},
logContext: "weatherprovider.weatherflow"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
const processed = this.#processData(data);
this.onDataCallback(processed);
} catch (error) {
Log.error("[weatherflow] Failed to parse JSON:", error);
}
});
this.fetcher.on("error", (errorInfo) => {
// HTTPFetcher already logged the error with logContext
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
/**
* Generate the URL for API requests
* @returns {string} The API URL
*/
#getUrl () {
const base = this.config.apiBase || "https://swd.weatherflow.com/swd/rest/";
return `${base}better_forecast?station_id=${this.config.stationid}&units_temp=c&units_wind=kph&units_pressure=mb&units_precip=mm&units_distance=km&token=${this.config.token}`;
}
/**
* Process the raw API data
* @param {object} data - Raw API response
* @returns {object} Processed weather data
*/
#processData (data) {
try {
let weatherData;
if (this.config.type === "current") {
weatherData = this.#generateCurrent(data);
} else if (this.config.type === "hourly") {
weatherData = this.#generateHourly(data);
} else {
weatherData = this.#generateDaily(data);
}
return weatherData;
} catch (error) {
Log.error("[weatherflow] Data processing error:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to process weather data",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
return null;
}
}
/**
* Generate current weather data
* @param {object} data - API response data
* @returns {object} Current weather object
*/
#generateCurrent (data) {
if (!data || !data.current_conditions || !data.forecast || !Array.isArray(data.forecast.daily) || data.forecast.daily.length === 0) {
Log.error("[weatherflow] Invalid current weather data structure");
return null;
}
const current = data.current_conditions;
const daily = data.forecast.daily[0];
const weather = {
date: new Date(),
humidity: current.relative_humidity || null,
temperature: current.air_temperature || null,
feelsLikeTemp: current.feels_like || null,
windSpeed: current.wind_avg != null ? convertKmhToMs(current.wind_avg) : null,
windFromDirection: current.wind_direction || null,
weatherType: this.#convertWeatherType(current.icon),
uvIndex: current.uv || null,
sunrise: daily.sunrise ? new Date(daily.sunrise * 1000) : null,
sunset: daily.sunset ? new Date(daily.sunset * 1000) : null
};
return weather;
}
/**
* Generate forecast data
* @param {object} data - API response data
* @returns {Array} Array of forecast objects
*/
#generateDaily (data) {
if (!data || !data.forecast || !Array.isArray(data.forecast.daily) || !Array.isArray(data.forecast.hourly)) {
Log.error("[weatherflow] Invalid forecast data structure");
return [];
}
const days = [];
for (const forecast of data.forecast.daily) {
const weather = {
date: new Date(forecast.day_start_local * 1000),
minTemperature: forecast.air_temp_low || null,
maxTemperature: forecast.air_temp_high || null,
precipitationProbability: forecast.precip_probability || null,
weatherType: this.#convertWeatherType(forecast.icon),
precipitationAmount: 0.0,
precipitationUnits: "mm",
uvIndex: 0
};
// Build UV and precipitation from hourly data
for (const hour of data.forecast.hourly) {
const hourDate = new Date(hour.time * 1000);
const forecastDate = new Date(forecast.day_start_local * 1000);
// Compare year, month, and day to ensure correct matching across month boundaries
if (hourDate.getFullYear() === forecastDate.getFullYear()
&& hourDate.getMonth() === forecastDate.getMonth()
&& hourDate.getDate() === forecastDate.getDate()) {
weather.uvIndex = Math.max(weather.uvIndex, hour.uv || 0);
weather.precipitationAmount += hour.precip || 0;
} else if (hourDate > forecastDate) {
// Check if we've moved to the next day
const diffMs = hourDate - forecastDate;
if (diffMs >= 86400000) break; // 24 hours in ms
}
}
days.push(weather);
}
return days;
}
/**
* Generate hourly forecast data
* @param {object} data - API response data
* @returns {Array} Array of hourly forecast objects
*/
#generateHourly (data) {
if (!data || !data.forecast || !Array.isArray(data.forecast.hourly)) {
Log.error("[weatherflow] Invalid hourly data structure");
return [];
}
const hours = [];
for (const hour of data.forecast.hourly) {
const weather = {
date: new Date(hour.time * 1000),
temperature: hour.air_temperature || null,
feelsLikeTemp: hour.feels_like || null,
humidity: hour.relative_humidity || null,
windSpeed: hour.wind_avg != null ? convertKmhToMs(hour.wind_avg) : null,
windFromDirection: hour.wind_direction || null,
weatherType: this.#convertWeatherType(hour.icon),
precipitationProbability: hour.precip_probability || null,
precipitationAmount: hour.precip || 0,
precipitationUnits: "mm",
uvIndex: hour.uv || null
};
hours.push(weather);
// WeatherFlow provides 10 days of hourly data, trim to 48 hours
if (hours.length >= 48) break;
}
return hours;
}
/**
* Convert weather icon type
* @param {string} weatherType - WeatherFlow icon code
* @returns {string} Weather icon CSS class
*/
#convertWeatherType (weatherType) {
const weatherTypes = {
"clear-day": "day-sunny",
"clear-night": "night-clear",
cloudy: "cloudy",
foggy: "fog",
"partly-cloudy-day": "day-cloudy",
"partly-cloudy-night": "night-alt-cloudy",
"possibly-rainy-day": "day-rain",
"possibly-rainy-night": "night-alt-rain",
"possibly-sleet-day": "day-sleet",
"possibly-sleet-night": "night-alt-sleet",
"possibly-snow-day": "day-snow",
"possibly-snow-night": "night-alt-snow",
"possibly-thunderstorm-day": "day-thunderstorm",
"possibly-thunderstorm-night": "night-alt-thunderstorm",
rainy: "rain",
sleet: "sleet",
snow: "snow",
thunderstorm: "thunderstorm",
windy: "strong-wind"
};
return weatherTypes[weatherType] || null;
}
/**
* Start fetching data
*/
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
/**
* Stop fetching data
*/
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
}
module.exports = WeatherFlowProvider;

View File

@@ -0,0 +1,416 @@
const Log = require("logger");
const { getSunTimes, isDayTime, getDateString, convertKmhToMs, cardinalToDegrees } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
/**
* Server-side weather provider for Weather.gov (US National Weather Service)
* Note: Only works for US locations, no API key required
* https://weather-gov.github.io/api/general-faqs
*/
class WeatherGovProvider {
constructor (config) {
this.config = {
apiBase: "https://api.weather.gov/points/",
lat: 0,
lon: 0,
type: "current",
updateInterval: 10 * 60 * 1000,
...config
};
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
this.locationName = null;
this.initRetryCount = 0;
this.initRetryTimer = null;
// Weather.gov specific URLs (fetched during initialization)
this.forecastURL = null;
this.forecastHourlyURL = null;
this.forecastGridDataURL = null;
this.observationStationsURL = null;
this.stationObsURL = null;
}
async initialize () {
// Add small random delay to prevent all instances from starting simultaneously
// This reduces parallel DNS lookups which can cause EAI_AGAIN errors
const staggerDelay = Math.random() * 3000; // 0-3 seconds
await new Promise((resolve) => setTimeout(resolve, staggerDelay));
try {
await this.#fetchWeatherGovURLs();
this.#initializeFetcher();
this.initRetryCount = 0; // Reset on success
} catch (error) {
const errorInfo = this.#categorizeError(error);
Log.error(`[weathergov] Initialization failed: ${errorInfo.message}`);
// Retry on temporary errors (DNS, timeout, network)
if (errorInfo.isRetryable && this.initRetryCount < 5) {
this.initRetryCount++;
const delay = HTTPFetcher.calculateBackoffDelay(this.initRetryCount);
Log.info(`[weathergov] Will retry initialization in ${Math.round(delay / 1000)}s (attempt ${this.initRetryCount}/5)`);
this.initRetryTimer = setTimeout(() => this.initialize(), delay);
} else if (this.onErrorCallback) {
this.onErrorCallback({
message: errorInfo.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#categorizeError (error) {
const cause = error.cause || error;
const code = cause.code || "";
if (code === "EAI_AGAIN" || code === "ENOTFOUND") {
return {
message: "DNS lookup failed for api.weather.gov - check your internet connection",
isRetryable: true
};
}
if (code === "ETIMEDOUT" || code === "ECONNREFUSED" || code === "ECONNRESET") {
return {
message: `Network error: ${code} - api.weather.gov may be temporarily unavailable`,
isRetryable: true
};
}
if (error.name === "AbortError") {
return {
message: "Request timeout - api.weather.gov is responding slowly",
isRetryable: true
};
}
return {
message: error.message || "Unknown error",
isRetryable: false
};
}
setCallbacks (onData, onError) {
this.onDataCallback = onData;
this.onErrorCallback = onError;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
if (this.initRetryTimer) {
clearTimeout(this.initRetryTimer);
this.initRetryTimer = null;
}
}
async #fetchWeatherGovURLs () {
// Step 1: Get grid point data
const pointsUrl = `${this.config.apiBase}${this.config.lat},${this.config.lon}`;
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 120000); // 120 second timeout - DNS can be slow
try {
const pointsResponse = await fetch(pointsUrl, {
signal: controller.signal,
headers: {
"User-Agent": "MagicMirror",
Accept: "application/geo+json"
}
});
if (!pointsResponse.ok) {
throw new Error(`Failed to fetch grid point: HTTP ${pointsResponse.status}`);
}
const pointsData = await pointsResponse.json();
if (!pointsData || !pointsData.properties) {
throw new Error("Invalid grid point data");
}
// Extract location name
const relLoc = pointsData.properties.relativeLocation?.properties;
if (relLoc) {
this.locationName = `${relLoc.city}, ${relLoc.state}`;
}
// Store forecast URLs
this.forecastURL = `${pointsData.properties.forecast}?units=si`;
this.forecastHourlyURL = `${pointsData.properties.forecastHourly}?units=si`;
this.forecastGridDataURL = pointsData.properties.forecastGridData;
this.observationStationsURL = pointsData.properties.observationStations;
// Step 2: Get observation station URL
const stationsResponse = await fetch(this.observationStationsURL, {
signal: controller.signal,
headers: {
"User-Agent": "MagicMirror",
Accept: "application/geo+json"
}
});
if (!stationsResponse.ok) {
throw new Error(`Failed to fetch observation stations: HTTP ${stationsResponse.status}`);
}
const stationsData = await stationsResponse.json();
if (!stationsData || !stationsData.features || stationsData.features.length === 0) {
throw new Error("No observation stations found");
}
this.stationObsURL = `${stationsData.features[0].id}/observations/latest`;
Log.log(`[weathergov] Initialized for ${this.locationName}`);
} finally {
clearTimeout(timeoutId);
}
}
#initializeFetcher () {
let url;
switch (this.config.type) {
case "current":
url = this.stationObsURL;
break;
case "forecast":
case "daily":
url = this.forecastURL;
break;
case "hourly":
url = this.forecastHourlyURL;
break;
default:
url = this.stationObsURL;
}
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
timeout: 60000, // 60 seconds - weather.gov can be slow
headers: {
"User-Agent": "MagicMirror",
Accept: "application/geo+json",
"Cache-Control": "no-cache"
},
logContext: "weatherprovider.weathergov"
});
this.fetcher.on("response", async (response) => {
try {
const data = await response.json();
this.#handleResponse(data);
} catch (error) {
Log.error("[weathergov] Failed to parse JSON:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
#handleResponse (data) {
try {
let weatherData;
switch (this.config.type) {
case "current":
if (!data.properties) {
throw new Error("Invalid current weather data");
}
weatherData = this.#generateWeatherObjectFromCurrentWeather(data.properties);
break;
case "forecast":
case "daily":
if (!data.properties || !data.properties.periods) {
throw new Error("Invalid forecast data");
}
weatherData = this.#generateWeatherObjectsFromForecast(data.properties.periods);
break;
case "hourly":
if (!data.properties || !data.properties.periods) {
throw new Error("Invalid hourly data");
}
weatherData = this.#generateWeatherObjectsFromHourly(data.properties.periods);
break;
default:
throw new Error(`Unknown weather type: ${this.config.type}`);
}
if (this.onDataCallback) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[weathergov] Error processing weather data:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#generateWeatherObjectFromCurrentWeather (currentWeatherData) {
const current = {};
current.date = new Date(currentWeatherData.timestamp);
current.temperature = currentWeatherData.temperature.value;
current.windSpeed = currentWeatherData.windSpeed.value; // Observations are already in m/s
current.windFromDirection = currentWeatherData.windDirection.value;
current.minTemperature = currentWeatherData.minTemperatureLast24Hours?.value;
current.maxTemperature = currentWeatherData.maxTemperatureLast24Hours?.value;
current.humidity = Math.round(currentWeatherData.relativeHumidity.value);
current.precipitationAmount = currentWeatherData.precipitationLastHour?.value ?? currentWeatherData.precipitationLast3Hours?.value;
// Feels like temperature
if (currentWeatherData.heatIndex.value !== null) {
current.feelsLikeTemp = currentWeatherData.heatIndex.value;
} else if (currentWeatherData.windChill.value !== null) {
current.feelsLikeTemp = currentWeatherData.windChill.value;
} else {
current.feelsLikeTemp = currentWeatherData.temperature.value;
}
// Calculate sunrise/sunset (not provided by weather.gov)
const { sunrise, sunset } = getSunTimes(current.date, this.config.lat, this.config.lon);
current.sunrise = sunrise;
current.sunset = sunset;
// Determine if daytime
const isDay = isDayTime(current.date, current.sunrise, current.sunset);
current.weatherType = this.#convertWeatherType(currentWeatherData.textDescription, isDay);
return current;
}
#generateWeatherObjectsFromForecast (forecasts) {
const days = [];
let minTemp = [];
let maxTemp = [];
let date = "";
let weather = {};
for (const forecast of forecasts) {
const forecastDate = new Date(forecast.startTime);
const dateStr = getDateString(forecastDate);
if (date !== dateStr) {
// New day
if (date !== "") {
weather.minTemperature = Math.min(...minTemp);
weather.maxTemperature = Math.max(...maxTemp);
days.push(weather);
}
weather = {};
minTemp = [];
maxTemp = [];
date = dateStr;
weather.date = forecastDate;
weather.precipitationProbability = forecast.probabilityOfPrecipitation?.value ?? 0;
weather.weatherType = this.#convertWeatherType(forecast.shortForecast, forecast.isDaytime);
}
// Update weather type for daytime hours (8am-5pm)
const hour = forecastDate.getHours();
if (hour >= 8 && hour <= 17) {
weather.weatherType = this.#convertWeatherType(forecast.shortForecast, forecast.isDaytime);
}
minTemp.push(forecast.temperature);
maxTemp.push(forecast.temperature);
}
// Last day
if (date !== "") {
weather.minTemperature = Math.min(...minTemp);
weather.maxTemperature = Math.max(...maxTemp);
days.push(weather);
}
return days.slice(1); // Skip first incomplete day
}
#generateWeatherObjectsFromHourly (forecasts) {
const hours = [];
for (const forecast of forecasts) {
const weather = {};
weather.date = new Date(forecast.startTime);
// Parse wind speed
const windSpeedStr = forecast.windSpeed;
let windSpeed = windSpeedStr;
if (windSpeedStr.includes(" ")) {
windSpeed = windSpeedStr.split(" ")[0];
}
weather.windSpeed = convertKmhToMs(parseFloat(windSpeed));
weather.windFromDirection = cardinalToDegrees(forecast.windDirection);
weather.temperature = forecast.temperature;
weather.precipitationProbability = forecast.probabilityOfPrecipitation?.value ?? 0;
weather.weatherType = this.#convertWeatherType(forecast.shortForecast, forecast.isDaytime);
hours.push(weather);
}
return hours;
}
#convertWeatherType (weatherType, isDaytime) {
// https://w1.weather.gov/xml/current_obs/weather.php
if (weatherType.includes("Cloudy") || weatherType.includes("Partly")) {
return isDaytime ? "day-cloudy" : "night-cloudy";
} else if (weatherType.includes("Overcast")) {
return isDaytime ? "cloudy" : "night-cloudy";
} else if (weatherType.includes("Freezing") || weatherType.includes("Ice")) {
return "rain-mix";
} else if (weatherType.includes("Snow")) {
return isDaytime ? "snow" : "night-snow";
} else if (weatherType.includes("Thunderstorm")) {
return isDaytime ? "thunderstorm" : "night-thunderstorm";
} else if (weatherType.includes("Showers")) {
return isDaytime ? "showers" : "night-showers";
} else if (weatherType.includes("Rain") || weatherType.includes("Drizzle")) {
return isDaytime ? "rain" : "night-rain";
} else if (weatherType.includes("Breezy") || weatherType.includes("Windy")) {
return isDaytime ? "cloudy-windy" : "night-alt-cloudy-windy";
} else if (weatherType.includes("Fair") || weatherType.includes("Clear") || weatherType.includes("Few") || weatherType.includes("Sunny")) {
return isDaytime ? "day-sunny" : "night-clear";
} else if (weatherType.includes("Dust") || weatherType.includes("Sand")) {
return "dust";
} else if (weatherType.includes("Fog")) {
return "fog";
} else if (weatherType.includes("Smoke")) {
return "smoke";
} else if (weatherType.includes("Haze")) {
return "day-haze";
}
return null;
}
}
module.exports = WeatherGovProvider;

View File

@@ -0,0 +1,469 @@
const Log = require("logger");
const { formatTimezoneOffset, getDateString, validateCoordinates } = require("../provider-utils");
const HTTPFetcher = require("#http_fetcher");
/**
* Server-side weather provider for Yr.no (Norwegian Meteorological Institute)
* Terms of service: https://developer.yr.no/doc/TermsOfService/
*
* Note: Minimum update interval is 10 minutes (600000 ms) per API terms
*/
class YrProvider {
constructor (config) {
this.config = {
apiBase: "https://api.met.no/weatherapi",
forecastApiVersion: "2.0",
sunriseApiVersion: "3.0",
altitude: 0,
lat: 0,
lon: 0,
currentForecastHours: 1, // 1, 6 or 12
type: "current",
updateInterval: 10 * 60 * 1000, // 10 minutes minimum
...config
};
// Enforce 10 minute minimum per API terms
if (this.config.updateInterval < 600000) {
Log.warn("[yr] Minimum update interval is 10 minutes (600000 ms). Adjusting configuration.");
this.config.updateInterval = 600000;
}
this.fetcher = null;
this.onDataCallback = null;
this.onErrorCallback = null;
this.locationName = null;
// Cache for sunrise/sunset data
this.stellarData = null;
this.stellarDataDate = null;
// Cache for weather data (If-Modified-Since support)
this.weatherCache = {
data: null,
lastModified: null,
expires: null
};
}
async initialize () {
// Yr.no requires max 4 decimal places
validateCoordinates(this.config, 4);
await this.#fetchStellarData();
this.#initializeFetcher();
}
setCallbacks (onData, onError) {
this.onDataCallback = onData;
this.onErrorCallback = onError;
}
start () {
if (this.fetcher) {
this.fetcher.startPeriodicFetch();
}
}
stop () {
if (this.fetcher) {
this.fetcher.clearTimer();
}
}
async #fetchStellarData () {
const today = getDateString(new Date());
// Check if we already have today's data
if (this.stellarDataDate === today && this.stellarData) {
return;
}
const url = this.#getSunriseUrl();
try {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), 10000);
const response = await fetch(url, {
headers: {
"User-Agent": "MagicMirror",
Accept: "application/json"
},
signal: controller.signal
});
clearTimeout(timeoutId);
if (!response.ok) {
Log.warn(`[yr] Could not fetch stellar data: HTTP ${response.status}`);
this.stellarDataDate = today;
} else {
// Parse and store the stellar data
const data = await response.json();
// Transform single-day response into array format expected by #getStellarInfoForDate
if (data && data.properties) {
this.stellarData = [
{
date: data.when.interval[0], // ISO date string
sunrise: data.properties.sunrise,
sunset: data.properties.sunset
}
];
}
this.stellarDataDate = today;
}
} catch (error) {
Log.warn("[yr] Failed to fetch stellar data:", error);
}
}
#initializeFetcher () {
const url = this.#getForecastUrl();
const headers = {
"User-Agent": "MagicMirror",
Accept: "application/json"
};
// Add If-Modified-Since header if we have cached data
if (this.weatherCache.lastModified) {
headers["If-Modified-Since"] = this.weatherCache.lastModified;
}
this.fetcher = new HTTPFetcher(url, {
reloadInterval: this.config.updateInterval,
headers,
logContext: "weatherprovider.yr"
});
this.fetcher.on("response", async (response) => {
try {
// Handle 304 Not Modified - use cached data
if (response.status === 304) {
Log.log("[yr] Data not modified, using cache");
if (this.weatherCache.data) {
this.#handleResponse(this.weatherCache.data, true);
}
return;
}
const data = await response.json();
// Store cache headers
const lastModified = response.headers.get("Last-Modified");
const expires = response.headers.get("Expires");
if (lastModified) {
this.weatherCache.lastModified = lastModified;
}
if (expires) {
this.weatherCache.expires = expires;
}
this.weatherCache.data = data;
// Update headers for next request
if (lastModified && this.fetcher) {
this.fetcher.customHeaders["If-Modified-Since"] = lastModified;
}
this.#handleResponse(data, false);
} catch (error) {
Log.error("[yr] Failed to parse JSON:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: "Failed to parse API response",
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
});
this.fetcher.on("error", (errorInfo) => {
if (this.onErrorCallback) {
this.onErrorCallback(errorInfo);
}
});
}
async #handleResponse (data, fromCache = false) {
try {
if (!data.properties || !data.properties.timeseries) {
throw new Error("Invalid weather data");
}
// Refresh stellar data if needed (new day or using cached weather data)
if (fromCache) {
await this.#fetchStellarData();
}
let weatherData;
switch (this.config.type) {
case "current":
weatherData = this.#generateCurrentWeather(data);
break;
case "forecast":
case "daily":
weatherData = this.#generateForecast(data);
break;
case "hourly":
weatherData = this.#generateHourly(data);
break;
default:
throw new Error(`Unknown weather type: ${this.config.type}`);
}
if (this.onDataCallback) {
this.onDataCallback(weatherData);
}
} catch (error) {
Log.error("[yr] Error processing weather data:", error);
if (this.onErrorCallback) {
this.onErrorCallback({
message: error.message,
translationKey: "MODULE_ERROR_UNSPECIFIED"
});
}
}
}
#generateCurrentWeather (data) {
const now = new Date();
const timeseries = data.properties.timeseries;
// Find closest forecast in the past
let forecast = timeseries[0];
let closestDiff = Math.abs(now - new Date(forecast.time));
for (const entry of timeseries) {
const entryTime = new Date(entry.time);
const diff = now - entryTime;
if (diff > 0 && diff < closestDiff) {
closestDiff = diff;
forecast = entry;
}
}
const forecastXHours = this.#getForecastForXHours(forecast.data);
const stellarInfo = this.#getStellarInfoForDate(new Date(forecast.time));
const current = {};
current.date = new Date(forecast.time);
current.temperature = forecast.data.instant.details.air_temperature;
current.windSpeed = forecast.data.instant.details.wind_speed;
current.windFromDirection = forecast.data.instant.details.wind_from_direction;
current.humidity = forecast.data.instant.details.relative_humidity;
current.weatherType = this.#convertWeatherType(
forecastXHours.summary?.symbol_code,
stellarInfo ? this.#isDayTime(current.date, stellarInfo) : true
);
current.precipitationAmount = forecastXHours.details?.precipitation_amount;
current.precipitationProbability = forecastXHours.details?.probability_of_precipitation;
current.minTemperature = forecastXHours.details?.air_temperature_min;
current.maxTemperature = forecastXHours.details?.air_temperature_max;
if (stellarInfo) {
current.sunrise = new Date(stellarInfo.sunrise.time);
current.sunset = new Date(stellarInfo.sunset.time);
}
return current;
}
#generateForecast (data) {
const timeseries = data.properties.timeseries;
const dailyData = new Map();
// Collect all data points for each day
for (const entry of timeseries) {
const date = new Date(entry.time);
const dateStr = getDateString(date);
if (!dailyData.has(dateStr)) {
dailyData.set(dateStr, {
date: date,
temps: [],
precip: [],
precipProb: [],
symbols: []
});
}
const dayData = dailyData.get(dateStr);
// Collect temperature from instant data
if (entry.data.instant?.details?.air_temperature !== undefined) {
dayData.temps.push(entry.data.instant.details.air_temperature);
}
// Collect data from forecast periods (prefer longer periods to avoid double-counting)
const forecast = entry.data.next_12_hours || entry.data.next_6_hours || entry.data.next_1_hours;
if (forecast) {
if (forecast.details?.precipitation_amount !== undefined) {
dayData.precip.push(forecast.details.precipitation_amount);
}
if (forecast.details?.probability_of_precipitation !== undefined) {
dayData.precipProb.push(forecast.details.probability_of_precipitation);
}
if (forecast.summary?.symbol_code) {
dayData.symbols.push(forecast.summary.symbol_code);
}
}
}
// Convert collected data to forecast objects
const days = [];
for (const [dateStr, data] of dailyData) {
const stellarInfo = this.#getStellarInfoForDate(data.date);
const dayData = {
date: data.date,
minTemperature: data.temps.length > 0 ? Math.min(...data.temps) : null,
maxTemperature: data.temps.length > 0 ? Math.max(...data.temps) : null,
precipitationAmount: data.precip.length > 0 ? Math.max(...data.precip) : null,
precipitationProbability: data.precipProb.length > 0 ? Math.max(...data.precipProb) : null,
weatherType: data.symbols.length > 0 ? this.#convertWeatherType(data.symbols[0], true) : null
};
if (stellarInfo) {
dayData.sunrise = new Date(stellarInfo.sunrise.time);
dayData.sunset = new Date(stellarInfo.sunset.time);
}
days.push(dayData);
}
// Sort by date to ensure correct order
return days.sort((a, b) => a.date - b.date);
}
#generateHourly (data) {
const hours = [];
const timeseries = data.properties.timeseries;
for (const entry of timeseries) {
const forecast1h = entry.data.next_1_hours;
if (!forecast1h) continue;
const date = new Date(entry.time);
const stellarInfo = this.#getStellarInfoForDate(date);
const hourly = {
date: date,
temperature: entry.data.instant.details.air_temperature,
windSpeed: entry.data.instant.details.wind_speed,
windFromDirection: entry.data.instant.details.wind_from_direction,
humidity: entry.data.instant.details.relative_humidity,
precipitationAmount: forecast1h.details?.precipitation_amount,
precipitationProbability: forecast1h.details?.probability_of_precipitation,
weatherType: this.#convertWeatherType(
forecast1h.summary?.symbol_code,
stellarInfo ? this.#isDayTime(date, stellarInfo) : true
)
};
hours.push(hourly);
}
return hours;
}
#getForecastForXHours (data) {
const hours = this.config.currentForecastHours;
if (hours === 12 && data.next_12_hours) {
return data.next_12_hours;
} else if (hours === 6 && data.next_6_hours) {
return data.next_6_hours;
} else if (data.next_1_hours) {
return data.next_1_hours;
}
return data.next_6_hours || data.next_12_hours || data.next_1_hours || {};
}
#getStellarInfoForDate (date) {
if (!this.stellarData) return null;
const dateStr = getDateString(date);
for (const day of this.stellarData) {
const dayDate = day.date.split("T")[0];
if (dayDate === dateStr) {
return day;
}
}
return null;
}
#isDayTime (date, stellarInfo) {
if (!stellarInfo || !stellarInfo.sunrise || !stellarInfo.sunset) {
return true;
}
const sunrise = new Date(stellarInfo.sunrise.time);
const sunset = new Date(stellarInfo.sunset.time);
return date >= sunrise && date < sunset;
}
#convertWeatherType (symbolCode, isDayTime) {
if (!symbolCode) return null;
// Yr.no uses symbol codes like "clearsky_day", "partlycloudy_night", etc.
const symbol = symbolCode.replace(/_day|_night/g, "");
const mappings = {
clearsky: isDayTime ? "day-sunny" : "night-clear",
fair: isDayTime ? "day-sunny" : "night-clear",
partlycloudy: isDayTime ? "day-cloudy" : "night-cloudy",
cloudy: "cloudy",
fog: "fog",
lightrainshowers: isDayTime ? "day-showers" : "night-showers",
rainshowers: isDayTime ? "showers" : "night-showers",
heavyrainshowers: isDayTime ? "day-rain" : "night-rain",
lightrain: isDayTime ? "day-sprinkle" : "night-sprinkle",
rain: isDayTime ? "rain" : "night-rain",
heavyrain: isDayTime ? "rain" : "night-rain",
lightsleetshowers: isDayTime ? "day-sleet" : "night-sleet",
sleetshowers: isDayTime ? "sleet" : "night-sleet",
heavysleetshowers: isDayTime ? "sleet" : "night-sleet",
lightsleet: isDayTime ? "day-sleet" : "night-sleet",
sleet: "sleet",
heavysleet: "sleet",
lightsnowshowers: isDayTime ? "day-snow" : "night-snow",
snowshowers: isDayTime ? "snow" : "night-snow",
heavysnowshowers: isDayTime ? "snow" : "night-snow",
lightsnow: isDayTime ? "day-snow" : "night-snow",
snow: "snow",
heavysnow: "snow",
lightrainandthunder: isDayTime ? "day-thunderstorm" : "night-thunderstorm",
rainandthunder: isDayTime ? "thunderstorm" : "night-thunderstorm",
heavyrainandthunder: isDayTime ? "thunderstorm" : "night-thunderstorm",
lightsleetandthunder: isDayTime ? "day-sleet-storm" : "night-sleet-storm",
sleetandthunder: isDayTime ? "day-sleet-storm" : "night-sleet-storm",
heavysleetandthunder: isDayTime ? "day-sleet-storm" : "night-sleet-storm",
lightsnowandthunder: isDayTime ? "day-snow-thunderstorm" : "night-snow-thunderstorm",
snowandthunder: isDayTime ? "day-snow-thunderstorm" : "night-snow-thunderstorm",
heavysnowandthunder: isDayTime ? "day-snow-thunderstorm" : "night-snow-thunderstorm"
};
return mappings[symbol] || null;
}
#getForecastUrl () {
const { lat, lon, altitude } = this.config;
return `${this.config.apiBase}/locationforecast/${this.config.forecastApiVersion}/complete?altitude=${altitude}&lat=${lat}&lon=${lon}`;
}
#getSunriseUrl () {
const { lat, lon } = this.config;
const today = getDateString(new Date());
const offset = formatTimezoneOffset(-new Date().getTimezoneOffset());
return `${this.config.apiBase}/sunrise/${this.config.sunriseApiVersion}/sun?lat=${lat}&lon=${lon}&date=${today}&offset=${offset}`;
}
}
module.exports = YrProvider;

Some files were not shown because too many files have changed in this diff Show More