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 v2.25.0 #3214

Merged
merged 169 commits into from
Oct 1, 2023
Merged

Release v2.25.0 #3214

merged 169 commits into from
Oct 1, 2023

Conversation

MichMich
Copy link
Collaborator

@MichMich MichMich commented Oct 1, 2023

[2.25.0] - 2023-10-01

Thanks to: @bugsounet, @dgoth, @dependabot, @kenzal, @Knapoc, @KristjanESPERANTO, @martingron, @NolanKingdon, @Paranoid93, @TeddyStarinvest 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 needs nodejs version >= v18, older releases have reached end of life and will not work!

Added

  • Added UV Index support to OpenWeatherMap
  • Added 'hideDuplicates' flag to the calendar module
  • Added allowOverrideNotification to weather module to enable sending current weather objects with the CURRENT_WEATHER_OVERRIDE notification to supplement/replace the current weather displayed
  • Added optional AnimateCSS animate for hide(), show(), updateDom()
  • Added AnimateIn and animateOut in module config definition
  • Apply AnimateIn rules on the first start
  • Added automatic client page reload when server was restarted by setting reloadAfterServerRestart: true in config.js, per default false (Automatic Page Reload #3105)
  • Added eventClass option for customEvents on the default calendar
  • Added AnimateCSS integration in tests suite (AnimateCSS integration in tests suite #3206)
  • Added npm dependabot [Reserved to developer] (Add npm dependabot #3210)
  • Added improved logging for calendar (Suggestion - calendar module (not sure how to do it)  #3110)

Removed

  • Breaking Change: Removed digest authentication method from calendar module (which was already broken since release 2.15.0)

Updated

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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
In response to #2487 this implements a Promise.all for the node_helper
start calls

Co-authored-by: veeck <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
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 <[email protected]>
> 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 <[email protected]>

Signed-off-by: naveen <[email protected]>
Co-authored-by: Karsten Hassel <[email protected]>
… 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.
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 <[email protected]>
…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 <[email protected]>
rejas and others added 25 commits September 2, 2023 22:18
Ran a linter over it (djlint) which fixed intendation and a few errors

---------

Co-authored-by: veeck <[email protected]>
Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Port change seems to fix a timing issue.
Fixes #3126 

Added the option `allowOverrideNotification` to `weather.js`. This
allows the module to receive the `CURRENT_WEATHER_OVERRIDE`
notification. The expected payload for this notification is a
full/partial `weatherObject` that is used to supplement/replace the
existing `weatherObject` returned by whichever weather provider is in
use.

No visual changes.

First time contributing - let me know if I've missed something
:slightly_smiling_face:

---------

Co-authored-by: veeck <[email protected]>
Hi,

This is my testing code for AnimateCSS for `show()`, `hide()`,
`updateDom()`

Naturally, we have to do better !

I voluntarily modify `newsfeed` and `compliments` in order to test

Note: I will correct checks later... it's a test...

---------

Co-authored-by: bugsounet <[email protected]>
Co-authored-by: veeck <[email protected]>
Update calendarfetcherutils.js to force recurrence date time to be the
same as event datetime

I found an issue with one of my calendars displaying the wrong time for
certain recurring events. Each event was set up by someone in a
different timezone (Central European) than my own (Eastern US). I traced
the issue back to the `Rrule.between()` method generating odd time
portions under certain circumstances.

The fix I found was to set the UTC time portion of the recurrence
datetime to be the same as the UTC time portion of the event start date.

This resolved the issues with the maladjusted event times, and had no
effect on other event times. While there may be edge cases that are
affected, I have been unable to locate any.

---------

Co-authored-by: Veeck <[email protected]>
Move AnimateCSS changeLog from  v2.24 to  v2.25
related to #2649

I was able to move to internal fetch and all tests seems fine so far.

But we have one problem with the calendar module. In the docs we have
several authentication methods and one of them is `digest`. For this we
used `digest-fetch` which needs `node-fetch` (this is not so clear from
code but I was not able to get it working).

So we have 3 options:
- remove `digest` as authentication method for calendar module (this is
what this PR does at the moment)
- find an alternative npm package or implement the digest stuff
ourselves
- use `digest-fetch` and `node-fetch` for calendar module (so they would
remain as dependencies in `package.json`)

Opinions? @KristjanESPERANTO @rejas @sdetweil @MichMich
solution for #3105 

~~not sure if updatenotification is the right place, so opinions?~~

now impleneted in `main.js`
related to PR [#3092](#3092)

maybe best way is using `html-to-text` library

sample: `&quotHello World&quot` will be transformed to `"Hello World"`
)

... in `config.js`.

Solves #3174 

With getting width/heigt from
`electron.screen.getPrimaryDisplay().workAreaSize` introduced with
#3161 the solution was to
remove the `setFullscreen` line.

So per default the fullscreen resolution is used but when someone now
uses `electronOptions.width`/`electronOptions.height` in `config.js`
these parameters are used and so "no fullscreen" is possible.
follow up for #3187

@bugsounet can you please confirm that this now works for you?
Updated the French translation according to the English file.

---------

Co-authored-by: TeddyStarinvest <[email protected]>
…eclared (#3204)

Issue #3202 

move shared modules/default/utils.js file to index.html
… multiple call (#3200)

PR: #3113  

I see this bugs:

AnimateCSS merge hide() and show() animated css class when we do
multiple call
--> result it will stay en hide state

I think event listener (is animateCSS file) is not a proper solution

I correct it with like traditional code with timer

Fix too: AnimateIn on first start
Some changes after yr api was deprecated and replaced with a new one.

Fixes #3189
Hello,
This pull request allows you to add a class to the tr of the event
sought in customEvents. You must enter the class with the "eventClass"
option.

---------

Co-authored-by: TeddyStarinvest <[email protected]>
Hi,

Just because, i never try to code a test
I purpose to supervise this work

After, perhaps it is not necessary to integrate it in develop branch. 
It's up to you to decide
Fixes #3182

Fixed issue with probability of precipitation not showing up on hourly
or daily forecast

---------

Co-authored-by: veeck <[email protected]>
I just see `electron` package used in develop branch have `1 high
severity vulnerability`

Detail is [there](GHSA-j7hp-h8jx-5ppr)

We can patch it with electron v26.2.2 (last version at this day) and
will correct it

(ChangeLog is not needed in this case)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: veeck <[email protected]>
Like mentioned
[there](#3207 (comment))

I open an PR with npm dependabot (every monthly)

It might be interesting to have an overview every month

---------

Co-authored-by: Veeck <[email protected]>
…fonts directory (#3213)

Last check before release:

* update to electron: v2.26.4
* update eslint-plugins-jest: v27.4.2
* renew `package-lock.json`
* add dependabot to `vendor` and `fonts` directory (monthly check)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
@codecov-commenter
Copy link

Codecov Report

Merging #3214 (6ea94e4) into master (e87f50e) will decrease coverage by 0.37%.
The diff coverage is 5.66%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master    #3214      +/-   ##
==========================================
- Coverage   25.56%   25.19%   -0.37%     
==========================================
  Files          53       54       +1     
  Lines       11481    11933     +452     
==========================================
+ Hits         2935     3007      +72     
- Misses       8546     8926     +380     
Files Coverage Δ
js/defaults.js 100.00% <100.00%> (ø)
js/server.js 95.86% <100.00%> (+0.06%) ⬆️
modules/default/calendar/calendarfetcher.js 93.19% <100.00%> (+0.29%) ⬆️
modules/default/calendar/calendarfetcherutils.js 68.75% <100.00%> (+1.31%) ⬆️
modules/default/newsfeed/newsfeedfetcher.js 83.24% <100.00%> (+0.72%) ⬆️
clientonly/index.js 0.00% <0.00%> (ø)
modules/default/updatenotification/node_helper.js 73.33% <83.33%> (+0.91%) ⬆️
js/loader.js 0.00% <0.00%> (ø)
js/module.js 67.97% <50.00%> (-0.27%) ⬇️
js/server_functions.js 89.23% <72.72%> (-1.68%) ⬇️
... and 10 more

... and 1 file with indirect coverage changes

@@ -46,6 +101,7 @@ Special thanks to @khassel, @rejas and @sdetweil for taking over most (if not al
- Fix date not shown when clock in analog mode (#3100)
- Fix envcanada today percentage-of-precipitation (#3106)
- Fix updatenotification where no branch is checked out but e.g. a version tag (#3130)
- Fix yr weather provider after changes in yr API (#3189)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably put in the wrong release line

@MichMich MichMich merged commit 343e7de into master Oct 1, 2023
7 of 9 checks passed
Ybbet added a commit to Ybbet/MagicMirror that referenced this pull request Oct 2, 2023
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.