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.24.0 #3141

Merged
merged 128 commits into from
Jul 1, 2023
Merged

Release 2.24.0 #3141

merged 128 commits into from
Jul 1, 2023

Conversation

MichMich
Copy link
Collaborator

@MichMich MichMich commented Jul 1, 2023

No description provided.

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>
rejas and others added 23 commits April 9, 2023 12:49
Refactored some methods in calendar module:
- move methods into own file 
- dont call shorten method from titelTransform because why? just call
them after each other.
- added tests for util methods
- cleaned up other tests

---------

Co-authored-by: veeck <michael@veeck.de>
Fixes #3080

---------

Co-authored-by: veeck <michael@veeck.de>
While waiting for the easterbunny I cleaned up some bad coding practice
:-)

Very open for comments especially regarding the places I commented
myself...

---------

Co-authored-by: veeck <michael@veeck.de>
additional:

- update deps
- suppress more unwanted log errors in e2e tests
- add .gitattributes
- fix prettier/js warnings
Due to the size of the commit there is no need for a long explanation:
Openmeteo supports precipitation probability in api, but the weather
provider .js had no support for it. After adding 4 lines it works as
expected. This should have no consequences on other files but improves
usability for (imo) the best weather provider.

---------

Co-authored-by: veeck <michael@veeck.de>
Copy `config.js` to a single `config.js-old` file whenever a
`config.template` is present, instead of using `Date()` as a suffix.
Creating files with a timestamp suffix means that whenever Magic Mirror
is restarted or recreated a new file is written into the config
directory.

Benefits:
* Single backup file will avoid excessive writing of files
* Saves space and usage on SD cards.
* Makes the folder cleaner and easier to overview, compared to ending up
with something like this as time goes on:

![image](https://github.com/MichMich/MagicMirror/assets/17575446/9b66a99c-e760-471e-884c-9daa19689702)
…) (#3096)

Fixes #3095.

Param `hideOngoing` is by default set to `false`, but the event
filtering handles `full day` & `non-full day` events inconsistently. For
`non-full day` _ongoing_ and _upcoming_ events are returned, while for
`full day` only _upcoming_ events where returned.
Co-authored-by: veeck <michael@veeck.de>
Adding date to the clock module when displayType is "analog" and
"showDate" is true. The setting in analogShowDate is respected.

Fixes #3100

---------

Co-authored-by: Michael Teeuw <michael@xonaymedia.nl>
Co-authored-by: Veeck <github@veeck.de>
Fix for today's probability-of-precipitation weather module's envcanada
provider.

Without which, requesting `showPrecipitationProbability` causes
"undefined" to be shown.

Consistent with method used elsewhere in the file:

https://github.com/MichMich/MagicMirror/blob/abe5c08a52ffee6b37c30c1f3160e130f0e966a2/modules/default/weather/providers/envcanada.js#L395-L399
This pr adds (config.js toggleable) showUV_Index to the hourly and
current weather modules, with right now only openmeteo configured to
supply the data. Other providers could have support too by adding
`uv_index` to current and hourly.

For example the current weather looks like
![image](https://github.com/MichMich/MagicMirror/assets/124401812/00fdf5db-c0d5-4797-9a31-1d72dd970d26)
positioned after sunset in the top row.



The following "hacks" are included and could be fixed to make it
cleaner, but the functionality is wanted and it works without problem.
- To hide entries where the UV Index is 0 i added an if statement to the
`hourly.njk` which is not how precipitation is handled.
The following are minor things that might not need fixing:
- The forecast option does not have UV support. This might not be
relevant since UV changes throughout the day but i tried to implement a
"max_UV" to openmeteo.js, but am not confident enough in JS to
accomplish that.
- The UV Icon is wi-hot and manually added to the `.njk`'s. This could
be made changeable by a config but does not seem relevant since wi-hot
is not used by anything else as far as i can tell.

---------

Co-authored-by: veeck <michael@veeck.de>
... makes looking at the checks a little easier in case they fail

---------

Co-authored-by: veeck <michael@veeck.de>
…3118)

- update electron to v25
- added `overrides:` section to `package.json` to fix
stylelint/stylelint#6898 (must be removed when
fixed upstream, fixing the version to `v15.6.2` did not fix the problem)
- update other deps
~~there are no "all" files in the v5 versions of roboto-fonts anymore so
I used the content of their css files in `roboto.css`~~

coming with separate PR
Hi,

Like some default modules, I propose to send an `UPDATES` notification
in an array with the git information of these modules

This allows developers to create their own auto-update system (which
I've been using in my case since 3 years, with automatic things)

Of course, for security reasons `MagicMirror` is excluded

---------

Co-authored-by: bugsounet <bugsounet@bugsounet.fr>
updatenotification: 

allow force scanning with `SCAN_UPDATES` notification from other modules
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
... but e.g. a version tag

fixes #3130 

This happens e.g. in my docker image where I use the version tag to get
the mm sources.

With this PR the error message is avoided and there will be never an
updatenotification when using a tag. This is o.k. because a tag should
never be moved.
last dependency update before next release
fixes #3138 just in case #3137 doesnt get worked on until the next
release

- inc fetchInterval for sample calender
- add fetchInterval config per calendar
@rejas
Copy link
Collaborator

rejas commented Jul 1, 2023

The history seems a little weird. Sure you have the correct master branched?

@codecov-commenter
Copy link

Codecov Report

Merging #3141 (46bca1b) into master (abe5c08) will decrease coverage by 1.87%.
The diff coverage is 61.30%.

❗ Your organization is not using the GitHub App Integration. As a result you may experience degraded service beginning May 15th. Please install the Github App Integration for your organization. Read more.

@@            Coverage Diff             @@
##           master    #3141      +/-   ##
==========================================
- Coverage   27.51%   25.65%   -1.87%     
==========================================
  Files          52       53       +1     
  Lines       11573    11481      -92     
==========================================
- Hits         3184     2945     -239     
- Misses       8389     8536     +147     
Impacted Files Coverage Δ
clientonly/index.js 0.00% <ø> (ø)
js/check_config.js 0.00% <ø> (ø)
js/class.js 72.22% <ø> (-0.26%) ⬇️
js/electron.js 0.00% <0.00%> (ø)
js/fetch.js 100.00% <ø> (ø)
js/loader.js 0.00% <ø> (ø)
js/main.js 0.00% <0.00%> (ø)
js/node_helper.js 98.57% <ø> (-0.04%) ⬇️
js/server.js 95.79% <ø> (-0.11%) ⬇️
js/server_functions.js 90.90% <ø> (-0.43%) ⬇️
... and 30 more

Copy link
Collaborator

@khassel khassel left a comment

Choose a reason for hiding this comment

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

LGTM

@khassel
Copy link
Collaborator

khassel commented Jul 1, 2023

looks like the strange test (14.x) is blocking merge

@MichMich MichMich merged commit e87f50e into master Jul 1, 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.