Compare commits

...

398 Commits

Author SHA1 Message Date
Michael Teeuw
9e0293047f Merge pull request #2921 from MichMich/develop
Release 2.21.0
2022-10-01 20:06:53 +02:00
Michael Teeuw
298e585361 Prepare 2.21.0 2022-10-01 19:53:44 +02:00
Michael Teeuw
21a6d1bcea Merge pull request #2920 from khassel/issue-template
update issue template
2022-10-01 19:41:10 +02:00
Karsten Hassel
bbe17b9b01 removed deprecated Docker Repository from issue template 2022-10-01 19:13:14 +02:00
Michael Teeuw
4381fc6695 Merge pull request #2912 from khassel/e2e
fix e2e tests not failing on errors
2022-09-28 09:59:10 +02:00
Michael Teeuw
818fd7b490 Merge pull request #2914 from khassel/remove-old-weather
Remove old weather modules
2022-09-28 09:58:47 +02:00
Michael Teeuw
4c6c6f9ed3 Merge pull request #2917 from khassel/update_deps
update dependencies
2022-09-28 09:58:25 +02:00
Karsten Hassel
2338a90191 update dependencies 2022-09-27 22:25:20 +02:00
Karsten Hassel
6cad0e191b fix weather README 2022-09-21 23:40:15 +02:00
Karsten Hassel
f23e604ed4 remove old weather modules 2022-09-21 22:51:48 +02:00
Karsten Hassel
0c1abad9df fix calendar_test_recurring.ics and uncomment recurring tests 2022-09-21 21:01:43 +02:00
Karsten Hassel
fb96cc3c72 fix e2e tests not failing on errors, disable recurring-event-tests of calendar 2022-09-21 00:28:43 +02:00
Michael Teeuw
e917f40542 Merge pull request #2908 from BKeyport/develop 2022-09-18 07:41:08 +02:00
Brendan Keyport
29d467715f ran prettier 2022-09-17 14:47:34 -07:00
B. Keyport
b791a3761f uncaught breaking change - now caught 2022-09-16 23:56:01 -07:00
B. Keyport
02201d9f15 CSS error in old coding, will break. 2022-09-13 14:03:06 -07:00
B. Keyport
b8dbf95497 Minor tweak to uncaught error in sizing. 2022-09-13 13:58:56 -07:00
B. Keyport
65022f3ce1 reset font sizes not to break 2022-09-13 12:44:10 -07:00
B. Keyport
44854d6a4f Fully implement font size adjustments to variables
Partially implementing variables is silly, noticed font sizes weren't implemented fully. Corrected this in my custom, decided it should be in main. Feel free to adjust REM factors to match defaults you like.
2022-09-08 12:19:59 -07:00
B. Keyport
203014c654 Fully implement font size adjustments to variables
Partially implementing variables is silly, noticed font sizes weren't implemented fully. Corrected this in my custom, decided it should be in main. Feel free to adjust REM factors to match defaults you like.
2022-09-08 12:11:56 -07:00
Michael Teeuw
d3e53586fd Merge pull request #2906 from khassel/update-deps
update dependencies, revert electron to v19
2022-09-06 21:59:57 +02:00
Michael Teeuw
9dd343054e Merge pull request #2905 from sdetweil/fixcal
Fixcal
2022-09-06 21:59:40 +02:00
Sam Detweiler
11d17dd2c0 fix typo, duplcate line 2022-09-06 13:29:08 -05:00
Karsten Hassel
4cc3e481cc update dependencies, revert electron to v19 2022-09-05 23:26:04 +02:00
Sam Detweiler
174da38cc8 run prettier 2022-09-05 15:02:16 -05:00
Sam Detweiler
0a35505e8d fix repeating calendar events without byday adjusted incorrectly 2022-09-05 14:52:53 -05:00
Sam Detweiler
032f7ac299 fix events with rrule byweekday 2022-09-05 14:13:46 -05:00
Michael Teeuw
ca906c4b36 Merge pull request #2902 from SkySails/feat/smhi-weather-provider-improvements
feat(weather/smhi): Add hourly forecasts, apparent temperature & custom location name
2022-08-30 10:38:38 +02:00
Malte Hallström
50f72f09ac refactor: fix linting & code style issues 2022-08-30 10:06:34 +02:00
Malte Hallström
02cf9b37e2 refactor: use const instead of let 2022-08-29 20:08:27 +02:00
Malte Hallström
6f273d76b3 chore: update changelog 2022-08-28 20:36:52 +02:00
Malte Hallström
0a1067ec7d feat(weather/smhi): support custom location names 2022-08-28 20:31:54 +02:00
Malte Hallström
48756e8774 feat(weather/smhi): calculate apparent temperature 2022-08-28 20:31:54 +02:00
Malte Hallström
4915ad8fc7 feat(weather/smhi): support hourly forecasts 2022-08-28 20:31:54 +02:00
Michael Teeuw
ba128cbae9 Merge pull request #2881 from SmartMirrorUmbrella/develop
Add possibility to fetch calendars through socket notifications
2022-08-19 12:53:42 +02:00
Michael Teeuw
2a6e51493e Merge pull request #2897 from khassel/update-deps
update dependencies
2022-08-19 12:53:26 +02:00
Michael Teeuw
ef678f9f8a Merge branch 'develop' into update-deps 2022-08-19 12:53:19 +02:00
Michael Teeuw
e997ee7071 Merge pull request #2898 from rejas/docs
Update jsdocs
2022-08-19 12:52:53 +02:00
Michael Teeuw
1273390af3 Merge pull request #2900 from rejas/issue_2899
Use type value in weatherbit provider
2022-08-19 12:52:32 +02:00
veeck
0f6eb4a244 Update CHANGELOG 2022-08-17 09:23:32 +02:00
veeck
2c0c62c89b Remove default weatherEndpoint 2022-08-17 09:18:35 +02:00
veeck
ec13c952d9 Use type value from config instead just only weatherEndpoint 2022-08-16 22:39:30 +02:00
veeck
6fc71cf6f8 Update license year 2022-08-16 17:32:13 +02:00
rejas
bd3137a3dc Update CHANGELOG 2022-08-08 10:45:42 +02:00
rejas
b26da4f97f Fix jsdoc in calendar 2022-08-08 10:30:37 +02:00
veeck
cde0adc28e Update nodehelper docs 2022-08-08 10:30:23 +02:00
Karsten Hassel
2813f101b8 update dependencies 2022-08-07 23:21:59 +02:00
Michael Teeuw
4d8fb8c176 Merge pull request #2895 from buxxi/develop 2022-08-06 18:38:23 +02:00
krukle
9ae62d60f7 fix automated test: error 'key' is not defined 2022-08-06 10:47:37 +02:00
buxxi
17c14e137e Make the calendar show the whole multi day event with how far it has progressed 2022-08-02 16:45:37 +02:00
krukle
bc239f6608 fix checkstyle errors 2022-07-29 10:25:23 +02:00
Christoffer Eid
6493fad8a4 Merge branch 'develop' into develop 2022-07-28 16:32:19 +02:00
Michael Teeuw
d539f459ca Merge pull request #2874 from MichMich/dependabot/github_actions/codecov/codecov-action-3
Bump codecov/codecov-action from 2 to 3
2022-07-28 15:30:32 +02:00
Michael Teeuw
2cca6a2f39 Merge pull request #2875 from MichMich/dependabot/github_actions/actions/setup-node-3
Bump actions/setup-node from 2 to 3
2022-07-28 15:30:17 +02:00
Michael Teeuw
80e07bae0d Merge pull request #2891 from khassel/mm-install
new script `install-mm` for simplifying mm installation
2022-07-28 15:29:43 +02:00
Michael Teeuw
d4c4f6e1a5 Merge branch 'develop' into mm-install 2022-07-28 15:29:37 +02:00
Michael Teeuw
d24fe4e983 Merge pull request #2890 from MikeBishop/showTimeToday
Show time today
2022-07-28 15:25:50 +02:00
Michael Teeuw
aaa9042810 Merge pull request #2889 from MikeBishop/no_day_after
English doesn't have a "day after tomorrow" word
2022-07-28 15:24:49 +02:00
Michael Teeuw
a4bb1cefb9 Merge pull request #2884 from khassel/newsfeed-ttl
respect rss ttl provided by newsfeed
2022-07-28 15:23:32 +02:00
Mike Bishop
c3339b47bb Remove newline to re-run tests 2022-07-25 18:34:24 -04:00
Mike Bishop
0c1e5ea881 Use German as the base for tests 2022-07-25 18:23:27 -04:00
Karsten Hassel
3fbd9006ad new script install-mm for simplifying mm installation and new params --no-audit --no-fund --no-update-notifier for less noise 2022-07-25 22:35:16 +02:00
Mike Bishop
be9761146c CHANGELOG 2022-07-25 14:09:56 -04:00
Mike Bishop
5aa9e7e0f6 Add showTimeToday option 2022-07-25 13:52:43 -04:00
Mike Bishop
65e87aea52 CHANGELOG 2022-07-25 13:49:19 -04:00
Mike Bishop
66fffc932c English doesn't have a "day after tomorrow" word 2022-07-25 13:33:47 -04:00
Karsten Hassel
1e934e16af respect rss ttl provided by newsfeed 2022-07-21 22:07:36 +02:00
krukle
82fbb7e32d add changes to changelog 2022-07-14 08:49:37 +02:00
krukle
8bf9b9bef9 Add possibility to fetch calendars through socket notifications 2022-07-12 14:35:04 +02:00
Michael Teeuw
2d15e4f976 Merge pull request #2877 from davide125/permissions
Drop executable bit where not needed
2022-07-06 16:30:08 +02:00
Michael Teeuw
055ce56a57 Merge pull request #2878 from kolbyjack/fix-per-calendar-max-entries
Broadcast all calendar events while still honoring global and per-calendar maximumEntries
2022-07-05 16:12:52 +02:00
Jonathan Kolb
f1f2a61dc8 Broadcast all calendar events while still honoring global and per-calendar maximumEntries 2022-07-03 13:17:18 -04:00
Davide Cavalca
39c1b37726 Drop executable bit where not needed 2022-07-02 14:38:10 -07:00
Michael Teeuw
5b1b25fa86 Prepare v2.21.0-develop 2022-07-02 13:09:41 +02:00
dependabot[bot]
54ab0b1bf0 Bump actions/setup-node from 2 to 3
Bumps [actions/setup-node](https://github.com/actions/setup-node) from 2 to 3.
- [Release notes](https://github.com/actions/setup-node/releases)
- [Commits](https://github.com/actions/setup-node/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/setup-node
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-02 11:07:27 +00:00
dependabot[bot]
5507e9ffe9 Bump codecov/codecov-action from 2 to 3
Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 2 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v2...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-07-02 11:07:24 +00:00
Michael Teeuw
30d5bfe59e Merge pull request #2873 from MichMich/develop
v2.20.0
2022-07-02 13:07:02 +02:00
Michael Teeuw
b716ec33d9 Release v2.20.0 2022-07-02 13:00:01 +02:00
Michael Teeuw
e25209d9f9 Merge pull request #2871 from sdetweil/fix_maxEntries
Fix maximumEntries regression
2022-06-28 15:26:31 +02:00
Sam Detweiler
1f4ac82495 add changelog for #2868 2022-06-28 08:05:13 -05:00
Sam Detweiler
0baf58f3fd fix regression calendar.maximumEntries not used 2022-06-28 08:01:28 -05:00
Michael Teeuw
9a769203e3 Merge pull request #2870 from khassel/update_deps 2022-06-25 10:33:18 +02:00
Karsten Hassel
1435efaea7 update depencies (before upcoming new release) 2022-06-24 23:44:17 +02:00
Michael Teeuw
c411ac821e Merge pull request #2864 from KristjanESPERANTO/develop
Use .yaml instead of .yml
2022-06-17 15:34:21 +02:00
Michael Teeuw
da0489fc0c Merge pull request #2866 from kolbyjack/broadcast-duplicate-events
Include duplicate events in broadcasts
2022-06-17 15:32:17 +02:00
Jonathan Kolb
c82de1e314 Group filters that only apply when limiting for display 2022-06-09 09:21:00 -04:00
Jonathan Kolb
604a555e14 Include duplicate events in broadcasts 2022-06-09 07:52:29 -04:00
Kristjan SCHMIDT
87e011ff96 Add entry for YAML file extention 2022-06-07 00:07:56 +02:00
Kristjan SCHMIDT
9b2051827c Use .yaml instead of .yml
This is the recommended file extension: https://yaml.org/faq.html
2022-06-06 23:57:52 +02:00
Michael Teeuw
47aefb0c82 Merge pull request #2858 from turrisxyz/Pinned-Dependencies-GitHub
chore: Set permissions for GitHub actions
2022-06-04 14:59:28 +02:00
Michael Teeuw
70da1d6f5c Merge pull request #2861 from turrisxyz/Dependabot-GitHub-Actions
chore: Included githubactions in the dependabot config
2022-06-04 14:59:14 +02:00
Michael Teeuw
c0743ce9de Merge pull request #2857 from khassel/fetch 2022-06-04 14:14:52 +02:00
naveen
fe7b4044e0 chore: Included githubactions in the dependabot config
This should help with keeping the GitHub actions updated on new releases. This will also help with keeping it secure.

Dependabot helps in keeping the supply chain secure https://docs.github.com/en/code-security/dependabot

GitHub actions up to date https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot

https://github.com/ossf/scorecard/blob/main/docs/checks.md#dependency-update-tool
Signed-off-by: naveen <172697+naveensrinivasan@users.noreply.github.com>
2022-06-02 01:29:42 +00:00
nathannaveen
701ce8ad47 chore: Set permissions for GitHub actions
Restrict the GitHub token permissions only to the required ones; this way, even if the attackers will succeed in compromising your workflow, they won’t be able to do much.

- Included permissions for the action. https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs

[Keeping your GitHub Actions and workflows secure Part 1: Preventing pwn requests](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)

Signed-off-by: nathannaveen <42319948+nathannaveen@users.noreply.github.com>
2022-05-30 00:58:20 +00:00
Karsten Hassel
591f907134 fix newsfeedfetcher using correct stream version (changed with node-18-fetch) 2022-05-28 22:28:37 +02:00
Michael Teeuw
4f1db749c0 Merge pull request #2855 from khassel/fetch 2022-05-28 06:38:52 +02:00
Karsten Hassel
ae72ed8c67 improve startApplication 2022-05-27 21:49:29 +02:00
Karsten Hassel
ab7934fa98 Merge branch 'develop' into fetch
# Conflicts:
#	CHANGELOG.md
2022-05-27 21:04:07 +02:00
Michael Teeuw
a4c77f0c9e Merge pull request #2853 from khassel/update_deps 2022-05-27 20:32:45 +02:00
Karsten Hassel
0023c64d59 use internal fetch function of node instead external node-fetch library if node version >= v18 2022-05-27 19:46:28 +02:00
Karsten Hassel
b55b3bd63b update dependencies including electron to v19 2022-05-24 23:50:33 +02:00
Michael Teeuw
cbda20f67e Merge pull request #2850 from khassel/iframe
added a new config option `httpHeaders` used by helmet
2022-05-18 09:15:32 +02:00
Michael Teeuw
e598dbb206 Merge branch 'develop' into iframe 2022-05-18 09:15:16 +02:00
Michael Teeuw
094881fc5c Merge pull request #2848 from rejas/issue_2192
Show endDate for calendar events when using dateHeaders
2022-05-18 09:14:36 +02:00
Michael Teeuw
b13414cab8 Merge branch 'develop' into issue_2192 2022-05-18 09:14:29 +02:00
Michael Teeuw
3e65ac653b Merge pull request #2844 from rejas/actions
Update github actions
2022-05-18 09:13:40 +02:00
Michael Teeuw
05621c9876 Merge branch 'develop' into actions 2022-05-18 09:13:31 +02:00
Michael Teeuw
938619ce0c Merge pull request #2843 from khassel/update-deps
update dependencies
2022-05-18 09:12:59 +02:00
Michael Teeuw
8e5267d44f Merge pull request #2842 from MMRIZE/weather
Added outgoing notification of the weather module
2022-05-18 09:12:48 +02:00
Karsten Hassel
3b55886c45 added a new config option httpHeaders used by helmet 2022-05-13 22:29:43 +02:00
rejas
ed3aceb427 Update CHANGELOG 2022-05-10 21:44:46 +02:00
rejas
c3b2aaec69 Show endDate for calendar events
when dateHeader is enabled and showEnd is set to true
2022-05-10 21:44:39 +02:00
veeck
bb1d3431cc Update node test matrix for real 2022-05-02 22:35:03 +02:00
veeck
fe83fe338a Update CHANGELOG 2022-05-02 22:02:20 +02:00
veeck
6504b5e818 Update github actions and tested node versions 2022-05-02 22:01:26 +02:00
Karsten Hassel
8578900bfb update deps 2022-05-02 21:50:16 +02:00
Michael Teeuw
d730dd04bf Merge pull request #2839 from rohitdharavath/patch-1 2022-04-26 20:46:38 +02:00
eouia
1d90c5e1fe Add JSDoc description 2022-04-26 17:37:23 +02:00
eouia
0f39b7733c fix typo jsdom tag returns 2022-04-26 14:57:47 +02:00
eouia
038b6765e7 Change property name clearly 2022-04-26 14:52:05 +02:00
eouia
58569a648c Added ECMA Version of lint to 2020 2022-04-26 14:51:12 +02:00
eouia
df0f048ecc Added outgoing notification 2022-04-26 13:55:39 +02:00
Rohith Dharavath
288a008e72 Update electron.js
corrected spelling mistake
2022-04-21 01:53:22 +05:30
Michael Teeuw
439690b981 Merge pull request #2836 from khassel/fix-non-latin 2022-04-09 19:18:17 +02:00
Karsten Hassel
b4e75f6844 fix problems with non latin fonds caused by updating to fontsource (fixes #2835). 2022-04-05 20:58:48 +02:00
Michael Teeuw
3f6a5a7772 Prepare 2.20.0-develop 2022-04-01 20:49:47 +02:00
Michael Teeuw
a2d7cdcfb4 Merge pull request #2834 from MichMich/develop
Release v2.19.0
2022-04-01 20:43:39 +02:00
Michael Teeuw
d995ce38ea Add missing contributor to list. 2022-04-01 20:39:22 +02:00
Michael Teeuw
0b21a22027 Prepare 2.19.0 2022-04-01 20:36:55 +02:00
Michael Teeuw
111d75b351 Merge pull request #2832 from khassel/disable-gpu
Add env var to disable gpu under electron when set
2022-04-01 20:34:15 +02:00
Michael Teeuw
b54cac72ec Merge branch 'develop' into disable-gpu 2022-04-01 20:30:01 +02:00
Michael Teeuw
69b2dd698c Merge pull request #2819 from krekos/patch-1
Add missing CS translations
2022-04-01 20:29:13 +02:00
Michael Teeuw
16bf19d115 Merge branch 'patch-1' of https://github.com/krekos/magicmirror into pr/krekos/2819 2022-04-01 20:24:04 +02:00
Michael Teeuw
c57c9c2a8f Run Prettier. 2022-04-01 20:21:46 +02:00
Michael Teeuw
9f750e5980 Add Changelog. 2022-04-01 20:20:43 +02:00
Krekos
8d296e563d Add missing CS translations 2022-04-01 20:18:54 +02:00
Karsten Hassel
88f7570caf add comments in electron.js 2022-03-29 21:24:17 +02:00
Karsten Hassel
00a7c6b5be added new env var ELECTRON_DISABLE_GPU which disable gpu under electron if set (fixes #2831). 2022-03-29 20:41:36 +02:00
Michael Teeuw
612b06346d Merge pull request #2829 from sdetweil/calfix 2022-03-29 19:55:20 +02:00
Michael Teeuw
9620566fbb Merge pull request #2830 from khassel/node-ical 2022-03-29 19:54:48 +02:00
Karsten Hassel
ed65c70a36 update node-ical to v0.15 and added luxon as dependency for not breaking the "no-optional" install (see #2718 and #2824). 2022-03-28 19:41:41 +02:00
Sam Detweiler
cdd87436be fix fullday/showend conflict #2629 2022-03-27 09:16:25 -05:00
Michael Teeuw
a143ebc8e0 Merge pull request #2827 from shin10/develop 2022-03-26 15:21:40 +01:00
Michael Trenkler
93581ca4d9 toggle pointer-events with suspension 2022-03-26 15:15:21 +01:00
Michael Teeuw
c5e9c9a683 Merge pull request #2825 from rejas/issue_2812 2022-03-22 21:41:55 +01:00
veeck
1bdab10872 Update dependencies 2022-03-22 21:29:49 +01:00
veeck
eca339ad60 Fix weird code in weathergov, still returns no data though 2022-03-22 21:11:44 +01:00
veeck
af5eb3447f Update CHANGELOG 2022-03-22 20:49:07 +01:00
rejas
b72cb52a71 Remove windspeed conversion from openweathermap 2022-03-22 20:46:15 +01:00
Michael Teeuw
d0565a15d3 Merge pull request #2820 from KristjanESPERANTO/german 2022-03-12 19:49:45 +01:00
Kristjan SCHMIDT
468bf1d6a0 Update German translation
- Remove unnecessary HTML Entities
- Completion of missing translations
- Rewordings
- Corrections of typography mistakes
2022-03-12 13:03:14 +01:00
Krekos
1d2637c980 Add missing CS translations 2022-03-12 12:21:20 +01:00
Michael Teeuw
a52c68d852 Merge pull request #2809 from Nerfzooka/patch-1
Revive contribution link
2022-03-11 15:46:16 +01:00
Michael Teeuw
e12f57d872 Merge pull request #2815 from 10bias/weather-provider-weatherflow
Weather provider weatherflow
2022-03-11 15:43:22 +01:00
Michael Teeuw
5def02ff7f Merge pull request #2810 from philnagel/weatherModule-weathergov-feelsLikeFix
fix parsing of feels like for weathergov
2022-03-11 15:39:11 +01:00
Michael Teeuw
7cab6eb680 Merge branch 'develop' into patch-1 2022-03-11 15:38:08 +01:00
Michael Teeuw
dcaa3526a4 Merge pull request #2817 from khassel/update_deps
Update dependencies
2022-03-11 15:36:43 +01:00
Michael Teeuw
2a989bc235 Merge pull request #2818 from kolbyjack/fix/changing-start-date
Don't adjust startDate for full day events if endDate is in the past
2022-03-11 15:36:25 +01:00
Jon Kolb
d588fab981 Don't adjust startDate for full day events if endDate is in the past 2022-03-02 22:09:15 -05:00
Karsten Hassel
9cb006b871 update dependencies 2022-02-28 23:08:56 +01:00
tobias
9056abaf4a add function to switch units 2022-02-26 11:09:41 +01:00
tobias
3c27fd10b6 fix a problem with sunrise 2022-02-25 18:30:01 +01:00
tobias
4048d79fc5 run lint:prettier 2022-02-22 11:14:28 +01:00
tobias
212e60c12d fix copy and paste mistake in comment 2022-02-22 11:12:17 +01:00
tobias
45142bc1bc updated the changelog 2022-02-21 14:58:48 +01:00
tobias
e791a663c8 add weatherprovider for weatherflow 2022-02-21 14:54:35 +01:00
Michael Teeuw
81ae95eba7 Merge pull request #2814 from KristjanESPERANTO/patch-2 2022-02-20 12:18:21 +01:00
Kristjan ESPERANTO
7ca5d81123 Update CHANGELOG.md 2022-02-20 02:30:47 +01:00
Kristjan ESPERANTO
e234d2379b Fix log output
Before:
```
MMM-OlympicGames - Load translationfalse: translations/de.json
translator.js:107 MMM-OlympicGames - Load translation  fallback: translations/en.json
```

After:
```
MMM-OlympicGames - Load translation: translations/de.json
translator.js:107 MMM-OlympicGames - Load translation fallback: translations/en.json
```
2022-02-20 02:24:22 +01:00
philna
d0838d53c2 fix parsing of feels like for weathergov 2022-02-08 21:07:08 -06:00
Michael Teeuw
880e2160a3 Merge pull request #2808 from KristjanESPERANTO/min-node-version-14 2022-02-07 09:41:36 +01:00
Nerfzooka
c214d776df Revive contribution link
Not sure if this is the contribution page that was intended, but the old link was pretty dead (https://docs.magicmirror.builders/getting-started/contributing.html).
2022-02-04 13:33:20 -05:00
Michael Teeuw
0a8220ca52 Merge pull request #2806 from khassel/update_deps
update to electron v17 and other deps
2022-02-02 09:08:59 +01:00
Michael Teeuw
b0c57272c2 Merge branch 'develop' into update_deps 2022-02-02 09:08:47 +01:00
Michael Teeuw
fbdebcae8a Merge pull request #2807 from KristjanESPERANTO/develop
Update Danish translation
2022-02-02 09:03:16 +01:00
Michael Teeuw
8e376deaaa Merge branch 'develop' into develop 2022-02-02 09:03:01 +01:00
Kristjan SCHMIDT
2d353ffa35 Minimal node version is 14
This was probably overseen in #2746
2022-02-02 01:47:04 +01:00
Kristjan SCHMIDT
b70a9c36fa Begin with capital letters 2022-02-02 00:48:50 +01:00
Kristjan SCHMIDT
c98967cb1e Update Danish translation 2022-02-02 00:46:05 +01:00
Kristjan SCHMIDT
05f0d1855c Update Danish translation
Translation from @The-Exterminator #2805
2022-02-01 23:51:01 +01:00
Karsten Hassel
cee5043625 update to electron v17 and other deps 2022-02-01 20:07:18 +01:00
Michael Teeuw
528358f3c3 Merge pull request #2795 from oscarb/patch-1 2022-01-28 11:23:15 +01:00
Michael Teeuw
da90412cea Merge pull request #2798 from khassel/cors 2022-01-28 11:22:43 +01:00
Michael Teeuw
e794aab012 Merge pull request #2799 from KristjanESPERANTO/develop 2022-01-28 11:21:50 +01:00
Michael Teeuw
69daf14ffd Merge pull request #2800 from khassel/update_deps 2022-01-28 11:21:14 +01:00
Karsten Hassel
afa6c4270d update dependencies including electron v17 beta 2022-01-27 22:05:33 +01:00
Kristjan SCHMIDT
be22309e45 Undo minor change: Version 1.0.0 wasn't MagicMirror² 2022-01-26 23:54:20 +01:00
Kristjan SCHMIDT
6f27e5ae07 MagicMirror -> MagicMirror² 2022-01-26 23:47:51 +01:00
Kristjan SCHMIDT
7e79547973 Add "Using a consistent spelling of MagicMirror²." 2022-01-26 23:16:22 +01:00
Kristjan SCHMIDT
a5668b1b99 Magic Mirror -> MagicMirror²
Consistent spelling
2022-01-26 23:09:26 +01:00
Karsten Hassel
f04dd6b6cd introduce useCorsProxy, per default only enabled for darksky and envcanada 2022-01-26 22:44:20 +01:00
Karsten Hassel
9f9c17ea8a increase test timeout to 20 sec. 2022-01-26 00:38:34 +01:00
Karsten Hassel
48845ab60e Merge branch 'develop' into cors
# Conflicts:
#	CHANGELOG.md
2022-01-26 00:31:02 +01:00
Karsten Hassel
59bc2318f8 fix weather tests and add CHANGELOG 2022-01-26 00:29:01 +01:00
Karsten Hassel
c622db918b working version, use corsUrl in weather providers 2022-01-25 23:42:42 +01:00
Michael Teeuw
4b381f33b5 Merge pull request #2794 from khassel/newsfeed-title-url
Newsfeed module: Add option to display title as url
2022-01-25 14:24:22 +01:00
Karsten Hassel
7cfc7b9d74 first cors approach 2022-01-25 00:43:57 +01:00
Oscar Björkman
7f52f9bcf2 Fix broken link to contribution guidelines 2022-01-23 01:55:56 +01:00
Karsten Hassel
c4e7e42cdd added new config option showTitleAsUrl to newsfeed module 2022-01-22 23:34:57 +01:00
Michael Teeuw
d181365620 Merge pull request #2788 from khassel/husky 2022-01-19 20:04:41 +01:00
Michael Teeuw
97b474665a Merge pull request #2787 from kolbyjack/broadcast_all_events 2022-01-19 20:03:49 +01:00
Karsten Hassel
284b01c524 husky changes 2022-01-17 21:39:21 +01:00
Jon Kolb
e3857ca0f4 Address review feedback 2022-01-17 10:48:16 -05:00
Jonathan Kolb
0aee42255f Return full list of events from createEventList for broadcasting 2022-01-17 10:07:12 -05:00
Michael Teeuw
fcb0d33e29 Merge pull request #2774 from khassel/remove-old-weather-modules 2022-01-14 23:11:12 +01:00
Karsten Hassel
3a761f2082 change link color to white 2022-01-14 22:54:42 +01:00
Karsten Hassel
ed0ad7b988 use fake modules instead 2022-01-14 22:16:07 +01:00
Karsten Hassel
c392b5a661 Merge branch 'develop' into remove-old-weather-modules
# Conflicts:
#	modules/default/currentweather/currentweather.js
2022-01-14 22:07:21 +01:00
Michael Teeuw
766848eea3 Merge pull request #2776 from SiderealArt/patch-1
Update zh-tw translation
2022-01-14 10:22:20 +01:00
Michael Teeuw
7ede537d1b Fix prettier issues. 2022-01-14 10:00:14 +01:00
Michael Teeuw
ec38f90662 Merge remote-tracking branch 'origin/develop' into pr/SiderealArt/2776 2022-01-14 09:58:05 +01:00
Michael Teeuw
d793b82d51 Merge pull request #2784 from khassel/e2e-tests 2022-01-14 07:10:26 +01:00
Michael Teeuw
aafeb1e875 Merge pull request #2785 from khassel/helmet-fix 2022-01-14 07:09:30 +01:00
Karsten Hassel
480c10b239 fix helmet, use defaults from v4 2022-01-14 00:05:08 +01:00
Karsten Hassel
82bb2544de add CHANGELOG and fix weather_spec 2022-01-13 22:46:10 +01:00
Karsten Hassel
b714abd9a0 Merge branch 'develop' into e2e-tests 2022-01-13 22:35:26 +01:00
Karsten Hassel
c1be0180f9 change weather_spec 2022-01-13 22:33:57 +01:00
Karsten Hassel
2cfafe7bfe improve waitForElement 2022-01-13 21:52:47 +01:00
Michael Teeuw
da8edbfdc1 Merge pull request #2783 from JHWelch/update-urls
Update urls
2022-01-13 09:44:07 +01:00
Jordan Welch
54bcbbc1de Update contribution link to active URL 2022-01-12 20:36:35 -06:00
Jordan Welch
5463183e01 Update config introduction to active URL. 2022-01-12 20:35:25 -06:00
Karsten Hassel
42b80b18f8 testing wait alternatives 2022-01-13 00:50:15 +01:00
Michael Teeuw
65fada7ef1 Merge pull request #2771 from CFenner/patch-1 2022-01-12 20:50:09 +01:00
Christopher Fenner
9e4997aa81 Merge branch 'develop' into patch-1 2022-01-12 20:39:09 +01:00
Michael Teeuw
e8c6ef945a Merge pull request #2782 from khassel/helmet 2022-01-12 20:18:01 +01:00
Karsten Hassel
14a22efae1 Merge branch 'develop' into helmet 2022-01-12 20:07:20 +01:00
Michael Teeuw
f7f0bc8681 Merge pull request #2780 from Tom-Hirschberger/develop 2022-01-12 19:52:07 +01:00
Michael Teeuw
9cb8a135e6 Merge pull request #2778 from khassel/roboto 2022-01-12 19:47:34 +01:00
Michael Teeuw
a02bce6517 Merge pull request #2766 from k1rd3rf/patch-1 2022-01-12 19:46:22 +01:00
Karsten Hassel
9604c3a187 helmet upgrade to v5 2022-01-11 21:51:09 +01:00
Tom Hirschberger
1ba4213910 set the hidden class by classList features instead of string manipulation now 2022-01-11 15:54:45 +01:00
Tom Hirschberger
6c63fac240 updated changelog 2022-01-11 15:52:56 +01:00
Tom Hirschberger
b3dd531abb removed adding of shown class 2022-01-11 15:52:00 +01:00
Tom Hirschberger
4ce42d4f70 added shown/hidden class feature to CHANGELOG 2022-01-11 15:25:37 +01:00
Tom Hirschberger
4325fcdca2 automatically add/remove a hidden/shown class to the module wrappers if they get hidden or shown 2022-01-11 15:20:33 +01:00
SiderealArt
8cf9d5f3ed Update CHANGELOG.md 2022-01-11 09:01:24 +08:00
Karsten Hassel
8cb6015930 refactor tests 2022-01-10 23:27:53 +01:00
Karsten Hassel
f3cefde7cb update deps and add CHANGELOG 2022-01-10 22:42:07 +01:00
SiderealArt
92fcdde60d Update zh-tw translation 2022-01-10 17:33:12 +08:00
Karsten Hassel
2dcf55ea89 change from deprecated roboto-fontface to @fontsource 2022-01-09 16:17:38 +01:00
Christopher Fenner
8537f40f1d Update calendar.js 2022-01-09 11:25:03 +01:00
Christopher Fenner
8417590893 update test case 2022-01-09 11:10:00 +01:00
Christopher Fenner
4c43f5db15 use alternative calendar icon 2022-01-09 08:38:48 +01:00
Karsten Hassel
eb32ec89b4 remove old weather modules 2022-01-08 23:08:41 +01:00
Michael Teeuw
ad66c02735 Merge pull request #2773 from khassel/weather-test-absolute 2022-01-08 07:12:35 +01:00
Karsten Hassel
e8c0611db4 increase test timeout 2022-01-07 22:00:31 +01:00
Karsten Hassel
7fa54642e1 Merge branch 'develop' into weather-test-absolute
# Conflicts:
#	CHANGELOG.md
2022-01-07 21:52:37 +01:00
Michael Teeuw
0e6d40f96c Merge pull request #2764 from oraclesean/patch-1 2022-01-07 21:44:46 +01:00
Karsten Hassel
cd1fe4e182 weather test for new absolute property 2022-01-07 21:38:56 +01:00
CFenner
c56b601ab8 adjust test case 2022-01-06 21:49:21 +01:00
Christopher Fenner
e78fa11fd4 Update CHANGELOG.md 2022-01-06 21:40:19 +01:00
Christopher Fenner
1619dd29e9 Apply suggestions from code review 2022-01-06 21:28:25 +01:00
CFenner
793f3dd75c Merge remote-tracking branch 'upstream/develop' into patch-1 2022-01-06 21:24:24 +01:00
Christopher Fenner
ce05f8e958 use solid type for font awesome icons 2022-01-05 13:28:07 +01:00
Christopher Fenner
c8c4585946 use solid type for font awesome icons 2022-01-05 13:27:20 +01:00
Christopher Fenner
990d1adfb2 use solid type for font awesome icons 2022-01-05 13:26:50 +01:00
Christopher Fenner
404343de1d use solid type for font awesome icons 2022-01-05 13:19:55 +01:00
Christopher Fenner
24bfaaca7e use solid type for font awesome icons 2022-01-05 13:18:08 +01:00
Christopher Fenner
060ca43fc8 use solid type for font awesome icons
related to #2768
2022-01-05 13:13:40 +01:00
Fredrik Oterholt
b87e802c8d Broken link for contribution guidelines
Replace with correct URL for the contribution guidelines
2022-01-04 09:18:29 +01:00
Sean Scott
0f596d5620 Update weather.js
Set absoluteDates default to false
2022-01-02 14:45:24 -07:00
Sean Scott
3ebdb67bc0 Update CHANGELOG.md
Update CHANCEGLOG
2022-01-02 11:44:01 -07:00
Sean Scott
a5668ef729 Update forecast.njk
Add an absolute date option to the weather module's forecast.
2022-01-02 11:35:29 -07:00
Michael Teeuw
24fccf6c44 Merge pull request #2762 from MichMich/prepare-2.19.0-develop
Prepare v2.19.0-develop.
2022-01-01 19:47:26 +01:00
Michael Teeuw
e12692252e Prepare v2.19.0-develop. 2022-01-01 19:37:55 +01:00
Michael Teeuw
a6cbc9f0ef Merge pull request #2761 from MichMich/develop
release v2.18.0
2022-01-01 19:31:41 +01:00
Michael Teeuw
be073daaf2 Merge pull request #2760 from MichMich/prepare-release-2.18.0
Prepare-release-2.18.0
2022-01-01 19:24:05 +01:00
Michael Teeuw
4c919a7489 Prepare 2.18.0. 2022-01-01 19:17:35 +01:00
Michael Teeuw
7a7ed48063 Merge pull request #2754 from kolbyjack/broadcast-custom-symbols 2021-12-29 09:14:00 +01:00
Michael Teeuw
01010fe795 Merge pull request #2753 from khassel/calendar-test 2021-12-29 09:13:11 +01:00
Karsten Hassel
32382dc461 Merge branch 'develop' into calendar-test 2021-12-28 13:45:58 +01:00
Jon Kolb
bf83341fb9 Merge branch 'develop' into broadcast-custom-symbols 2021-12-28 07:33:22 -05:00
Michael Teeuw
c4d2a7b409 Merge pull request #2751 from KristjanESPERANTO/patch-1
Add End-to-End Testing + Format
2021-12-28 13:23:54 +01:00
Michael Teeuw
4ad832dcdd Merge pull request #2755 from sdetweil/newcal 2021-12-27 17:59:50 +01:00
sam detweiler
b35d25eda4 Merge branch 'develop' into newcal 2021-12-27 08:29:09 -06:00
Michael Teeuw
da51a5512f Merge pull request #2756 from sdetweil/fixhttps 2021-12-27 10:19:34 +01:00
Sam Detweiler
710d51bf32 Merge branch 'fixhttps' of https://github.com/sdetweil/MagicMirror into fixhttps 2021-12-26 17:54:32 +01:00
Sam Detweiler
446bb229bc fix changelog 2021-12-26 17:53:28 +01:00
sam detweiler
c605023bad Merge branch 'develop' into fixhttps 2021-12-26 10:46:12 -06:00
Sam Detweiler
28d866c001 enable useHTTP for full electron version 2021-12-26 17:43:27 +01:00
Sam Detweiler
95b587381b add changelog entry 2021-12-26 16:43:14 +01:00
Sam Detweiler
fc14431147 fix date correction comparison for fulldate, just less than, not less or equal 2021-12-26 16:40:17 +01:00
Karsten Hassel
5d8f2f5da1 iterate over timezones 2021-12-26 16:27:40 +01:00
Jon Kolb
cf428dc1f7 Add CHANGELOG entry 2021-12-26 09:44:04 -05:00
Jon Kolb
c579989ded Perform customEvent symbols replacement in symbolsForEvent 2021-12-26 09:25:28 -05:00
Karsten Hassel
a954a62762 added test for calendar recurring event with checks the correct date displayed (related to #2752) 2021-12-26 14:30:38 +01:00
Kristjan Esperanto
855860c00c Update CONTRIBUTING.md 2021-12-26 06:54:46 +01:00
Kristjan Esperanto
58c48b1b21 End-to-End Testing + Format 2021-12-25 21:58:30 +01:00
Michael Teeuw
512c392386 Merge pull request #2748 from sdetweil/calfix 2021-12-24 18:00:06 +01:00
Sam Detweiler
c5ed70dbfc past prettier 2021-12-25 02:26:11 +11:00
Sam Detweiler
f75ca0c399 after prettier 2021-12-25 02:22:42 +11:00
sam detweiler
75c2977daf Merge branch 'develop' into calfix 2021-12-24 09:17:25 -06:00
Sam Detweiler
b3ef4b40c5 fix calendar across timezone, showEnd/FullDay 2021-12-25 02:10:48 +11:00
Michael Teeuw
bd5664cf8e Merge pull request #2746 from khassel/node-version-update 2021-12-23 18:56:50 +01:00
Karsten Hassel
272219eb61 Merge branch 'develop' into node-version-update 2021-12-23 18:48:40 +01:00
Michael Teeuw
acbcb47739 Merge pull request #2739 from rico24/develop
Added missing translations (NL)
2021-12-23 10:27:53 +01:00
Michael Teeuw
672575e427 Merge pull request #2747 from khassel/electron-tests
fix electron tests
2021-12-23 10:27:42 +01:00
Michael Teeuw
be0b3b1d63 Merge pull request #2745 from KristjanESPERANTO/shebang
Add missing shebang
2021-12-23 10:27:30 +01:00
Karsten Hassel
c88d25b4ee update node versions in templates and github workflows 2021-12-22 22:35:55 +01:00
Karsten Hassel
9b83862a96 fixed electron tests with retry, update dependencies 2021-12-22 22:31:39 +01:00
Kristjan SCHMIDT
21c7f0da6e Added missing shebang 2021-12-22 21:00:13 +01:00
Michael Teeuw
dca5759569 Merge pull request #2744 from MichMich/patch-use-https-for-shields
Use https for shield links.
2021-12-22 09:13:27 +01:00
Michael Teeuw
0abf87bfa2 Use https for links and images. 2021-12-22 09:08:43 +01:00
rico24
6b8b37843b Added missing translations 2021-12-21 20:50:11 +01:00
Michael Teeuw
fa0b83f056 Merge pull request #2738 from MichMich/patch-replace-broken-shields
Replace broken shields.
2021-12-21 20:36:21 +01:00
Michael Teeuw
a706fa3590 Add changelog. 2021-12-21 20:31:13 +01:00
Michael Teeuw
852aa3d260 Remove flacky badge. 2021-12-21 20:30:09 +01:00
Michael Teeuw
c4edcaad87 Replace broken shields. 2021-12-21 20:12:05 +01:00
Michael Teeuw
9d0cab01d5 Merge pull request #2736 from rejas/issue_2712
Allow dangerouslyDisablingAutoEscaping in newsfeed items
2021-12-21 19:44:03 +01:00
Michael Teeuw
c3e507234d Merge pull request #2737 from rejas/RelativeFullDayEvents
Resubmit of "Relative full day events"
2021-12-21 19:42:47 +01:00
rejas
405ec82dd0 Run prettier 2021-12-21 15:22:52 +01:00
rejas
9c4c77fe84 Merge branch 'develop' into RelativeFullDayEvents 2021-12-21 15:19:36 +01:00
rejas
831afdf9e7 Update CHANGELOG 2021-12-21 13:35:38 +01:00
rejas
1996efb183 Add new variable dangerouslyDisableAutoEscaping 2021-12-21 13:31:39 +01:00
rejas
19bb2a0238 Add safe option to newsfeed templates 2021-12-21 08:13:00 +01:00
Michael Teeuw
af6cf70558 Merge pull request #2734 from rejas/issue_2731 2021-12-20 19:41:31 +01:00
rejas
9b57e6049e Update CHANGELOG 2021-12-20 13:37:07 +01:00
rejas
f54c06fb94 Add test for old items 2021-12-20 13:35:50 +01:00
rejas
2107e7c427 Show empty message when no newsfeed items are available 2021-12-20 13:29:56 +01:00
Michael Teeuw
eae277f165 Merge pull request #2730 from khassel/newsfeed-user-agent 2021-12-14 05:59:57 +01:00
Karsten Hassel
a9c4ad2895 update User-Agent-Header in calendarfetcher 2021-12-13 23:00:07 +01:00
Karsten Hassel
e88ba1ab1c update dependencies 2021-12-13 21:34:32 +01:00
Karsten Hassel
677dcb87ef fixed User-Agent-Header for newsfeed module (#2729) 2021-12-13 21:24:37 +01:00
Michael Teeuw
7bb217636e Merge pull request #2723 from MariusVaice/patch-1
Added lithuanian language to translations.js
2021-12-13 20:42:31 +01:00
MariusVaice
abc16e98eb Update CHANGELOG.md 2021-12-03 17:29:48 +02:00
MariusVaice
3b1405609e Added lithuanian language 2021-12-03 17:28:59 +02:00
Michael Teeuw
b0d3518c1d Merge pull request #2716 from khassel/revert-node-ical
Revert node ical update
2021-11-29 19:49:26 +01:00
Karsten Hassel
aed005618e revert node-ical update 2021-11-29 00:21:00 +01:00
Michael Teeuw
559970c95d Merge pull request #2715 from khassel/playwright 2021-11-28 21:25:30 +01:00
Karsten Hassel
f6f3aa11ea add CHANGELOG.md 2021-11-27 23:50:49 +01:00
Karsten Hassel
472c91f022 update dependencies 2021-11-27 23:10:04 +01:00
Karsten Hassel
4a7f498683 replace spectron with playwright, rewrite electron tests 2021-11-27 23:00:02 +01:00
Michael Teeuw
2b87d6ec01 Merge pull request #2699 from khassel/test-updates 2021-11-06 15:12:00 +01:00
AmpioRosso
1af282a7a1 Don't display 'in xxx' for all day events when using relative times 2021-11-06 15:03:08 +01:00
AmpioRosso
46b63f52fe Updated changelog.md, fix for issue #2424 2021-10-24 18:12:05 +02:00
AmpioRosso
01977005fb Issue #2424 - Don't display start time of full date events when using relative dates. Also use the fullDateEventDateFormat when showing full day events more than a week out 2021-10-24 18:02:19 +02:00
Karsten Hassel
b1a46b365b increase load delay for modules tests 2021-10-22 22:49:10 +02:00
Karsten Hassel
3a0a02d3ba Merge branch 'develop' into test-updates
# Conflicts:
#	CHANGELOG.md
2021-10-20 21:22:12 +02:00
Karsten Hassel
1acbef5bfa increase testTimeout, minor changes tests e2e 2021-10-20 21:05:19 +02:00
Michael Teeuw
66b2ba07bb Merge pull request #2697 from jupadin/fixTimeOffset 2021-10-20 15:20:22 +02:00
Julian Dinter
4777538103 Updated CHANGELOG. 2021-10-20 15:11:41 +02:00
Julian Dinter
31d31fc3d3 [Fix] Fixed time zone calculation error on starting date of events with different time zones. 2021-10-20 15:05:40 +02:00
Michael Teeuw
21f606c6ba Merge pull request #2694 from rejas/codecov2 2021-10-17 20:04:55 +02:00
veeck
6508ec2d17 Update CHANGELOG 2021-10-17 19:09:43 +02:00
veeck
c623ca9fe0 Update other actions and dependencies 2021-10-17 19:02:22 +02:00
veeck
90deaf564f Update codecov action before the old one gets deprecated 2021-10-17 18:56:18 +02:00
Michael Teeuw
e2d2cf67fa Merge pull request #2693 from rejas/patch-1 2021-10-17 18:51:20 +02:00
Veeck
8ee73a11bb Update CHANGELOG
add credits where credits due :-)
2021-10-17 18:39:06 +02:00
Michael Teeuw
b5b01be373 Merge pull request #2691 from rejas/issue_2638 2021-10-17 17:07:12 +02:00
veeck
730f2eb0b8 Add fix for chaotic newsfeed display after network connection loss 2021-10-17 16:01:01 +02:00
Michael Teeuw
4576754de2 Merge pull request #2687 from khassel/weather-e2e 2021-10-16 03:15:16 +02:00
Karsten Hassel
0fb9e0bc89 increase test delay for alert module test 2021-10-16 00:25:31 +02:00
Karsten Hassel
000c34ef73 update dependencies 2021-10-16 00:18:52 +02:00
Karsten Hassel
0ec80a7791 move weather-test to e2e 2021-10-16 00:05:12 +02:00
Michael Teeuw
e9650285bd Merge pull request #2686 from fewieden/clean-up-alert-module
Clean up alert module
2021-10-15 09:08:23 +02:00
Felix Wiedenbach
d0cc0a4034 move notificationReceived 2021-10-15 06:50:54 +02:00
Felix Wiedenbach
f9c4a3a9c0 updated CHANGELOG.md 2021-10-15 06:44:58 +02:00
Felix Wiedenbach
15fd2021bb blur modules instead of black overlay 2021-10-15 06:43:53 +02:00
Felix Wiedenbach
75cf1d610e migrate manual DOM creation for alerts to nunjuck template 2021-10-15 06:31:07 +02:00
Felix Wiedenbach
8f5ee9466a move notificationFx styles into styles directory 2021-10-15 06:26:23 +02:00
Felix Wiedenbach
467720f1c4 migrate manual DOM creation for notifications to nunjuck template 2021-10-15 06:23:50 +02:00
Felix Wiedenbach
026e624e23 use alert as default in notificationReceived 2021-10-15 06:17:03 +02:00
Felix Wiedenbach
460a9fc5f7 move notification effect override into start function 2021-10-15 06:14:45 +02:00
Felix Wiedenbach
3695e64ce9 migrate set position DOM manipulation to css 2021-10-15 06:11:24 +02:00
Felix Wiedenbach
b3bb829e4d fix missing translation files 2021-10-15 06:05:06 +02:00
Felix Wiedenbach
1b9f8c23d2 shorthand camelcase functions 2021-10-15 06:03:51 +02:00
Michael Teeuw
5ee5fd7332 Cleanup Changelog. 2021-10-07 09:09:16 +02:00
Michael Teeuw
18d94b9a26 Merge pull request #2682 from MMRIZE/ko
fix language Code kr->ko and add missed translation
2021-10-07 09:07:33 +02:00
eouia
3ae9686b2b modify CHANGELOG.md 2021-10-06 21:32:31 +02:00
eouia
bbe4ef8497 fix Language ko 2021-10-06 15:58:16 +02:00
eouia
a2fd354dc9 fix ko language 2021-10-06 15:56:33 +02:00
Seongnoh Sean Yi
a7202078ce Merge branch 'develop' into ko 2021-10-06 15:44:31 +02:00
eouia
d8940a9cea Merge branch 'ko' of https://github.com/MMRIZE/MagicMirror into ko 2021-10-06 15:42:13 +02:00
eouia
96611333bf fix translations.js 2021-10-06 15:42:01 +02:00
Michael Teeuw
5074123f57 Merge pull request #2679 from fewieden/clean-up-updatenotifications-and-nunjuck-templating
Clean up updatenotifications and nunjuck templating
2021-10-06 15:24:02 +02:00
Michael Teeuw
5bfbd3eaa0 Merge branch 'develop' into clean-up-updatenotifications-and-nunjuck-templating 2021-10-06 15:21:54 +02:00
Michael Teeuw
7fdeed14f5 Merge pull request #2680 from rejas/issue_2678 2021-10-05 10:31:18 +02:00
veeck
04a9ca92b5 Update dependencies 2021-10-05 10:24:42 +02:00
Michael Teeuw
016a1e9adb Merge pull request #2683 from khassel/calendar-test 2021-10-05 08:30:23 +02:00
Karsten Hassel
1d12e57606 move calendar tests from category electron to e2e 2021-10-04 23:04:28 +02:00
Seongnoh Sean Yi
cb753f5371 Merge branch 'develop' into ko 2021-10-04 11:16:33 +02:00
eouia
7a9f9b2705 edit CHANGELOG 2021-10-04 11:15:06 +02:00
eouia
6d4b4dd9fc fix language Code kr->ko and add missed translation 2021-10-04 11:05:33 +02:00
rejas
3d9c92fb63 Update CHANGELOG 2021-10-02 23:05:10 +02:00
rejas
d4168f6b5d Use feels_like data from openweathermap instead of calculating it 2021-10-02 22:15:21 +02:00
Felix Wiedenbach
1751cabb9d remove obsolete snapshot 2021-10-02 14:56:13 +02:00
Felix Wiedenbach
b0e3b6414a bump ecmascript to 2018 for eslint 2021-10-02 14:42:49 +02:00
Felix Wiedenbach
51967ed9f5 shorthand function 2021-10-02 14:18:58 +02:00
Felix Wiedenbach
fc06f13c30 Merge branch 'develop' into clean-up-updatenotifications-and-nunjuck-templating
# Conflicts:
#	CHANGELOG.md
2021-10-02 14:15:54 +02:00
Felix Wiedenbach
b094707324 remove mocking from implementation and use jest to mock git cli instead 2021-10-02 14:08:16 +02:00
Michael Teeuw
e4a0a517d5 Merge 2.17.1 2021-10-01 18:58:26 +02:00
Michael Teeuw
1735ca57d5 Fix Formatting 2021-10-01 16:03:29 +02:00
Michael Teeuw
a49459b253 Prepare 2.18.0 Dev Branch 2021-10-01 15:25:54 +02:00
Felix Wiedenbach
332e429a41 updated CHANGELOG.md 2021-09-18 04:02:07 +02:00
Felix Wiedenbach
7be25c21ed use nunjuck template, es6, removed unused config option 2021-09-18 03:57:45 +02:00
Felix Wiedenbach
1dfa5d383c nunjuck template for updatenotification 2021-09-18 03:55:32 +02:00
Felix Wiedenbach
c2d2c278e0 fixed updatenotification async/await issues and more es6 2021-09-18 03:53:40 +02:00
Felix Wiedenbach
75a57829c2 fixed git helper async/await issues, template strings, clean up 2021-09-18 03:50:53 +02:00
200 changed files with 7220 additions and 13212 deletions

View File

@@ -16,7 +16,7 @@
},
"parserOptions": {
"sourceType": "module",
"ecmaVersion": 2017,
"ecmaVersion": 2020,
"ecmaFeatures": {
"globalReturn": true
}

View File

@@ -4,13 +4,15 @@ Thanks for contributing to MagicMirror²!
We hold our code to standard, and these standards are documented below.
## Linters
If you wish to run our linters, use `npm run lint` without any arguments.
### JavaScript: Run ESLint
We use [ESLint](https://eslint.org) on our JavaScript files.
Our ESLint configuration is in our .eslintrc.json and .eslintignore files.
Our ESLint configuration is in our `.eslintrc.json` and `.eslintignore` files.
To run ESLint, use `npm run lint:js`.
@@ -20,7 +22,15 @@ We use [StyleLint](https://stylelint.io) to lint our CSS. Our configuration is i
To run StyleLint, use `npm run lint:css`.
### Submitting Issues
## Testing
We use [Jest](https://jestjs.io) for JavaScript testing.
To run all tests, use `npm run test`.
The specific test commands are defined in `package.json`. So you can also run the specific tests with other commands, e.g. `npm run test:unit` or `npx jest tests/e2e/env_spec.js`.
## Submitting Issues
Please only submit reproducible issues.
@@ -32,9 +42,9 @@ When submitting a new issue, please supply the following information:
**Platform**: Place your platform here... give us your web browser/Electron version _and_ your hardware (Raspberry Pi 2/3/4, Windows, Mac, Linux, System V UNIX).
**Node Version**: Make sure it's version 12 or later (recommended is 14).
**Node Version**: Make sure it's version 14 or later (recommended is 16).
**MagicMirror Version**: Please let us know which version of MagicMirror you are running. It can be found in the `package.json` file.
**MagicMirror² Version**: Please let us know which version of MagicMirror² you are running. It can be found in the `package.json` file.
**Description**: Provide a detailed description about the issue and include specific details to help us understand the problem. Adding screenshots will help describing the problem.

View File

@@ -10,19 +10,17 @@ If you're not sure if it's a real bug or if it's just you, please open a topic o
Problems installing or configuring your MagicMirror? Check out: [https://forum.magicmirror.builders/category/10/troubleshooting](https://forum.magicmirror.builders/category/10/troubleshooting)
A common problem is that your config file could be invalid. Please run in your MagicMirror directory: `npm run config:check` and see if it reports an error.
A common problem is that your config file could be invalid. Please run in your MagicMirror² directory: `npm run config:check` and see if it reports an error.
## I found a bug in the MagicMirror installer
## I found a bug in the MagicMirror² installer
If you are facing an issue or found a bug while trying to install MagicMirror via the installer please report it in the respective GitHub repository:
If you are facing an issue or found a bug while trying to install MagicMirror² via the installer please report it in the respective GitHub repository:
[https://github.com/sdetweil/MagicMirror_scripts](https://github.com/sdetweil/MagicMirror_scripts)
## I found a bug in the MagicMirror Docker image
## I found a bug in the MagicMirror² Docker image
If you are facing an issue or found a bug while running MagicMirror inside a Docker container please create an issue in the corresponding repository:
- karsten13/magicmirror: [https://gitlab.com/khassel/magicmirror](https://gitlab.com/khassel/magicmirror)
- (deprecated) bastilimbach/docker-magicmirror: [https://github.com/bastilimbach/docker-MagicMirror](https://github.com/bastilimbach/docker-MagicMirror)
If you are facing an issue or found a bug while running MagicMirror² inside a Docker container please create an issue in the corresponding repository:
[https://gitlab.com/khassel/magicmirror](https://gitlab.com/khassel/magicmirror)
---
@@ -33,9 +31,9 @@ When submitting a new issue, please supply the following information:
**Platform**: Place your platform here... give us your web browser/Electron version _and_ your hardware (Raspberry Pi 2/3/4, Windows, Mac, Linux, System V UNIX).
**Node Version**: Make sure it's version 12 or later (recommended is 14).
**Node Version**: Make sure it's version 14 or later (recommended is 16).
**MagicMirror Version**: Please let us know which version of MagicMirror you are running. It can be found in the `package.json` file.
**MagicMirror² Version**: Please let us know which version of MagicMirror² you are running. It can be found in the `package.json` file.
**Description**: Provide a detailed description about the issue and include specific details to help us understand the problem. Adding screenshots will help describing the problem.

View File

@@ -1,4 +1,4 @@
Hello and thank you for wanting to contribute to the MagicMirror project
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:**

6
.github/dependabot.yaml vendored Normal file
View File

@@ -0,0 +1,6 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"

View File

@@ -9,29 +9,31 @@ on:
pull_request:
branches: [master, develop]
permissions:
contents: read
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
node-version: [12.x, 14.x, 16.x]
node-version: [14.x, 16.x, 18.x]
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
- name: Install dependencies and run tests
run: |
Xvfb :99 -screen 0 1024x768x16 &
export DISPLAY=:99
npm install
npm run install-mm:dev
touch css/custom.css
npm run test:prettier
npm run test:js
npm run test:css
npm run test:unit
npm run test:e2e
npm run test:electron
npm run test

View File

@@ -1,4 +1,5 @@
# This workflow runs the automated test and uploads the coverage results to codecov.io
# For more information see: https://github.com/codecov/codecov-action
name: "Run Codecov Tests"
@@ -8,13 +9,16 @@ on:
pull_request:
branches: [master, develop]
permissions:
contents: read
jobs:
run-and-upload-coverage-report:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Install dependencies and run coverage
run: |
Xvfb :99 -screen 0 1024x768x16 &
@@ -23,7 +27,7 @@ jobs:
touch css/custom.css
npm run test:coverage
- name: Upload coverage results to codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
file: ./coverage/lcov.info
files: ./coverage/lcov.info
fail_ci_if_error: true

View File

@@ -1,4 +1,5 @@
# This workflow enforces the update of a changelog file on every pull request
# For more information see: https://github.com/dangoslen/changelog-enforcer
name: "Enforce Changelog"
@@ -11,10 +12,8 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Enforce changelog
uses: dangoslen/changelog-enforcer@v1.6.1
uses: dangoslen/changelog-enforcer@v3
with:
changeLogPath: "CHANGELOG.md"
skipLabels: "Skip Changelog"

View File

@@ -1,4 +1,7 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"
npm run lint:staged
[ -f "$(dirname "$0")/_/husky.sh" ] && . "$(dirname "$0")/_/husky.sh"
if command -v npm &> /dev/null; then
npm run lint:staged
fi

View File

@@ -3,13 +3,146 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](https://semver.org/).
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror²
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/donate) With your help we can continue to improve the MagicMirror².
## [2.21.0] - 2022-10-01
Special thanks to: @BKeyport, @buxxi, @davide125, @khassel, @kolbyjack, @krukle, @MikeBishop, @rejas, @sdetweil, @SkySails and @veeck
## Added
- Possibility to fetch calendars through socket notifications.
- New scripts `install-mm` (and `install-mm:dev`) for simplifying mm installation (now: `npm run install-mm`) and adding params `--no-audit --no-fund --no-update-notifier` for less noise.
- New `showTimeToday` option in calendar module shows time for current-day events even if `timeFormat` is `"relative"`.
- Add hourly forecasts, apparent temperature & custom location name to SMHI weather provider.
## Removed
- Old weather deprecated modules `currentweather` and `weatherforecast`.
## Updated
- Removed `DAYAFTERTOMORROW` from English.
- Update dependencies.
- Updated jsdoc.
- Updated font tree to use variables consistantly.
- Removed deprecated Docker Repository from issue template.
## Fixed
- Broadcast all calendar events while still honoring global and per-calendar maximumEntries.
- Respect rss ttl provided by newsfeed (#2883).
- Fix multi day calendar events always presented as "(1/X)" instead of the amount of days the event has progressed.
- Fix weatherbit provider to use type config value instead of endpoint.
- Fix calendar events which DO NOT specify rrule byday adjusted incorrectly (#2885).
- Fix e2e tests not failing on errors (#2911).
## [2.20.0] - 2022-07-02
Special thanks to the following contributors: @eouia, @khassel, @kolbyjack, @KristjanESPERANTO, @nathannaveen, @naveensrinivasan, @rejas, @rohitdharavath and @sdetweil.
### Added
- Added a new config option `httpHeaders` used by helmet (see https://helmetjs.github.io/). You can now set own httpHeaders which will override the defaults in `js/defauls.js` which is useful e.g. if you want to embed MagicMirror into annother website (solves #2847).
- Show endDate for calendar events when dateHeader is enabled and showEnd is set to true (#2192).
- Added the notification emitting from the weather module on information updated.
- Use recommended file extension for YAML files (#2864).
### Updated
- Use latest node 18 when running tests on github actions.
- Updated `electron` to v19 and other dependencies.
- Use internal fetch function of node instead external `node-fetch` library if used node version >= `v18`.
- Include duplicate events in broadcasts.
### Fixed
- Fix problems with non latin fonds caused by updating to fontsource (fixes #2835).
## [2.19.0] - 2022-04-01
Special thanks to the following contributors: @10bias, @CFenner, @JHWelch, @k1rd3rf, @khassel, @kolbyjack, @krekos, @KristjanESPERANTO, @Nerfzooka, @oraclesean, @oscarb, @philnagel, @rejas, @sdetweil, @shin10, @SiderealArt and @Tom-Hirschberger.
### Added
- Added a config option under the weather module, `absoluteDates`, providing an option to format weather forecast date output with either absolute or relative dates.
- Added test for new weather forecast `absoluteDates` property.
- The modules get a class hidden added/removed if they get hidden/shown which will also toggle pointer-events.
- Added new config option `showTitleAsUrl` to newsfeed module. If set, the displayed title is a link to the article which is useful when running in a browser and you want to read this article.
- Added internal cors proxy to get weather providers working without public proxies (fixes #2714). The new url `http(s)://address:port/cors?url=https://whatever-to-proxy` can be used in other modules too.
- Added a WeatherProvider for Weatherflow.
- Added new env var `ELECTRON_DISABLE_GPU` which disable gpu under electron if set (fixes #2831).
- Added missing Czech translations.
### Updated
- Deprecated roboto fonts package `roboto-fontface-bower` replaced with `fontsource`.
- Updated `electron` to v17, `helmet` to v5 (use defaults of v4) and other dependencies
- Updated Font Awesome css class to new default style (fixes #2768)
- Replaced deprecated modules `currentweather` and `weatherforecast` with dummy modules only displaying that they have to be replaced.
- Include all calendar events from the configured date range when broadcasting.
- Updated Danish and German translation.
- Updated `node-ical` to v0.15 and added `luxon` as dependency for not breaking the "no-optional" install (see #2718 and #2824).
### Fixed
- Improved and speedup e2e tests, artificial wait after mm start removed.
- Improved husky setup not blocking `git commit` if `husky` or `npm` is not installed.
- Using a consistent spelling of MagicMirror².
- Fix minor console output issue for loading translations (#2814).
- Don't adjust startDate for full day events if endDate is in the past.
- Fix windspeed conversion error in openweathermap provider. (#2812)
- Fix conflicting parms turning off showEnd for full day events. (#2629)
- Fix regression, calendar.maximumEntries not used to filter calendar level entries (#2868)
## [2.18.0] - 2022-01-01
Special thanks to the following contributors: @AmpioRosso, @eouia, @fewieden, @jupadin, @khassel, @kolbyjack, @KristjanESPERANTO, @MariusVaice, @rejas, @rico24 and @sdetweil.
### Added
- Added test for calendar recurring event with checks the correct date displayed (related to #2752).
### Updated
- ESLint version supports now ECMAScript 2018.
- Cleaned up `updatenotification` module and switched to nunjuck template.
- Moved calendar tests from category `electron` to `e2e`.
- Updated missed translations for Korean language (ko.json).
- Updated missed translations for Dutch language (nl.json).
- Cleaned up `alert` module and switched to nunjuck template.
- Moved weather tests from category `electron` to `e2e`.
- Updated github actions.
- Replace spectron with playwright, update dependencies including electron update to v16.
- Added lithuanian language to translations.js.
- Show info message if newsfeed is empty (fixes #2731).
- Added dangerouslyDisableAutoEscaping config option for newsfeed templates (fixes #2712).
- Added missing shebang to `installers/mm.sh`.
- Node versions in templates and github workflows.
- Updated translations for Traditional Chinese (Taiwan) (zh-tw.json).
### Fixed
- Fixed wrong file `kr.json` to `ko.json`. Use language code 'ko' instead of 'kr' for Korean language.
- Fixed `feels_like` data from openweathermaps current weather being ignored (#2678).
- Fixed chaotic newsfeed display after network connection loss thanks to @jalibu (#2638).
- Fixed incorrect time zone correction of recurring full day events (#2632 and #2634).
- Fixed e2e tests by increasing testTimeout.
- Revert node-ical update due to missing luxon package.
- Fixed User-Agent-Header for newsfeed and calendar module (#2729).
- Replace broken shields in Readme and use https for links.
- Fixed electron tests with retry.
- Fixed Calendar recurring cross timezone error (add/subtract a day, not just offset hours) (#2632).
- Fixed Calendar showEnd and Full Date overlay (#2629).
- Fixed regression on #2632, #2752.
- Broadcast custom symbols in CALENDAR_EVENTS.
## [2.17.1] - 2021-10-01
### Fixed
- Fixed error when accessing letsencrypt certificates
- Fixed Calendar module enhancement: displaying full events without time (#2424)
## [2.17.0] - 2021-10-01
@@ -27,14 +160,14 @@ Special thanks to the following contributors: @apiontek, @eouia, @jupadin, @khas
- Refactor test configs, use default test config for all tests.
- Updated github templates.
- Actually test all js and css files when lint script is run.
- Update jsdocs and print warnings during testing too.
- Update weathergov provider to try fetching not just current, but also foreacst, when API URLs available.
- Updated jsdocs and print warnings during testing too.
- Updated weathergov provider to try fetching not just current, but also foreacst, when API URLs available.
- Refactored clock layout.
- Refactored methods from weatherproviders into weatherobject (isDaytime, updateSunTime).
- Use of `logger.js` in jest tests.
- Run prettier over all relevant files.
- Move tests needing electron in new category `electron`, use `server only` mode in `e2e` tests.
- Update dependencies in package.json.
- Updated dependencies in package.json.
### Fixed
@@ -68,13 +201,13 @@ Special thanks to the following contributors: @210954, @B1gG, @codac, @Crazylegs
- Refactor code into es6 where possible (e.g. var -> let/const).
- Use node v16 in github workflow (replacing node v10).
- Moved some files into better suited directories.
- Update dependencies in package.json, require node >= v12, remove `rrule-alt` and `rrule`.
- Update dependencies in package.json and migrate husky to v6, fix husky setup in prod environment.
- Updated dependencies in package.json, require node >= v12, remove `rrule-alt` and `rrule`.
- Updated dependencies in package.json and migrate husky to v6, fix husky setup in prod environment.
- Cleaned up error handling in newsfeed and calendar modules for real.
- Updated default WEATHER module such that a provider can optionally set a custom unit-of-measure for precipitation (`weatherObject.precipitationUnits`).
- Update documentation.
- Update jest tests: Reset changes on js/logger.js, mock logger.js in global_vars tests.
- Update dependencies in package.json.
- Updated documentation.
- Updated jest tests: Reset changes on js/logger.js, mock logger.js in global_vars tests.
- Updated dependencies in package.json.
### Removed
@@ -186,10 +319,10 @@ Special thanks to the following contributors: @Alvinger, @AndyPoms, @ashishtank,
- Merging .gitignore in the config-folder with the .gitignore in the root-folder.
- Weather module - forecast now show TODAY and TOMORROW instead of weekday, to make it easier to understand.
- Update dependencies to latest versions.
- Update dependencies eslint, feedme, simple-git and socket.io to latest versions.
- Update lithuanian translation.
- Update config sample.
- Updated dependencies to latest versions.
- Updated dependencies eslint, feedme, simple-git and socket.io to latest versions.
- Updated lithuanian translation.
- Updated config sample.
- Highlight required version mismatch.
- No select Text for TouchScreen use.
- Corrected logic for timeFormat "relative" and "absolute".
@@ -210,19 +343,19 @@ Special thanks to the following contributors: @Alvinger, @AndyPoms, @ashishtank,
- Rename Greek translation to correct ISO 639-1 alpha-2 code (gr > el). (#2155)
- Add a space after icons of sunrise and sunset. (#2169)
- Fix calendar when no DTEND record found in event, startDate overlay when endDate set. (#2177)
- Fix windspeed convertion error in ukmetoffice weather provider. (#2189)
- Fix windspeed conversion error in ukmetoffice weather provider. (#2189)
- Fix console.debug not having timestamps. (#2199)
- Fix calendar full day event east of UTC start time. (#2200)
- Fix non-fullday recurring rule processing. (#2216)
- Catch errors when parsing calendar data with ical. (#2022)
- Fix Default Alert Module does not hide black overlay when alert is dismissed manually. (#2228)
- Weather module - Always displays night icons when local is other than English. (#2221)
- Update node-ical 0.12.4, fix invalid RRULE format in cal entries
- Updated node-ical 0.12.4, fix invalid RRULE format in cal entries
- Fix package.json for optional electron dependency (2378)
- Update node-ical version again, 0.12.5, change RRULE fix (#2371, #2379)
- Updated node-ical version again, 0.12.5, change RRULE fix (#2371, #2379)
- Remove undefined objects from modules array (#2382)
- Update node-ical version again, 0.12.7, change RRULE fix (#2371, #2379), node-ical now throws error (which we catch)
- Update simple-git version to 2.31 unhandled promise rejection (#2383)
- Updated node-ical version again, 0.12.7, change RRULE fix (#2371, #2379), node-ical now throws error (which we catch)
- Updated simple-git version to 2.31 unhandled promise rejection (#2383)
## [2.13.0] - 2020-10-01
@@ -233,8 +366,8 @@ Special thanks to the following contributors: @bryanzzhu, @bugsounet, @chamakura
### Added
- `--dry-run` Added option in fetch call within updatenotification node_helper. This is to prevent
MagicMirror from consuming any fetch result. Causes conflict with MMPM when attempting to check
for updates to MagicMirror and/or MagicMirror modules.
MagicMirror² from consuming any fetch result. Causes conflict with MMPM when attempting to check
for updates to MagicMirror² and/or MagicMirror² modules.
- Test coverage with Istanbul, run it with `npm run test:coverage`.
- Added lithuanian language.
- Added support in weatherforecast for OpenWeather onecall API.
@@ -307,7 +440,7 @@ Special thanks to the following contributors: @AndreKoepke, @andrezibaia, @bryan
🚨 READ THIS BEFORE UPDATING 🚨
In the past years the project has grown a lot. This came with a huge downside: poor maintainability. If I let the project continue the way it was, it would eventually crash and burn. More important: I would completely lose the drive and interest to continue the project. Because of this the decision was made to simplify the core by removing all side features like automatic installers and support for exotic platforms. This release (2.11.0) is the first real release that will reflect (parts) of these changes. As a result of this, some things might break. So before you continue make sure to backup your installation. Your config, your modules or better yet: your full MagicMirror folder. In other words: update at your own risk.
In the past years the project has grown a lot. This came with a huge downside: poor maintainability. If I let the project continue the way it was, it would eventually crash and burn. More important: I would completely lose the drive and interest to continue the project. Because of this the decision was made to simplify the core by removing all side features like automatic installers and support for exotic platforms. This release (2.11.0) is the first real release that will reflect (parts) of these changes. As a result of this, some things might break. So before you continue make sure to backup your installation. Your config, your modules or better yet: your full MagicMirror² folder. In other words: update at your own risk.
For more information regarding this major change, please check issue [#1860](https://github.com/MichMich/MagicMirror/issues/1860).
@@ -447,10 +580,10 @@ Special thanks to @sdetweil for all his great contributions!
- English translation for "Feels" to "Feels like"
- Fixed the example calendar url in `config.js.sample`
- Update `ical.js` to solve various calendar issues.
- Update weather city list url [#1676](https://github.com/MichMich/MagicMirror/issues/1676)
- Updated `ical.js` to solve various calendar issues.
- Updated weather city list url [#1676](https://github.com/MichMich/MagicMirror/issues/1676)
- Only update clock once per minute when seconds aren't shown
- Update weatherprovider documentation.
- Updated weatherprovider documentation.
### Fixed
@@ -470,7 +603,7 @@ Special thanks to @sdetweil for all his great contributions!
- use current username vs hardcoded 'pi' to support non-pi install
- check for npm installed. node install doesn't do npm anymore
- check for mac as part of PM2 install, add install option string
- update pm2 config with current username instead of hard coded 'pi'
- Updated pm2 config with current username instead of hard coded 'pi'
- check for screen saver config, "/etc/xdg/lxsession", bypass if not setup
## [2.7.1] - 2019-04-02
@@ -508,7 +641,7 @@ Fixed `package.json` version number.
- Fixed unhandled error on bad git data in updatenotification module [#1285](https://github.com/MichMich/MagicMirror/issues/1285).
- Weather forecast now works with openweathermap in new weather module. Daily data are displayed, see issue [#1504](https://github.com/MichMich/MagicMirror/issues/1504).
- Fixed analogue clock border display issue where non-black backgrounds used (previous fix for issue 611)
- Fixed compatibility issues caused when modules request different versions of Font Awesome, see issue [#1522](https://github.com/MichMich/MagicMirror/issues/1522). MagicMirror now uses [Font Awesome 5 with v4 shims included for backwards compatibility](https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#shims).
- Fixed compatibility issues caused when modules request different versions of Font Awesome, see issue [#1522](https://github.com/MichMich/MagicMirror/issues/1522). MagicMirror² now uses [Font Awesome 5 with v4 shims included for backwards compatibility](https://fontawesome.com/how-to-use/on-the-web/setup/upgrading-from-version-4#shims).
- Installation script problems with raspbian
- Calendar: only show repeating count if the event is actually repeating [#1534](https://github.com/MichMich/MagicMirror/pull/1534)
- Calendar: Fix exdate handling when multiple values are specified (comma separated)
@@ -620,7 +753,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we
## [2.4.0] - 2018-07-01
**Warning:** This release includes an updated version of Electron. This requires a Raspberry Pi configuration change to allow the best performance and prevent the CPU from overheating. Please read the information on the [MagicMirror Wiki](https://github.com/michmich/magicmirror/wiki/configuring-the-raspberry-pi#enable-the-open-gl-driver-to-decrease-electrons-cpu-usage).
**Warning:** This release includes an updated version of Electron. This requires a Raspberry Pi configuration change to allow the best performance and prevent the CPU from overheating. Please read the information on the [MagicMirror² Wiki](https://github.com/michmich/magicmirror/wiki/configuring-the-raspberry-pi#enable-the-open-gl-driver-to-decrease-electrons-cpu-usage).
**Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`
@@ -678,7 +811,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we
- Add types for module.
- Implement Danger.js to notify contributors when CHANGELOG.md is missing in PR.
- Allow scrolling in full page article view of default newsfeed module with gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures)
- Changed 'compliments.js' - update DOM if remote compliments are loaded instead of waiting one updateInterval to show custom compliments
- Changed 'compliments.js' - Updated DOM if remote compliments are loaded instead of waiting one updateInterval to show custom compliments
- Automated unit tests utils, deprecated, translator, cloneObject(lockstrings)
- Automated integration tests translations
- Add advanced filtering to the excludedEvents configuration of the default calendar module
@@ -690,7 +823,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we
- Add link to GitHub repository which contains the respective Dockerfile.
- Optimized automated unit tests cloneObject, cmpVersions
- Update notifications use now translation templates instead of normal strings.
- Updated notifications use now translation templates instead of normal strings.
- Yarn can be used now as an installation tool
- Changed Electron dependency to v1.7.13.
@@ -861,7 +994,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we
- Add use pm2 for manager process into Installer RaspberryPi script.
- Russian Translation.
- Afrikaans Translation.
- Add postinstall script to notify user that MagicMirror installed successfully despite warnings from NPM.
- Add postinstall script to notify user that MagicMirror² installed successfully despite warnings from NPM.
- Init tests using mocha.
- Option to use RegExp in Calendar's titleReplace.
- Hungarian Translation.
@@ -897,7 +1030,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we
### Fixed
- Update .gitignore to not ignore default modules folder.
- Updated .gitignore to not ignore default modules folder.
- Remove white flash on boot up.
- Added `update` in Raspberry Pi installation script.
- Fix an issue where the analog clock looked scrambled. ([#611](https://github.com/MichMich/MagicMirror/issues/611))
@@ -924,7 +1057,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we
- Add VSCode IntelliSense support.
- Module API: Add Visibility locking to module system. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules#visibility-locking) for more information.
- Module API: Method to overwrite the module's header. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules#getheader) for more information.
- Module API: Option to define the minimum MagicMirror version to run a module. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules#requiresversion) for more information.
- Module API: Option to define the minimum MagicMirror² version to run a module. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules#requiresversion) for more information.
- Calendar module now broadcasts the event list to all other modules using the notification system. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules/default/calendar) for more information.
- Possibility to use the calendar feed as the source for the weather (currentweather & weatherforecast) location data. [See documentation](https://github.com/MichMich/MagicMirror/tree/develop/modules/default/weatherforecast) for more information.
- Added option to show rain amount in the weatherforecast default module
@@ -982,8 +1115,8 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we
### Updated
- Force fullscreen when kioskmode is active.
- Update the .github templates and information with more modern information.
- Update the Gruntfile with a more functional StyleLint implementation.
- Updated the .github templates and information with more modern information.
- Updated the Gruntfile with a more functional StyleLint implementation.
## [2.0.4] - 2016-08-07
@@ -1071,6 +1204,6 @@ It includes (but is not limited to) the following features:
## [1.0.0] - 2014-02-16
### Initial release of MagicMirror.
### Initial release of MagicMirror
This was part of the blogpost: [https://michaelteeuw.nl/post/83916869600/magic-mirror-part-vi-production-of-the](https://michaelteeuw.nl/post/83916869600/magic-mirror-part-vi-production-of-the)

View File

@@ -1,6 +1,6 @@
# The MIT License (MIT)
Copyright © 2016-2021 Michael Teeuw
Copyright © 2016-2022 Michael Teeuw
Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation

View File

@@ -1,12 +1,17 @@
![MagicMirror²: The open source modular smart mirror platform. ](.github/header.png)
<p style="text-align: center">
<a href="https://david-dm.org/MichMich/MagicMirror"><img src="https://david-dm.org/MichMich/MagicMirror.svg" alt="Dependency Status"></a>
<a href="https://david-dm.org/MichMich/MagicMirror?type=dev"><img src="https://david-dm.org/MichMich/MagicMirror/dev-status.svg" alt="devDependency Status"></a>
<a href="https://bestpractices.coreinfrastructure.org/projects/347"><img src="https://bestpractices.coreinfrastructure.org/projects/347/badge" alt="CLI Best Practices"></a>
<a href="https://codecov.io/gh/MichMich/MagicMirror"><img src="https://codecov.io/gh/MichMich/MagicMirror/branch/master/graph/badge.svg?token=LEG1KitZR6" alt="CodeCov Status"/></a>
<a href="https://choosealicense.com/licenses/mit"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
<a href="https://github.com/MichMich/MagicMirror/actions?query=workflow%3A%22Automated+Tests%22"><img src="https://github.com/MichMich/MagicMirror/workflows/Automated%20Tests/badge.svg" alt="Tests"></a>
<a href="https://choosealicense.com/licenses/mit">
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
</a>
<img src="https://img.shields.io/github/workflow/status/michmich/magicmirror/Run%20Automated%20Tests" alt="GitHub Actions">
<img src="https://img.shields.io/github/checks-status/michmich/magicmirror/master" alt="Build Status">
<a href="https://codecov.io/gh/MichMich/MagicMirror">
<img src="https://codecov.io/gh/MichMich/MagicMirror/branch/master/graph/badge.svg?token=LEG1KitZR6" alt="CodeCov Status"/>
</a>
<a href="https://github.com/MichMich/MagicMirror">
<img src="https://img.shields.io/github/stars/michmich/magicmirror?style=social">
</a>
</p>
**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](https://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors).
@@ -35,7 +40,7 @@ Contributions of all kinds are welcome, not only in the form of code but also wi
- documentation
- translations
For the full contribution guidelines, check out: [https://docs.magicmirror.builders/getting-started/contributing.html](https://docs.magicmirror.builders/getting-started/contributing.html)
For the full contribution guidelines, check out: [https://docs.magicmirror.builders/about/contributing.html](https://docs.magicmirror.builders/about/contributing.html)
## Enjoying MagicMirror? Consider a donation!

View File

@@ -1,10 +1,10 @@
/* Magic Mirror Config Sample
/* MagicMirror² Config Sample
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*
* For more information on how you can configure this file
* see https://docs.magicmirror.builders/getting-started/configuration.html#general
* see https://docs.magicmirror.builders/configuration/introduction.html
* and https://docs.magicmirror.builders/modules/configuration.html
*/
let config = {
@@ -14,7 +14,7 @@ let config = {
// - "0.0.0.0", "::" to listen on any interface
// Default, when address config is left out or empty, is "localhost"
port: 8080,
basePath: "/", // The URL path where MagicMirror is hosted. If you are using a Reverse proxy
basePath: "/", // The URL path where MagicMirror² is hosted. If you are using a Reverse proxy
// you must set the sub path here. basePath must end with a /
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses
// or add a specific IPv4 of 192.168.1.5 :

View File

@@ -1,4 +1,4 @@
/* Magic Mirror Custom CSS Sample
/* MagicMirror² Custom CSS Sample
*
* Change color and fonts here.
*

View File

@@ -8,7 +8,11 @@
--font-secondary: "Roboto";
--font-size: 20px;
--font-size-small: 0.75rem;
--font-size-xsmall: 0.75rem;
--font-size-small: 1rem;
--font-size-medium: 1.5rem;
--font-size-large: 3.25rem;
--font-size-xlarge: 3.75rem;
--gap-body-top: 60px;
--gap-body-right: 60px;
@@ -60,27 +64,27 @@ body {
}
.xsmall {
font-size: var(--font-size-small);
font-size: var(--font-size-xsmall);
line-height: 1.275;
}
.small {
font-size: 1rem;
font-size: var(--font-size-small);
line-height: 1.25;
}
.medium {
font-size: 1.5rem;
font-size: var(--font-size-medium);
line-height: 1.225;
}
.large {
font-size: 3.25rem;
font-size: var(--font-size-large);
line-height: 1;
}
.xlarge {
font-size: 3.75rem;
font-size: var(--font-size-xlarge);
line-height: 1;
letter-spacing: -3px;
}
@@ -115,7 +119,7 @@ body {
header {
text-transform: uppercase;
font-size: var(--font-size-small);
font-size: var(--font-size-xsmall);
font-family: var(--font-primary), Arial, Helvetica, sans-serif;
font-weight: 400;
border-bottom: 1px solid var(--color-text-dimmed);
@@ -138,6 +142,14 @@ sup {
margin-bottom: var(--gap-modules);
}
.module.hidden {
pointer-events: none;
}
.module:not(.hidden) {
pointer-events: auto;
}
.region.bottom .module {
margin-top: var(--gap-modules);
margin-bottom: 0;
@@ -170,10 +182,6 @@ sup {
pointer-events: none;
}
.region.fullscreen * {
pointer-events: auto;
}
.region.right {
right: 0;
text-align: right;

View File

@@ -7,20 +7,31 @@
"name": "magicmirror-fonts",
"license": "MIT",
"dependencies": {
"roboto-fontface": "^0.10.0"
"@fontsource/roboto": "^4.5.8",
"@fontsource/roboto-condensed": "^4.5.9"
}
},
"node_modules/roboto-fontface": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/roboto-fontface/-/roboto-fontface-0.10.0.tgz",
"integrity": "sha512-OlwfYEgA2RdboZohpldlvJ1xngOins5d7ejqnIBWr9KaMxsnBqotpptRXTyfNRLnFpqzX6sTDt+X+a+6udnU8g=="
"node_modules/@fontsource/roboto": {
"version": "4.5.8",
"resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-4.5.8.tgz",
"integrity": "sha512-CnD7zLItIzt86q4Sj3kZUiLcBk1dSk81qcqgMGaZe7SQ1P8hFNxhMl5AZthK1zrDM5m74VVhaOpuMGIL4gagaA=="
},
"node_modules/@fontsource/roboto-condensed": {
"version": "4.5.9",
"resolved": "https://registry.npmjs.org/@fontsource/roboto-condensed/-/roboto-condensed-4.5.9.tgz",
"integrity": "sha512-ql4sQq+h8puBVildZ5ssjYf8DWDONYDe3PD3Bu/p1ZW9GnRETRNPPcCTs/q62HIl3QimwwkiKWynn6wZhQaetg=="
}
},
"dependencies": {
"roboto-fontface": {
"version": "0.10.0",
"resolved": "https://registry.npmjs.org/roboto-fontface/-/roboto-fontface-0.10.0.tgz",
"integrity": "sha512-OlwfYEgA2RdboZohpldlvJ1xngOins5d7ejqnIBWr9KaMxsnBqotpptRXTyfNRLnFpqzX6sTDt+X+a+6udnU8g=="
"@fontsource/roboto": {
"version": "4.5.8",
"resolved": "https://registry.npmjs.org/@fontsource/roboto/-/roboto-4.5.8.tgz",
"integrity": "sha512-CnD7zLItIzt86q4Sj3kZUiLcBk1dSk81qcqgMGaZe7SQ1P8hFNxhMl5AZthK1zrDM5m74VVhaOpuMGIL4gagaA=="
},
"@fontsource/roboto-condensed": {
"version": "4.5.9",
"resolved": "https://registry.npmjs.org/@fontsource/roboto-condensed/-/roboto-condensed-4.5.9.tgz",
"integrity": "sha512-ql4sQq+h8puBVildZ5ssjYf8DWDONYDe3PD3Bu/p1ZW9GnRETRNPPcCTs/q62HIl3QimwwkiKWynn6wZhQaetg=="
}
}
}

View File

@@ -1,6 +1,6 @@
{
"name": "magicmirror-fonts",
"description": "Package for fonts use by MagicMirror Core.",
"description": "Package for fonts use by MagicMirror² Core.",
"repository": {
"type": "git",
"url": "git+https://github.com/MichMich/MagicMirror.git"
@@ -10,6 +10,7 @@
"url": "https://github.com/MichMich/MagicMirror/issues"
},
"dependencies": {
"roboto-fontface": "^0.10.0"
"@fontsource/roboto": "^4.5.8",
"@fontsource/roboto-condensed": "^4.5.9"
}
}

View File

@@ -2,57 +2,54 @@
font-family: Roboto;
font-style: normal;
font-weight: 100;
src: local("Roboto Thin"), local("Roboto-Thin"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Thin.woff2") format("woff2"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Thin.woff") format("woff");
src: local("Roboto Thin"), local("Roboto-Thin"), url("node_modules/@fontsource/roboto/files/roboto-all-100-normal.woff") format("woff");
}
@font-face {
font-family: "Roboto Condensed";
font-style: normal;
font-weight: 300;
src: local("Roboto Condensed Light"), local("RobotoCondensed-Light"), url("node_modules/roboto-fontface/fonts/roboto-condensed/Roboto-Condensed-Light.woff2") format("woff2"),
url("node_modules/roboto-fontface/fonts/roboto-condensed/Roboto-Condensed-Light.woff") format("woff");
src: local("Roboto Condensed Light"), local("RobotoCondensed-Light"), url("node_modules/@fontsource/roboto-condensed/files/roboto-condensed-all-300-normal.woff") format("woff");
}
@font-face {
font-family: "Roboto Condensed";
font-style: normal;
font-weight: 400;
src: local("Roboto Condensed"), local("RobotoCondensed-Regular"), url("node_modules/roboto-fontface/fonts/roboto-condensed/Roboto-Condensed-Regular.woff2") format("woff2"),
url("node_modules/roboto-fontface/fonts/roboto-condensed/Roboto-Condensed-Regular.woff") format("woff");
src: local("Roboto Condensed"), local("RobotoCondensed-Regular"), url("node_modules/@fontsource/roboto-condensed/files/roboto-condensed-all-400-normal.woff") format("woff");
}
@font-face {
font-family: "Roboto Condensed";
font-style: normal;
font-weight: 700;
src: local("Roboto Condensed Bold"), local("RobotoCondensed-Bold"), url("node_modules/roboto-fontface/fonts/roboto-condensed/Roboto-Condensed-Bold.woff2") format("woff2"),
url("node_modules/roboto-fontface/fonts/roboto-condensed/Roboto-Condensed-Bold.woff") format("woff");
src: local("Roboto Condensed Bold"), local("RobotoCondensed-Bold"), url("node_modules/@fontsource/roboto-condensed/files/roboto-condensed-all-700-normal.woff") format("woff");
}
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 400;
src: local("Roboto"), local("Roboto-Regular"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Regular.woff2") format("woff2"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Regular.woff") format("woff");
src: local("Roboto"), local("Roboto-Regular"), url("node_modules/@fontsource/roboto/files/roboto-all-400-normal.woff") format("woff");
}
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 500;
src: local("Roboto Medium"), local("Roboto-Medium"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Medium.woff2") format("woff2"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Medium.woff") format("woff");
src: local("Roboto Medium"), local("Roboto-Medium"), url("node_modules/@fontsource/roboto/files/roboto-all-500-normal.woff") format("woff");
}
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 700;
src: local("Roboto Bold"), local("Roboto-Bold"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Bold.woff2") format("woff2"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Bold.woff") format("woff");
src: local("Roboto Bold"), local("Roboto-Bold"), url("node_modules/@fontsource/roboto/files/roboto-all-700-normal.woff") format("woff");
}
@font-face {
font-family: Roboto;
font-style: normal;
font-weight: 300;
src: local("Roboto Light"), local("Roboto-Light"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Light.woff2") format("woff2"), url("node_modules/roboto-fontface/fonts/roboto/Roboto-Light.woff") format("woff");
src: local("Roboto Light"), local("Roboto-Light"), url("node_modules/@fontsource/roboto/files/roboto-all-300-normal.woff") format("woff");
}

View File

@@ -1,3 +1,4 @@
#!/bin/bash
# This file is still here to keep PM2 working on older installations.
cd ~/MagicMirror
DISPLAY=:0 npm start

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* The Core App (Server)
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -37,7 +37,7 @@ if (process.env.MM_PORT) {
process.on("uncaughtException", function (err) {
Log.error("Whoops! There was an uncaught exception...");
Log.error(err);
Log.error("MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?");
Log.error("MagicMirror² will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?");
Log.error("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues");
});
@@ -128,7 +128,7 @@ function App() {
let m = new Module();
if (m.requiresVersion) {
Log.log(`Check MagicMirror version for node helper '${moduleName}' - Minimum version: ${m.requiresVersion} - Current version: ${global.version}`);
Log.log(`Check MagicMirror² version for node helper '${moduleName}' - Minimum version: ${m.requiresVersion} - Current version: ${global.version}`);
if (cmpVersions(global.version, m.requiresVersion) >= 0) {
Log.log("Version is ok!");
} else {

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
*
* Check the configuration file for errors
*

View File

@@ -1,6 +1,6 @@
/* global mmPort */
/* Magic Mirror
/* MagicMirror²
* Config Defaults
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -25,6 +25,9 @@ const defaults = {
units: "metric",
zoom: 1,
customCss: "css/custom.css",
// httpHeaders used by helmet, see https://helmetjs.github.io/. You can add other/more object values by overriding this in config.js,
// e.g. you need to add `frameguard: false` for embedding MagicMirror in another website, see https://github.com/MichMich/MagicMirror/issues/2847
httpHeaders: { contentSecurityPolicy: false, crossOriginOpenerPolicy: false, crossOriginEmbedderPolicy: false, crossOriginResourcePolicy: false, originAgentCluster: false },
modules: [
{
@@ -36,7 +39,7 @@ const defaults = {
position: "upper_third",
classes: "large thin",
config: {
text: "Magic Mirror<sup>2</sup>"
text: "MagicMirror²"
}
},
{
@@ -59,7 +62,7 @@ const defaults = {
position: "middle_center",
classes: "xsmall",
config: {
text: "If you get this message while your config file is already created,<br>" + "it probably contains an error. To validate your config file run in your MagicMirror directory<br>" + "<pre>npm run config:check</pre>"
text: "If you get this message while your config file is already created,<br>" + "it probably contains an error. To validate your config file run in your MagicMirror² directory<br>" + "<pre>npm run config:check</pre>"
}
},
{

View File

@@ -1,4 +1,4 @@
/* Magic Mirror Deprecated Config Options List
/* MagicMirror² Deprecated Config Options List
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.

View File

@@ -8,6 +8,12 @@ const Log = require("logger");
let config = process.env.config ? JSON.parse(process.env.config) : {};
// Module to control application life.
const app = electron.app;
// If ELECTRON_DISABLE_GPU is set electron is started with --disable-gpu flag.
// See https://www.electronjs.org/docs/latest/tutorial/offscreen-rendering for more info.
if (process.env.ELECTRON_DISABLE_GPU !== undefined) {
app.disableHardwareAcceleration();
}
// Module to create native browser window.
const BrowserWindow = electron.BrowserWindow;
@@ -53,7 +59,7 @@ function createWindow() {
// If config.address is not defined or is an empty string (listening on all interfaces), connect to localhost
let prefix;
if (config["tls"] !== null && config["tls"]) {
if ((config["tls"] !== null && config["tls"]) || config.useHttps) {
prefix = "https://";
} else {
prefix = "http://";
@@ -140,6 +146,13 @@ app.on("before-quit", (event) => {
process.exit(0);
});
/* handle errors from self signed certificates */
app.on("certificate-error", (event, webContents, url, error, certificate, callback) => {
event.preventDefault();
callback(true);
});
// Start the core application if server is run on localhost
// This starts all node helpers and starts the webserver.
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].includes(config.address)) {

20
js/fetch.js Normal file
View File

@@ -0,0 +1,20 @@
/**
* fetch
*
* @param {string} url to be fetched
* @param {object} options object e.g. for headers
* @class
*/
async function fetch(url, options) {
const nodeVersion = process.version.match(/^v(\d+)\.*/)[1];
if (nodeVersion >= 18) {
// node version >= 18
return global.fetch(url, options);
} else {
// node version < 18
const nodefetch = require("node-fetch");
return nodefetch(url, options);
}
}
module.exports = fetch;

View File

@@ -1,6 +1,6 @@
/* global defaultModules, vendor */
/* Magic Mirror
/* MagicMirror²
* Module and File loaders.
*
* By Michael Teeuw https://michaelteeuw.nl

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Log
*
* This logger is very simple, but needs to be extended.

View File

@@ -1,6 +1,6 @@
/* global Loader, defaults, Translator */
/* Magic Mirror
/* MagicMirror²
* Main System
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -245,6 +245,7 @@ const MM = (function () {
if (moduleWrapper !== null) {
moduleWrapper.style.transition = "opacity " + speed / 1000 + "s";
moduleWrapper.style.opacity = 0;
moduleWrapper.classList.add("hidden");
clearTimeout(module.showHideTimer);
module.showHideTimer = setTimeout(function () {
@@ -310,6 +311,7 @@ const MM = (function () {
moduleWrapper.style.transition = "opacity " + speed / 1000 + "s";
// Restore the position. See hideModule() for more info.
moduleWrapper.style.position = "static";
moduleWrapper.classList.remove("hidden");
updateWrapperStates();
@@ -478,7 +480,7 @@ const MM = (function () {
* Main init method.
*/
init: function () {
Log.info("Initializing MagicMirror.");
Log.info("Initializing MagicMirror².");
loadConfig();
Log.setLogLevel(config.logLevel);

View File

@@ -1,6 +1,6 @@
/* global Class, cloneObject, Loader, MMSocket, nunjucks, Translator */
/* Magic Mirror
/* MagicMirror²
* Module Blueprint.
* @typedef {Object} Module
*
@@ -12,7 +12,7 @@ const Module = Class.extend({
* All methods (and properties) below can be subclassed. *
*********************************************************/
// Set the minimum MagicMirror module version for this module.
// Set the minimum MagicMirror² module version for this module.
requiresVersion: "2.0.0",
// Module config defaults.
@@ -74,7 +74,7 @@ const Module = Class.extend({
},
/**
* Generates the dom which needs to be displayed. This method is called by the Magic Mirror core.
* Generates the dom which needs to be displayed. This method is called by the MagicMirror² core.
* This method can to be subclassed if the module wants to display info on the mirror.
* Alternatively, the getTemplate method could be subclassed.
*
@@ -109,7 +109,7 @@ const Module = Class.extend({
/**
* Generates the header string which needs to be displayed if a user has a header configured for this module.
* This method is called by the Magic Mirror core, but only if the user has configured a default header for the module.
* This method is called by the MagicMirror² core, but only if the user has configured a default header for the module.
* This method needs to be subclassed if the module wants to display modified headers on the mirror.
*
* @returns {string} The header to display above the header.
@@ -141,7 +141,7 @@ const Module = Class.extend({
},
/**
* Called by the Magic Mirror core when a notification arrives.
* Called by the MagicMirror² core when a notification arrives.
*
* @param {string} notification The identifier of the notification.
* @param {*} payload The payload of the notification.
@@ -434,7 +434,7 @@ const Module = Class.extend({
});
/**
* Merging MagicMirror (or other) default/config script by @bugsounet
* Merging MagicMirror² (or other) default/config script by @bugsounet
* Merge 2 objects or/with array
*
* Usage:
@@ -498,7 +498,7 @@ Module.create = function (name) {
Module.register = function (name, moduleDefinition) {
if (moduleDefinition.requiresVersion) {
Log.log("Check MagicMirror version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + window.mmVersion);
Log.log("Check MagicMirror² version for module '" + name + "' - Minimum version: " + moduleDefinition.requiresVersion + " - Current version: " + window.mmVersion);
if (cmpVersions(window.mmVersion, moduleDefinition.requiresVersion) >= 0) {
Log.log("Version is ok!");
} else {

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Node Helper Superclass
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -22,39 +22,38 @@ const NodeHelper = Class.extend({
Log.log(`Starting module helper: ${this.name}`);
},
/* stop()
* Called when the MagicMirror server receives a `SIGINT`
/**
* Called when the MagicMirror² server receives a `SIGINT`
* Close any open connections, stop any sub-processes and
* gracefully exit the module.
*
*/
stop() {
Log.log(`Stopping module helper: ${this.name}`);
},
/* socketNotificationReceived(notification, payload)
/**
* This method is called when a socket notification arrives.
*
* argument notification string - The identifier of the notification.
* argument payload mixed - The payload of the notification.
* @param {string} notification The identifier of the notification.
* @param {*} payload The payload of the notification.
*/
socketNotificationReceived(notification, payload) {
Log.log(`${this.name} received a socket notification: ${notification} - Payload: ${payload}`);
},
/* setName(name)
/**
* Set the module name.
*
* argument name string - Module name.
* @param {string} name Module name.
*/
setName(name) {
this.name = name;
},
/* setPath(path)
/**
* Set the module path.
*
* argument path string - Module path.
* @param {string} path Module path.
*/
setPath(path) {
this.path = path;

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Server
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -10,6 +10,7 @@ const path = require("path");
const ipfilter = require("express-ipfilter").IpFilter;
const fs = require("fs");
const helmet = require("helmet");
const fetch = require("fetch");
const Log = require("logger");
const Utils = require("./utils.js");
@@ -61,13 +62,14 @@ function Server(config, callback) {
app.use(function (req, res, next) {
ipfilter(config.ipWhitelist, { mode: config.ipWhitelist.length === 0 ? "deny" : "allow", log: false })(req, res, function (err) {
if (err === undefined) {
res.header("Access-Control-Allow-Origin", "*");
return next();
}
Log.log(err.message);
res.status(403).send("This device is not allowed to access your mirror. <br> Please check your config.js or config.js.sample to change this.");
});
});
app.use(helmet({ contentSecurityPolicy: false }));
app.use(helmet(config.httpHeaders));
app.use("/js", express.static(__dirname));
@@ -76,6 +78,33 @@ function Server(config, callback) {
app.use(directory, express.static(path.resolve(global.root_path + directory)));
}
app.get("/cors", async function (req, res) {
// example: http://localhost:8080/cors?url=https://google.de
try {
const reg = "^/cors.+url=(.*)";
let url = "";
let match = new RegExp(reg, "g").exec(req.url);
if (!match) {
url = "invalid url: " + req.url;
Log.error(url);
res.send(url);
} else {
url = match[1];
Log.log("cors url: " + url);
const response = await fetch(url, { headers: { "User-Agent": "Mozilla/5.0 MagicMirror/" + global.version } });
const header = response.headers.get("Content-Type");
const data = await response.text();
if (header) res.set("Content-Type", header);
res.send(data);
}
} catch (error) {
Log.error(error);
res.send(error);
}
});
app.get("/version", function (req, res) {
res.send(global.version);
});

View File

@@ -1,6 +1,6 @@
/* global io */
/* Magic Mirror
/* MagicMirror²
* TODO add description
*
* By Michael Teeuw https://michaelteeuw.nl

View File

@@ -1,6 +1,6 @@
/* global translations */
/* Magic Mirror
/* MagicMirror²
* Translator (l10n)
*
* By Christopher Fenner https://github.com/CFenner
@@ -104,7 +104,7 @@ const Translator = (function () {
* @param {Function} callback Function called when done.
*/
load(module, file, isFallback, callback) {
Log.log(`${module.name} - Load translation${isFallback && " fallback"}: ${file}`);
Log.log(`${module.name} - Load translation${isFallback ? " fallback" : ""}: ${file}`);
if (this.translationsFallback[module.name]) {
callback();

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Utils
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com

View File

@@ -1,5 +1,5 @@
# Module: Alert
The alert module is one of the default modules of the MagicMirror. This module displays notifications from other modules.
The alert module is one of the default modules of the MagicMirror². This module displays notifications from other modules.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/alert.html).

View File

@@ -1,167 +1,146 @@
/* global NotificationFx */
/* Magic Mirror
/* MagicMirror²
* Module: alert
*
* By Paul-Vincent Roll https://paulvincentroll.com/
* MIT Licensed.
*/
Module.register("alert", {
alerts: {},
defaults: {
// scale|slide|genie|jelly|flip|bouncyflip|exploader
effect: "slide",
// scale|slide|genie|jelly|flip|bouncyflip|exploader
alert_effect: "jelly",
//time a notification is displayed in seconds
display_time: 3500,
//Position
effect: "slide", // scale|slide|genie|jelly|flip|bouncyflip|exploader
alert_effect: "jelly", // scale|slide|genie|jelly|flip|bouncyflip|exploader
display_time: 3500, // time a notification is displayed in seconds
position: "center",
//shown at startup
welcome_message: false
welcome_message: false // shown at startup
},
getScripts: function () {
getScripts() {
return ["notificationFx.js"];
},
getStyles: function () {
return ["notificationFx.css", "font-awesome.css"];
getStyles() {
return ["font-awesome.css", this.file(`./styles/notificationFx.css`), this.file(`./styles/${this.config.position}.css`)];
},
// Define required translations.
getTranslations: function () {
getTranslations() {
return {
en: "translations/en.json",
bg: "translations/bg.json",
da: "translations/da.json",
de: "translations/de.json",
nl: "translations/nl.json"
en: "translations/en.json",
es: "translations/es.json",
fr: "translations/fr.json",
hu: "translations/hu.json",
nl: "translations/nl.json",
ru: "translations/ru.json"
};
},
show_notification: function (message) {
getTemplate(type) {
return `templates/${type}.njk`;
},
start() {
Log.info(`Starting module: ${this.name}`);
if (this.config.effect === "slide") {
this.config.effect = this.config.effect + "-" + this.config.position;
this.config.effect = `${this.config.effect}-${this.config.position}`;
}
let msg = "";
if (message.title) {
msg += "<span class='thin dimmed medium'>" + message.title + "</span>";
if (this.config.welcome_message) {
const message = this.config.welcome_message === true ? this.translate("welcome") : this.config.welcome_message;
this.showNotification({ title: this.translate("sysTitle"), message });
}
if (message.message) {
if (msg !== "") {
msg += "<br />";
},
notificationReceived(notification, payload, sender) {
if (notification === "SHOW_ALERT") {
if (payload.type === "notification") {
this.showNotification(payload);
} else {
this.showAlert(payload, sender);
}
msg += "<span class='light bright small'>" + message.message + "</span>";
} else if (notification === "HIDE_ALERT") {
this.hideAlert(sender);
}
},
async showNotification(notification) {
const message = await this.renderMessage("notification", notification);
new NotificationFx({
message: msg,
message,
layout: "growl",
effect: this.config.effect,
ttl: message.timer !== undefined ? message.timer : this.config.display_time
ttl: notification.timer || this.config.display_time
}).show();
},
show_alert: function (params, sender) {
let image = "";
//Set standard params if not provided by module
if (typeof params.timer === "undefined") {
params.timer = null;
}
if (typeof params.imageHeight === "undefined") {
params.imageHeight = "80px";
}
if (typeof params.imageUrl === "undefined" && typeof params.imageFA === "undefined") {
params.imageUrl = null;
} else if (typeof params.imageFA === "undefined") {
image = "<img src='" + params.imageUrl.toString() + "' height='" + params.imageHeight.toString() + "' style='margin-bottom: 10px;'/><br />";
} else if (typeof params.imageUrl === "undefined") {
image = "<span class='bright " + "fa fa-" + params.imageFA + "' style='margin-bottom: 10px;font-size:" + params.imageHeight.toString() + ";'/></span><br />";
}
//Create overlay
const overlay = document.createElement("div");
overlay.id = "overlay";
overlay.innerHTML += '<div class="black_overlay"></div>';
document.body.insertBefore(overlay, document.body.firstChild);
//If module already has an open alert close it
async showAlert(alert, sender) {
// If module already has an open alert close it
if (this.alerts[sender.name]) {
this.hide_alert(sender, false);
this.hideAlert(sender, false);
}
//Display title and message only if they are provided in notification parameters
let message = "";
if (params.title) {
message += "<span class='light dimmed medium'>" + params.title + "</span>";
}
if (params.message) {
if (message !== "") {
message += "<br />";
}
message += "<span class='thin bright small'>" + params.message + "</span>";
// Add overlay
if (!Object.keys(this.alerts).length) {
this.toggleBlur(true);
}
//Store alert in this.alerts
const message = await this.renderMessage("alert", alert);
// Store alert in this.alerts
this.alerts[sender.name] = new NotificationFx({
message: image + message,
message,
effect: this.config.alert_effect,
ttl: params.timer,
onClose: () => this.hide_alert(sender),
ttl: alert.timer,
onClose: () => this.hideAlert(sender),
al_no: "ns-alert"
});
//Show alert
// Show alert
this.alerts[sender.name].show();
//Add timer to dismiss alert and overlay
if (params.timer) {
// Add timer to dismiss alert and overlay
if (alert.timer) {
setTimeout(() => {
this.hide_alert(sender);
}, params.timer);
this.hideAlert(sender);
}, alert.timer);
}
},
hide_alert: function (sender, close = true) {
//Dismiss alert and remove from this.alerts
hideAlert(sender, close = true) {
// Dismiss alert and remove from this.alerts
if (this.alerts[sender.name]) {
this.alerts[sender.name].dismiss(close);
this.alerts[sender.name] = null;
//Remove overlay
const overlay = document.getElementById("overlay");
overlay.parentNode.removeChild(overlay);
}
},
setPosition: function (pos) {
//Add css to body depending on the set position for notifications
const sheet = document.createElement("style");
if (pos === "center") {
sheet.innerHTML = ".ns-box {margin-left: auto; margin-right: auto;text-align: center;}";
}
if (pos === "right") {
sheet.innerHTML = ".ns-box {margin-left: auto;text-align: right;}";
}
if (pos === "left") {
sheet.innerHTML = ".ns-box {margin-right: auto;text-align: left;}";
}
document.body.appendChild(sheet);
},
notificationReceived: function (notification, payload, sender) {
if (notification === "SHOW_ALERT") {
if (typeof payload.type === "undefined") {
payload.type = "alert";
}
if (payload.type === "alert") {
this.show_alert(payload, sender);
} else if (payload.type === "notification") {
this.show_notification(payload);
}
} else if (notification === "HIDE_ALERT") {
this.hide_alert(sender);
}
},
start: function () {
this.alerts = {};
this.setPosition(this.config.position);
if (this.config.welcome_message) {
if (this.config.welcome_message === true) {
this.show_notification({ title: this.translate("sysTitle"), message: this.translate("welcome") });
} else {
this.show_notification({ title: this.translate("sysTitle"), message: this.config.welcome_message });
delete this.alerts[sender.name];
// Remove overlay
if (!Object.keys(this.alerts).length) {
this.toggleBlur(false);
}
}
Log.info("Starting module: " + this.name);
},
renderMessage(type, data) {
return new Promise((resolve) => {
this.nunjucksEnvironment().render(this.getTemplate(type), data, function (err, res) {
if (err) {
Log.error("Failed to render alert", err);
}
resolve(res);
});
});
},
toggleBlur(add = false) {
const method = add ? "add" : "remove";
const modules = document.querySelectorAll(".module");
for (const module of modules) {
module.classList[method]("alert-blur");
}
}
});

View File

@@ -9,6 +9,8 @@
*
* Copyright 2014, Codrops
* https://tympanus.net/codrops/
*
* @param {object} window The window object
*/
(function (window) {
/**

View File

@@ -0,0 +1,5 @@
.ns-box {
margin-left: auto;
margin-right: auto;
text-align: center;
}

View File

@@ -0,0 +1,4 @@
.ns-box {
margin-right: auto;
text-align: left;
}

View File

@@ -39,12 +39,8 @@
border-radius: 20px;
}
.black_overlay {
position: fixed;
z-index: 2;
background-color: rgba(0, 0, 0, 0.93);
width: 100%;
height: 100%;
.alert-blur {
filter: blur(2px) brightness(50%);
}
[class^="ns-effect-"].ns-growl.ns-hide,

View File

@@ -0,0 +1,4 @@
.ns-box {
margin-left: auto;
text-align: right;
}

View File

@@ -0,0 +1,18 @@
{% if imageUrl or imageFA %}
{% set imageHeight = imageHeight if imageHeight else "80px" %}
{% if imageUrl %}
<img src="{{ imageUrl }}" height="{{ imageHeight }}" style="margin-bottom: 10px;"/>
{% else %}
<span class="bright fas fa-{{ imageFA }}" style='margin-bottom: 10px; font-size: {{ imageHeight }};'/></span>
{% endif %}
<br/>
{% endif %}
{% if title %}
<span class="thin dimmed medium">{{ title }}</span>
{% endif %}
{% if message %}
{% if title %}
<br/>
{% endif %}
<span class="light bright small">{{ message }}</span>
{% endif %}

View File

@@ -0,0 +1,9 @@
{% if title %}
<span class="thin dimmed medium">{{ title }}</span>
{% endif %}
{% if message %}
{% if title %}
<br/>
{% endif %}
<span class="light bright small">{{ message }}</span>
{% endif %}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror нотификация",
"sysTitle": "MagicMirror² нотификация",
"welcome": "Добре дошли, стартирането беше успешно"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror Notifikation",
"sysTitle": "MagicMirror² Notifikation",
"welcome": "Velkommen, modulet er succesfuldt startet!"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror Benachrichtigung",
"sysTitle": "MagicMirror² Benachrichtigung",
"welcome": "Willkommen, Start war erfolgreich!"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror Notification",
"sysTitle": "MagicMirror² Notification",
"welcome": "Welcome, start was successful!"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror Notificaciones",
"sysTitle": "MagicMirror² Notificaciones",
"welcome": "Bienvenido, ¡se iniciado correctamente!"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror Notification",
"sysTitle": "MagicMirror² Notification",
"welcome": "Bienvenue, le démarrage a été un succès!"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror értesítés",
"sysTitle": "MagicMirror² értesítés",
"welcome": "Üdvözöljük, indulás sikeres!"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror Notificatie",
"sysTitle": "MagicMirror² Notificatie",
"welcome": "Welkom, Succesvol gestart!"
}

View File

@@ -1,4 +1,4 @@
{
"sysTitle": "MagicMirror Уведомление",
"sysTitle": "MagicMirror² Уведомление",
"welcome": "Добро пожаловать, старт был успешным!"
}

2
modules/default/calendar/README.md Executable file → Normal file
View File

@@ -1,6 +1,6 @@
# Module: Calendar
The `calendar` module is one of the default modules of the MagicMirror.
The `calendar` module is one of the default modules of the MagicMirror².
This module displays events from a public .ical calendar. It can combine multiple calendars.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/calendar.html).

129
modules/default/calendar/calendar.js Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/* global cloneObject */
/* Magic Mirror
/* MagicMirror²
* Module: Calendar
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -13,7 +13,7 @@ Module.register("calendar", {
maximumNumberOfDays: 365,
limitDays: 0, // Limit the number of days shown, 0 = no limit
displaySymbol: true,
defaultSymbol: "calendar", // Fontawesome Symbol see https://fontawesome.com/cheatsheet?from=io
defaultSymbol: "calendar-alt", // Fontawesome Symbol see https://fontawesome.com/cheatsheet?from=io
showLocation: false,
displayRepeatingCountTitle: false,
defaultRepeatingCountTitle: "",
@@ -37,13 +37,14 @@ Module.register("calendar", {
hidePrivate: false,
hideOngoing: false,
hideTime: false,
showTimeToday: false,
colored: false,
coloredSymbolOnly: false,
customEvents: [], // Array of {keyword: "", symbol: "", color: ""} where Keyword is a regexp and symbol/color are to be applied for matched
tableClass: "small",
calendars: [
{
symbol: "calendar",
symbol: "calendar-alt",
url: "https://www.calendarlabs.com/templates/ical/US-Holidays.ics"
}
],
@@ -133,6 +134,10 @@ Module.register("calendar", {
// Override socket notification handler.
socketNotificationReceived: function (notification, payload) {
if (notification === "FETCH_CALENDAR") {
this.sendSocketNotification(notification, { url: payload.url, id: this.identifier });
}
if (this.identifier !== payload.id) {
return;
}
@@ -164,7 +169,7 @@ Module.register("calendar", {
const oneHour = oneMinute * 60;
const oneDay = oneHour * 24;
const events = this.createEventList();
const events = this.createEventList(true);
const wrapper = document.createElement("table");
wrapper.className = this.config.tableClass;
@@ -237,21 +242,9 @@ Module.register("calendar", {
symbolWrapper.className = "symbol align-right " + symbolClass;
const symbols = this.symbolsForEvent(event);
// If symbols are displayed and custom symbol is set, replace event symbol
if (this.config.displaySymbol && this.config.customEvents.length > 0) {
for (let ev in this.config.customEvents) {
if (typeof this.config.customEvents[ev].symbol !== "undefined" && this.config.customEvents[ev].symbol !== "") {
let needle = new RegExp(this.config.customEvents[ev].keyword, "gi");
if (needle.test(event.title)) {
symbols[0] = this.config.customEvents[ev].symbol;
break;
}
}
}
}
symbols.forEach((s, index) => {
const symbol = document.createElement("span");
symbol.className = "fa fa-fw fa-" + s;
symbol.className = "fas fa-fw fa-" + s;
if (index > 0) {
symbol.style.paddingLeft = "5px";
}
@@ -317,6 +310,12 @@ Module.register("calendar", {
timeWrapper.className = "time light align-left " + this.timeClassForUrl(event.url);
timeWrapper.style.paddingLeft = "2px";
timeWrapper.innerHTML = moment(event.startDate, "x").format("LT");
// Add endDate to dataheaders if showEnd is enabled
if (this.config.showEnd) {
timeWrapper.innerHTML += " - " + moment(event.endDate, "x").format("LT");
}
eventWrapper.appendChild(timeWrapper);
titleWrapper.classList.add("align-right");
}
@@ -341,8 +340,7 @@ Module.register("calendar", {
//subtract one second so that fullDayEvents end at 23:59:59, and not at 0:00:00 one the next day
event.endDate -= oneSecond;
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").format(this.config.fullDayEventDateFormat));
}
if (this.config.getRelative > 0 && event.startDate < now) {
} else if (this.config.getRelative > 0 && event.startDate < now) {
// Ongoing and getRelative is set
timeWrapper.innerHTML = this.capFirst(
this.translate("RUNNING", {
@@ -368,22 +366,33 @@ Module.register("calendar", {
}
} else {
// Show relative times
if (event.startDate >= now) {
if (event.startDate >= now || (event.fullDayEvent && event.today)) {
// Use relative time
if (!this.config.hideTime) {
if (!this.config.hideTime && !event.fullDayEvent) {
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").calendar(null, { sameElse: this.config.dateFormat }));
} else {
timeWrapper.innerHTML = this.capFirst(
moment(event.startDate, "x").calendar(null, {
sameDay: "[" + this.translate("TODAY") + "]",
sameDay: this.config.showTimeToday ? "LT" : "[" + this.translate("TODAY") + "]",
nextDay: "[" + this.translate("TOMORROW") + "]",
nextWeek: "dddd",
sameElse: this.config.dateFormat
sameElse: event.fullDayEvent ? this.config.fullDayEventDateFormat : this.config.dateFormat
})
);
}
if (event.startDate - now < this.config.getRelative * oneHour) {
// If event is within getRelative hours, display 'in xxx' time format or moment.fromNow()
if (event.fullDayEvent) {
// Full days events within the next two days
if (event.today) {
timeWrapper.innerHTML = this.capFirst(this.translate("TODAY"));
} else if (event.startDate - now < oneDay && event.startDate - now > 0) {
timeWrapper.innerHTML = this.capFirst(this.translate("TOMORROW"));
} else if (event.startDate - now < 2 * oneDay && event.startDate - now > 0) {
if (this.translate("DAYAFTERTOMORROW") !== "DAYAFTERTOMORROW") {
timeWrapper.innerHTML = this.capFirst(this.translate("DAYAFTERTOMORROW"));
}
}
} else if (event.startDate - now < this.config.getRelative * oneHour) {
// If event is within getRelative hours, display 'in xxx' time format or moment.fromNow()
timeWrapper.innerHTML = this.capFirst(moment(event.startDate, "x").fromNow());
}
} else {
@@ -478,9 +487,10 @@ Module.register("calendar", {
/**
* Creates the sorted list of all events.
*
* @param {boolean} limitNumberOfEntries Whether to filter returned events for display.
* @returns {object[]} Array with events.
*/
createEventList: function () {
createEventList: function (limitNumberOfEntries) {
const now = new Date();
const today = moment().startOf("day");
const future = moment().startOf("day").add(this.config.maximumNumberOfDays, "days").toDate();
@@ -488,25 +498,27 @@ Module.register("calendar", {
for (const calendarUrl in this.calendarData) {
const calendar = this.calendarData[calendarUrl];
let remainingEntries = this.maximumEntriesForUrl(calendarUrl);
for (const e in calendar) {
const event = JSON.parse(JSON.stringify(calendar[e])); // clone object
if (event.endDate < now) {
if (this.config.hidePrivate && event.class === "PRIVATE") {
// do not add the current event, skip it
continue;
}
if (this.config.hidePrivate) {
if (event.class === "PRIVATE") {
// do not add the current event, skip it
if (limitNumberOfEntries) {
if (event.endDate < now) {
continue;
}
}
if (this.config.hideOngoing) {
if (event.startDate < now) {
if (this.config.hideOngoing && event.startDate < now) {
continue;
}
}
if (this.listContainsEvent(events, event)) {
continue;
if (this.listContainsEvent(events, event)) {
continue;
}
if (--remainingEntries < 0) {
break;
}
}
event.url = calendarUrl;
event.today = event.startDate >= today && event.startDate < today + 24 * 60 * 60 * 1000;
@@ -549,6 +561,10 @@ Module.register("calendar", {
return a.startDate - b.startDate;
});
if (!limitNumberOfEntries) {
return events;
}
// Limit the number of days displayed
// If limitDays is set > 0, limit display to that number of days
if (this.config.limitDays > 0) {
@@ -629,6 +645,17 @@ Module.register("calendar", {
symbols = this.mergeUnique(this.getCalendarPropertyAsArray(event.url, "fullDaySymbol", this.config.defaultSymbol), symbols);
}
// If custom symbol is set, replace event symbol
for (let ev of this.config.customEvents) {
if (typeof ev.symbol !== "undefined" && ev.symbol !== "") {
let needle = new RegExp(ev.keyword, "gi");
if (needle.test(event.title)) {
symbols[0] = ev.symbol;
break;
}
}
}
return symbols;
},
@@ -700,6 +727,16 @@ Module.register("calendar", {
return this.getCalendarProperty(url, "repeatingCountTitle", this.config.defaultRepeatingCountTitle);
},
/**
* Retrieves the maximum entry count for a specific calendar url.
*
* @param {string} url The calendar url
* @returns {number} The maximum entry count
*/
maximumEntriesForUrl: function (url) {
return this.getCalendarProperty(url, "maximumEntries", this.config.maximumEntries);
},
/**
* Helper method to retrieve the property for a specific calendar url.
*
@@ -825,22 +862,14 @@ Module.register("calendar", {
* The all events available in one array, sorted on startdate.
*/
broadcastEvents: function () {
const eventList = [];
for (const url in this.calendarData) {
for (const ev of this.calendarData[url]) {
const event = cloneObject(ev);
event.symbol = this.symbolsForEvent(event);
event.calendarName = this.calendarNameForUrl(url);
event.color = this.colorForUrl(url);
delete event.url;
eventList.push(event);
}
const eventList = this.createEventList(false);
for (const event of eventList) {
event.symbol = this.symbolsForEvent(event);
event.calendarName = this.calendarNameForUrl(event.url);
event.color = this.colorForUrl(event.url);
delete event.url;
}
eventList.sort(function (a, b) {
return a.startDate - b.startDate;
});
this.sendNotification("CALENDAR_EVENTS", eventList);
}
});

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Node Helper: Calendar - CalendarFetcher
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -8,7 +8,7 @@ const CalendarUtils = require("./calendarutils");
const Log = require("logger");
const NodeHelper = require("node_helper");
const ical = require("node-ical");
const fetch = require("node-fetch");
const fetch = require("fetch");
const digest = require("digest-fetch");
const https = require("https");
@@ -41,7 +41,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
let fetcher = null;
let httpsAgent = null;
let headers = {
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version
};
if (selfSignedCert) {

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Calendar Util Methods
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -98,7 +98,7 @@ const CalendarUtils = {
if (h > 0 && h < Math.abs(current_offset) / 60) {
// if so, rrule created a wrong date (utc day, oops, with utc yesterday adjusted time)
// we need to fix that
adjustHours = 24;
//adjustHours = 24;
// Log.debug("adjusting date")
}
//-300 > -240
@@ -160,7 +160,7 @@ const CalendarUtils = {
}
if (event.type === "VEVENT") {
Log.debug("\nEvent: " + JSON.stringify(event));
Log.debug("Event:\n" + JSON.stringify(event));
let startDate = eventDate(event, "start");
let endDate;
@@ -177,8 +177,8 @@ const CalendarUtils = {
}
}
Log.debug("startDate (local): " + startDate.toDate());
Log.debug("endDate (local): " + endDate.toDate());
Log.debug("start: " + startDate.toDate());
Log.debug("end:: " + endDate.toDate());
// Calculate the duration of the event for use with recurring events.
let duration = parseInt(endDate.format("x")) - parseInt(startDate.format("x"));
@@ -332,40 +332,47 @@ const CalendarUtils = {
Log.debug("Fullday");
// If the offset is negative (east of GMT), where the problem is
if (dateoffset < 0) {
// Remove the offset, independently of the comparison between the date hour and the offset,
// since in the case that *date houre < offset*, the *new Date* command will handle this by
// representing the day before.
// Reduce the time by the offset:
// Apply the correction to the date/time to get it UTC relative
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
// the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry
//duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date1 is " + date);
if (dh < Math.abs(dateoffset / 60)) {
// if the rrule byweekday WAS explicitly set , correct it
// reduce the time by the offset
if (curEvent.rrule.origOptions.byweekday !== undefined) {
// Apply the correction to the date/time to get it UTC relative
date = new Date(date.getTime() - Math.abs(24 * 60) * 60000);
}
// the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry
//duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date1 fulldate is " + date);
}
} else {
// if the timezones are the same, correct date if needed
if (event.start.tz === moment.tz.guess()) {
// if the date hour is less than the offset
if (24 - dh < Math.abs(dateoffset / 60)) {
//if (event.start.tz === moment.tz.guess()) {
// if the date hour is less than the offset
if (24 - dh <= Math.abs(dateoffset / 60)) {
// if the rrule byweekday WAS explicitly set , correct it
if (curEvent.rrule.origOptions.byweekday !== undefined) {
// apply the correction to the date/time back to right day
date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
// the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry
//duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date2 is " + date);
}
// the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry
//duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date2 fulldate is " + date);
}
//}
}
} else {
// not full day, but luxon can still screw up the date on the rule processing
// we need to correct the date to get back to the right event for
if (dateoffset < 0) {
// if the date hour is less than the offset
if (dh < Math.abs(dateoffset / 60)) {
// Reduce the time by the offset:
// Apply the correction to the date/time to get it UTC relative
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
if (dh <= Math.abs(dateoffset / 60)) {
// if the rrule byweekday WAS explicitly set , correct it
if (curEvent.rrule.origOptions.byweekday !== undefined) {
// Reduce the time by t:
// Apply the correction to the date/time to get it UTC relative
date = new Date(date.getTime() - Math.abs(24 * 60) * 60000);
}
// the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry
//duration = 24 * 60 * 60 * 1000;
@@ -373,21 +380,24 @@ const CalendarUtils = {
}
} else {
// if the timezones are the same, correct date if needed
if (event.start.tz === moment.tz.guess()) {
// if the date hour is less than the offset
if (24 - dh < Math.abs(dateoffset / 60)) {
//if (event.start.tz === moment.tz.guess()) {
// if the date hour is less than the offset
if (24 - dh <= Math.abs(dateoffset / 60)) {
// if the rrule byweekday WAS explicitly set , correct it
if (curEvent.rrule.origOptions.byweekday !== undefined) {
// apply the correction to the date/time back to right day
date = new Date(date.getTime() + Math.abs(24 * 60) * 60000);
// the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry
//duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date2 is " + date);
}
// the duration was calculated way back at the top before we could correct the start time..
// fix it for this event entry
//duration = 24 * 60 * 60 * 1000;
Log.debug("new recurring date2 is " + date);
}
//}
}
}
startDate = moment(date);
Log.debug("Corrected startDate (local): " + startDate.toDate());
Log.debug("Corrected startDate: " + startDate.toDate());
let adjustDays = CalendarUtils.calculateTimezoneAdjustment(event, date);
@@ -471,10 +481,6 @@ const CalendarUtils = {
return;
}
// Adjust start date so multiple day events will be displayed as happening today even though they started some days ago already
if (fullDayEvent && startDate <= today) {
startDate = moment(today);
}
// if the start and end are the same, then make end the 'end of day' value (start is at 00:00:00)
if (fullDayEvent && startDate.format("x") === endDate.format("x")) {
endDate = endDate.endOf("day");
@@ -500,23 +506,7 @@ const CalendarUtils = {
return a.startDate - b.startDate;
});
// include up to maximumEntries current or upcoming events
// If past events should be included, include all past events
const now = moment();
let entries = 0;
let events = [];
for (let ne of newEvents) {
if (moment(ne.endDate, "x").isBefore(now)) {
if (config.includePastEvents) events.push(ne);
continue;
}
entries++;
// If max events has been saved, skip the rest
if (entries > config.maximumEntries) break;
events.push(ne);
}
return events;
return newEvents;
},
/**

View File

@@ -1,6 +1,6 @@
/* CalendarFetcher Tester
* use this script with `node debug.js` to test the fetcher without the need
* of starting the MagicMirror core. Adjust the values below to your desire.
* of starting the MagicMirror² core. Adjust the values below to your desire.
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Node Helper: Calendar
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -19,6 +19,14 @@ module.exports = NodeHelper.create({
socketNotificationReceived: function (notification, payload) {
if (notification === "ADD_CALENDAR") {
this.createFetcher(payload.url, payload.fetchInterval, payload.excludedEvents, payload.maximumEntries, payload.maximumNumberOfDays, payload.auth, payload.broadcastPastEvents, payload.selfSignedCert, payload.id);
} else if (notification === "FETCH_CALENDAR") {
const key = payload.id + payload.url;
if (typeof this.fetchers[key] === "undefined") {
Log.error("Calendar Error. No fetcher exists with key: ", key);
this.sendSocketNotification("CALENDAR_ERROR", { error_type: "MODULE_ERROR_UNSPECIFIED" });
return;
}
this.fetchers[key].startFetch();
}
},

View File

@@ -1,6 +1,6 @@
# Module: Clock
The `clock` module is one of the default modules of the MagicMirror.
The `clock` module is one of the default modules of the MagicMirror².
This module displays the current date and time. The information will be updated realtime.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/clock.html).

View File

@@ -1,6 +1,6 @@
/* global SunCalc */
/* Magic Mirror
/* MagicMirror²
* Module: Clock
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -199,13 +199,13 @@ Module.register("clock", {
sunWrapper.innerHTML =
'<span class="' +
(isVisible ? "bright" : "") +
'"><i class="fa fa-sun-o" aria-hidden="true"></i> ' +
'"><i class="fas fa-sun" aria-hidden="true"></i> ' +
untilNextEventString +
"</span>" +
'<span><i class="fa fa-arrow-up" aria-hidden="true"></i> ' +
'<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ' +
formatTime(this.config, sunTimes.sunrise) +
"</span>" +
'<span><i class="fa fa-arrow-down" aria-hidden="true"></i> ' +
'<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ' +
formatTime(this.config, sunTimes.sunset) +
"</span>";
digitalWrapper.appendChild(sunWrapper);
@@ -230,13 +230,13 @@ Module.register("clock", {
moonWrapper.innerHTML =
'<span class="' +
(isVisible ? "bright" : "") +
'"><i class="fa fa-moon-o" aria-hidden="true"></i> ' +
'"><i class="fas fa-moon" aria-hidden="true"></i> ' +
illuminatedFractionString +
"</span>" +
'<span><i class="fa fa-arrow-up" aria-hidden="true"></i> ' +
'<span><i class="fas fa-arrow-up" aria-hidden="true"></i> ' +
(moonRise ? formatTime(this.config, moonRise) : "...") +
"</span>" +
'<span><i class="fa fa-arrow-down" aria-hidden="true"></i> ' +
'<span><i class="fas fa-arrow-down" aria-hidden="true"></i> ' +
(moonSet ? formatTime(this.config, moonSet) : "...") +
"</span>";
digitalWrapper.appendChild(moonWrapper);

View File

@@ -1,6 +1,6 @@
# Module: Compliments
The `compliments` module is one of the default modules of the MagicMirror.
The `compliments` module is one of the default modules of the MagicMirror².
This module displays a random compliment.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/compliments.html).

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Module: Compliments
*
* By Michael Teeuw https://michaelteeuw.nl

View File

@@ -1,8 +0,0 @@
# Module: Current Weather
> :warning: **This module is deprecated in favor of the [weather](https://docs.magicmirror.builders/modules/weather.html) module.**
The `currentweather` module is one of the default modules of the MagicMirror.
This module displays the current weather, including the windspeed, the sunset or sunrise time, the temperature and an icon to display the current conditions.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/currentweather.html).

View File

@@ -1,15 +0,0 @@
.currentweather .weathericon,
.currentweather .fa-home {
font-size: 75%;
line-height: 65px;
display: inline-block;
transform: translate(0, -3px);
}
.currentweather .humidityIcon {
padding-right: 4px;
}
.currentweather .humidity-padding {
padding-bottom: 6px;
}

View File

@@ -1,600 +0,0 @@
/* eslint-disable */
/* Magic Mirror
* Module: CurrentWeather
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*
* This module is deprecated. Any additional feature will no longer be merged.
*/
Module.register("currentweather", {
// Default module config.
defaults: {
location: false,
locationID: false,
appid: "",
units: config.units,
updateInterval: 10 * 60 * 1000, // every 10 minutes
animationSpeed: 1000,
timeFormat: config.timeFormat,
showPeriod: true,
showPeriodUpper: false,
showWindDirection: true,
showWindDirectionAsArrow: false,
useBeaufort: true,
useKMPHwind: false,
lang: config.language,
decimalSymbol: ".",
showHumidity: false,
showSun: true,
degreeLabel: false,
showIndoorTemperature: false,
showIndoorHumidity: false,
showFeelsLike: true,
initialLoadDelay: 0, // 0 seconds delay
retryDelay: 2500,
apiVersion: "2.5",
apiBase: "https://api.openweathermap.org/data/",
weatherEndpoint: "weather",
appendLocationNameToHeader: true,
useLocationAsHeader: false,
calendarClass: "calendar",
tableClass: "large",
onlyTemp: false,
hideTemp: false,
roundTemp: false,
iconTable: {
"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"
}
},
// create a variable for the first upcoming calendar event. Used if no location is specified.
firstEvent: false,
// create a variable to hold the location name based on the API result.
fetchedLocationName: "",
// Define required scripts.
getScripts: function () {
return ["moment.js"];
},
// Define required scripts.
getStyles: function () {
return ["weather-icons.css", "currentweather.css"];
},
// Define required translations.
getTranslations: function () {
// The translations for the default modules are defined in the core translation files.
// Therefor we can just return false. Otherwise we should have returned a dictionary.
// If you're trying to build your own module including translations, check out the documentation.
return false;
},
// Define start sequence.
start: function () {
Log.info("Starting module: " + this.name);
// Set locale.
moment.locale(config.language);
this.windSpeed = null;
this.windDirection = null;
this.windDeg = null;
this.sunriseSunsetTime = null;
this.sunriseSunsetIcon = null;
this.temperature = null;
this.indoorTemperature = null;
this.indoorHumidity = null;
this.weatherType = null;
this.feelsLike = null;
this.loaded = false;
this.scheduleUpdate(this.config.initialLoadDelay);
},
// add extra information of current weather
// windDirection, humidity, sunrise and sunset
addExtraInfoWeather: function (wrapper) {
var small = document.createElement("div");
small.className = "normal medium";
var windIcon = document.createElement("span");
windIcon.className = "wi wi-strong-wind dimmed";
small.appendChild(windIcon);
var windSpeed = document.createElement("span");
windSpeed.innerHTML = " " + this.windSpeed;
small.appendChild(windSpeed);
if (this.config.showWindDirection) {
var windDirection = document.createElement("sup");
if (this.config.showWindDirectionAsArrow) {
if (this.windDeg !== null) {
windDirection.innerHTML = ' &nbsp;<i class="fa fa-long-arrow-down" style="transform:rotate(' + this.windDeg + 'deg);"></i>&nbsp;';
}
} else {
windDirection.innerHTML = " " + this.translate(this.windDirection);
}
small.appendChild(windDirection);
}
var spacer = document.createElement("span");
spacer.innerHTML = "&nbsp;";
small.appendChild(spacer);
if (this.config.showHumidity) {
var humidity = document.createElement("span");
humidity.innerHTML = this.humidity;
var supspacer = document.createElement("sup");
supspacer.innerHTML = "&nbsp;";
var humidityIcon = document.createElement("sup");
humidityIcon.className = "wi wi-humidity humidityIcon";
humidityIcon.innerHTML = "&nbsp;";
small.appendChild(humidity);
small.appendChild(supspacer);
small.appendChild(humidityIcon);
}
if (this.config.showSun) {
var sunriseSunsetIcon = document.createElement("span");
sunriseSunsetIcon.className = "wi dimmed " + this.sunriseSunsetIcon;
small.appendChild(sunriseSunsetIcon);
var sunriseSunsetTime = document.createElement("span");
sunriseSunsetTime.innerHTML = " " + this.sunriseSunsetTime;
small.appendChild(sunriseSunsetTime);
}
wrapper.appendChild(small);
},
// Override dom generator.
getDom: function () {
var wrapper = document.createElement("div");
wrapper.className = this.config.tableClass;
if (this.config.appid === "") {
wrapper.innerHTML = "Please set the correct openweather <i>appid</i> in the config for module: " + this.name + ".";
wrapper.className = "dimmed light small";
return wrapper;
}
if (!this.loaded) {
wrapper.innerHTML = this.translate("LOADING");
wrapper.className = "dimmed light small";
return wrapper;
}
if (this.config.onlyTemp === false) {
this.addExtraInfoWeather(wrapper);
}
var large = document.createElement("div");
large.className = "light";
var degreeLabel = "";
if (this.config.units === "metric" || this.config.units === "imperial") {
degreeLabel += "°";
}
if (this.config.degreeLabel) {
switch (this.config.units) {
case "metric":
degreeLabel += "C";
break;
case "imperial":
degreeLabel += "F";
break;
case "default":
degreeLabel += "K";
break;
}
}
if (this.config.decimalSymbol === "") {
this.config.decimalSymbol = ".";
}
if (this.config.hideTemp === false) {
var weatherIcon = document.createElement("span");
weatherIcon.className = "wi weathericon wi-" + this.weatherType;
large.appendChild(weatherIcon);
var temperature = document.createElement("span");
temperature.className = "bright";
temperature.innerHTML = " " + this.temperature.replace(".", this.config.decimalSymbol) + degreeLabel;
large.appendChild(temperature);
}
if (this.config.showIndoorTemperature && this.indoorTemperature) {
var indoorIcon = document.createElement("span");
indoorIcon.className = "fa fa-home";
large.appendChild(indoorIcon);
var indoorTemperatureElem = document.createElement("span");
indoorTemperatureElem.className = "bright";
indoorTemperatureElem.innerHTML = " " + this.indoorTemperature.replace(".", this.config.decimalSymbol) + degreeLabel;
large.appendChild(indoorTemperatureElem);
}
if (this.config.showIndoorHumidity && this.indoorHumidity) {
var indoorHumidityIcon = document.createElement("span");
indoorHumidityIcon.className = "fa fa-tint";
large.appendChild(indoorHumidityIcon);
var indoorHumidityElem = document.createElement("span");
indoorHumidityElem.className = "bright";
indoorHumidityElem.innerHTML = " " + this.indoorHumidity + "%";
large.appendChild(indoorHumidityElem);
}
wrapper.appendChild(large);
if (this.config.showFeelsLike && this.config.onlyTemp === false) {
var small = document.createElement("div");
small.className = "normal medium";
var feelsLike = document.createElement("span");
feelsLike.className = "dimmed";
feelsLike.innerHTML = this.translate("FEELS", {
DEGREE: this.feelsLike + degreeLabel
});
small.appendChild(feelsLike);
wrapper.appendChild(small);
}
return wrapper;
},
// Override getHeader method.
getHeader: function () {
if (this.config.useLocationAsHeader && this.config.location !== false) {
return this.config.location;
}
if (this.config.appendLocationNameToHeader) {
if (this.data.header) return this.data.header + " " + this.fetchedLocationName;
else return this.fetchedLocationName;
}
return this.data.header ? this.data.header : "";
},
// Override notification handler.
notificationReceived: function (notification, payload, sender) {
if (notification === "DOM_OBJECTS_CREATED") {
if (this.config.appendLocationNameToHeader) {
this.hide(0, { lockString: this.identifier });
}
}
if (notification === "CALENDAR_EVENTS") {
var senderClasses = sender.data.classes.toLowerCase().split(" ");
if (senderClasses.indexOf(this.config.calendarClass.toLowerCase()) !== -1) {
this.firstEvent = false;
for (var e in payload) {
var event = payload[e];
if (event.location || event.geo) {
this.firstEvent = event;
//Log.log("First upcoming event with location: ", event);
break;
}
}
}
}
if (notification === "INDOOR_TEMPERATURE") {
this.indoorTemperature = this.roundValue(payload);
this.updateDom(this.config.animationSpeed);
}
if (notification === "INDOOR_HUMIDITY") {
this.indoorHumidity = this.roundValue(payload);
this.updateDom(this.config.animationSpeed);
}
},
/* updateWeather(compliments)
* Requests new data from openweather.org.
* Calls processWeather on succesfull response.
*/
updateWeather: function () {
if (this.config.appid === "") {
Log.error("CurrentWeather: APPID not set!");
return;
}
var url = this.config.apiBase + this.config.apiVersion + "/" + this.config.weatherEndpoint + this.getParams();
var self = this;
var retry = true;
var weatherRequest = new XMLHttpRequest();
weatherRequest.open("GET", url, true);
weatherRequest.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
self.processWeather(JSON.parse(this.response));
} else if (this.status === 401) {
self.updateDom(self.config.animationSpeed);
Log.error(self.name + ": Incorrect APPID.");
retry = true;
} else {
Log.error(self.name + ": Could not load weather.");
}
if (retry) {
self.scheduleUpdate(self.loaded ? -1 : self.config.retryDelay);
}
}
};
weatherRequest.send();
},
/* getParams(compliments)
* Generates an url with api parameters based on the config.
*
* return String - URL params.
*/
getParams: function () {
var params = "?";
if (this.config.locationID) {
params += "id=" + this.config.locationID;
} else if (this.config.location) {
params += "q=" + this.config.location;
} else if (this.firstEvent && this.firstEvent.geo) {
params += "lat=" + this.firstEvent.geo.lat + "&lon=" + this.firstEvent.geo.lon;
} else if (this.firstEvent && this.firstEvent.location) {
params += "q=" + this.firstEvent.location;
} else {
this.hide(this.config.animationSpeed, { lockString: this.identifier });
return;
}
params += "&units=" + this.config.units;
params += "&lang=" + this.config.lang;
params += "&APPID=" + this.config.appid;
return params;
},
/* processWeather(data)
* Uses the received data to set the various values.
*
* argument data object - Weather information received form openweather.org.
*/
processWeather: function (data) {
if (!data || !data.main || typeof data.main.temp === "undefined") {
// Did not receive usable new data.
// Maybe this needs a better check?
return;
}
this.humidity = parseFloat(data.main.humidity);
this.temperature = this.roundValue(data.main.temp);
this.fetchedLocationName = data.name;
this.feelsLike = 0;
if (this.config.useBeaufort) {
this.windSpeed = this.ms2Beaufort(this.roundValue(data.wind.speed));
} else if (this.config.useKMPHwind) {
this.windSpeed = parseFloat((data.wind.speed * 60 * 60) / 1000).toFixed(0);
} else {
this.windSpeed = parseFloat(data.wind.speed).toFixed(0);
}
// ONLY WORKS IF TEMP IN C //
var windInMph = parseFloat(data.wind.speed * 2.23694);
var tempInF = 0;
switch (this.config.units) {
case "metric":
tempInF = 1.8 * this.temperature + 32;
break;
case "imperial":
tempInF = this.temperature;
break;
case "default":
tempInF = 1.8 * (this.temperature - 273.15) + 32;
break;
}
if (windInMph > 3 && tempInF < 50) {
// windchill
var windChillInF = Math.round(35.74 + 0.6215 * tempInF - 35.75 * Math.pow(windInMph, 0.16) + 0.4275 * tempInF * Math.pow(windInMph, 0.16));
var windChillInC = (windChillInF - 32) * (5 / 9);
// this.feelsLike = windChillInC.toFixed(0);
switch (this.config.units) {
case "metric":
this.feelsLike = windChillInC.toFixed(0);
break;
case "imperial":
this.feelsLike = windChillInF.toFixed(0);
break;
case "default":
this.feelsLike = (windChillInC + 273.15).toFixed(0);
break;
}
} else if (tempInF > 80 && this.humidity > 40) {
// heat index
var Hindex =
-42.379 +
2.04901523 * tempInF +
10.14333127 * this.humidity -
0.22475541 * tempInF * this.humidity -
6.83783 * Math.pow(10, -3) * tempInF * tempInF -
5.481717 * Math.pow(10, -2) * this.humidity * this.humidity +
1.22874 * Math.pow(10, -3) * tempInF * tempInF * this.humidity +
8.5282 * Math.pow(10, -4) * tempInF * this.humidity * this.humidity -
1.99 * Math.pow(10, -6) * tempInF * tempInF * this.humidity * this.humidity;
switch (this.config.units) {
case "metric":
this.feelsLike = parseFloat((Hindex - 32) / 1.8).toFixed(0);
break;
case "imperial":
this.feelsLike = Hindex.toFixed(0);
break;
case "default":
var tc = parseFloat((Hindex - 32) / 1.8) + 273.15;
this.feelsLike = tc.toFixed(0);
break;
}
} else {
this.feelsLike = parseFloat(this.temperature).toFixed(0);
}
this.windDirection = this.deg2Cardinal(data.wind.deg);
this.windDeg = data.wind.deg;
this.weatherType = this.config.iconTable[data.weather[0].icon];
var now = new Date();
var sunrise = new Date(data.sys.sunrise * 1000);
var sunset = new Date(data.sys.sunset * 1000);
// The moment().format('h') method has a bug on the Raspberry Pi.
// So we need to generate the timestring manually.
// See issue: https://github.com/MichMich/MagicMirror/issues/181
var sunriseSunsetDateObject = sunrise < now && sunset > now ? sunset : sunrise;
var timeString = moment(sunriseSunsetDateObject).format("HH:mm");
if (this.config.timeFormat !== 24) {
//var hours = sunriseSunsetDateObject.getHours() % 12 || 12;
if (this.config.showPeriod) {
if (this.config.showPeriodUpper) {
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm A');
timeString = moment(sunriseSunsetDateObject).format("h:mm A");
} else {
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm a');
timeString = moment(sunriseSunsetDateObject).format("h:mm a");
}
} else {
//timeString = hours + moment(sunriseSunsetDateObject).format(':mm');
timeString = moment(sunriseSunsetDateObject).format("h:mm");
}
}
this.sunriseSunsetTime = timeString;
this.sunriseSunsetIcon = sunrise < now && sunset > now ? "wi-sunset" : "wi-sunrise";
this.show(this.config.animationSpeed, { lockString: this.identifier });
this.loaded = true;
this.updateDom(this.config.animationSpeed);
this.sendNotification("CURRENTWEATHER_DATA", { data: data });
this.sendNotification("CURRENTWEATHER_TYPE", { type: this.config.iconTable[data.weather[0].icon].replace("-", "_") });
},
/* scheduleUpdate()
* Schedule next update.
*
* argument delay number - Milliseconds before next update. If empty, this.config.updateInterval is used.
*/
scheduleUpdate: function (delay) {
var nextLoad = this.config.updateInterval;
if (typeof delay !== "undefined" && delay >= 0) {
nextLoad = delay;
}
var self = this;
setTimeout(function () {
self.updateWeather();
}, nextLoad);
},
/* ms2Beaufort(ms)
* Converts m2 to beaufort (windspeed).
*
* see:
* https://www.spc.noaa.gov/faq/tornado/beaufort.html
* https://en.wikipedia.org/wiki/Beaufort_scale#Modern_scale
*
* argument ms number - Windspeed in m/s.
*
* return number - Windspeed in beaufort.
*/
ms2Beaufort: function (ms) {
var kmh = (ms * 60 * 60) / 1000;
var speeds = [1, 5, 11, 19, 28, 38, 49, 61, 74, 88, 102, 117, 1000];
for (var beaufort in speeds) {
var speed = speeds[beaufort];
if (speed > kmh) {
return beaufort;
}
}
return 12;
},
deg2Cardinal: function (deg) {
if (deg > 11.25 && deg <= 33.75) {
return "NNE";
} else if (deg > 33.75 && deg <= 56.25) {
return "NE";
} else if (deg > 56.25 && deg <= 78.75) {
return "ENE";
} else if (deg > 78.75 && deg <= 101.25) {
return "E";
} else if (deg > 101.25 && deg <= 123.75) {
return "ESE";
} else if (deg > 123.75 && deg <= 146.25) {
return "SE";
} else if (deg > 146.25 && deg <= 168.75) {
return "SSE";
} else if (deg > 168.75 && deg <= 191.25) {
return "S";
} else if (deg > 191.25 && deg <= 213.75) {
return "SSW";
} else if (deg > 213.75 && deg <= 236.25) {
return "SW";
} else if (deg > 236.25 && deg <= 258.75) {
return "WSW";
} else if (deg > 258.75 && deg <= 281.25) {
return "W";
} else if (deg > 281.25 && deg <= 303.75) {
return "WNW";
} else if (deg > 303.75 && deg <= 326.25) {
return "NW";
} else if (deg > 326.25 && deg <= 348.75) {
return "NNW";
} else {
return "N";
}
},
/* function(temperature)
* Rounds a temperature to 1 decimal or integer (depending on config.roundTemp).
*
* argument temperature number - Temperature.
*
* return string - Rounded Temperature.
*/
roundValue: function (temperature) {
var decimals = this.config.roundTemp ? 0 : 1;
var roundValue = parseFloat(temperature).toFixed(decimals);
return roundValue === "-0" ? 0 : roundValue;
}
});

View File

@@ -1,9 +0,0 @@
const NodeHelper = require("node_helper");
const Log = require("logger");
module.exports = NodeHelper.create({
// Override start method.
start: function () {
Log.warn(`The module '${this.name}' is deprecated in favor of the 'weather'-module, please refer to the documentation for a migration path`);
}
});

View File

@@ -1,10 +1,10 @@
/* Magic Mirror Default Modules List
/* MagicMirror² Default Modules List
* Modules listed below can be loaded without the 'default/' prefix. Omitting the default folder name.
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
const defaultModules = ["alert", "calendar", "clock", "compliments", "currentweather", "helloworld", "newsfeed", "weatherforecast", "updatenotification", "weather"];
const defaultModules = ["alert", "calendar", "clock", "compliments", "helloworld", "newsfeed", "updatenotification", "weather"];
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {

View File

@@ -1,5 +1,5 @@
# Module: Hello World
The `helloworld` module is one of the default modules of the MagicMirror. It is a simple way to display a static text on the mirror.
The `helloworld` module is one of the default modules of the MagicMirror². It is a simple way to display a static text on the mirror.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/helloworld.html).

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Module: HelloWorld
*
* By Michael Teeuw https://michaelteeuw.nl

View File

@@ -1,6 +1,6 @@
# Module: News Feed
The `newsfeed` module is one of the default modules of the MagicMirror.
The `newsfeed` module is one of the default modules of the MagicMirror².
This module displays news headlines based on an RSS feed. Scrolling through news headlines happens time-based (`updateInterval`), but can also be controlled by sending news feed specific notifications to the module.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/newsfeed.html).

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Module: NewsFeed
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -20,6 +20,7 @@ Module.register("newsfeed", {
broadcastNewsFeeds: true,
broadcastNewsUpdates: true,
showDescription: false,
showTitleAsUrl: false,
wrapTitle: true,
wrapDescription: true,
truncDescription: true,
@@ -37,7 +38,8 @@ Module.register("newsfeed", {
endTags: [],
prohibitedWords: [],
scrollLength: 500,
logFeedWarnings: false
logFeedWarnings: false,
dangerouslyDisableAutoEscaping: false
},
// Define required scripts.
@@ -121,7 +123,7 @@ Module.register("newsfeed", {
}
if (this.newsItems.length === 0) {
return {
loaded: false
empty: true
};
}
if (this.activeItem >= this.newsItems.length) {
@@ -140,6 +142,7 @@ Module.register("newsfeed", {
sourceTitle: item.sourceTitle,
publishDate: moment(new Date(item.pubdate)).fromNow(),
title: item.title,
url: item.url,
description: item.description,
items: items
};
@@ -184,6 +187,7 @@ Module.register("newsfeed", {
const dateB = new Date(b.pubdate);
return dateB - dateA;
});
if (this.config.maxNewsItems > 0) {
newsItems = newsItems.slice(0, this.config.maxNewsItems);
}
@@ -219,7 +223,6 @@ Module.register("newsfeed", {
}
//Remove selected tags from the end of rss feed items (title or description)
if (this.config.removeEndTags) {
for (let endTag of this.config.endTags) {
if (item.title.slice(-endTag.length) === endTag) {
@@ -295,6 +298,9 @@ Module.register("newsfeed", {
this.sendNotification("NEWS_FEED", { items: this.newsItems });
}
// #2638 Clear timer if it already exists
if (this.timer) clearInterval(this.timer);
this.timer = setInterval(() => {
this.activeItem++;
this.updateDom(this.config.animationSpeed);

View File

@@ -1,3 +1,27 @@
{% macro escapeText(text, dangerouslyDisableAutoEscaping=false) %}
{% if dangerouslyDisableAutoEscaping %}
{{ text | safe}}
{% else %}
{{ text }}
{% endif %}
{% endmacro %}
{% macro escapeTitle(title, url, dangerouslyDisableAutoEscaping=false, showTitleAsUrl=false) %}
{% if dangerouslyDisableAutoEscaping %}
{% if showTitleAsUrl %}
<a href="{{ url }}" style="text-decoration:none;color:#ffffff" target="_blank">{{ title | safe }}</a>
{% else %}
{{ title | safe}}
{% endif %}
{% else %}
{% if showTitleAsUrl %}
<a href="{{ url }}" style="text-decoration:none;color:#ffffff" target="_blank">{{ title }}</a>
{% else %}
{{ title }}
{% endif %}
{% endif %}
{% endmacro %}
{% if loaded %}
{% if config.showAsList %}
<ul class="newsfeed-list">
@@ -14,14 +38,14 @@
</div>
{% endif %}
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
{{ item.title }}
{{ escapeTitle(item.title, item.url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}
</div>
{% if config.showDescription %}
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
{% if config.truncDescription %}
{{ item.description | truncate(config.lengthDescription) }}
{{ escapeText(item.description | truncate(config.lengthDescription), config.dangerouslyDisableAutoEscaping) }}
{% else %}
{{ item.description }}
{{ escapeText(item.description, config.dangerouslyDisableAutoEscaping) }}
{% endif %}
</div>
{% endif %}
@@ -33,7 +57,7 @@
{% if (config.showSourceTitle and sourceTitle) or config.showPublishDate %}
<div class="newsfeed-source light small dimmed">
{% if sourceTitle and config.showSourceTitle %}
{{ sourceTitle }}{% if config.showPublishDate %}, {% else %}: {% endif %}
{{ escapeText(sourceTitle, config.dangerouslyDisableAutoEscaping) }}{% if config.showPublishDate %}, {% else %}: {% endif %}
{% endif %}
{% if config.showPublishDate %}
{{ publishDate }}:
@@ -41,19 +65,23 @@
</div>
{% endif %}
<div class="newsfeed-title bright medium light{{ ' no-wrap' if not config.wrapTitle }}">
{{ title }}
{{ escapeTitle(title, url, config.dangerouslyDisableAutoEscaping, config.showTitleAsUrl) }}
</div>
{% if config.showDescription %}
<div class="newsfeed-desc small light{{ ' no-wrap' if not config.wrapDescription }}">
{% if config.truncDescription %}
{{ description | truncate(config.lengthDescription) }}
{{ escapeText(description | truncate(config.lengthDescription), config.dangerouslyDisableAutoEscaping) }}
{% else %}
{{ description }}
{{ escapeText(description, config.dangerouslyDisableAutoEscaping) }}
{% endif %}
</div>
{% endif %}
</div>
{% endif %}
{% elseif empty %}
<div class="small dimmed">
{{ "NEWSFEED_NO_ITEMS" | translate | safe }}
</div>
{% elseif error %}
<div class="small dimmed">
{{ "MODULE_CONFIG_ERROR" | translate({MODULE_NAME: "Newsfeed", ERROR: error}) | safe }}

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Node Helper: Newsfeed - NewsfeedFetcher
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -7,8 +7,9 @@
const Log = require("logger");
const FeedMe = require("feedme");
const NodeHelper = require("node_helper");
const fetch = require("node-fetch");
const fetch = require("fetch");
const iconv = require("iconv-lite");
const stream = require("stream");
/**
* Responsible for requesting an update on the set interval and broadcasting the data.
@@ -77,9 +78,22 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
scheduleTimer();
});
parser.on("ttl", (minutes) => {
try {
// 86400000 = 24 hours is mentioned in the docs as maximum value:
const ttlms = Math.min(minutes * 60 * 1000, 86400000);
if (ttlms > reloadInterval) {
reloadInterval = ttlms;
Log.info("Newsfeed-Fetcher: reloadInterval set to ttl=" + reloadInterval + " for url " + url);
}
} catch (error) {
Log.warn("Newsfeed-Fetcher: feed ttl is no valid integer=" + minutes + " for url " + url);
}
});
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
const headers = {
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)",
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version,
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
Pragma: "no-cache"
};
@@ -87,7 +101,13 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
fetch(url, { headers: headers })
.then(NodeHelper.checkFetchStatus)
.then((response) => {
response.body.pipe(iconv.decodeStream(encoding)).pipe(parser);
let nodeStream;
if (response.body instanceof stream.Readable) {
nodeStream = response.body;
} else {
nodeStream = stream.Readable.fromWeb(response.body);
}
nodeStream.pipe(iconv.decodeStream(encoding)).pipe(parser);
})
.catch((error) => {
fetchFailedCallback(this, error);

View File

@@ -1,4 +1,4 @@
/* Magic Mirror
/* MagicMirror²
* Node Helper: Newsfeed
*
* By Michael Teeuw https://michaelteeuw.nl

View File

@@ -1,6 +1,6 @@
# Module: Update Notification
The `updatenotification` module is one of the default modules of the MagicMirror.
This will display a message whenever a new version of the MagicMirror application is available.
The `updatenotification` module is one of the default modules of the MagicMirror².
This will display a message whenever a new version of the MagicMirror² application is available.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/updatenotification.html).

View File

@@ -4,48 +4,53 @@ const fs = require("fs");
const path = require("path");
const Log = require("logger");
class gitHelper {
const BASE_DIR = path.normalize(`${__dirname}/../../../`);
class GitHelper {
constructor() {
this.gitRepos = [];
this.baseDir = path.normalize(__dirname + "/../../../");
}
getRefRegex(branch) {
return new RegExp("s*([a-z,0-9]+[.][.][a-z,0-9]+) " + branch, "g");
return new RegExp(`s*([a-z,0-9]+[.][.][a-z,0-9]+) ${branch}`, "g");
}
async execShell(command) {
let res = { stdout: "", stderr: "" };
const { stdout, stderr } = await exec(command);
const { stdout = "", stderr = "" } = await exec(command);
res.stdout = stdout;
res.stderr = stderr;
return res;
return { stdout, stderr };
}
async isGitRepo(moduleFolder) {
let res = await this.execShell("cd " + moduleFolder + " && git remote -v");
if (res.stderr) {
Log.error("Failed to fetch git data for " + moduleFolder + ": " + res.stderr);
const { stderr } = await this.execShell(`cd ${moduleFolder} && git remote -v`);
if (stderr) {
Log.error(`Failed to fetch git data for ${moduleFolder}: ${stderr}`);
return false;
} else {
return true;
}
return true;
}
add(moduleName) {
let moduleFolder = this.baseDir;
async add(moduleName) {
let moduleFolder = BASE_DIR;
if (moduleName !== "default") {
moduleFolder = moduleFolder + "modules/" + moduleName;
moduleFolder = `${moduleFolder}modules/${moduleName}`;
}
try {
Log.info("Checking git for module: " + moduleName);
Log.info(`Checking git for module: ${moduleName}`);
// Throws error if file doesn't exist
fs.statSync(path.join(moduleFolder, ".git"));
// Fetch the git or throw error if no remotes
if (this.isGitRepo(moduleFolder)) {
const isGitRepo = await this.isGitRepo(moduleFolder);
if (isGitRepo) {
// Folder has .git and has at least one git remote, watch this folder
this.gitRepos.unshift({ module: moduleName, folder: moduleFolder });
this.gitRepos.push({ module: moduleName, folder: moduleFolder });
}
} catch (err) {
// Error when directory .git doesn't exist or doesn't have any remotes
@@ -56,38 +61,34 @@ class gitHelper {
async getStatusInfo(repo) {
let gitInfo = {
module: repo.module,
// commits behind:
behind: 0,
// branch name:
current: "",
// current hash:
hash: "",
// remote branch:
tracking: "",
behind: 0, // commits behind
current: "", // branch name
hash: "", // current hash
tracking: "", // remote branch
isBehindInStatus: false
};
let res;
if (repo.module === "default") {
// the hash is only needed for the mm repo
res = await this.execShell("cd " + repo.folder + " && git rev-parse HEAD");
if (res.stderr) {
Log.error("Failed to get current commit hash for " + repo.module + ": " + res.stderr);
const { stderr, stdout } = await this.execShell(`cd ${repo.folder} && git rev-parse HEAD`);
if (stderr) {
Log.error(`Failed to get current commit hash for ${repo.module}: ${stderr}`);
}
gitInfo.hash = res.stdout;
gitInfo.hash = stdout;
}
if (repo.res) {
// mocking
res = repo.res;
} else {
res = await this.execShell("cd " + repo.folder + " && git status -sb");
}
if (res.stderr) {
Log.error("Failed to get git status for " + repo.module + ": " + res.stderr);
const { stderr, stdout } = await this.execShell(`cd ${repo.folder} && git status -sb`);
if (stderr) {
Log.error(`Failed to get git status for ${repo.module}: ${stderr}`);
// exit without git status info
return;
}
// only the first line of stdout is evaluated
let status = res.stdout.split("\n")[0];
let status = stdout.split("\n")[0];
// examples for status:
// ## develop...origin/develop
// ## master...origin/master [behind 8]
@@ -101,72 +102,63 @@ class gitHelper {
// [ 'origin/develop' ]
// [ 'origin/master', '[behind', '8]' ]
gitInfo.tracking = status[0].trim();
if (status[2]) {
// git fetch was already called before so `git status -sb` delivers already the behind number
gitInfo.behind = parseInt(status[2].substring(0, status[2].length - 1));
gitInfo.isBehindInStatus = true;
}
return gitInfo;
}
async getRepoInfo(repo) {
let gitInfo;
if (repo.gitInfo) {
// mocking
gitInfo = repo.gitInfo;
} else {
gitInfo = await this.getStatusInfo(repo);
}
const gitInfo = await this.getStatusInfo(repo);
if (!gitInfo) {
return;
}
if (gitInfo.isBehindInStatus) {
return gitInfo;
}
let res;
if (repo.res) {
// mocking
res = repo.res;
} else {
res = await this.execShell("cd " + repo.folder + " && git fetch --dry-run");
}
const { stderr } = await this.execShell(`cd ${repo.folder} && git fetch --dry-run`);
// example output:
// From https://github.com/MichMich/MagicMirror
// e40ddd4..06389e3 develop -> origin/develop
// here the result is in stderr (this is a git default, don't ask why ...)
const matches = res.stderr.match(this.getRefRegex(gitInfo.current));
const matches = stderr.match(this.getRefRegex(gitInfo.current));
if (!matches || !matches[0]) {
// no refs found, nothing to do
return;
}
// get behind with refs
try {
res = await this.execShell("cd " + repo.folder + " && git rev-list --ancestry-path --count " + matches[0]);
gitInfo.behind = parseInt(res.stdout);
const { stdout } = await this.execShell(`cd ${repo.folder} && git rev-list --ancestry-path --count ${matches[0]}`);
gitInfo.behind = parseInt(stdout);
return gitInfo;
} catch (err) {
Log.error("Failed to get git revisions for " + repo.module + ": " + err);
Log.error(`Failed to get git revisions for ${repo.module}: ${err}`);
}
}
async getStatus() {
const gitResultList = [];
for (let repo of this.gitRepos) {
const gitInfo = await this.getStatusInfo(repo);
if (gitInfo) {
gitResultList.unshift(gitInfo);
}
}
return gitResultList;
}
async getRepos() {
const gitResultList = [];
for (let repo of this.gitRepos) {
const gitInfo = await this.getRepoInfo(repo);
if (gitInfo) {
gitResultList.unshift(gitInfo);
for (const repo of this.gitRepos) {
try {
const gitInfo = await this.getRepoInfo(repo);
if (gitInfo) {
gitResultList.push(gitInfo);
}
} catch (e) {
Log.error(`Failed to retrieve repo info for ${repo.module}: ${e}`);
}
}
@@ -174,4 +166,4 @@ class gitHelper {
}
}
module.exports.gitHelper = gitHelper;
module.exports = GitHelper;

View File

@@ -1,70 +1,66 @@
const GitHelper = require(__dirname + "/git_helper.js");
const defaultModules = require(__dirname + "/../defaultmodules.js");
const GitHelper = require("./git_helper");
const defaultModules = require("../defaultmodules");
const NodeHelper = require("node_helper");
const ONE_MINUTE = 60 * 1000;
module.exports = NodeHelper.create({
config: {},
updateTimer: null,
updateProcessStarted: false,
gitHelper: new GitHelper.gitHelper(),
gitHelper: new GitHelper(),
start: function () {},
configureModules: async function (modules) {
// Push MagicMirror itself , biggest chance it'll show up last in UI and isn't overwritten
// others will be added in front
// this method returns promises so we can't wait for every one to resolve before continuing
this.gitHelper.add("default");
for (let moduleName in modules) {
async configureModules(modules) {
for (const moduleName of modules) {
if (!this.ignoreUpdateChecking(moduleName)) {
this.gitHelper.add(moduleName);
await this.gitHelper.add(moduleName);
}
}
await this.gitHelper.add("default");
},
socketNotificationReceived: function (notification, payload) {
async socketNotificationReceived(notification, payload) {
if (notification === "CONFIG") {
this.config = payload;
} else if (notification === "MODULES") {
// if this is the 1st time thru the update check process
if (!this.updateProcessStarted) {
this.updateProcessStarted = true;
this.configureModules(payload).then(() => this.performFetch());
await this.configureModules(payload);
await this.performFetch();
}
}
},
performFetch: async function () {
for (let gitInfo of await this.gitHelper.getRepos()) {
this.sendSocketNotification("STATUS", gitInfo);
async performFetch() {
const repos = await this.gitHelper.getRepos();
for (const repo of repos) {
this.sendSocketNotification("STATUS", repo);
}
this.scheduleNextFetch(this.config.updateInterval);
},
scheduleNextFetch: function (delay) {
if (delay < 60 * 1000) {
delay = 60 * 1000;
}
let self = this;
scheduleNextFetch(delay) {
clearTimeout(this.updateTimer);
this.updateTimer = setTimeout(function () {
self.performFetch();
}, delay);
this.updateTimer = setTimeout(() => {
this.performFetch();
}, Math.max(delay, ONE_MINUTE));
},
ignoreUpdateChecking: function (moduleName) {
ignoreUpdateChecking(moduleName) {
// Should not check for updates for default modules
if (defaultModules.indexOf(moduleName) >= 0) {
if (defaultModules.includes(moduleName)) {
return true;
}
// Should not check for updates for ignored modules
if (this.config.ignoreModules.indexOf(moduleName) >= 0) {
if (this.config.ignoreModules.includes(moduleName)) {
return true;
}

View File

@@ -0,0 +1,3 @@
.module.updatenotification a.difflink {
text-decoration: none;
}

View File

@@ -1,46 +1,63 @@
/* Magic Mirror
/* MagicMirror²
* Module: UpdateNotification
*
* By Michael Teeuw https://michaelteeuw.nl
* MIT Licensed.
*/
Module.register("updatenotification", {
// Define module defaults
defaults: {
updateInterval: 10 * 60 * 1000, // every 10 minutes
refreshInterval: 24 * 60 * 60 * 1000, // one day
ignoreModules: [],
timeout: 5000
ignoreModules: []
},
suspended: false,
moduleList: {},
// Override start method.
start: function () {
Log.info("Starting module: " + this.name);
start() {
Log.info(`Starting module: ${this.name}`);
this.addFilters();
setInterval(() => {
this.moduleList = {};
this.updateDom(2);
}, this.config.refreshInterval);
},
notificationReceived: function (notification, payload, sender) {
suspend() {
this.suspended = true;
},
resume() {
this.suspended = false;
this.updateDom(2);
},
notificationReceived(notification) {
if (notification === "DOM_OBJECTS_CREATED") {
this.sendSocketNotification("CONFIG", this.config);
this.sendSocketNotification("MODULES", Module.definitions);
//this.hide(0, { lockString: this.identifier });
this.sendSocketNotification("MODULES", Object.keys(Module.definitions));
}
},
// Override socket notification handler.
socketNotificationReceived: function (notification, payload) {
socketNotificationReceived(notification, payload) {
if (notification === "STATUS") {
this.updateUI(payload);
}
},
updateUI: function (payload) {
getStyles() {
return [`${this.name}.css`];
},
getTemplate() {
return `${this.name}.njk`;
},
getTemplateData() {
return { moduleList: this.moduleList, suspended: this.suspended };
},
updateUI(payload) {
if (payload && payload.behind > 0) {
// if we haven't seen info for this module
if (this.moduleList[payload.module] === undefined) {
@@ -48,7 +65,6 @@ Module.register("updatenotification", {
this.moduleList[payload.module] = payload;
this.updateDom(2);
}
//self.show(1000, { lockString: self.identifier });
} else if (payload && payload.behind === 0) {
// if the module WAS in the list, but shouldn't be
if (this.moduleList[payload.module] !== undefined) {
@@ -59,62 +75,15 @@ Module.register("updatenotification", {
}
},
diffLink: function (module, text) {
const localRef = module.hash;
const remoteRef = module.tracking.replace(/.*\//, "");
return '<a href="https://github.com/MichMich/MagicMirror/compare/' + localRef + "..." + remoteRef + '" ' + 'class="xsmall dimmed" ' + 'style="text-decoration: none;" ' + 'target="_blank" >' + text + "</a>";
},
// Override dom generator.
getDom: function () {
const wrapper = document.createElement("div");
if (this.suspended === false) {
// process the hash of module info found
for (const key of Object.keys(this.moduleList)) {
let m = this.moduleList[key];
const message = document.createElement("div");
message.className = "small bright";
const icon = document.createElement("i");
icon.className = "fa fa-exclamation-circle";
icon.innerHTML = "&nbsp;";
message.appendChild(icon);
const updateInfoKeyName = m.behind === 1 ? "UPDATE_INFO_SINGLE" : "UPDATE_INFO_MULTIPLE";
let subtextHtml = this.translate(updateInfoKeyName, {
COMMIT_COUNT: m.behind,
BRANCH_NAME: m.current
});
const text = document.createElement("span");
if (m.module === "default") {
text.innerHTML = this.translate("UPDATE_NOTIFICATION");
subtextHtml = this.diffLink(m, subtextHtml);
} else {
text.innerHTML = this.translate("UPDATE_NOTIFICATION_MODULE", {
MODULE_NAME: m.module
});
}
message.appendChild(text);
wrapper.appendChild(message);
const subtext = document.createElement("div");
subtext.innerHTML = subtextHtml;
subtext.className = "xsmall dimmed";
wrapper.appendChild(subtext);
addFilters() {
this.nunjucksEnvironment().addFilter("diffLink", (text, status) => {
if (status.module !== "default") {
return text;
}
}
return wrapper;
},
suspend: function () {
this.suspended = true;
},
resume: function () {
this.suspended = false;
this.updateDom(2);
const localRef = status.hash;
const remoteRef = status.tracking.replace(/.*\//, "");
return `<a href="https://github.com/MichMich/MagicMirror/compare/${localRef}...${remoteRef}" class="xsmall dimmed difflink" target="_blank">${text}</a>`;
});
}
});

View File

@@ -0,0 +1,15 @@
{% if not suspended %}
{% for name, status in moduleList %}
<div class="small bright">
<i class="fas fa-exclamation-circle"></i>
<span>
{% set mainTextLabel = "UPDATE_NOTIFICATION" if name === "default" else "UPDATE_NOTIFICATION_MODULE" %}
{{ mainTextLabel | translate({MODULE_NAME: name}) }}
</span>
</div>
<div class="xsmall dimmed">
{% set subTextLabel = "UPDATE_INFO_SINGLE" if status.behind === 1 else "UPDATE_INFO_MULTIPLE" %}
{{ subTextLabel | translate({COMMIT_COUNT: status.behind, BRANCH_NAME: status.current}) | diffLink(status) | safe }}
</div>
{% endfor %}
{% endif %}

2
modules/default/weather/README.md Executable file → Normal file
View File

@@ -1,5 +1,5 @@
# Weather Module
This module aims to be the replacement for the current `currentweather` and `weatherforcast` modules. The module will be configurable to be used as a current weather view, or to show the forecast. This way the module can be used twice to fulfill both purposes.
This module will be configurable to be used as a current weather view, or to show the forecast. This way the module can be used twice to fulfill both purposes.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/weather.html).

6
modules/default/weather/current.njk Executable file → Normal file
View File

@@ -15,7 +15,7 @@
{% if config.showWindDirection %}
<sup>
{% if config.showWindDirectionAsArrow %}
<i class="fa fa-long-arrow-up" style="transform:rotate({{ current.windDirection }}deg);"></i>
<i class="fas fa-long-arrow-alt-up" style="transform:rotate({{ current.windDirection }}deg);"></i>
{% else %}
{{ current.cardinalWindDirection() | translate }}
{% endif %}
@@ -47,7 +47,7 @@
<div class="normal light indoor">
{% if config.showIndoorTemperature and indoor.temperature %}
<div>
<span class="fa fa-home"></span>
<span class="fas fa-home"></span>
<span class="bright">
{{ indoor.temperature | roundValue | unit("temperature") | decimalSymbol }}
</span>
@@ -55,7 +55,7 @@
{% endif %}
{% if config.showIndoorHumidity and indoor.humidity %}
<div>
<span class="fa fa-tint"></span>
<span class="fas fa-tint"></span>
<span class="bright">
{{ indoor.humidity | roundValue | unit("humidity") | decimalSymbol }}
</span>

View File

@@ -8,9 +8,9 @@
{% set forecast = forecast.slice(0, numSteps) %}
{% for f in forecast %}
<tr {% if config.colored %}class="colored"{% endif %} {% if config.fade %}style="opacity: {{ currentStep | opacity(numSteps) }};"{% endif %}>
{% if (currentStep == 0) and config.ignoreToday == false %}
{% if (currentStep == 0) and config.ignoreToday == false and config.absoluteDates == false %}
<td class="day">{{ "TODAY" | translate }}</td>
{% elif (currentStep == 1) and config.ignoreToday == false %}
{% elif (currentStep == 1) and config.ignoreToday == false and config.absoluteDates == false %}
<td class="day">{{ "TOMORROW" | translate }}</td>
{% else %}
<td class="day">{{ f.date.format('ddd') }}</td>

0
modules/default/weather/providers/README.md Executable file → Normal file
View File

5
modules/default/weather/providers/darksky.js Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
* Provider: Dark Sky
*
@@ -18,7 +18,8 @@ WeatherProvider.register("darksky", {
// Set the default config properties that is specific to this provider
defaults: {
apiBase: "https://cors-anywhere.herokuapp.com/https://api.darksky.net",
useCorsProxy: true,
apiBase: "https://api.darksky.net",
weatherEndpoint: "/forecast",
apiKey: "",
lat: 0,

View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
* Provider: Environment Canada (EC)
*
@@ -40,6 +40,7 @@ WeatherProvider.register("envcanada", {
// Set the default config properties that is specific to this provider
defaults: {
useCorsProxy: true,
siteCode: "s1234567",
provCode: "ON"
},
@@ -73,7 +74,7 @@ WeatherProvider.register("envcanada", {
// Override the fetchCurrentWeather method to query EC and construct a Current weather object
//
fetchCurrentWeather() {
this.fetchData(this.getUrl(), "GET")
this.fetchData(this.getUrl(), "GET", "xml")
.then((data) => {
if (!data) {
// Did not receive usable new data.
@@ -93,7 +94,7 @@ WeatherProvider.register("envcanada", {
// Override the fetchWeatherForecast method to query EC and construct Forecast weather objects
//
fetchWeatherForecast() {
this.fetchData(this.getUrl(), "GET")
this.fetchData(this.getUrl(), "GET", "xml")
.then((data) => {
if (!data) {
// Did not receive usable new data.
@@ -113,7 +114,7 @@ WeatherProvider.register("envcanada", {
// Override the fetchWeatherHourly method to query EC and construct Forecast weather objects
//
fetchWeatherHourly() {
this.fetchData(this.getUrl(), "GET")
this.fetchData(this.getUrl(), "GET", "xml")
.then((data) => {
if (!data) {
// Did not receive usable new data.
@@ -129,26 +130,6 @@ WeatherProvider.register("envcanada", {
.finally(() => this.updateAvailable());
},
//
// Override fetchData function to handle XML document (base function assumes JSON)
//
fetchData: function (url, method = "GET", data = null) {
return new Promise(function (resolve, reject) {
const request = new XMLHttpRequest();
request.open(method, url, true);
request.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
resolve(this.responseXML);
} else {
reject(request);
}
}
};
request.send();
});
},
//////////////////////////////////////////////////////////////////////////////////
//
// Environment Canada methods - not part of the standard Provider methods
@@ -160,11 +141,8 @@ WeatherProvider.register("envcanada", {
// URL defaults to the Englsih version simply because there is no language dependancy in the data
// being accessed. This is only pertinent when using the EC data elements that contain a textual forecast.
//
// Also note that access is supported through a proxy service (thingproxy.freeboard.io) to mitigate
// CORS errors when accessing EC
//
getUrl() {
return "https://thingproxy.freeboard.io/fetch/https://dd.weather.gc.ca/citypage_weather/xml/" + this.config.provCode + "/" + this.config.siteCode + "_e.xml";
return "https://dd.weather.gc.ca/citypage_weather/xml/" + this.config.provCode + "/" + this.config.siteCode + "_e.xml";
},
//

9
modules/default/weather/providers/openweathermap.js Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -127,11 +127,8 @@ WeatherProvider.register("openweathermap", {
currentWeather.humidity = currentWeatherData.main.humidity;
currentWeather.temperature = currentWeatherData.main.temp;
if (this.config.windUnits === "metric") {
currentWeather.windSpeed = this.config.useKmh ? currentWeatherData.wind.speed * 3.6 : currentWeatherData.wind.speed;
} else {
currentWeather.windSpeed = currentWeatherData.wind.speed;
}
currentWeather.feelsLikeTemp = currentWeatherData.main.feels_like;
currentWeather.windSpeed = currentWeatherData.wind.speed;
currentWeather.windDirection = currentWeatherData.wind.deg;
currentWeather.weatherType = this.convertWeatherType(currentWeatherData.weather[0].icon);
currentWeather.sunrise = moment(currentWeatherData.sys.sunrise, "X");

View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
* Provider: SMHI
*
@@ -17,19 +17,20 @@ WeatherProvider.register("smhi", {
defaults: {
lat: 0,
lon: 0,
precipitationValue: "pmedian"
precipitationValue: "pmedian",
location: false
},
/**
* Implements method in interface for fetching current weather
* Implements method in interface for fetching current weather.
*/
fetchCurrentWeather() {
this.fetchData(this.getURL())
.then((data) => {
let closest = this.getClosestToCurrentTime(data.timeSeries);
let coordinates = this.resolveCoordinates(data);
let weatherObject = this.convertWeatherDataToObject(closest, coordinates);
this.setFetchedLocation(`(${coordinates.lat},${coordinates.lon})`);
const closest = this.getClosestToCurrentTime(data.timeSeries);
const coordinates = this.resolveCoordinates(data);
const weatherObject = this.convertWeatherDataToObject(closest, coordinates);
this.setFetchedLocation(this.config.location || `(${coordinates.lat},${coordinates.lon})`);
this.setCurrentWeather(weatherObject);
})
.catch((error) => Log.error("Could not load data: " + error.message))
@@ -37,21 +38,35 @@ WeatherProvider.register("smhi", {
},
/**
* Implements method in interface for fetching a forecast.
* Handling hourly forecast would be easy as not grouping by day but it seems really specific for one weather provider for now.
* Implements method in interface for fetching a multi-day forecast.
*/
fetchWeatherForecast() {
this.fetchData(this.getURL())
.then((data) => {
let coordinates = this.resolveCoordinates(data);
let weatherObjects = this.convertWeatherDataGroupedByDay(data.timeSeries, coordinates);
this.setFetchedLocation(`(${coordinates.lat},${coordinates.lon})`);
const coordinates = this.resolveCoordinates(data);
const weatherObjects = this.convertWeatherDataGroupedBy(data.timeSeries, coordinates);
this.setFetchedLocation(this.config.location || `(${coordinates.lat},${coordinates.lon})`);
this.setWeatherForecast(weatherObjects);
})
.catch((error) => Log.error("Could not load data: " + error.message))
.finally(() => this.updateAvailable());
},
/**
* Implements method in interface for fetching hourly forecasts.
*/
fetchWeatherHourly() {
this.fetchData(this.getURL())
.then((data) => {
const coordinates = this.resolveCoordinates(data);
const weatherObjects = this.convertWeatherDataGroupedBy(data.timeSeries, coordinates, "hour");
this.setFetchedLocation(this.config.location || `(${coordinates.lat},${coordinates.lon})`);
this.setWeatherHourly(weatherObjects);
})
.catch((error) => Log.error("Could not load data: " + error.message))
.finally(() => this.updateAvailable());
},
/**
* Overrides method for setting config with checks for the precipitationValue being unset or invalid
*
@@ -94,6 +109,21 @@ WeatherProvider.register("smhi", {
return `https://opendata-download-metfcst.smhi.se/api/category/pmp3g/version/2/geotype/point/lon/${lon}/lat/${lat}/data.json`;
},
/**
* Calculates the apparent temperature based on known atmospheric data.
*
* @param {object} weatherData Weatherdata to use for the calculation
* @returns {number} The apparent temperature
*/
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.E * ((17.27 * Ta) / (237.7 + Ta));
return Ta + 0.33 * p - 0.7 * ws - 4;
},
/**
* Converts the returned data into a WeatherObject with required properties set for both current weather and forecast.
* The returned units is always in metric system.
@@ -114,6 +144,7 @@ WeatherProvider.register("smhi", {
currentWeather.windSpeed = this.paramValue(weatherData, "ws");
currentWeather.windDirection = this.paramValue(weatherData, "wd");
currentWeather.weatherType = this.convertWeatherType(this.paramValue(weatherData, "Wsymb2"), currentWeather.isDayTime());
currentWeather.feelsLikeTemp = this.calculateAT(weatherData);
// Determine the precipitation amount and category and update the
// weatherObject with it, the valuetype to use can be configured or uses
@@ -147,9 +178,10 @@ WeatherProvider.register("smhi", {
*
* @param {object[]} allWeatherData Array of weatherdata
* @param {object} coordinates Coordinates of the locations of the weather
* @param {string} groupBy The interval to use for grouping the data (day, hour)
* @returns {WeatherObject[]} Array of weatherobjects
*/
convertWeatherDataGroupedByDay(allWeatherData, coordinates) {
convertWeatherDataGroupedBy(allWeatherData, coordinates, groupBy = "day") {
let currentWeather;
let result = [];
@@ -157,10 +189,11 @@ WeatherProvider.register("smhi", {
let dayWeatherTypes = [];
for (const weatherObject of allWeatherObjects) {
//If its the first object or if a day change we need to reset the summary object
if (!currentWeather || !currentWeather.date.isSame(weatherObject.date, "day")) {
//If its the first object or if a day/hour change we need to reset the summary object
if (!currentWeather || !currentWeather.date.isSame(weatherObject.date, groupBy)) {
currentWeather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits);
dayWeatherTypes = [];
currentWeather.temperature = weatherObject.temperature;
currentWeather.date = weatherObject.date;
currentWeather.minTemperature = Infinity;
currentWeather.maxTemperature = -Infinity;
@@ -237,7 +270,7 @@ WeatherProvider.register("smhi", {
},
/**
* Map the icon value from SMHI to an icon that MagicMirror understands.
* Map the icon value from SMHI to an icon that MagicMirror² understands.
* Uses different icons depending if its daytime or nighttime.
* SMHI's description of what the numeric value means is the comment after the case.
*

2
modules/default/weather/providers/ukmetoffice.js Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
*
* By Malcolm Oakes https://github.com/maloakes

View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
*
* By Malcolm Oakes https://github.com/maloakes

View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
* Provider: Weatherbit
*
@@ -18,7 +18,6 @@ WeatherProvider.register("weatherbit", {
// Set the default config properties that is specific to this provider
defaults: {
apiBase: "https://api.weatherbit.io/v2.0",
weatherEndpoint: "/current",
apiKey: "",
lat: 0,
lon: 0
@@ -69,6 +68,31 @@ WeatherProvider.register("weatherbit", {
.finally(() => this.updateAvailable());
},
/**
* Overrides method for setting config to check if endpoint is correct for hourly
*
* @param {object} config The configuration object
*/
setConfig(config) {
this.config = config;
if (!this.config.weatherEndpoint) {
switch (this.config.type) {
case "hourly":
this.config.weatherEndpoint = "/forecast/hourly";
break;
case "daily":
case "forecast":
this.config.weatherEndpoint = "/forecast/daily";
break;
case "current":
this.config.weatherEndpoint = "/current";
break;
default:
Log.error("weatherEndpoint not configured and could not resolve it based on type");
}
}
},
// Create a URL from the config and base URL.
getUrl() {
const units = this.units[this.config.units] || "auto";

View File

@@ -0,0 +1,109 @@
/* global WeatherProvider, WeatherObject */
/* MagicMirror²
* Module: Weather
* Provider: Weatherflow
*
* By Tobias Dreyem https://github.com/10bias
* MIT Licensed
*
* This class is a provider for Weatherflow.
* Note that the Weatherflow API does not provide snowfall.
*/
WeatherProvider.register("weatherflow", {
// Set the name of the provider.
// Not strictly required, but helps for debugging
providerName: "WeatherFlow",
// Set the default config properties that is specific to this provider
defaults: {
apiBase: "https://swd.weatherflow.com/swd/rest/",
token: "",
stationid: ""
},
units: {
imperial: {
temp: "f",
wind: "mph",
pressure: "hpa",
precip: "in",
distance: "mi"
},
metric: {
temp: "c",
wind: "kph",
pressure: "mb",
precip: "mm",
distance: "km"
}
},
fetchCurrentWeather() {
this.fetchData(this.getUrl())
.then((data) => {
const currentWeather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits, this.config.useKmh);
currentWeather.date = moment();
currentWeather.humidity = data.current_conditions.relative_humidity;
currentWeather.temperature = data.current_conditions.air_temperature;
currentWeather.windSpeed = data.current_conditions.wind_avg;
currentWeather.windDirection = data.current_conditions.wind_direction;
currentWeather.weatherType = data.forecast.daily[0].icon;
currentWeather.sunrise = moment(data.forecast.daily[0].sunrise, "X");
currentWeather.sunset = moment(data.forecast.daily[0].sunset, "X");
this.setCurrentWeather(currentWeather);
})
.catch(function (request) {
Log.error("Could not load data ... ", request);
})
.finally(() => this.updateAvailable());
},
fetchWeatherForecast() {
this.fetchData(this.getUrl())
.then((data) => {
const days = [];
for (const forecast of data.forecast.daily) {
const weather = new WeatherObject(this.config.units, this.config.tempUnits, this.config.windUnits, this.config.useKmh);
weather.date = moment(forecast.day_start_local, "X");
weather.minTemperature = forecast.air_temp_low;
weather.maxTemperature = forecast.air_temp_high;
weather.weatherType = forecast.icon;
weather.snow = 0;
days.push(weather);
}
this.setWeatherForecast(days);
})
.catch(function (request) {
Log.error("Could not load data ... ", request);
})
.finally(() => this.updateAvailable());
},
// Create a URL from the config and base URL.
getUrl() {
return (
this.config.apiBase +
"better_forecast?station_id=" +
this.config.stationid +
"&units_temp=" +
this.units[this.config.units].temp +
"&units_wind=" +
this.units[this.config.units].wind +
"&units_pressure=" +
this.units[this.config.units].pressure +
"&units_precip=" +
this.units[this.config.units].precip +
"&units_distance=" +
this.units[this.config.units].distance +
"&token=" +
this.config.token
);
}
});

14
modules/default/weather/providers/weathergov.js Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/* global WeatherProvider, WeatherObject */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
* Provider: weather.gov
* https://weather-gov.github.io/api/general-faqs
@@ -40,7 +40,8 @@ WeatherProvider.register("weathergov", {
// Called to set the config, this config is the same as the weather module's config.
setConfig: function (config) {
this.config = config;
(this.config.apiBase = "https://api.weather.gov"), this.fetchWxGovURLs(this.config);
this.config.apiBase = "https://api.weather.gov";
this.fetchWxGovURLs(this.config);
},
// Called when the weather provider is about to start.
@@ -156,8 +157,13 @@ WeatherProvider.register("weathergov", {
currentWeather.rain = null;
currentWeather.snow = null;
currentWeather.precipitation = this.convertLength(currentWeatherData.precipitationLastHour.value);
currentWeather.feelsLikeTemp = this.convertTemp(currentWeatherData.heatIndex.value);
if (currentWeatherData.heatIndex.value !== null) {
currentWeather.feelsLikeTemp = this.convertTemp(currentWeatherData.heatIndex.value);
} else if (currentWeatherData.windChill.value !== null) {
currentWeather.feelsLikeTemp = this.convertTemp(currentWeatherData.windChill.value);
} else {
currentWeather.feelsLikeTemp = this.convertTemp(currentWeatherData.temperature.value);
}
// determine the sunrise/sunset times - not supplied in weather.gov data
currentWeather.updateSunTime(this.config.lat, this.config.lon);

View File

@@ -1,6 +1,6 @@
/* global WeatherProvider */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -43,7 +43,8 @@ Module.register("weather", {
onlyTemp: false,
showPrecipitationAmount: false,
colored: false,
showFeelsLike: true
showFeelsLike: true,
absoluteDates: false
},
// Module properties.
@@ -153,6 +154,15 @@ Module.register("weather", {
if (this.weatherProvider.currentWeather()) {
this.sendNotification("CURRENTWEATHER_TYPE", { type: this.weatherProvider.currentWeather().weatherType.replace("-", "_") });
}
const notificationPayload = {
currentWeather: this.weatherProvider?.currentWeatherObject?.simpleClone() ?? null,
forecastArray: this.weatherProvider?.weatherForecastArray?.map((ar) => ar.simpleClone()) ?? [],
hourlyArray: this.weatherProvider?.weatherHourlyArray?.map((ar) => ar.simpleClone()) ?? [],
locationName: this.weatherProvider?.fetchedLocationName,
providerName: this.weatherProvider.providerName
};
this.sendNotification("WEATHER_UPDATED", notificationPayload);
},
scheduleUpdate: function (delay = null) {

19
modules/default/weather/weatherobject.js Executable file → Normal file
View File

@@ -1,6 +1,6 @@
/* global SunCalc */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -146,6 +146,23 @@ class WeatherObject {
this.sunrise = moment(times.sunrise, "X");
this.sunset = moment(times.sunset, "X");
}
/**
* Clone to simple object to prevent mutating and deprecation of legacy library.
*
* Before being handed to other modules, mutable values must be cloned safely.
* Especially 'moment' object is not immutable, so original 'date', 'sunrise', 'sunset' could be corrupted or changed by other modules.
*
* @returns {object} plained object clone of original weatherObject
*/
simpleClone() {
const toFlat = ["date", "sunrise", "sunset"];
let clone = { ...this };
for (const prop of toFlat) {
clone[prop] = clone?.[prop]?.valueOf() ?? clone?.[prop];
}
return clone;
}
}
/*************** DO NOT EDIT THE LINE BELOW ***************/

View File

@@ -1,6 +1,6 @@
/* global Class */
/* Magic Mirror
/* MagicMirror²
* Module: Weather
*
* By Michael Teeuw https://michaelteeuw.nl
@@ -111,22 +111,45 @@ const WeatherProvider = Class.extend({
this.delegate.updateAvailable(this);
},
getCorsUrl: function () {
if (this.config.mockData || typeof this.config.useCorsProxy === "undefined" || !this.config.useCorsProxy) {
return "";
} else {
return location.protocol + "//" + location.host + "/cors?url=";
}
},
// A convenience function to make requests. It returns a promise.
fetchData: function (url, method = "GET", data = null) {
return new Promise(function (resolve, reject) {
const request = new XMLHttpRequest();
request.open(method, url, true);
request.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
resolve(JSON.parse(this.response));
} else {
reject(request);
}
fetchData: function (url, method = "GET", type = "json") {
url = this.getCorsUrl() + url;
const getData = function (mockData) {
return new Promise(function (resolve, reject) {
if (mockData) {
let data = mockData;
data = data.substring(1, data.length - 1);
resolve(JSON.parse(data));
} else {
const request = new XMLHttpRequest();
request.open(method, url, true);
request.onreadystatechange = function () {
if (this.readyState === 4) {
if (this.status === 200) {
if (type === "xml") {
resolve(this.responseXML);
} else {
resolve(JSON.parse(this.response));
}
} else {
reject(request);
}
}
};
request.send();
}
};
request.send();
});
});
};
return getData(this.config.mockData);
}
});

View File

@@ -1,8 +0,0 @@
# Module: Weather Forecast
> :warning: **This module is deprecated in favor of the [weather](https://docs.magicmirror.builders/modules/weather.html) module.**
The `weatherforecast` module is one of the default modules of the MagicMirror.
This module displays the weather forecast for the coming week, including an an icon to display the current conditions, the minimum temperature and the maximum temperature.
For configuration options, please check the [MagicMirror² documentation](https://docs.magicmirror.builders/modules/weatherforecast.html).

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