Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 2.26.0 #3319

Merged
merged 209 commits into from
Jan 1, 2024
Merged

Release 2.26.0 #3319

merged 209 commits into from
Jan 1, 2024

Conversation

MichMich
Copy link
Collaborator

@MichMich MichMich commented Jan 1, 2024

[2.26.0] - 01-01-2024

Thanks to: @bnitkin, @bugsounet, @dependabot, @jkriegshauser, @kaennchenstruggle, @KristjanESPERANTO and @Ybbet.

Special thanks to @khassel, @rejas and @sdetweil for taking over most (if not all) of the work on this release as project collaborators. This version would not be there without their effort. Thank you guys! You are awesome!

This release also marks the latest release by Michael Teeuw. For more info, please read the following post: A New Chapter for MagicMirror: The Community Takes the Lead.

Added

  • Added update notification updater (for 3rd party modules)
  • Added node 21 to the test matrix
  • Added transform object to calendar:customEvents
  • Added ESLint rules for jest (including jest/expect-expect and jest/no-done-callback)

Removed

Updated

  • Update electron to v27 and update other dependencies as well as github actions
  • Update newsfeed: Use html-to-text instead of regex for transform description
  • Review ESLint config (Review eslint config #3269)
  • Updated dependencies
  • Clock module: optionally display current moon phase in addition to rise/set times
  • electron is now per default started without gpu, if needed it must be enabled with new env var ELECTRON_ENABLE_GPU=1 on startup (disable/enable gpu when running under electron #3226)
  • Replace prettier by stylistic in ESLint config to lint JavaScript (and disable some rules for config/config.js* files)
  • Update node-ical to v0.17.1 and fix tests

Fixed

MichMich and others added 30 commits October 1, 2022 20:14
use es6 syntax in all tests, split weather tests, remove callbacks
This PR addresses [this
comment](48756e8#commitcomment-85772193),
which points out an issue with #2902.

Looks like the apparent temp calculation method was incorrectly
referenced 😅
nothing fancy here, just a simple test after @khassel's changes to the
test setup :-)

Co-authored-by: veeck <michael@veeck.de>
as proposed in
05f0d18#commitcomment-85730050

Co-authored-by: veeck <michael@veeck.de>
Added fetchWeatherHourly functionality to:
 modules/default/weather/providers/weathergov.js
small update to the fetchData method to use the fetch helper instead of
the old XCMLHttpRequest.
Also fixes some typos :-)

Co-authored-by: veeck <michael@veeck.de>
Removed weatherEnpoint definition in defaults. It is not used in the
weathergov.js provider.
Moves files around and renames some so that the structure is cleaner and
more consistent
Added class names "today" and "tomorrow" on the calendar module tr
elements (i.e. calendar items).
This way you can for example color your events today and/or tomorrow to
more easily see what's happening in the near future.

Implemented by adding an event.tomorrow variable (similar to
event.today) that can be used for other things in the future. Also
replaced a few hardcoded values (hours, seconds etc.) with constants to
make the code more consistent.

Edit: tested with normal events, split day events and events with
locations.
… remote (#2943)

This PR resolves a small bug in the updatenotification module if a local
git repo is ahead of the remote (for example I have made local commits
for my personal needs).

Currently, if `git status -sb` reports a status like: `##
master...origin/master [ahead 2]` then updatenotification treats this as
though it's "behind".

This PR uses a single Regex to match `git status -sb` output and uses
capture groups to extract info to populate the `gitInfo` object to avoid
needing to do string manipulation to extract this information.

Co-authored-by: Dario Mratovich <dario.mratovich@outlook.com>
In response to #2487 this implements a Promise.all for the node_helper
start calls

Co-authored-by: veeck <michael@veeck.de>
Some icons in FontAwesome, like the Facebook-logo, requires a different
class than `fas fa-fw fa-`. Added support for specifying the
`className`:
```js
{
    symbol: "facebook-square",
    symbolClassName: "fab fa-",
    url: "https://www.facebook.com/events/ical/upcoming/?uid=<some_uid>"
}
```
because I thought it was more readable and I found a little bug when
calculatin suntimes on the way....

Co-authored-by: veeck <michael@veeck.de>
first PR for #2942 

- added new electron tests for calendar which test new css classes from
#2939
- moved some compliments tests from `e2e` to `electron` because of date
mocking
- removed mock stuff from compliments module
solves #2840 as far as possible. There could still be errors on the
embedded iframe when the owner of the site has set `X-Frame-Options` or
`Access-Control-Allow-Origin` headers (as already mentioned in the
docs).
Fixes #2944

Also splits the Server js into a constrcutor and an open call to remove
one callback parameter :-)

Co-authored-by: veeck <michael@veeck.de>
So finally I think this refactorin is ready to be reviewed :-)

DONE:
- [x] Removed all conversion functions for wind and temperature from
specific weatherproviders
- [x] Use internally only metric units: celsius for temperature, meters
per seconds for wind
- [x] Convert temp and wind into the configured units when displaying
data on the UI
- [x] look how beaufort calculation uses metrics, added knots as new
windunit
- [x] add more e2e tests 

Checked providers:
- [x] Darksky
- [x] EnvCanada
- [x] OpenWeatherMap
- [x] SMHI provider 
- [x] UK Met Office
- [x] UK Met Office DataHub
- [x] WeatherBit
- [x] WeatherFlow
- [x] WeatherGov

TODO in different tickets:
- check weatherproviders for usage of weatherEndpoint (as seen in
MagicMirrorOrg/MagicMirror-Documentation#131) -> see
#2926
- cleanup precipations -> #2953

Co-authored-by: veeck <michael@veeck.de>
…ates (#2956)

Fixes #2955

Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: veeck <michael@veeck.de>
Some small cleanups with regards to jest
- call jest directly (nyc is integrated in jest these days)
- move jest config into seperate file so we dont clutter up the
package.json
- remove empty test file for newsletter-unit-tests
- update dependencies that touch jest
- try out v8 as coverageProvider

Co-authored-by: veeck <michael@veeck.de>
> Dependency Review GitHub Action in your repository to enforce
dependency
> reviews on your pull requests.
> The action scans for vulnerable versions of dependencies introduced by
package version
> changes in pull requests,
> and warns you about the associated security vulnerabilities.
> This gives you better visibility of what's changing in a pull request,
> and helps prevent vulnerabilities being added to your repository.


https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>

Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
Co-authored-by: veeck <michael@veeck.de>
… next test (#2952)

When trying to debug why the tests broke for
#2946 I found that the tests
does not wait for the app to start and close. So if the startup isn't
blocking that would fail.

So I added a callback for `close()` too and converted them to promises
for the `startApplication()` and `stopApplication()` and updated all the
e2e tests to await both. Will try to refactor all these callbacks to
promises in a later PR.
As discussed in #2952

Co-authored-by: veeck <michael@veeck.de>
Adds support for sending and receiving HTTP-headers when using the
CORS-method.

This change is required for the Yr weather-provider introduced in
#2948.

To make it easier to add unit tests I moved the server-functions into a
separate file.
As already discussed here the first shot of the collaboration rules.

We can discuss this in the comments until ready to merge.

Co-authored-by: Veeck <github@veeck.de>
…response headers (#2963)

Many users like me do have the problem that they want to embed other
sites to their mirror by "iframe".
As some developers set the "x-frame-options" and
"content-security-policy" for security reasons these sites can not be
embedded.
Electron provides the "webview" element additionally to "iframe" which
allows to embed these sites although. The main difference is that a new
process is started which handles the "webview" element.
BUT: As the "webview" process needs to be started and is isolated
"webview" is slower and the elements can not be accessed from the
embedding website.

As an alternative i implemented a small callback function in electron.js
which removes the response headers that forbid the embedding.

The removing can be controlled with the new config options:
* ignoreXOriginHeader
* ignoreContentSecurityPolicy
# Added Yr.no as a weather provider

Yr.no is a free Norwegian weather service. The configuration is quite
simple:
```js
{
    weatherProvider: "yr",
    lat: 59.9171,
    lon: 10.7276,
    altitude: 30
}
```
The latitude and longitude cannot have more than 4 decimals, but that
should be plenty. To quote yr: "There is no need to ask for weather
forecasts with nanometer precision!". The altitude should be meters
above sea level and defaults to 0. If `type` is set to `current` the
symbol can display the next 1, 6 or 12 hours by setting
`currentForecastHours` (default is 1).

It states in [Getting
started-guide](https://developer.yr.no/doc/GettingStarted/) that users
of the API should cache the results and use the `Expires`-header to know
when to ask for new data. By using the `If-Modified-Since`-header we can
avoid downloading the same data over and over again. I chose not to
override the `User-Agent`-header set in
[`server.js`](https://github.com/MichMich/MagicMirror/blob/a328ce5/js/server.js#L97)
even though it does not comply with [the terms of
service](https://developer.yr.no/doc/TermsOfService/). It currently
works with the default header, and by searching the web for MagicMirror
the GitHub-repo should be easy to find without an explicit link.

I also had to make some minor changes to `server.js` and
`weatherprovider.js` to be able to send and return HTTP headers. To
handle the HTTP 304 response without body I chose to return `undefined`
so we easily can use the response as a condition: `if (response) ...`.

The documentation for the API is available here:
- [API Reference overview](https://api.met.no/weatherapi/)
-
[Locationforecast](https://api.met.no/weatherapi/locationforecast/2.0/)
- Used to get the weather forecast
- [Sunrise](https://api.met.no/weatherapi/sunrise/2.0/documentation) -
used to find sunrise and sunset times

Co-authored-by: Veeck <github@veeck.de>
dependabot bot and others added 24 commits November 1, 2023 19:48
Bumps
[eslint-plugin-jest](https://github.com/jest-community/eslint-plugin-jest)
from 27.4.3 to 27.6.0.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/jest-community/eslint-plugin-jest/releases">eslint-plugin-jest's
releases</a>.</em></p>
<blockquote>
<h2>v27.6.0</h2>
<h1><a
href="https://github.com/jest-community/eslint-plugin-jest/compare/v27.5.0...v27.6.0">27.6.0</a>
(2023-10-26)</h1>
<h3>Features</h3>
<ul>
<li>include plugin <code>meta</code> information for ESLint v9 (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1454">#1454</a>)
(<a
href="https://github.com/jest-community/eslint-plugin-jest/commit/4d571467631a407a038d5b4d61bc45f4622954f1">4d57146</a>)</li>
</ul>
<h2>v27.5.0</h2>
<h1><a
href="https://github.com/jest-community/eslint-plugin-jest/compare/v27.4.3...v27.5.0">27.5.0</a>
(2023-10-26)</h1>
<h3>Features</h3>
<ul>
<li><strong>valid-title:</strong> allow ignoring tests with non-string
titles (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1460">#1460</a>)
(<a
href="https://github.com/jest-community/eslint-plugin-jest/commit/ea89da9b4e726980d80f97b69d31a4c4f81ff562">ea89da9</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Changelog</summary>
<p><em>Sourced from <a
href="https://github.com/jest-community/eslint-plugin-jest/blob/main/CHANGELOG.md">eslint-plugin-jest's
changelog</a>.</em></p>
<blockquote>
<h1><a
href="https://github.com/jest-community/eslint-plugin-jest/compare/v27.5.0...v27.6.0">27.6.0</a>
(2023-10-26)</h1>
<h3>Features</h3>
<ul>
<li>include plugin <code>meta</code> information for ESLint v9 (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1454">#1454</a>)
(<a
href="https://github.com/jest-community/eslint-plugin-jest/commit/4d571467631a407a038d5b4d61bc45f4622954f1">4d57146</a>)</li>
</ul>
<h1><a
href="https://github.com/jest-community/eslint-plugin-jest/compare/v27.4.3...v27.5.0">27.5.0</a>
(2023-10-26)</h1>
<h3>Features</h3>
<ul>
<li><strong>valid-title:</strong> allow ignoring tests with non-string
titles (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1460">#1460</a>)
(<a
href="https://github.com/jest-community/eslint-plugin-jest/commit/ea89da9b4e726980d80f97b69d31a4c4f81ff562">ea89da9</a>)</li>
</ul>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/6dfbf15d02684acc7633830aebfc22bad3b86034"><code>6dfbf15</code></a>
chore(release): 27.6.0 [skip ci]</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/4d571467631a407a038d5b4d61bc45f4622954f1"><code>4d57146</code></a>
feat: include plugin <code>meta</code> information for ESLint v9 (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1454">#1454</a>)</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/55ad33675da722043fca7e8d2e8a1896967c5001"><code>55ad336</code></a>
chore: update <code>moduleResolution</code> and <code>module</code> to
<code>node16</code> (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1455">#1455</a>)</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/9cc95920ea299f1a4e84969170bf8805d0002e17"><code>9cc9592</code></a>
chore: replace <code>eslint-plugin-node</code> with
<code>eslint-plugin-n</code> (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1462">#1462</a>)</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/1d5bdd1391b4b03a6f75d84c6a190c333dc4373b"><code>1d5bdd1</code></a>
chore(release): 27.5.0 [skip ci]</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/ea89da9b4e726980d80f97b69d31a4c4f81ff562"><code>ea89da9</code></a>
feat(valid-title): allow ignoring tests with non-string titles (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1460">#1460</a>)</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/f2af5194bd01eb48ac41e663de1f36d981c92d5e"><code>f2af519</code></a>
chore: run CI on Node 21 (<a
href="https://redirect.github.com/jest-community/eslint-plugin-jest/issues/1461">#1461</a>)</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/d8b10b47e7040199ac105b1170fd784f78d6a7ee"><code>d8b10b4</code></a>
chore: update permissions granted on CI</li>
<li><a
href="https://github.com/jest-community/eslint-plugin-jest/commit/4295882c21305fd0eae2844e258da119cd17e3bd"><code>4295882</code></a>
chore(deps): lock file maintenance</li>
<li>See full diff in <a
href="https://github.com/jest-community/eslint-plugin-jest/compare/v27.4.3...v27.6.0">compare
view</a></li>
</ul>
</details>
<br />


[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=eslint-plugin-jest&package-manager=npm_and_yarn&previous-version=27.4.3&new-version=27.6.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>
Fixes: #3256 

BUT.. the testcase is inconclusive.. as the code FAILS without the fix,
BUT somehow RETURNS 0 entries..
in real life run the node helper fails, and all calendar processing
stops.
Added my (modified) updater main core into updatenotification default
module

Missing: callback display in MM² (i will code it after)

new part of configuration added:

```
		updates: [
			// array of module update commands
			{
				// with embed npm script
				"MMM-Test": "npm run update"
			},
			{
				// with "complex" process
				"MMM-OtherSample": "rm -rf package-lock.json && git reset --hard && git pull && npm install"
			},
			{
				// with git pull && npm install
				"MMM-OtherSample2": "git pull && npm install"
			},
			{
				// with a simple git pull
				"MMM-OtherSample3": "git pull"
			}
		],
		updateTimeout: 2 * 60 * 1000, // max update duration
		updateAutorestart: false // autoRestart MM when update done ?
```

@khassel: i need your help
I don't use docker, maybe you can help me for this:
How can i check if MM² is running inside a docker ? (from MM² main core)
Actually, I check if we use pm2 or not.
I have to check if docker is used or not too
last time you tell me: "you can't use updater with docker", so I want to
check and deny any update if docker used

---------

Co-authored-by: bugsounet <bugsounet@bugsounet.fr>
I try to use only `html-to-text` library

it's will solve issue #3235 

@rejas, @sdetweil, @khassel: Can you do tests with your own feeds?

Thanks for feedbacks
> - Does the pull request solve a **related** issue?
Fixes #2550 

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

changes the loadUrl to use localhost, as electron and MM are on this
same system
the mm 'server' is still listening on all adapters, including localhost
- Remove "prettier" from plugin array, because it's already enabled by
"plugin:prettier/recommended"
- Remove "jsdoc" from plugin array, because it's already enabled by
"plugin:jsdoc/recommended"
- Enable recommended import rules
- Add two additional import rules

Note: To avoid overloading this PR I'll tackle the jest part with
another PR after this one has been dealt with.
Jest was in the plugin array of the ESLint configuration, but no rules
were enabled. So ESLint hasn't checked any Jest rules yet.

So I activated the recommended Jest rules and added a few more. Then I
fixed the issues (mostly automatically). I have deactivated the rules
"jest/expect-expect" and "jest/no-done-callback" for the time being, as
they would have entailed major changes. I didn't want to make the PR too
big.

I'm not a Jest expert, but the changes so far look good to me. What do
you think of that @khassel? 🙂
Took the ones from dependabot and updated the rest...

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Sometime, `pm2 jlist` don't send an json reponse
Catch error if happen

---------

Co-authored-by: bugsounet <bugsounet@bugsounet.fr>
I think comparing here with "undefined" (as a string) makes only sense
with typeof.
This change replaces the font-awesome moon icon and percent-lit with an
icon showing the current lunar phase.

It uses emoji, which may not be installed on all machines. The fallback
text version is backwards (the dark part of the moon is text-color,
which is normally black but white in MagicMirror).

---------

Co-authored-by: veeck <michael.veeck@nebenan.de>
see title, should be merged because style tests are failing, see
#3284 (comment)
can be overriden with env var ELECTRON_ENABLE_GPU=1.

see #3226 

Tests will fail as long as
#3289 is not merged.
params `fetchInterval` and `excludedEvents` were never used from single
calendar config.

Fixes #3297
- Update default calendar config to use customEvents
- Update url that is displayed when old authentication is used
I have noticed unused variables that seem superfluous.
In the latest versions of ESLint, more and more formatting rules were
removed or declared deprecated. These rules have been integrated into
the new Stylistic package (https://eslint.style/guide/why) and expanded.

Stylistic acts as a better formatter  for JavaScript as Prettier.

With this PR there are many changes that make the code more uniform, but
it may be difficult to review due to the large amount. Even if I have no
worries about the changes, perhaps this would be something for the
release after next.

Let me know what you think.
for all files beginning with `config/config.js` so e.g. `config.js` and
`config.js.template` are included.

Otherwise the test will always fail locally if someone has renamed
`config.js.sample` to `config.js`.
- update `node-ical` to `v0.17.1` (and other deps)
- remove `luxon` (not needed anymore with new `node-ical` version)
- fix `navigator is not defined` errors in e2e tests when running with
Node `v20`
related to #3302

- fix MM_PORT variable not used in electron
- fix to allow full path for MM_CONFIG_FILE variable
rejas
rejas previously approved these changes Jan 1, 2024
@MichMich
Copy link
Collaborator Author

MichMich commented Jan 1, 2024

@rejas I'm on a super crappy connection. Would it be possible for you to fix the merge conflicts?

@MichMich MichMich merged commit 8c0e7db into master Jan 1, 2024
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

calendar crashes when bad dates returned from rrule.between in calendarfetcherutils.js