4753 Commits

Author SHA1 Message Date
Patrick
f6dcfb5ca3
Refresh the Calendar DOM every minute (#3016)
This keeps relative dates accurate when the calendar's fetch frequency
is much larger than a minute.
As fetching incurs network traffic and load on servers and most
calendars don't update that often, simply refreshing locally is enough.

When using relative for today's events, dates will show as "in X
minutes" or "ends in X minutes" for events within an hour and this goes
out of date quickly. It's weird to see that the time is, say, 16:30 and
an event that you know ends at 16:45 is shown to "ends in 23 minutes"
because that's when the last fetch happened.

Please forgive me if there's style issue, I don't have npm set up on my
machine to run the formatter.
2023-01-26 12:55:34 +01:00
Karsten Hassel
157e74ce7c
added error message if <modulename>.js file is missing … (#3015)
… in module folder to get a hint in the logs

fixes #2403
2023-01-26 12:45:17 +01:00
Magnus
67e4dbaacd
Point wind arrow in the direction the wind is flowing (#3022)
Fixes #3019

The previous implementation had the arrow pointing in to the wind. When
the wind blows from the north (0 degrees), the arrow should point
straight down. In other words, no rotation of the arrow-down symbol.
When the wind blows from the south (180 degrees), the arrow should point
straight up (I.e. the arrow down symbol rotated 180 degrees).

Co-authored-by: Magnus Marthinsen <magmar@online.no>
2023-01-22 11:41:19 +01:00
Magnus
2e2962d492
Fix yr weather direction (#3020)
Fixes so the Yr weather direction is not inverted. This error was
[reported in the
community](https://forum.magicmirror.builders/topic/17561/wind-direction-180-degrees-twisted-at-yr).

I misunderstood when developing the module because of the wind direction
arrow was pointing opposite to the arrow displayed on Yr.no. I renamed
the variable to help other developers in the future.

Co-authored-by: Magnus Marthinsen <magmar@online.no>
Co-authored-by: veeck <michael@veeck.de>
2023-01-21 22:40:08 +01:00
grenagit
cd4ba428da
[Alert Module] Fix HTML message (#3018)
Solve #2828 by adding nunjucks safe filter to the message

Co-authored-by: Grena <grena@grenabox.fr>
Co-authored-by: Veeck <github@veeck.de>
2023-01-21 12:46:03 +01:00
grenagit
ee8695637b
Fix typo into french translation (#3017)
French translation: Removes unnecessary spaces
2023-01-21 12:40:20 +01:00
Dave Child
4244c05764
Fix calendar.js missing default symbol prefix (#3007)
Symbols provided in customEvents don't get the "fas fa-fw fa-" prefix,
which according to the docs they should. This fixes that.

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!

Co-authored-by: veeck <michael@veeck.de>
2023-01-16 22:33:05 +01:00
Veeck
c714399b4d
Fix weathergov provider hourly weather forecast (#3011)
Hourly forecast wasnt converted properly during the last release cycle,
one fix and two cleanups were necessary.

Fixes #3010

Co-authored-by: veeck <michael@veeck.de>
2023-01-16 21:52:11 +01:00
Karsten Hassel
8d9f132666
add Pirate Weather as new weather provider (#3006)
solves #3005 

- same api as former dark sky provider
- website: https://pirateweather.net/
2023-01-15 11:12:55 +01:00
Karsten Hassel
d2327d3d6f
removed unneeded (and unwanted) '.' in calendar (#3003)
- removed unneeded (and unwanted) '.' after the year in calendar
repeatingCountTitle (fixes #2896)
- update Collaboration.md
2023-01-14 13:47:32 +01:00
Karsten Hassel
29e3ec06cb
added possibility to ignore MagicMirror repo in updatenotification (#3002)
was [requested in the
forum](https://forum.magicmirror.builders/topic/17519/updatenotification).

- added possibility to exclude MagicMirror Repo and renamed it from
`default` to `MagicMirror`
- improved getting `behind` in case a hard `git fetch` was already done
- removed test "excludes repo if refs don't match regex" because of
above improvement this case is obsolete
- improved `git fetch --dry-run` with `-n` option to exclude tags (noise
reduction)
2023-01-12 09:14:20 +01:00
Veeck
877f8ad380
Refactor mock-data for weather-tests generation (#3000)
Refactored the mock data generation for the tests so we can use plain
JSON files for the data and read it in a more general way.

Comments welcome!

Co-authored-by: veeck <michael@veeck.de>
2023-01-11 21:47:20 +01:00
Veeck
6e80e5a295
Add option to show hourly forecast in increments (#2998)
Adds new config option to show weather forecast for every X hour
(default value is 1 which reflects the current behaviour)
Also adds tests for hourly forecast
Fixes #2996

Co-authored-by: veeck <michael@veeck.de>
2023-01-10 18:55:07 +01:00
Karsten Hassel
7bc91a742f Fix badge status (#2991) 2023-01-07 20:40:36 +01:00
Veeck
fc303146a5
Remove darksky weather provider (#2993)
since the web api gets shut down end of march, see
https://darksky.net/dev

Co-authored-by: veeck <michael@veeck.de>
2023-01-07 20:14:03 +01:00
Veeck
2908c15ea6
Cleanup md files (#2994)
Update the issue template and the contributing guidelines

Co-authored-by: veeck <michael@veeck.de>
2023-01-07 20:13:25 +01:00
Veeck
a975b44fbb
Fix wrong day labels in envcanada forecast (#2992)
Fixes #2987

lastDate isnt a unix date, but just a normal moment-date

Co-authored-by: veeck <michael@veeck.de>
2023-01-07 20:12:23 +01:00
Veeck
4fc38bd5bb
Update dependabot action (#2985)
Supersedes https://github.com/MichMich/MagicMirror/pull/2984 
and tell dependabot to base its PRs against develop
2023-01-02 20:11:26 +01:00
Michael Teeuw
c99f660d98 Prepare 2.23.0 develop branch. 2023-01-01 18:19:30 +01:00
Michael Teeuw
cd739b6912
Merge branch 'master' into develop 2023-01-01 18:02:15 +01:00
Michael Teeuw
0ebedd0fb8 Prepare Release 2.22.0 2023-01-01 17:57:13 +01:00
Andrés Vanegas Jiménez
e9be668d1b
Added a WeatherProvider for Open-Meteo (#2964)
## Added Weather Provider for Open-Meteo.

I've found a completely free weather REST API (event with option of
self-hosting) after having problems with API keys from all MagicMirror
weather providers currently implemented (the remote services, not the
providers themselves).

This API doesn't return information about reverse geocode from latitude
and longitude options like others. I solved that issue using another
free API.

### APIs used
- [Open-Meteo Weather Forecast API](https://open-meteo.com/en/docs)
- [BigDataCloud’s Free Client-Side Reverse Geocoding
API](https://www.bigdatacloud.com/docs/api/free-reverse-geocode-to-city-api)

### Considerations
- This provider is config reliable so, be free to use the same config
you can found in the official MagicMirror Weather module documentation.
- This module config skips the `apiKey` parameter. It's not used at all.
Only `latitude` and `longitude` are required.

#### Config examples:
```
modules: [
  {
    module: "weather",
    position: "top_right",
    header: "Weather Forecast",
    config: {
      updateInterval: <number here>, 
      weatherProvider: "openmeteo",
      type: "current",
      lat: <number here>,
      lon: <number here>,
      showHumidity: true,
      showWindDirectionAsArrow: true,
      showWindDirection: true,
      degreeLabel: true,
    }
  },
  {
    module: "weather",
    position: "top_right",
    header: "Weather Forecast",
    config: {
      updateInterval: <number here>,
      weatherProvider: "openmeteo",
      type: "daily",
      lat: <number here>,
      lon: <number here>
      colored: true,
      maxNumberOfDays: <number here>,
      showPrecipitationAmount: true,
      appendLocationNameToHeader: true
    }
  },
  {
    module: "weather",
    position: "top_right",
    header: "Weather Forecast",
    config: {
      updateInterval: <number here>,
      weatherProvider: "openmeteo",
      type: "hourly",
      lat: <number here>,
      lon: <number here>,
      maxEntries: <number here>,
      showPrecipitationAmount: true,
      degreeLabel: true,
      appendLocationNameToHeader: true
    }
  },
]
```

Co-authored-by: Michael Teeuw <michael@xonaymedia.nl>
2022-12-26 11:56:01 +01:00
Karsten Hassel
76d9042e60
update playwright to v1.29.1 and other dependencies (#2980)
see title, fixes https://github.com/MichMich/MagicMirror/issues/2969
2022-12-22 16:40:53 +01:00
Karsten Hassel
2fec314ff5
improve electron tests (avoid errors in github workflows) (#2977)
Fix electron tests failing sometimes in github workflow.
2022-12-12 21:43:22 +01:00
Kristjan ESPERANTO
3124b0a9c5
Replace &hellip; with (#2973)
I think it is clearer if we don't use the HTML entity.

Co-authored-by: Karsten Hassel <hassel@gmx.de>
2022-12-10 21:50:56 +01:00
Veeck
a2624442cc
Cleanup compliments module (#2965)
Lots of small fixes and cleanups:
- only render something when there is a compliment
- cleanup naming
- use es6 notations
- use fetch instead of XMLHttpRequest in compliments

Co-authored-by: veeck <michael@veeck.de>
Co-authored-by: Karsten Hassel <hassel@gmx.de>
2022-12-10 21:23:00 +01:00
Veeck
eee289aee8
Only add clock type wrappers to DOM when they are used (#2971)
Fixes a layout gap when digital clock is displayd on the left

Reported via discord:
https://discord.com/channels/545884423703494657/545884914982322177/1044376412997562418

Co-authored-by: veeck <michael@veeck.de>
2022-12-10 21:17:29 +01:00
Karsten Hassel
abbae90a8f
update dependencies: electron to v22, fix playwright to v1.27.1 (#2976)
Changes:
- as discussed in #2903: update to electron v22 (we can revert it before
next release if we find any problems)
- update other dependencies
- set playwright to version v1.27.1 until #2969 is solved
2022-12-08 21:30:05 +01:00
Magnus
bd0b3c00ad
New weather provider: Yr.no (#2948)
# 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>
2022-11-08 06:18:47 +01:00
Thomas Hirschberger
b9b7d2c95d
Add option to remove "x-frame-options" and "content-security-policy" 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
2022-11-07 07:42:27 +01:00
veeck
0b01e9dbe0 Fix jsdoc error 2022-11-06 17:51:15 +01:00
Karsten Hassel
4fecffc3df
Add Collaboration.md (#2954)
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>
2022-10-31 14:27:31 +01:00
Magnus
4d47c0837f
Support HTTP headers with CORS-method (#2957)
Adds support for sending and receiving HTTP-headers when using the
CORS-method.

This change is required for the Yr weather-provider introduced in
https://github.com/MichMich/MagicMirror/pull/2948.

To make it easier to add unit tests I moved the server-functions into a
separate file.
2022-10-30 18:14:02 +01:00
Veeck
3879949f58
Switch back to third party fetch lib for all node versions (#2961)
As discussed in https://github.com/MichMich/MagicMirror/pull/2952

Co-authored-by: veeck <michael@veeck.de>
2022-10-29 23:10:25 +02:00
buxxi
f25abfd2f8
Make the e2e tests wait for the app to start and close before running next test (#2952)
When trying to debug why the tests broke for
https://github.com/MichMich/MagicMirror/pull/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.
2022-10-29 22:34:17 +02:00
Veeck
7058fc5fd8
Update dependencies (#2960)
Co-authored-by: veeck <michael@veeck.de>
2022-10-28 21:51:18 +02:00
Naveen
00bc6eb28c
Add dependency review action (#2862)
> 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>
2022-10-28 21:16:42 +02:00
Veeck
f79d3f007d
Cleanup jest config (#2959)
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>
2022-10-28 20:57:08 +02:00
Veeck
c191ff0032
Refactor common weather methods into utils class (#2958)
Co-authored-by: veeck <michael@veeck.de>
2022-10-28 19:56:55 +02:00
Veeck
dde88601a6
Make sure smhi provider api only gets a maximimum of 6 digits coordinates (#2956)
Fixes #2955

Co-authored-by: veeck <michael@veeck.de>
2022-10-24 20:27:18 +02:00
Veeck
2d3940a4ff
Use metric units internally in all weatherproviders (#2849)
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
https://github.com/MichMich/MagicMirror-Documentation/issues/131) -> see
#2926
- cleanup precipations -> #2953

Co-authored-by: veeck <michael@veeck.de>
2022-10-24 19:41:34 +02:00
Veeck
64ed5a54cb
Add error handling to node_helper startup sequence (#2945)
Fixes https://github.com/MichMich/MagicMirror/issues/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>
2022-10-19 21:40:43 +02:00
Karsten Hassel
7bd944391e
fix cors problems with newsfeed articles (#2940)
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).
2022-10-17 21:38:08 +02:00
Karsten Hassel
ad4dbd786a
added new electron tests supporting date mocking (#2947)
first PR for #2942 

- added new electron tests for calendar which test new css classes from
https://github.com/MichMich/MagicMirror/pull/2939
- moved some compliments tests from `e2e` to `electron` because of date
mocking
- removed mock stuff from compliments module
2022-10-17 07:20:23 +02:00
Veeck
fc59ed20e3
Convert moment(..., "X") to moment.unix(...) (#2950)
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>
2022-10-16 23:37:50 +02:00
Magnus
835c893205
Support for configuring FontAwesome class in calendar-module: (#2949)
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>"
}
```
2022-10-16 21:48:57 +02:00
Veeck
7bbf8c19db
Wait till all node_helper are started before finishing startup (#2928)
In response to #2487 this implements a Promise.all for the node_helper
start calls

Co-authored-by: veeck <michael@veeck.de>
2022-10-13 21:38:04 +02:00
Dario Mratovich
1eb2965b2b
Ensure updatenotification module isn't shown when local is *ahead* of 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>
2022-10-12 20:23:42 +02:00
Johan
85a9f14178
Added css class names "today" and "tomorrow" for calendar (#2939)
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.
2022-10-11 21:05:11 +02:00
Veeck
a328ce537f
Cleanup test directory (#2937)
Moves files around and renames some so that the structure is cleaner and
more consistent
2022-10-07 12:16:37 -05:00