Compare commits

...

427 Commits

Author SHA1 Message Date
Michael Teeuw
1a2b4f8260 Merge pull request #811 from MichMich/develop
Release 2.1.1
2017-04-01 22:00:06 +02:00
Michael Teeuw
5436050df1 Prepare for release. 2017-04-01 21:49:52 +02:00
Michael Teeuw
d3f3946971 Merge pull request #810 from roramirez/vendor-fix-moment-timezone-script
Bugfix introduced into bb08fe8113
2017-04-01 21:49:03 +02:00
Rodrigo Ramírez Norambuena
597a7f7b40 Bugfix introduced into bb08fe8113
This is work on Pull Request #803 and help of @johanhammar and @fewieden
2017-04-01 15:53:20 -03:00
Michael Teeuw
02f549d1dd Merge pull request #809 from roramirez/readme-timezone
Add link more information timezone information for configuracion in clock module
2017-04-01 11:15:52 +02:00
Michael Teeuw
0c096bb090 Merge pull request #806 from johanhammar/newsfeed-documentation-updates
Updated documentation and fixed typos for the newsfeed module
2017-03-31 09:29:04 +02:00
Michael Teeuw
8bc6cd7fc9 Merge pull request #799 from roramirez/missing-entries-changelog-test
Add in Changelog missing tests added for 2.1.1 version
2017-03-31 09:27:03 +02:00
Michael Teeuw
65d9e5d1fc Merge pull request #800 from roramirez/test-set-MM_PORT
Test set mm port
2017-03-31 09:26:43 +02:00
Johan Hammar
47c356692f Fix a few more typos 2017-03-30 22:14:11 +02:00
Rodrigo Ramírez Norambuena
ef9157174c Fix broken next test:
Now after ran the test MM_PORT of test case for change of port the
enviroment variable is deleted.
2017-03-30 16:41:46 -03:00
Johan Hammar
7345807871 Updated documentation and fixed typos for the newsfeed module. Fixes GH-804 2017-03-30 21:15:51 +02:00
Rodrigo Ramírez Norambuena
19b9d3737e Merge branch 'develop' into test-set-MM_PORT 2017-03-30 16:12:08 -03:00
Michael Teeuw
db3be3d80a Merge pull request #801 from johanhammar/clock-week-section
Added a week section to the clock module
2017-03-30 20:32:53 +02:00
Michael Teeuw
60c7522f22 Merge pull request #802 from johanhammar/develop
Corrected minor typo
2017-03-30 20:32:36 +02:00
Michael Teeuw
60002793b0 Merge pull request #805 from zhyuri/develop
Updated the zh_cn translation.
2017-03-30 20:32:14 +02:00
Yuri
9e5a4189d7 Update zh_cn.json 2017-03-30 14:48:21 +08:00
Yuri
945cbdd3a7 Update zh_cn.json
Add Chinese support updated.
2017-03-30 14:47:16 +08:00
Johan Hammar
77c72d2bb3 Merge pull request #1 from roramirez/add-es
Add translations es for Week
2017-03-28 23:02:08 +02:00
Rodrigo Ramírez Norambuena
8404617090 Add translations es for Week 2017-03-28 17:57:34 -03:00
Johan Hammar
cc9a429689 Corrected minor typo 2017-03-28 22:44:47 +02:00
Johan Hammar
44f50eba5b Updated changelog with information about the new week section of the clock module 2017-03-28 22:30:48 +02:00
Johan Hammar
f4509e24c6 Added a week section to the clock module 2017-03-28 22:02:30 +02:00
Rodrigo Ramírez Norambuena
e17a40fdb2 Merge branch 'develop' into missing-entries-changelog-test 2017-03-28 13:19:26 -03:00
Michael Teeuw
e3456cb74f Merge pull request #788 from flo80/fullscreen
Support full screen
2017-03-28 13:31:58 +02:00
Michael Teeuw
e377552f12 Merge branch 'develop' into fullscreen 2017-03-28 12:55:10 +02:00
Michael Teeuw
9ab9e4894d Merge pull request #789 from 42SK/develop
Added option to ignore old items in the news feed module
2017-03-28 12:54:09 +02:00
Michael Teeuw
5782979203 Merge pull request #796 from roramirez/package-description
change description package.json
2017-03-28 12:53:25 +02:00
Michael Teeuw
a4bb279da8 Merge pull request #795 from roramirez/test-port-8090
Test change port configuration
2017-03-28 12:53:07 +02:00
Michael Teeuw
8df9549a42 Merge pull request #794 from roramirez/test-position-modules
Add test module position using helloworld
2017-03-28 12:52:57 +02:00
Michael Teeuw
de873c5f6f Merge pull request #793 from roramirez/format-CHANGELOG
Format changelog for 2.1.1
2017-03-28 12:51:44 +02:00
Michael Teeuw
3425e929e9 Merge pull request #790 from roramirez/404_request-test
Test env 404 not found request http://localhost:8080/nothing
2017-03-28 12:51:23 +02:00
Rodrigo Ramírez Norambuena
4b4c3ddb2f Add changelog test MM_PORT 2017-03-27 02:01:42 -03:00
Rodrigo Ramírez Norambuena
1ea50ea917 Merge branch 'develop' into test-set-MM_PORT 2017-03-28 13:16:56 -03:00
Rodrigo Ramírez Norambuena
9ad22d7405 Add link more information timezone information for configuracion in
clock module.
2017-03-26 16:13:54 -03:00
Flo
455819566b Update CHANGELOG.md 2017-03-24 23:13:08 +01:00
Flo
b39113f0ae Removed fullscreen toggle; is now own, configurable module 2017-03-24 23:10:05 +01:00
Flo
af0f1939a3 Fixed lint errors 2017-03-22 22:28:51 +01:00
Flo
becb9fc43e Updated CHANGELOG 2017-03-22 22:27:47 +01:00
Flo
8b9c274fdd Moved scripts to bottom in index.html 2017-03-22 22:27:19 +01:00
Flo
0701f3496b Merge branch 'fullscreen' of github.com:flo80/MagicMirror into fullscreen 2017-03-22 22:20:27 +01:00
Flo
09c03e8ca7 Support full screen mode on iOS and enable "click to toggle fullscreen" in standard browsers 2017-03-22 22:19:19 +01:00
Michael Teeuw
9285da6c12 Merge pull request #787 from roramirez/200_request-test
test env requst http://localhost:8080
2017-03-22 09:03:08 +01:00
Flo
6a0e16885d Support full screen mode on iOS and enable "click to toggle fullscreen" in standard browsers 2017-03-21 20:56:11 +01:00
42SK
f0db135b1d Added option to ignore old items in the news feed module
Outdated news items can be omitted via the ignoreOldItems and the ignoreOlderThan option.
2017-03-21 19:39:51 +01:00
Rodrigo Ramírez Norambuena
4fb86bd699 change description package.json 2017-03-19 16:54:36 -03:00
Michael Teeuw
c62082b924 Merge pull request #785 from roramirez/colors-error
Use color red for error when the configuration file is not found.
2017-03-18 21:50:18 +01:00
Michael Teeuw
e8f592c6e0 Merge pull request #784 from roramirez/validate_vendor_js_file
Fix eslintignore for vendor/vendor.js and fix the eslint validation
2017-03-18 21:49:46 +01:00
Michael Teeuw
61935942cf Merge pull request #783 from roramirez/fixspace-code-main
Remote extra space  main.js
2017-03-18 20:44:32 +01:00
Michael Teeuw
f1d8bb84b7 Merge pull request #782 from roramirez/fail-auth-calendar
Add test module calendar fail basic auth
2017-03-18 20:44:22 +01:00
Rodrigo Ramírez Norambuena
ae33de7e7c Add in Changelog missing tests added for 2.1.1 version 2017-03-18 09:42:36 -03:00
Rodrigo Ramírez Norambuena
b23e474648 Format changelog for 2.1.1 2017-03-18 09:36:50 -03:00
Michael Teeuw
611bc26685 Merge pull request #719 from roramirez/test-without-modules
Testing default modules
2017-03-18 11:43:06 +01:00
Michael Teeuw
0dc39166ac Merge pull request #775 from roramirez/npm-vendors
Npm for vendors
2017-03-18 11:42:38 +01:00
Michael Teeuw
8d970b7858 Merge pull request #781 from roramirez/test-ipWhitelist-none
Add test  ipWhistelist = []
2017-03-18 11:41:31 +01:00
Michael Teeuw
7033c4a182 Merge pull request #780 from roramirez/restore-code-merges
Restore code removed on Merges on 2017-03-17
2017-03-18 11:41:17 +01:00
Rodrigo Ramírez Norambuena
0d3c03d1e3 Restore code removed on Merges on 2017-03-17 2017-03-17 22:36:21 -03:00
Michael Teeuw
b4dfce4a44 Merge branch 'fewieden-calendar-multiple-icons' into develop 2017-03-17 15:37:40 +01:00
Michael Teeuw
91ca3939b3 Fix Merge Conflicts 2017-03-17 15:36:55 +01:00
Michael Teeuw
92db5d3a35 Merge pull request #770 from amcolash/excluded_events
Calendar module excluded events filter
2017-03-17 14:35:30 +01:00
Michael Teeuw
f252960aaf Merge branch 'develop' into excluded_events 2017-03-17 14:35:11 +01:00
Michael Teeuw
4aec39df7a Fix Merge Conflicts. 2017-03-17 14:32:01 +01:00
Michael Teeuw
15b19925f2 Fix Merge 2017-03-17 14:16:35 +01:00
Michael Teeuw
bfb376505b Merge pull request #759 from roramirez/readme-ipWhitelist
Add note to allow all IP addresses. ipWhitelist configuration directive.
2017-03-17 14:10:24 +01:00
Andrew McOlash
ec75ff5292 Merge branch 'develop' into excluded_events 2017-03-17 07:28:06 -05:00
Michael Teeuw
28eb0be4ad Merge pull request #769 from amcolash/single_line_news
Add in single line news items
2017-03-17 13:27:13 +01:00
Andrew McOlash
4d3b6b1486 Merge remote-tracking branch 'upstream/develop' into excluded_events 2017-03-17 07:25:42 -05:00
Andrew McOlash
d3fd9a188d Merge branch 'develop' into single_line_news 2017-03-17 07:18:13 -05:00
Andrew McOlash
41a15f90cb Merge remote-tracking branch 'upstream/develop' into single_line_news 2017-03-17 07:17:19 -05:00
Michael Teeuw
9c604a7886 Merge pull request #773 from amcolash/degree_label 2017-03-17 13:12:49 +01:00
Andrew McOlash
8ad1d6fd97 Merge branch 'develop' into degree_label 2017-03-17 07:12:15 -05:00
Andrew McOlash
a18e7eb089 Fix conflict with CHANGELOG, merge with upstream/develop 2017-03-17 07:08:00 -05:00
BeatIdo
1f5ea40bf6 News Feed hideLoading option 2017-03-17 09:08:45 +01:00
BeatIdo
44509e027c Add hideLoading option description 2017-03-17 09:06:29 +01:00
Michael Teeuw
fe3758b1bb Merge pull request #768 from roramirez/test-auth-calendar
Test auth calendar
2017-03-17 08:59:04 +01:00
Michael Teeuw
ebe2a30463 Merge pull request #754 from deg0nz/develop
Add support for more authentication methods for the default calendar module
2017-03-17 08:58:37 +01:00
Michael Teeuw
1216a26d13 Merge pull request #766 from BeatIdo/patch-1
Complete OWM city list URL
2017-03-17 08:55:52 +01:00
Michael Teeuw
65800853f4 Merge pull request #765 from roramirez/test-ipWhitelist
Add test without access by ipWhistelist
2017-03-17 08:55:15 +01:00
fewieden
ccb81179ab fix config option 2017-03-16 16:57:55 +01:00
Rodrigo Ramírez Norambuena
f2ea701d34 Fix eslintignore for vendor/vendor.js and fix the eslint validation 2017-03-14 22:53:37 -03:00
Rodrigo Ramírez Norambuena
1d4aa27f1c Merge pull request #1 from fewieden/npm-vendors
fix recursive installation loop, added other vendor dependencies
2017-03-14 17:35:34 -03:00
fewieden
bb08fe8113 fix recursive installation loop, added other vendor dependencies 2017-03-14 11:49:20 +01:00
Andrew McOlash
e2099f0749 Fix indents 2017-03-13 06:27:54 -05:00
Andrew McOlash
3c60feed02 Add in degree label to solve issue #753 2017-03-13 06:24:04 -05:00
Andrew McOlash
5466e1b733 Remove unnecessary string from excluded array 2017-03-12 20:22:40 -05:00
Rodrigo Ramírez Norambuena
328f15c2ea Add font-awesome using npm on vendors:
This can updated libs and clean repository code.
2017-03-12 21:55:08 -03:00
Andrew McOlash
873125abe1 Add changes to CHANGELOG 2017-03-12 11:39:05 -05:00
Andrew McOlash
5df818a19c Add in support to hide and exclude events based on a filter 2017-03-12 11:36:40 -05:00
Andrew McOlash
a5dc3cd018 Update CHANGELOG to reflect updates to the codebase 2017-03-11 17:40:24 -06:00
Andrew McOlash
afe0e3c1d6 Add in option to have single line news 2017-03-11 17:36:47 -06:00
Beh
91e1f958f2 Removed Calendar.zip 2017-03-11 12:24:17 +01:00
Rodrigo Ramírez Norambuena
c6fa0cc072 Add test for check MM_PORT enviroment variable 2017-03-10 18:21:06 -03:00
Rodrigo Ramírez Norambuena
c282bb2fe1 Fix if MM_PORT enviroment variable is set 2017-03-10 18:20:11 -03:00
Rodrigo Ramírez Norambuena
72d18fd7e1 Add test module position using helloworld
Also is using a configuration with "exotic content"
2017-03-10 17:52:40 -03:00
Rodrigo Ramírez Norambuena
6802873cd1 Add test module calendar fail basic auth 2017-03-10 16:50:25 -03:00
Rodrigo Ramírez Norambuena
1bdc46969c Add information message when the ipWhitelist is configurate with [] 2017-03-10 16:36:17 -03:00
Rodrigo Ramírez Norambuena
989ee0e281 Add link for tutorial ipWhitelist HowTo of @mochman 2017-03-10 16:27:05 -03:00
BeatIdo
0f27d646bb removed trailing spaces 2017-03-10 17:03:14 +01:00
BeatIdo
81aca500b3 Hide News Feed loading option
Configuration option to hide News Feed module if feed is empty instead of showing LOADING status
2017-03-10 16:56:28 +01:00
BeatIdo
50f2dded64 Complete OWM city list URL 2017-03-10 16:42:43 +01:00
Michael Teeuw
d26d94b62a Merge pull request #760 from roramirez/readme-tab-fix
Fix tab documentacion calendar for colored option
2017-03-10 14:59:22 +01:00
Michael Teeuw
2811f76714 Merge pull request #758 from CatoAntonsen/nn_translation
Updated Norwegian translations (nn and nb)
2017-03-10 14:57:09 +01:00
Michael Teeuw
67b21ad766 Merge pull request #757 from slametps/develop
indonesian translation
2017-03-10 14:56:43 +01:00
Michael Teeuw
6d07d5dccb Merge pull request #751 from roramirez/callback-fail-load-config
Use just one callback statement in case of failure on configuration loader
2017-03-10 14:53:36 +01:00
Michael Teeuw
da0e3d5c8b Merge pull request #750 from CatoAntonsen/animation_fix
Fixed missing animations on this.show() when module is alone in a region
2017-03-10 14:53:16 +01:00
Rodrigo Ramírez Norambuena
b129fe908c Test check backward backward compatibility authentication method basic
on calendar module

Fix travis basic-auth server
2017-03-10 04:47:57 -03:00
Rodrigo Ramírez Norambuena
f5c57e84c7 Add test calendar without auth method. Should be set by default basic. 2017-03-10 04:36:09 -03:00
Rodrigo Ramírez Norambuena
ceb4ef2642 Add test basic-auth 2017-03-10 04:33:27 -03:00
Rodrigo Ramírez Norambuena
1c235aa761 Add test default calendar 2017-03-10 04:31:26 -03:00
Rodrigo Ramírez Norambuena
cfc8117c3c Remove tests case from without_modules with much hardcode
This test retain
 * Check title.
 * Check footer with Michael website.
2017-03-10 00:52:43 -03:00
Rodrigo Ramírez Norambuena
aa1f515fcf Remote extra space main.js 2017-03-10 00:27:47 -03:00
Rodrigo Ramírez Norambuena
4fdd12bc48 Test change port configuration
This test change to 8090 port on configuration and check if system
response there.
2017-03-09 21:17:39 -03:00
Rodrigo Ramírez Norambuena
34f04b1946 Add note to allow all IP addresses. ipWhitelist configuration directive. 2017-03-09 17:26:50 -03:00
Rodrigo Ramírez Norambuena
5770b9dc0e Test env 404 not found request http://localhost:8080/nothing
This test expect gets 404 HTTP code on get request to
http://localhost:8080/nothing
2017-03-09 17:10:32 -03:00
Rodrigo Ramírez Norambuena
afe2b934de test env requst http://localhost:8080
This test expect get 200 HTTP code on get request to
http://localhost:8080
2017-03-08 10:36:08 -03:00
Rodrigo Ramírez Norambuena
11fe6cfbb0 Add test ipWhistelist = []
This test ipWhistelist on [] to access all IPs
Creates a request to localhost and port added in configuration and
check if gets 200 HTTP code.
2017-03-08 10:30:27 -03:00
Slamet PS
db10226005 update spaces to tab 2017-03-08 10:37:27 +07:00
Rodrigo Ramírez Norambuena
a15b8077a3 Add test without access by ipWhistelist
This test set a invalid IP address for not have access to MagicMirror.
Creates a request to localhost and port added in configuration and check if
gets 403 HTTP code.
2017-03-07 19:50:19 -03:00
Cato Antonsen
a3836b5e17 Updated Norwegian translations (nn and nb) 2017-03-07 18:06:26 +01:00
Beh
f8d80422b2 Fixed Travis CI errors
Changed indentation from spaces to tabs
changed strings from single quote to double quote
2017-03-07 00:34:17 +01:00
Beh
9848f80630 Added support for more authentication methods for the default calendar module
HTTP Basic, Digest and OAuth2/Bearer authentications are now supported
by the calendar module
2017-03-07 00:12:43 +01:00
Michael Teeuw
6ea1732630 Merge pull request #749 from peet86/develop
Small fixes in the Hungarian translation
2017-03-06 15:07:29 +01:00
Rodrigo Ramírez Norambuena
d97571ce0c Fix tab documentacion calendar for colored option 2017-03-06 02:11:27 -03:00
Rodrigo Ramírez Norambuena
1e3b866c8b Use color red for error when the configuration file is not found. 2017-03-05 22:20:35 -03:00
Rodrigo Ramírez Norambuena
2168838365 Use just one callback statement in case of failure on loader of the
configuration file.
2017-03-05 22:05:54 -03:00
Cato Antonsen
219021873d Removed trailing space 2017-03-05 23:42:13 +01:00
Cato Antonsen
120b505361 Implemented another way of waiting for refresh of region before animation 2017-03-05 23:36:24 +01:00
Cato Antonsen
347a2977fa Removed trailing spaces 2017-03-05 22:46:48 +01:00
Cato Antonsen
c2e90864ac Fixed missing animations on this.show() when module is alone in a region 2017-03-05 22:23:05 +01:00
Peter Varga
1027efd6e5 small fixes in hu translation 2017-03-05 19:50:48 +01:00
Michael Teeuw
bd0de83d31 Merge pull request #745 from roramirez/mv-colors-utils
Move colors in utils file
2017-03-05 17:16:16 +01:00
Michael Teeuw
4d3523b677 Merge pull request #746 from roramirez/json-format-config-pm2
Use JSON format for configuration file on pm2 control process file
2017-03-05 17:15:56 +01:00
Michael Teeuw
03f15e0075 Merge pull request #747 from roramirez/comment-bash-installer
Fix format comments on installer script
2017-03-05 17:15:33 +01:00
Michael Teeuw
043779f4af Merge pull request #743 from fewi/build-docker-windows
Fix error when building and running docker on windows
2017-03-03 13:26:32 +01:00
Felix Wiedemann
25b5daf6a5 fix problems when building the docker image on windows 2017-03-03 13:06:32 +01:00
Rodrigo Ramírez Norambuena
db444f5d7e Fix format comments on installer script 2017-03-02 09:22:32 -03:00
Rodrigo Ramírez Norambuena
16499d2fb8 Use JSON format for configuration pm2 control process file on installer
file.

Also, add to validate format on Gruntfile
2017-03-01 22:12:09 -03:00
Rodrigo Ramírez Norambuena
ddff2b2982 Move colors into utils file 2017-02-28 01:41:21 -03:00
Michael Teeuw
e697ee72fa Merge pull request #734 from roramirez/refactor-routes
refactor code for include multiples routes on js/server.js
2017-02-25 22:12:43 +01:00
Michael Teeuw
f98c59172b Merge pull request #736 from roramirez/readme-electron-optins
fix format kiosk mode options setted in README
2017-02-25 11:39:10 +01:00
Michael Teeuw
3badafaa82 Merge pull request #737 from roramirez/deprecated-options
Deprecated options
2017-02-25 11:38:30 +01:00
Michael Teeuw
cbf65a9355 Merge pull request #739 from roramirez/more_info_comment_hotfix
Add more information and tag FIXME on Hotfix code
2017-02-25 11:37:18 +01:00
Rodrigo Ramírez Norambuena
365bc900b0 Add more information and tag FIXME on Hotfix code 2017-02-24 18:52:33 -03:00
Rodrigo Ramírez Norambuena
bd0da63f4c use colors for warning message in deprecated options 2017-02-21 20:28:12 -03:00
Rodrigo Ramírez Norambuena
db0b663a3d Put file deprecated into js directory
Request in Pull Request #569
Initial work by @olexs
2017-02-21 19:28:53 -03:00
Rodrigo Ramírez Norambuena
fd7fe129e2 Merge remote-tracking branch 'olexs/deprecated-config-notify' into deprecated-options 2017-02-21 19:13:33 -03:00
Rodrigo Ramírez Norambuena
27253c360b fix format kiosk mode options setted in README 2017-02-21 19:03:39 -03:00
Rodrigo Ramírez Norambuena
ab226d16c8 refactor code for include multiples routes on js/server.js 2017-02-21 10:33:54 -03:00
Michael Teeuw
d6394402b8 Merge pull request #733 from roramirez/second-test-anytime
Second test case anytime feature module compliments
2017-02-21 10:56:32 +01:00
Michael Teeuw
6be5fac953 Merge pull request #725 from roramirez/compliments-anytime
Test anytime compliments module.
2017-02-20 19:54:33 +01:00
Michael Teeuw
c4435279de Merge pull request #728 from roramirez/global-setup-test
Refactoring some e2e tests.
2017-02-20 18:19:53 +01:00
Michael Teeuw
a9bdc8ad85 Merge pull request #727 from roramirez/vNode7
Add version Node 7 in travis
2017-02-20 18:19:22 +01:00
Michael Teeuw
df2a5fc789 Merge pull request #726 from roramirez/issue-709
Issue 709
2017-02-20 18:19:05 +01:00
Rodrigo Ramírez Norambuena
5af2768d33 refactor afterEach and beforeEach compliments_spec 2017-02-20 05:25:16 -03:00
Rodrigo Ramírez Norambuena
474695643f Second test case anytime feature module compliments
Suggested by @fewieden PL #725
2017-02-20 04:59:15 -03:00
Rodrigo Ramírez Norambuena
97ab88b39a Modified test compliments anytime this follow configuration:
{
	morning: [],
	afternoon: [],
	evening: [],
	anytime: ["Anytime here"]
    }
2017-02-20 01:52:07 -03:00
Rodrigo Ramírez Norambuena
3773d40201 Refactoring some e2e tests. Now is use a global-setup instead of
repeat repeat code to setup tests enviroment.
2017-02-19 21:06:38 -03:00
Rodrigo Ramírez Norambuena
b3fd01fe04 Add version Node 7 in travis 2017-02-19 20:06:20 -03:00
Rodrigo Ramírez Norambuena
75c4ca77c2 Update socket.io to 1.7.3 2017-02-19 19:57:21 -03:00
slametps
692ddc60c7 remove period
remove period
2017-02-19 22:23:16 +07:00
Rodrigo Ramírez Norambuena
1a296a8ca1 Test anytime compliments module.
feature introduced 79c79146a5
2017-02-18 23:38:39 -03:00
slametps
f5595dd4c3 added Indonesian translation
added Indonesian translation
2017-02-17 13:45:29 +07:00
Michael Teeuw
11c0221f81 Merge pull request #720 from roramirez/prevent_error_load
Prevent crash system if cannot load a js script or style sheet.
2017-02-15 11:55:46 +01:00
Michael Teeuw
2d0aad3da9 Merge pull request #721 from roramirez/extra-spaces-return
remove extra spaces alert README
2017-02-15 11:55:15 +01:00
Michael Teeuw
ff19cb68b4 Merge pull request #716 from roramirez/increment-timeouts-test-e2e
Increment timeout e2e test to 20000 ms
2017-02-13 20:37:20 +01:00
Rodrigo Ramírez Norambuena
e62df3b3b1 Increment timeout e2e test to 20000 ms 2017-02-12 15:42:00 -03:00
Rodrigo Ramírez Norambuena
1d024cc339 remove extra spaces alert README 2017-02-12 13:29:36 -03:00
Rodrigo Ramírez Norambuena
8bda91aafb Prevent crash system if cannot load a js script or style sheet. 2017-02-12 13:06:11 -03:00
Rodrigo Ramírez Norambuena
fd9963e7eb Testing default modules 2017-02-11 21:03:07 -03:00
Michael Teeuw
dc81ca4f53 Merge pull request #715 from roramirez/spelling
fixed minor word mistake
2017-02-11 23:48:59 +01:00
Rodrigo Ramírez Norambuena
fb754f9bc7 fixed minor word mistake 2017-02-11 19:34:43 -03:00
Michael Teeuw
7045f6571f Merge pull request #711 from qistoph/develop
Check for dev console instead of counting windows
2017-02-11 22:39:25 +01:00
Michael Teeuw
50d9bccacf Merge pull request #714 from qistoph/fix712
Fix issue #712
2017-02-11 22:37:19 +01:00
Chris van Marle
9064769185 Check for dev console 2017-02-11 13:43:03 +01:00
Chris van Marle
5fc16bdbfb Fix sabado in clock_es_spec.js test
Fixes #712
2017-02-11 13:41:00 +01:00
Michael Teeuw
172e4e939d Merge pull request #705 from roramirez/text-fresh-update-branch
add note for pull request about update develop branch
2017-02-10 09:21:20 +01:00
Rodrigo Ramírez Norambuena
f914b728ff add note for pull request about update develop branch 2017-02-09 14:10:07 -03:00
Michael Teeuw
54857e843b Merge pull request #704 from APPLEH0LIC/develop
Added Korean Translation
2017-02-09 13:32:19 +01:00
Michael Teeuw
64b34e98c7 Remove comments. 2017-02-09 13:28:20 +01:00
APPLEH0LIC
1ccf74bca1 Update CHANGELOG.md
added Korean Translation.
2017-02-09 17:56:56 +09:00
APPLEH0LIC
49a534a61b Add kr.json file
Added Korean Translation kr.json file.
2017-02-09 17:56:06 +09:00
APPLEH0LIC
b8889c6a1f Update translations.js
Added Korean Translation
2017-02-09 17:54:47 +09:00
Michael Teeuw
ccbc5c9d17 Merge pull request #696 from kpaaro/develop
Compliments module can use remoteFile without default daytime arrays defined
2017-02-08 19:35:09 +01:00
Michael Teeuw
555e01ec87 Merge branch 'develop' into develop 2017-02-08 19:32:53 +01:00
Michael Teeuw
7869f472c3 Merge pull request #697 from roramirez/global_version
unit test global.version
2017-02-08 19:32:11 +01:00
LAPTOP-KAUR\race2
90f60f95f7 formating fix so that grunt passes 2017-02-08 19:29:52 +02:00
Michael Teeuw
0f0a71a109 Merge pull request #689 from roramirez/test-compliments
add test parts of day for compliments module
2017-02-08 09:14:23 +01:00
Michael Teeuw
a43c8a2def Merge pull request #695 from fewieden/develop
applied dry pattern
2017-02-08 09:11:02 +01:00
LAPTOP-KAUR\race2
cbafaf5d56 compliments,js handles remoteFile without default daytimes defined 2017-02-08 02:35:09 +02:00
LAPTOP-KAUR\race2
62e4e13f5a case correction; added changelog.md entry 2017-02-08 02:33:03 +02:00
fewieden
e69908abef fix indentation 2017-02-08 00:10:44 +01:00
fewieden
6cb3cf8747 fix indentation 2017-02-08 00:05:28 +01:00
fewieden
2f71a43420 dry pattern 2017-02-07 23:51:13 +01:00
Rodrigo Ramírez Norambuena
f57ad57e62 unit test global.version 2017-02-07 19:35:51 -03:00
Rodrigo Ramírez Norambuena
03f5d9b102 Split test for parts of day in compliments module 2017-02-07 16:49:07 -03:00
Michael Teeuw
6b17e1820c Merge pull request #693 from qistoph/testdevarg
Test "dev" argument
2017-02-07 16:27:14 +01:00
Michael Teeuw
e0f6fca987 Merge pull request #688 from Nosrac/develop
New Compliments category: `anytime`
2017-02-07 12:04:40 +01:00
Michael Teeuw
1fe95a5fe4 Merge pull request #687 from fewieden/develop
bugfix newsfeed
2017-02-07 12:04:00 +01:00
Michael Teeuw
1257ecf100 Merge pull request #686 from kpaaro/develop
Added estonian translations
2017-02-07 12:03:20 +01:00
Michael Teeuw
4163304b24 Merge pull request #685 from roramirez/dev-npm-run
fix when is set dev parameter option in "npm start dev".
2017-02-07 12:03:05 +01:00
Michael Teeuw
d35f2c4a4f Merge pull request #681 from qistoph/testing
Testing
2017-02-07 12:02:40 +01:00
Michael Teeuw
e5d5c5f9a7 Merge pull request #679 from EdgardosReis/patch-1
Update pt.json
2017-02-07 12:01:39 +01:00
Rodrigo Ramírez Norambuena
6fcaec3ca8 add test parts of day for compliments module 2017-02-06 00:28:08 -03:00
Kyle Carson
a2892ad097 Update Readme and changelog 2017-02-05 19:29:35 -06:00
Kyle Carson
79c79146a5 Support anytime compliment group. 2017-02-05 19:28:42 -06:00
Kyle Carson
cd37ba308c Merge remote-tracking branch 'MichMich/develop' into develop 2017-02-05 19:19:58 -06:00
fewieden
b35c0f7e39 update changelog 2017-02-06 02:08:59 +01:00
fewieden
14b1b649cb bugfix 2017-02-06 01:19:03 +01:00
Chris van Marle
14c0307c09 Fix grunt error 2017-02-05 12:26:42 +01:00
Chris van Marle
42f22119f2 Add test for 'dev' argument 2017-02-05 11:38:01 +01:00
LAPTOP-KAUR\race2
75f4771616 Added estonian translations 2017-02-05 05:12:31 +02:00
Rodrigo Ramírez Norambuena
83f7cb2033 fix when is set dev parameter option in "npm start dev".
issue #684
2017-02-03 19:26:49 -03:00
EdgardosReis
43a4c6198c Update pt.json 2017-02-03 15:41:11 +00:00
EdgardosReis
8c2fafecd7 Update pt.json
removed comments
2017-02-03 15:40:33 +00:00
Chris van Marle
d004c0ccd1 Split translation key testing
All keys in a translation file should be in the base file (en.json).
When there are keys in the base file that are not in a translation,
the translation file test is skipped.
2017-02-03 10:10:03 +01:00
Chris van Marle
406ae4e8c3 Skip translation test on fail 2017-02-02 14:28:59 +01:00
Chris van Marle
cd8bee1371 Run App in vm 2017-02-02 10:32:35 +01:00
Chris van Marle
123392c549 Translations test 2017-02-02 10:32:06 +01:00
EdgardosReis
42ffe213fd Update pt.json 2017-02-02 00:04:48 +00:00
Michael Teeuw
fd738e5c8b Merge pull request #677 from roramirez/test-displayseconds-false-clock
add test with displaySeconds config disabled for clock module
2017-02-01 17:00:53 +01:00
Rodrigo Ramírez Norambuena
6f95b2c2ad add test with displaySeconds config disabled for clock module 2017-02-01 14:33:17 -03:00
Michael Teeuw
f66c2b078c Merge pull request #678 from roramirez/test-e2e-es-clock
Test e2e es clock
2017-02-01 17:00:33 +01:00
Rodrigo Ramírez Norambuena
c6f5c120ba add tests clock module variant language es 2017-02-01 14:12:27 -03:00
Michael Teeuw
677e93430d Merge pull request #675 from roramirez/run-travis-all-tests
Run tests e2e in Travis
2017-02-01 07:45:50 +01:00
Michael Teeuw
a9a90c5545 Merge pull request #676 from roramirez/hotfix/MM_PORT
hotfix PL #673
2017-02-01 07:45:28 +01:00
Rodrigo Ramírez Norambuena
ee0418e719 hotfix PL #673 2017-01-31 22:08:38 -03:00
Rodrigo Ramírez Norambuena
6fc1141477 Run tests e2e in Travis 2017-01-31 18:38:25 -03:00
Michael Teeuw
b02920c43c Merge pull request #674 from morozgrafix/test_branch
Restructured Test Suite
2017-01-31 21:52:53 +01:00
Michael Teeuw
049d249609 Merge pull request #673 from bastilimbach/feature/docker
Added Docker support for server only mode
2017-01-31 21:51:58 +01:00
Sergey Morozov
fc2a554415 fix for 12hr regex
thanks to @roramirez for testing and catching it.
2017-01-31 12:24:11 -08:00
Sebastian Limbach
42b806b500 Fixed whitespace 2017-01-31 21:19:37 +01:00
Rodrigo Ramírez Norambuena
aeb3ccaf09 Remove extra spaces and lines in tests. 2017-01-31 17:02:18 -03:00
Sergey Morozov
86fdd91597 Restructured Test Suite
- separated tests into e2e and unit directories
- created configs directory structure to support test framework
- added/modified `npm run test`, `npm run test:unit` and `npm run test:e2e` to target all, unit and e2e tests respectively
- modified some of the test names to be more descriptive

New structure of the Test Suite has following directory tree:

```
tests
├── configs
│   ├── env.js
│   └── modules
│       ├── clock
│       │   ├── clock_12hr.js
│       │   ├── clock_24hr.js
│       │   └── clock_showPeriodUpper.js
│       └── helloworld
│           └── helloworld.js
├── e2e
│   ├── env_spec.js
│   └── modules
│       ├── clock_spec.js
│       └── helloworld_spec.js
└── unit
    ├── functions
    │   └── cmp_versions_spec.js
    └── global_vars
        └── root_path_spec.js
```
2017-01-31 11:08:53 -08:00
Sebastian Limbach
e68fea185d Merge branch 'develop' into feature/docker 2017-01-31 19:48:38 +01:00
Sebastian Limbach
a3eaf9f473 Fixed typos and some description changes 2017-01-31 19:41:42 +01:00
Sebastian Limbach
e6a2b9f06e Added the Docker support changes to changelog 2017-01-31 19:40:49 +01:00
Sebastian Limbach
a78973702b Added Docker install documentation 2017-01-31 16:36:01 +01:00
Sebastian Limbach
354b745c39 Added Docker support 2017-01-31 11:41:40 +01:00
Michael Teeuw
ce6cd6acdc Merge pull request #670 from roramirez/translation-check
Translation check
2017-01-31 08:44:10 +01:00
Michael Teeuw
8e129143f1 Merge pull request #671 from Nosrac/develop
Support calendar-specific maximumEntries and maximumNumberOfDays
2017-01-31 08:42:50 +01:00
Michael Teeuw
6d50cbba6f Merge pull request #672 from morozgrafix/test_branch
Add missing 'chai-as-promised' dependency
2017-01-31 08:41:54 +01:00
Sergey Morozov
7731878f36 Add missing 'chai-as-promised' dependency
When I attempted to run e2e tests I got following error:

```
$npm run test:e2e

> magicmirror@2.1.1 test:e2e /Users/sergeym/localDev/MagicMirror
> ./node_modules/mocha/bin/mocha tests/e2e --recursive

module.js:471
    throw err;
    ^

Error: Cannot find module 'chai-as-promised'
...
```

Adding `chai-as-promised` to `package.json` and running npm install fixes it.
2017-01-30 15:33:23 -08:00
Kyle Carson
9f659eef1b Fix formatting 2017-01-30 16:35:21 -06:00
Kyle Carson
14cc642e54 Support calendar-specific maximumEntries and maximumNumberOfDays 2017-01-30 16:26:42 -06:00
Michael Teeuw
c47852cd0a Merge pull request #661 from artifactdev/master
Color options for calendar and weather forecast
2017-01-30 20:56:34 +01:00
Michael Teeuw
c3bfaa31ee Merge branch 'develop' into master 2017-01-30 20:55:53 +01:00
Michael Teeuw
832505a315 Merge pull request #669 from roramirez/test-e2e
Test e2e
2017-01-30 20:55:25 +01:00
Rodrigo Ramírez Norambuena
cb71667336 Use jsonlint task to check translation files 2017-01-30 13:36:22 -03:00
Rodrigo Ramírez Norambuena
1032e97d58 Fix string russian translation module alert 2017-01-30 13:32:52 -03:00
Rodrigo Ramírez Norambuena
b4271da13e add translations/translations.js eslint check 2017-01-30 13:17:36 -03:00
Rodrigo Ramírez Norambuena
e2dc5ef4f2 fix eslint change single quote by double quote 2017-01-30 12:46:21 -03:00
Rodrigo Ramírez Norambuena
c75ee042a8 add e2e test enviroment 2017-01-30 12:36:11 -03:00
Rodrigo Ramírez Norambuena
d474d518ca test e2e module helloworld 2017-01-30 12:24:49 -03:00
Rodrigo Ramírez Norambuena
52b8dbcbb1 separate test type. Create directory for End-to-end testing. 2017-01-30 12:17:45 -03:00
Rodrigo Ramírez Norambuena
0d8d8f0426 Add tests configs directory as express route. 2017-01-30 12:17:23 -03:00
artifactdev
ed12deae25 Update CHANGELOG.md
Added color options for calendar and weather forecast to changelog
2017-01-30 13:17:44 +01:00
Michael Teeuw
7f1e7c981d Merge pull request #666 from roramirez/index-mm-config-file-env-var
Use configuration file in index.html when is set MM_CONFIG_FILE
2017-01-30 12:53:44 +01:00
Michael Teeuw
cc26688d82 Merge pull request #668 from Jopyth/patch-4
missing comma in sv.json translation
2017-01-30 12:52:31 +01:00
Jopyth
a0fa3a6063 missing comma in sv.json translation 2017-01-30 09:28:37 +01:00
Rodrigo Ramírez Norambuena
110a1a640d fix .stylelintrc in jsonlint check 2017-01-29 17:15:01 -03:00
Rodrigo Ramírez Norambuena
bbdc43c750 Use configuration file in index.html when is set MM_CONFIG_FILE 2017-01-29 17:00:56 -03:00
Michael Teeuw
c73b9b4882 Merge pull request #663 from Snille/develop
Added and translated some missing strings in the sv.json file.
2017-01-29 11:39:47 +01:00
Jeremias Arnstadt
e249092f91 used mardown in calendar README 2017-01-29 11:17:00 +01:00
Jeremias Arnstadt
5c0b04bfc8 fixed linting issues 2017-01-29 00:59:38 +01:00
Jeremias Arnstadt
bc257f4951 Merge branch 'develop' of https://github.com/artifactdev/MagicMirror
# Conflicts:
#	modules/default/calendar/README.md
#	modules/default/weatherforecast/README.md
2017-01-29 00:53:07 +01:00
Erik Pettersson
e738ee0812 Added information about the sv.json update. 2017-01-29 00:09:51 +01:00
snille
ebb2db17f3 Fixed the Swedish translation. 2017-01-29 00:06:06 +01:00
Jeremias Arnstadt
4214293b76 updated README of weatherforecast and calendar module for color options 2017-01-28 18:32:06 +01:00
Jeremias Arnstadt
ce3ee909bf added possibility to give each calendar another color 2017-01-28 18:21:02 +01:00
Jeremias Arnstadt
09ba1e2470 added possibility to color max and min temprature 2017-01-28 18:01:37 +01:00
Michael Teeuw
68444b81cc Merge pull request #659 from Jopyth/patch-hidden-status
fix module hidden status
2017-01-28 13:44:49 +01:00
Joseph Bethge
d3c0b9a438 fix module hidden status 2017-01-28 12:31:33 +01:00
Michael Teeuw
6e2f1f72c6 Merge pull request #657 from roramirez/splashscreen-halt-reboot
Show splash screen image on reboot and halt.
2017-01-28 06:21:25 +01:00
Michael Teeuw
c82eec09b7 Merge pull request #658 from roramirez/fix-validate-file-config-by-variable
Fix bug validation when is not set MM_CONFIG_FILE enviroment variable
2017-01-28 06:20:23 +01:00
Olexandr Savchuk
d4093d8c98 Merge branch 'deprecated-config-notify' of github.com:olexs/MagicMirror into deprecated-config-notify 2017-01-27 18:03:34 +01:00
Olexandr Savchuk
90616c82b6 Added console warning for deprecated config options 2017-01-27 18:02:50 +01:00
Rodrigo Ramírez Norambuena
de69fe1745 Show splash screen image on reboot and halt. 2017-01-27 13:42:20 -03:00
Michael Teeuw
9bd42ac221 Merge pull request #656 from roramirez/env-config-file-pl
Code change discussion  Pull Request  #653
2017-01-27 17:27:03 +01:00
Rodrigo Ramírez Norambuena
2f9a272696 Improvement of code block about from discussion Pull Request #653
https://github.com/MichMich/MagicMirror/pull/653
2017-01-27 13:13:04 -03:00
Michael Teeuw
552ea0356e Merge pull request #652 from roramirez/electron-issues
Electron issues
2017-01-27 09:02:20 +01:00
Michael Teeuw
ff6bd91ef7 Merge branch 'develop' into electron-issues 2017-01-27 09:01:57 +01:00
Michael Teeuw
835f20f872 Merge pull request #653 from roramirez/env-config-file
Set configuration file by enviroment variable
2017-01-27 09:00:23 +01:00
Rodrigo Ramírez Norambuena
1e9b35d18f Fix bug validation when is not set MM_CONFIG_FILE enviroment variable 2017-01-26 21:13:58 -03:00
Rodrigo Ramírez Norambuena
3818e48218 remove console.log 2017-01-25 19:05:40 -03:00
Michael Teeuw
5d63065057 Merge pull request #650 from qistoph/testing
Fix grunt errors in root_path.js and syntax in da.json
2017-01-25 12:25:04 +01:00
Chris van Marle
ae41ed1d51 Fix syntax in DA translation 2017-01-25 12:00:38 +01:00
Chris van Marle
36ead2251a Fix grunt errors 2017-01-25 11:58:20 +01:00
Michael Teeuw
dc7093f68a Merge pull request #648 from qistoph/testing
Add root_path testing
2017-01-25 10:03:53 +01:00
Michael Teeuw
6c79d2b008 Merge pull request #649 from roramirez/example-quote-config
Change of examples configuration in README modules.
2017-01-25 10:02:43 +01:00
Rodrigo Ramírez Norambuena
422349c2d1 Change of examples configuration in README modules.
This change is related commit f59f035a7e
Now is used  grunt for check ESLint syntax validation of config/* files
2017-01-24 17:22:17 -03:00
Chris van Marle
7dbfa0b203 Add root_path testing 2017-01-24 17:58:04 +01:00
Michael Teeuw
57ea2ac039 Merge pull request #645 from roramirez/grunt-config
Add config/* to the Grunt target.
2017-01-24 14:43:32 +01:00
Michael Teeuw
a9e664e89d Merge pull request #646 from zoliaz1993/develop
Update Hungarian language.
2017-01-24 14:42:59 +01:00
Michael Teeuw
c0e2210da3 Merge pull request #647 from qistoph/testing
Run npm test on Travis
2017-01-24 14:40:14 +01:00
Chris van Marle
b13c6f283a Run npm test on Travis 2017-01-24 12:03:19 +01:00
Zoltán Rónai
8181b9a31c Rename hu to hu.json
extension (**.json)
2017-01-24 09:09:13 +01:00
Zoltán Rónai
105e4f990d Update translations.js
Text aligned.
2017-01-24 08:59:37 +01:00
zoliaz1993
9670d74345 Update Hungarian language.
Add Alert module Hun translation.
Text aligned formality.
2017-01-24 08:54:39 +01:00
Rodrigo Ramírez Norambuena
86e553e756 Set configuration file by enviroment variable:
Enable ability to set configuration file by the enviroment variable
called MM_CONFIG_FILE.
2017-01-24 02:59:20 -03:00
Rodrigo Ramírez Norambuena
566ea9a110 Use script for start MagicMirror 2017-01-24 02:12:36 -03:00
Rodrigo Ramírez Norambuena
f59f035a7e Add config/* to the Grunt target.
Also, this change can be check config errors by syntax.
2017-01-23 18:03:26 -03:00
Michael Teeuw
4c6d4f3caf Merge pull request #642 from kthorri/master
Icelandic Translation
2017-01-23 19:41:50 +01:00
Michael Teeuw
8af87bac22 Merge pull request #644 from morozgrafix/tests_cleanup
Minor clean up for test suite
2017-01-23 19:41:27 +01:00
Sergey Morozov
690567659c Minor clean up for test suite
@roramirez thanks for starting adding tests. I figured that we might as well grunt them and follow same rules for linting as we do for rest of JS code in the repo.

I've made following minor modifications:
- added tests to the grunt target
- fixed indentation in package.json
- made tests a bit more descriptive
- fixed eslint errors surfaced by grunt
2017-01-23 09:59:19 -08:00
Michael Teeuw
d9c7ee8976 Fixed Changelog to match the correct version. 2017-01-23 16:18:42 +01:00
Michael Teeuw
95cf554de4 Merge branch 'develop' into master 2017-01-23 16:17:28 +01:00
kthorri
47a87a14f5 Fixing typo 2017-01-23 14:55:24 +00:00
kthorri
5e860b6850 Added icelandic translation to changelog 2017-01-23 14:53:57 +00:00
kthorri
9a983e7565 Adding icelandic translation json file 2017-01-23 14:53:18 +00:00
kthorri
00197d131d Adding Icelandic translation to translation.js 2017-01-23 14:51:59 +00:00
Michael Teeuw
9758f3c9d2 Add the Hungarian translation. 2017-01-23 11:38:48 +01:00
Michael Teeuw
e7d7425b6e Merge pull request #641 from zoliaz1993/master
Add the Hungarian translation.
2017-01-23 11:38:12 +01:00
Michael Teeuw
b566c81ae7 Merge branch 'develop' into master 2017-01-23 11:36:15 +01:00
Michael Teeuw
742837e7a1 Merge pull request #640 from roramirez/fix-mm-script-path
Fix path for script MagicMirror on pm2
2017-01-23 10:29:54 +01:00
zoliaz1993
5087dbd756 Update hu.json
Remove + line.
2017-01-23 09:44:09 +01:00
Rodrigo Ramez Norambuena
b893ae7c14 Fix path for script MagicMirror on pm2 2017-01-22 23:47:17 -03:00
Michael Teeuw
1f7863057f Merge pull request #636 from Jopyth/fix_calendar
Fix Calendar Issues
2017-01-22 16:10:31 +01:00
Michael Teeuw
3dd3afd21f Update CHANGELOG.md 2017-01-22 12:23:11 +01:00
Michael Teeuw
387d3b7335 Merge pull request #638 from villevirtanen/patch-2
Updates to fi.json
2017-01-22 12:22:02 +01:00
villevirtanen
782bfd058b Update fi.json
DAYAFTERTOMORROW, UPDATE_NOTIFICATION and UPDATE_NOTIFICATION_MODULE added.
2017-01-22 10:46:28 +02:00
Michael Teeuw
c0d936fa4d Merge pull request #635 from roramirez/tests
minor fix textual
2017-01-21 19:28:43 +01:00
Joseph Bethge
63819c5757 fix calendar issues 2017-01-21 16:05:29 +01:00
Rodrigo Ramírez Norambuena
08cbac6277 minor fix textual 2017-01-21 11:04:11 -03:00
Michael Teeuw
68c0a9aec4 Merge pull request #634 from roramirez/note-readme-cp-config-sample
Add note in step of copy for sample file configuration in README.
2017-01-21 11:58:59 +01:00
Michael Teeuw
1c585815a1 Merge pull request #633 from roramirez/tests
Hotfix  introduced client error on commit  3a8d72d
2017-01-21 11:57:31 +01:00
Rodrigo Ramírez Norambuena
853ec7320f Add note in step of copy for sample file configuration in README.
This note is related if was used installer script.
2017-01-20 19:07:37 -03:00
Rodrigo Ramírez Norambuena
b8917a3c0e Hotfix introduced client error on commit 3a8d72d
Noticed by @qistoph
https://github.com/MichMich/MagicMirror/pull/623#issuecomment-273505208
2017-01-20 18:44:28 -03:00
zoliaz1993
c4d70e7f9b Hungarian Translation 2017-01-20 13:49:10 +01:00
zoliaz1993
7f1b11d19b Hungarian translation 2017-01-20 13:45:14 +01:00
zoliaz1993
02a32dea40 Revert "Hungarian Translation"
This reverts commit d9e20ea17a.
2017-01-20 13:43:58 +01:00
zoliaz1993
d9e20ea17a Hungarian Translation 2017-01-20 13:43:44 +01:00
Michael Teeuw
039c2fe0a6 Merge pull request #630 from fry0815/fix_temperature_check
Fix temperature check
2017-01-19 20:04:56 +01:00
Michael Teeuw
a967e73f9e Merge branch 'develop' into fix_temperature_check 2017-01-19 20:03:13 +01:00
Tino Ziegler
222e4154a1 changed to double quotes 2017-01-19 09:11:33 +01:00
Tino Ziegler
56413ee94e added fix 2017-01-18 16:04:02 +01:00
Tino Ziegler
93c07b2b1e Fix: check if temperature is defined (0°) 2017-01-18 15:56:12 +01:00
Michael Teeuw
27ed64a1af Merge pull request #628 from aaronaxvig/master
Provide example of syntax for electronOptions
2017-01-18 09:13:37 +01:00
Michael Teeuw
ad68106c3c Merge pull request #629 from roramirez/branch-README
update branch Manual Installation in README.md
2017-01-18 09:13:13 +01:00
Rodrigo Ramírez Norambuena
a591cf1d21 update branch Manual Installation in README.md 2017-01-18 01:36:14 -03:00
Michael Teeuw
03a4b8f5cf Merge pull request #627 from tosti007/README_tables
Replace HTML tables with Markdown tables
2017-01-17 17:23:27 +01:00
Michael Teeuw
2d8d25808d Merge pull request #623 from roramirez/tests
Init Tests
2017-01-17 17:22:50 +01:00
Michael Teeuw
a82fcce734 Merge branch 'develop' into tests 2017-01-17 17:22:37 +01:00
Brian
0734e136d0 Update CHANGELOG 2017-01-17 16:15:39 +01:00
Brian
2913120ff7 Update README files 2017-01-17 16:14:50 +01:00
Michael Teeuw
bd277b087a Merge pull request #624 from tosti007/Calendar_Regex
Add Regexp possibility to titleReplace
2017-01-17 11:07:42 +01:00
Brian
fc00966b8b Update CHANGELOG 2017-01-17 11:05:18 +01:00
Michael Teeuw
495a76353f Merge pull request #622 from tosti007/develop
Fix typo and remove unused variable
2017-01-17 08:41:15 +01:00
Michael Teeuw
6ea225ed2a Rescale Splash Screen 2017-01-16 11:53:02 +01:00
Brian
c1a5f59c42 Remove Trailing space 2017-01-16 02:52:50 +01:00
Brian
49fb9108e9 Add Regexp possibility to titleReplace
Check if the given needle is a regexp, if so create one and use it
instead
2017-01-16 02:49:08 +01:00
Rodrigo Ramírez Norambuena
4cb3b514ab update CHANGELOG test 2017-01-15 22:41:16 -03:00
Brian
c95a37130a Remove unused uelf variable 2017-01-16 02:36:10 +01:00
Brian
29e82cc509 Fix Typo
Change E into R
2017-01-16 02:27:12 +01:00
Michael Teeuw
a4cb53fdb4 Show correct units for showRainAmount 2017-01-15 21:16:01 +01:00
Michael Teeuw
865dce6f68 Add info about issue #611. 2017-01-15 20:36:11 +01:00
Michael Teeuw
1d02154d99 Fix eslint issues. 2017-01-15 19:41:42 +01:00
Rodrigo Ramírez Norambuena
3a8d72db31 init tests:
This patch propouse use the mocha for testing MagicMirror.
2017-01-15 15:40:23 -03:00
Michael Teeuw
ec57a240d5 Merge branch 'develop' of https://github.com/MichMich/MagicMirror into develop 2017-01-15 19:38:53 +01:00
Michael Teeuw
949f7587dc Solve issue: #611 2017-01-15 19:38:46 +01:00
Michael Teeuw
55cce646e0 Merge pull request #621 from roramirez/fix-changelog-blackslash
fix blackslash introduce in Pull Request #619
2017-01-15 19:30:50 +01:00
Rodrigo Ramírez Norambuena
4c3dce694a fix blackslash introduce in Pull Request #619
URL Pull Request: https://github.com/MichMich/MagicMirror/pull/619
2017-01-15 14:10:48 -03:00
Michael Teeuw
46d5b70391 Merge pull request #619 from nhubbard/develop
Add postinstall script
2017-01-15 00:19:58 +01:00
Michael Teeuw
08a102d182 Merge pull request #620 from roramirez/Changelog-reference
Changelog: fix number reference issue.
2017-01-15 00:18:21 +01:00
Rodrigo Ramírez Norambuena
1cf8e08d4b Changelog: fix number reference issue. 2017-01-14 19:37:38 -03:00
Nicholas Hubbard
65a8b83150 Add Cache 2017-01-14 15:46:38 -05:00
Nicholas Hubbard
f4c8db654c Fix postinstall error. 2017-01-14 15:42:29 -05:00
Nicholas Hubbard
5c4d1c0259 Add CHANGELOG.md 2017-01-14 15:37:32 -05:00
Nicholas Hubbard
a459f8b84c Merge branch 'develop' of https://github.com/nhubbard/MagicMirror into develop
This merge is necessary to make Git happy.
2017-01-14 15:34:23 -05:00
Nicholas Hubbard
0d672420f7 Add postinstall script for installation 2017-01-14 15:32:59 -05:00
Michael Teeuw
2f7be0559a Switch to rrule-alt. Issue: #565 2017-01-14 19:31:24 +01:00
Michael Teeuw
0623ae1f87 Merge pull request #596 from IgniparousTempest/master
Afrikaans Translation
2017-01-12 19:48:04 +01:00
Michael Teeuw
8ae946c2c5 Merge branch 'develop' into master 2017-01-12 19:46:34 +01:00
Michael Teeuw
bb75f6ffce Merge pull request #601 from morozgrafix/russian_translations2
Russian translations2
2017-01-12 19:45:10 +01:00
Michael Teeuw
fcfe83f0cc Merge pull request #599 from qistoph/hover
Pass pointer-events on fullscreen overlay to underlaying modules
2017-01-12 19:44:46 +01:00
Michael Teeuw
5cbcded929 Merge branch 'develop' into russian_translations2 2017-01-12 19:42:50 +01:00
Michael Teeuw
2a95f792ec Merge pull request #609 from roramirez/README-update
Fix capitalize missing word Community
2017-01-12 19:41:45 +01:00
Michael Teeuw
daa2808448 Merge pull request #612 from thobach/master
Enabled newsfeed default module for gesture events from https://github.com/thobach/MMM-Gestures
2017-01-12 19:41:06 +01:00
Michael Teeuw
fc06ffdcee Merge branch 'develop' into master 2017-01-12 19:40:53 +01:00
Michael Teeuw
1601179081 Merge pull request #613 from roramirez/pm2_start
Pm2 start
2017-01-12 19:39:03 +01:00
Michael Teeuw
7fe374b67e Merge pull request #614 from greg-dev/fix-update-info-pl
Fix missing comma and complete Polish translation
2017-01-12 19:37:37 +01:00
Michael Teeuw
7a353bbe48 Merge pull request #617 from alexbarcelo/extra_update
Add `apt-get update` in raspberry.sh script
2017-01-12 19:36:08 +01:00
Alex Barcelo
c103ff271b Merge branch 'master' into extra_update 2017-01-12 17:37:31 +01:00
Alex Barcelo
ab9e0f891a updating CHANGELOG 2017-01-12 17:35:04 +01:00
Alex Barcelo
af85ef8cfb removing unnecessary exit, leaving a warning 2017-01-12 17:34:56 +01:00
Alex Barcelo
3cea6e5d0c Add apt-get update in raspberry.sh script
Just tried this script and realized that it is likely that it will fail because the apt index is not up to date.

The trivial fix seems to be to add an `apt-get update` before the package installation. It should be harmless also.
2017-01-12 17:34:54 +01:00
Greg Dev
6d1b0ae498 Add Polish translation for UPDATE_INFO 2017-01-12 01:33:13 +01:00
Courtney Pitcher
07d5b07748 Update Changelog.md 2017-01-11 21:48:33 +02:00
Courtney Pitcher
d47b9cd5c0 Merge branch 'develop' into master 2017-01-11 21:47:19 +02:00
IgniparousTempest
d542c063d7 Updated CHANGELOG.md to include Afrikkans translation 2017-01-11 21:42:31 +02:00
Rodrigo Ramírez Norambuena
4bb3d33907 add choice to use pm2 for auto starting of MagicMirror 2017-01-11 10:22:46 -03:00
Thomas Bachmann
62bec25b6e Merge remote-tracking branch 'MichMich/develop' 2017-01-11 11:34:04 +01:00
Thomas Bachmann
3ba16f1773 Merge remote-tracking branch 'MichMich/develop' 2017-01-11 11:32:20 +01:00
Thomas Bachmann
c302030301 Added documentation on supported notifications and related third party modules 2017-01-11 11:19:33 +01:00
Rodrigo Ramírez Norambuena
49abe2b11f Fix capitalize missing word Community 2017-01-10 16:11:29 -03:00
Sergey Morozov
544e7fce88 removing .gitignore changes and changelog notes about it 2017-01-10 11:05:37 -08:00
Michael Teeuw
b9e7f018e2 Merge pull request #607 from qistoph/fixdefmod
Fix gitignore to not ignore default modules folder
2017-01-10 19:54:02 +01:00
Michael Teeuw
f31049cf69 Merge branch 'develop' into fixdefmod 2017-01-10 19:52:20 +01:00
Michael Teeuw
2b3b73b3f1 Merge pull request #600 from roramirez/config_sample-installer
modified installer to use config.js.sample for init config.
2017-01-10 19:46:38 +01:00
Michael Teeuw
704bb5a848 Merge pull request #597 from roramirez/fix-white-flash-boot
Remove white flash on boot up
2017-01-10 19:44:01 +01:00
Michael Teeuw
01f7d7add2 Merge pull request #608 from roramirez/new_year
update year license for 2017
2017-01-10 19:34:55 +01:00
Rodrigo Ramírez Norambuena
831d8b6d36 update year license for 2017 2017-01-10 15:22:10 -03:00
Chris van Marle
2e9b6ead2e Fix gitignore to not ignore default modules folder
/modules/** makes git ignore all directories and files in /modules, so
it's not even looking in /modules/default for changes.
!/modules/default/** is therefore never used. By adding the new line
!/modules/default, git is told to look in the /modules/default folder
for changes and will find all sub files/dirs and match these on
!/modules/default/**.
2017-01-10 11:31:00 +01:00
Rodrigo Ramírez Norambuena
d71fd0ff2d Add pm2 configuration for manager MagicMirror in script installer 2017-01-09 20:39:48 -03:00
aaronaxvig
6466bd4ba7 Add back missing newline 2017-01-08 18:15:48 -07:00
aaronaxvig
a97fa1abb6 Remove errant character 2017-01-08 18:14:30 -07:00
aaronaxvig
6171e5cc6e Update README.md 2017-01-08 18:02:45 -07:00
Thomas Bachmann
456502893c Addressed code review comments to reduce redundant lines 2017-01-08 14:38:16 +01:00
Thomas Bachmann
443a90c7ba Made full article view of news full-screen on any screen size 2017-01-07 22:42:11 +01:00
Thomas Bachmann
b8a72245dc Using generic news feed events as notifications, instead of more implementation specific gestures from sensor 2017-01-06 21:57:30 +01:00
Sergey Morozov
d019f88e26 Merge branch 'develop' into russian_translations2 2017-01-06 11:24:52 -08:00
Sergey Morozov
01cf4cc1ed Added Russian Translations
Redo of the PR #598

**Added:**
- Russian Translations

**Fixed:**
- corrected .gitignore rules for default modules

(Reasoning behind change: when I added translation for `alert` module `git add` was telling me that `.gitignore` rule excludes files and folders under `modules/default`)

I also noticed that `.gitignore:56` has following declaration:

```
!/modules/node_helper
!/modules/node_helper/**
```
but I don't think this directory structure exists today (also there is a small typo)
2017-01-06 11:21:20 -08:00
Rodrigo Ramírez Norambuena
396bbd83c8 modified installer to use config.js.sample for init config. 2017-01-05 16:09:41 -03:00
Chris van Marle
92e0affb85 Disable pointer-events on fullscreen overlay 2017-01-05 10:14:52 +01:00
Rodrigo Ramez Norambuena
6552157894 Remove white flash on boot up
When the electron app is started appear a white flash before show the
MagicMirror system.

This patch remove the white flash on boot up.
2017-01-04 13:06:24 -03:00
IgniparousTempest
af41e4892f Afrikaans language translation 2017-01-04 16:26:49 +02:00
Thomas Bachmann
09531b399a Fixed Link formatting in MD 2017-01-04 11:04:33 +01:00
Thomas Bachmann
6251b77b28 Fixed code formatting issues 2017-01-04 11:01:07 +01:00
Thomas Bachmann
0099b6d4a2 Added change to CHANGELOG.md 2017-01-04 10:56:03 +01:00
Thomas Bachmann
adb8de9754 Enabled newsfeed default module for gesture events from https://github.com/thobach/MMM-Gestures 2017-01-04 10:46:31 +01:00
Michael Teeuw
8ac8b666bf Update CHANGELOG.md 2017-01-04 08:59:37 +01:00
Michael Teeuw
095feddf73 Merge pull request #591 from qistoph/modloaded
Update CHANGELOG for the async loaded function
2017-01-04 08:58:53 +01:00
Chris van Marle
4882a801d2 Update CHANGELOG 2017-01-03 17:46:41 +01:00
Michael Teeuw
1a1736ca0e Merge pull request #588 from brosy/handle-newsfeed-errors
Add error handling to newsfeed
2017-01-03 11:43:26 +01:00
Ben Brosnahan
a7619771a6 Add error handling to newsfeed 2017-01-02 21:35:53 +00:00
Michael Teeuw
6febcf3b94 Merge pull request #556 from qistoph/modloaded
Add async callback to module when loaded
2017-01-02 13:37:16 +01:00
Chris van Marle
3947deb7bd Add async callback to module when loaded 2017-01-02 13:04:15 +01:00
Michael Teeuw
98855de71f Changes in preperation of 2.1.1 2016-12-31 21:25:49 +01:00
Olexandr Savchuk
980b8a2924 Added console warning for deprecated config options 2016-12-14 18:54:44 +01:00
176 changed files with 3476 additions and 28186 deletions

72
.dockerignore Normal file
View File

@@ -0,0 +1,72 @@
# Various Node ignoramuses.
logs
*.log
npm-debug.log*
pids
*.pid
*.seed
lib-cov
coverage
.grunt
.lock-wscript
build/Release
node_modules
jspm_modules
.npm
.node_repl_history
# Various Windows ignoramuses.
Thumbs.db
ehthumbs.db
Desktop.ini
$RECYCLE.BIN/
*.cab
*.msi
*.msm
*.msp
*.lnk
# Various OSX ignoramuses.
.DS_Store
.AppleDouble
.LSOverride
Icon
._*
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk
# Various Linux ignoramuses.
.fuse_hidden*
.directory
.Trash-*
# Various Magic Mirror ignoramuses and anti-ignoramuses.
# Don't ignore the node_helper core module.
!/modules/node_helper
!/modules/node_helper/**
# Ignore all modules except the default modules.
/modules/**
!/modules/default/**
# Ignore changes to the custom css files.
/css/custom.css
# Ignore unnecessary files for docker
CHANGELOG.md
LICENSE.md
README.md
Gruntfile.js
.*

View File

@@ -1,6 +1,6 @@
vendor/
vendor/*
!/vendor/vendor.js
!/modules/default/**
!/modules/node_helper
!/modules/node_helper/**
!/modules/default/defaultmodules.js
!/modules/default/defaultmodules.js

View File

@@ -1,6 +1,13 @@
> Please send your pull requests the develop branch.
> Don't forget to add the change to CHANGELOG.md.
**Note**: Sometimes the development moves very fast. It is highly
recommended that you update your branch of `develop` before creating a
pull request to send us your changes. This makes everyone's lives
easier (including yours) and helps us out on the development team.
Thanks!
* Does the pull request solve a **related** issue?
* If so, can you reference the issue?
* What does the pull request accomplish? Use a list if needed.

3
.gitignore vendored
View File

@@ -53,12 +53,13 @@ Temporary Items
# Various Magic Mirror ignoramuses and anti-ignoramuses.
# Don't ignore the node_helper nore module.
# Don't ignore the node_helper core module.
!/modules/node_helper
!/modules/node_helper/**
# Ignore all modules except the default modules.
/modules/**
!/modules/default
!/modules/default/**
!/modules/README.md**

View File

@@ -1,7 +1,16 @@
language: node_js
node_js:
- "7"
- "6"
- "5.1"
before_script:
- npm install grunt-cli -g
script: grunt
- "export DISPLAY=:99.0"
- "sh -e /etc/init.d/xvfb start"
- sleep 5
script:
- grunt
- npm test
cache:
directories:
- node_modules

View File

@@ -2,6 +2,80 @@
All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/).
## [2.1.1] - 2017-04-01
**Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`
### Changed
- Add `anytime` group for Compliments module.
- Compliments module can use remoteFile without default daytime arrays defined
- Installer: Use init config.js from config.js.sample.
- Switched out `rrule` package for `rrule-alt` and fixes in `ical.js` in order to fix calendar issues. ([#565](https://github.com/MichMich/MagicMirror/issues/565))
- Make mouse events pass through the region fullscreen_above to modules below.
- Scaled the splash screen down to make it a bit more subtle.
- Replace HTML tables with markdown tables in README files.
- Added `DAYAFTERTOMORROW`, `UPDATE_NOTIFICATION` and `UPDATE_NOTIFICATION_MODULE` to Finnish translations.
- Run `npm test` on Travis automatically
- Show the splash screen image even when is reboot or halted.
- Added some missing translaton strings in the sv.json file.
- Run task jsonlint to check translation files.
- Restructured Test Suite
### Added
- Added Docker support (Pull Request [#673](https://github.com/MichMich/MagicMirror/pull/673)).
- Calendar-specific support for `maximumEntries`, and ` maximumNumberOfDays`.
- Add loaded function to modules, providing an async callback.
- Made default newsfeed module aware of gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures)
- 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.
- Init tests using mocha.
- Option to use RegExp in Calendar's titleReplace.
- Hungarian Translation.
- Icelandic Translation.
- Add use a script to prevent when is run by SSH session set DISPLAY enviroment.
- Enable ability to set configuration file by the enviroment variable called MM_CONFIG_FILE.
- Option to give each calendar a different color.
- Option for colored min-temp and max-temp.
- Add test e2e helloworld.
- Add test e2e enviroment.
- Add `chai-as-promised` npm module to devDependencies.
- Basic set of tests for clock module.
- Run e2e test in Travis.
- Estonian Translation.
- Add test for compliments module for parts of day.
- Korean Translation.
- Added console warning on startup when deprecated config options are used.
- Add option to display temperature unit label to the current weather module.
- Added ability to disable wrapping of news items.
- Added in the ability to hide events in the calendar module based on simple string filters.
- Updated Norwegian translation.
- Added hideLoading option for News Feed module.
- Added configurable dateFormat to clock module.
- Added multiple calendar icon support.
- Added tests for Translations, dev argument, version, dev console.
- Added test anytime feature compliments module.
- Added test ipwhitelist configuration directive.
- Added test for calendar module: default, basic-auth, backward compability, fail-basic-auth.
- Added meta tags to support fullscreen mode on iOS (for server mode)
- Added `ignoreOldItems` and `ignoreOlderThan` options to the News Feed module
- Added test for MM_PORT enviroment variable.
- Added a configurable Week section to the clock module.
### Fixed
- Update .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))
- If units is set to imperial, the showRainAmount option of weatherforecast will show the correct unit.
- Module currentWeather: check if temperature received from api is defined.
- Fix an issue with module hidden status changing to `true` although lock string prevented showing it.
- Fix newsfeed module bug (removeStartTags)
- Fix when is set MM_PORT enviroment variable.
- Fixed missing animation on `this.show(speed)` when module is alone in a region.
## [2.1.0] - 2016-12-31
**Note:** This update uses new dependencies. Please update using the following command: `git pull && npm install`
@@ -118,7 +192,7 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
- Added reference to Italian Translation.
- Added the missing NE translation to all languages. [#334](https://github.com/MichMich/MagicMirror/issues/344)
- Added the missing NE translation to all languages. [#344](https://github.com/MichMich/MagicMirror/issues/344)
- Added proper User-Agent string to calendar call.
### Changed

19
Dockerfile Normal file
View File

@@ -0,0 +1,19 @@
FROM node:latest
RUN apt-get update && apt-get -y install dos2unix
WORKDIR /opt/magic_mirror
COPY . .
COPY /modules unmount_modules
COPY /config unmount_config
ENV NODE_ENV production
ENV MM_PORT 8080
RUN npm install
RUN ["dos2unix", "docker-entrypoint.sh"]
RUN ["chmod", "+x", "docker-entrypoint.sh"]
EXPOSE $MM_PORT
ENTRYPOINT ["/opt/magic_mirror/docker-entrypoint.sh"]

View File

@@ -7,8 +7,11 @@ module.exports = function(grunt) {
configFile: ".eslintrc.json"
},
target: ["js/*.js", "modules/default/*.js", "modules/default/*/*.js",
"serveronly/*.js", "*.js", "!modules/default/alert/notificationFx.js",
"!modules/default/alert/modernizr.custom.js", "!modules/default/alert/classie.js"
"serveronly/*.js", "*.js", "tests/*/*.js", "!modules/default/alert/notificationFx.js",
"!modules/default/alert/modernizr.custom.js", "!modules/default/alert/classie.js",
"config/*",
"translations/translations.js", "vendor/vendor.js"
]
},
stylelint: {
@@ -21,7 +24,9 @@ module.exports = function(grunt) {
},
jsonlint: {
main: {
src: ["package.json", ".eslintrc.json", ".stylelint"],
src: ["package.json", ".eslintrc.json", ".stylelintrc", "translations/*.json",
"modules/default/*/translations/*.json", "installers/pm2_MagicMirror.json",
"vendor/package.js"],
options: {
reporter: "jshint"
}

View File

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

View File

@@ -19,7 +19,7 @@ MagicMirror² focuses on a modular plugin system and uses [Electron](http://elec
- [Configuration](#configuration)
- [Modules](#modules)
- [Known Issues](#known-issues)
- [community](#community)
- [Community](#community)
- [Contributing Guidelines](#contributing-guidelines)
## Usage
@@ -37,7 +37,7 @@ curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installer
### Manual Installation
1. Download and install the latest Node.js version.
2. Clone the repository and check out the beta branch: `git clone https://github.com/MichMich/MagicMirror`
2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror`
3. Enter the repository: `cd ~/MagicMirror`
4. Install and run the app: `npm install && npm start`
@@ -46,8 +46,41 @@ curl -sL https://raw.githubusercontent.com/MichMich/MagicMirror/master/installer
**Note:** if you want to debug on Raspberry Pi you can use `npm start dev` which will start the MagicMirror app with Dev Tools enabled.
### Server Only
In some cases, you want to start the application without an actual app window. In this case, you can start MagicMirror² in server only mode by manually running `node serveronly` or using Docker. This will start the server, after which you can open the application in your browser of choice. Detailed description below.
In some cases, you want to start the application without an actual app window. In this case, execute the following command from the MagicMirror folder: `node serveronly`. This will start the server, after which you can open the application in your browser of choice.
#### Docker
MagicMirror² in server only mode can be deployed using [Docker](https://docker.com). After a successful [Docker installation](https://docs.docker.com/engine/installation/) you just need to execute the following command in the shell:
```bash
docker run -d \
--publish 80:8080 \
--restart always \
--volume ~/magic_mirror/config:/opt/magic_mirror/config \
--volume ~/magic_mirror/modules:/opt/magic_mirror/modules \
--name magic_mirror \
MichMich/MagicMirror
```
| **Volumes** | **Description** |
| --- | --- |
| `/opt/magic_mirror/config` | Mount this volume to insert your own config into the docker container. |
| `/opt/magic_mirror/modules` | Mount this volume to add your own custom modules into the docker container. |
You may need to add your Docker Host IP to your `ipWhitelist` option. If you have some issues setting up this configuration, check [this forum post](https://forum.magicmirror.builders/topic/1326/ipwhitelist-howto).
```javascript
var config = {
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:172.17.0.1"]
};
```
#### Manual
1. Download and install the latest Node.js version.
2. Clone the repository and check out the master branch: `git clone https://github.com/MichMich/MagicMirror`
3. Enter the repository: `cd ~/MagicMirror`
4. Install and run the app: `npm install && node serveronly`
### Raspberry Configuration & Auto Start.
@@ -68,7 +101,7 @@ Type `git status` to see your changes, if there are any, you can reset them with
## Configuration
1. Duplicate `config/config.js.sample` to `config/config.js`.
1. Duplicate `config/config.js.sample` to `config/config.js`. **Note:** If you used the installer script. This step is already done for you.
2. Modify your required settings.
The following properties can be configured:
@@ -77,13 +110,13 @@ The following properties can be configured:
| --- | --- |
| `port` | The port on which the MagicMirror² server will run on. The default value is `8080`. |
| `address` | The ip address the accept connections. The default open bind `::` is IPv6 is available or `0.0.0.0` IPv4 run on. Example config: `192.168.10.100`. |
| `ipWhitelist` | The list of IPs from which you are allowed to access the MagicMirror². The default value is `["127.0.0.1", "::ffff:127.0.0.1", "::1"]`. It is possible to specify IPs with subnet masks (`["127.0.0.1", "127.0.0.1/24"]`) or define ip ranges (`["127.0.0.1", ["192.168.0.1", "192.168.0.100"]]`).|
| `ipWhitelist` | The list of IPs from which you are allowed to access the MagicMirror². The default value is `["127.0.0.1", "::ffff:127.0.0.1", "::1"]`. It is possible to specify IPs with subnet masks (`["127.0.0.1", "127.0.0.1/24"]`) or define ip ranges (`["127.0.0.1", ["192.168.0.1", "192.168.0.100"]]`). Set `[]` to allow all IP addresses. For more information about how configure this directive see the [follow post ipWhitelist HowTo](https://forum.magicmirror.builders/topic/1326/ipwhitelist-howto) |
| `zoom` | This allows to scale the mirror contents with a given zoom factor. The default value is `1.0`|
| `language` | The language of the interface. (Note: Not all elements will be localized.) Possible values are `en`, `nl`, `ru`, `fr`, etc., but the default value is `en`. |
| `timeFormat` | The form of time notation that will be used. Possible values are `12` or `24`. The default is `24`. |
| `units` | The units that will be used in the default weather modules. Possible values are `metric` or `imperial`. The default is `metric`. |
| `modules` | An array of active modules. **The array must contain objects. See the next table below for more information.** |
| `electronOptions` | An optional array of Electron (browser) options. This allows configuration of e.g. the browser screen size and position (defaults `.width = 800` & `.height = 600`). Kiosk mode can be enabled by setting `.kiosk = true`, `.autoHideMenuBar = false`, `.fullscreen = false`. More options can be found [here](https://github.com/electron/electron/blob/master/docs/api/browser-window.md). |
| `electronOptions` | An optional array of Electron (browser) options. This allows configuration of e.g. the browser screen size and position (example: `electronOptions: { fullscreen: false, width: 800, height: 600 }`). Kiosk mode can be enabled by setting `kiosk = true`, `autoHideMenuBar = false` and `fullscreen = false`. More options can be found [here](https://github.com/electron/electron/blob/master/docs/api/browser-window.md). |
Module configuration:

View File

@@ -6,63 +6,63 @@
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], // Set [] to allow all IP addresses.
language: 'en',
language: "en",
timeFormat: 24,
units: 'metric',
units: "metric",
modules: [
{
module: 'alert',
module: "alert",
},
{
module: "updatenotification",
position: "top_bar"
},
{
module: 'clock',
position: 'top_left'
module: "clock",
position: "top_left"
},
{
module: 'calendar',
header: 'US Holidays',
position: 'top_left',
module: "calendar",
header: "US Holidays",
position: "top_left",
config: {
calendars: [
{
symbol: 'calendar-check-o ',
url: 'webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics'
symbol: "calendar-check-o ",
url: "webcal://www.calendarlabs.com/templates/ical/US-Holidays.ics"
}
]
}
},
{
module: 'compliments',
position: 'lower_third'
module: "compliments",
position: "lower_third"
},
{
module: 'currentweather',
position: 'top_right',
module: "currentweather",
position: "top_right",
config: {
location: 'New York',
locationID: '', //ID from http://www.openweathermap.org
appid: 'YOUR_OPENWEATHER_API_KEY'
location: "New York",
locationID: "", //ID from http://www.openweathermap.org/help/city_list.txt
appid: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: 'weatherforecast',
position: 'top_right',
header: 'Weather Forecast',
module: "weatherforecast",
position: "top_right",
header: "Weather Forecast",
config: {
location: 'New York',
locationID: '5128581', //ID from http://www.openweathermap.org
appid: 'YOUR_OPENWEATHER_API_KEY'
location: "New York",
locationID: "5128581", //ID from http://www.openweathermap.org/help/city_list.txt
appid: "YOUR_OPENWEATHER_API_KEY"
}
},
{
module: 'newsfeed',
position: 'bottom_bar',
module: "newsfeed",
position: "bottom_bar",
config: {
feeds: [
{
@@ -79,4 +79,4 @@ var config = {
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== 'undefined') {module.exports = config;}
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -1,6 +1,7 @@
html {
cursor: none;
overflow: hidden;
background: #000;
}
::-webkit-scrollbar {
@@ -121,6 +122,12 @@ sup {
margin-bottom: 0;
}
.no-wrap {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
/**
* Region Definitions.
*/
@@ -135,6 +142,11 @@ sup {
left: -60px;
right: -60px;
bottom: -60px;
pointer-events: none;
}
.region.fullscreen * {
pointer-events: auto;
}
.region.right {

11
docker-entrypoint.sh Normal file
View File

@@ -0,0 +1,11 @@
#!/bin/bash
if [ ! -f /opt/magic_mirror/modules ]; then
cp -R /opt/magic_mirror/unmount_modules/. /opt/magic_mirror/modules
fi
if [ ! -f /opt/magic_mirror/config ]; then
cp -R /opt/magic_mirror/unmount_config/. /opt/magic_mirror/config
fi
node serveronly

View File

@@ -4,6 +4,12 @@
<title>Magic Mirror</title>
<meta name="google" content="notranslate" />
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="format-detection" content="telephone=no">
<meta name="mobile-web-app-capable" content="yes">
<link rel="icon" href="data:;base64,iVBORw0KGgo=">
<link rel="stylesheet" type="text/css" href="css/main.css">
<link rel="stylesheet" type="text/css" href="fonts/roboto.css">
@@ -33,7 +39,7 @@
<div class="region fullscreen above"><div class="container"></div></div>
<script type="text/javascript" src="/socket.io/socket.io.js"></script>
<script type="text/javascript" src="js/defaults.js"></script>
<script type="text/javascript" src="config/config.js"></script>
<script type="text/javascript" src="#CONFIG_FILE#"></script>
<script type="text/javascript" src="vendor/vendor.js"></script>
<script type="text/javascript" src="modules/default/defaultmodules.js"></script>
<script type="text/javascript" src="js/logger.js"></script>

2
installers/mm.sh Executable file
View File

@@ -0,0 +1,2 @@
cd ~/MagicMirror
DISPLAY=:0 npm start

View File

@@ -0,0 +1,7 @@
{
"apps" : [{
"name" : "MagicMirror",
"script" : "/home/pi/MagicMirror/installers/mm.sh",
"watch" : ["/home/pi/MagicMirror/config/config.js"]
}]
}

View File

@@ -0,0 +1,2 @@
echo "\033[32mMagicMirror installation successful!"
exit 0

View File

@@ -21,10 +21,10 @@ echo -e "\e[0m"
# Define the tested version of Node.js.
NODE_TESTED="v5.1.0"
#Determine which Pi is running.
# Determine which Pi is running.
ARM=$(uname -m)
#Check the Raspberry Pi version.
# Check the Raspberry Pi version.
if [ "$ARM" != "armv7l" ]; then
echo -e "\e[91mSorry, your Raspberry Pi is not supported."
echo -e "\e[91mPlease run MagicMirror on a Raspberry Pi 2 or 3."
@@ -32,10 +32,14 @@ if [ "$ARM" != "armv7l" ]; then
exit;
fi
#define helper methods.
# Define helper methods.
function version_gt() { test "$(echo "$@" | tr " " "\n" | sort -V | head -n 1)" != "$1"; }
function command_exists () { type "$1" &> /dev/null ;}
# Update before first apt-get
echo -e "\e[96mUpdating packages ...\e[90m"
sudo apt-get update || echo -e "\e[91mUpdate failed, carrying on installation ...\e[90m"
# Installing helper tools
echo -e "\e[96mInstalling helper tools ...\e[90m"
sudo apt-get install curl wget git build-essential unzip || exit
@@ -52,8 +56,8 @@ if command_exists node; then
echo -e "\e[96mNode should be upgraded.\e[0m"
NODE_INSTALL=true
#Check if a node process is currenlty running.
#If so abort installation.
# Check if a node process is currenlty running.
# If so abort installation.
if pgrep "node" > /dev/null; then
echo -e "\e[91mA Node process is currently running. Can't upgrade."
echo "Please quit all Node processes and restart the installer."
@@ -74,9 +78,9 @@ if $NODE_INSTALL; then
echo -e "\e[96mInstalling Node.js ...\e[90m"
#Fetch the latest version of Node.js from the selected branch
#The NODE_STABLE_BRANCH variable will need to be manually adjusted when a new branch is released. (e.g. 7.x)
#Only tested (stable) versions are recommended as newer versions could break MagicMirror.
# Fetch the latest version of Node.js from the selected branch
# The NODE_STABLE_BRANCH variable will need to be manually adjusted when a new branch is released. (e.g. 7.x)
# Only tested (stable) versions are recommended as newer versions could break MagicMirror.
NODE_STABLE_BRANCH="6.x"
curl -sL https://deb.nodesource.com/setup_$NODE_STABLE_BRANCH | sudo -E bash -
@@ -84,7 +88,7 @@ if $NODE_INSTALL; then
echo -e "\e[92mNode.js installation Done!\e[0m"
fi
#Install magic mirror
# Install MagicMirror
cd ~
if [ -d "$HOME/MagicMirror" ] ; then
echo -e "\e[93mIt seems like MagicMirror is already installed."
@@ -113,6 +117,9 @@ else
exit;
fi
# Use sample config for start MagicMirror
cp config/config.js.sample config/config.js
# Check if plymouth is installed (default with PIXEL desktop environment), then install custom splashscreen.
echo -e "\e[96mCheck plymouth installation ...\e[0m"
if command_exists plymouth; then
@@ -141,6 +148,16 @@ else
echo -e "\e[93mplymouth is not installed.\e[0m";
fi
# Use pm2 control like a service MagicMirror
read -p "Do you want use pm2 for auto starting of your MagicMirror (y/n)?" choice
if [[ $choice =~ ^[Yy]$ ]]
then
sudo npm install -g pm2
sudo su -c "env PATH=$PATH:/usr/bin pm2 startup linux -u pi --hp /home/pi"
pm2 start ~/MagicMirror/installers/pm2_MagicMirror.json
pm2 save
fi
echo " "
echo -e "\e[92mWe're ready! Run \e[1m\e[97mDISPLAY=:0 npm start\e[0m\e[92m from the ~/MagicMirror directory to start your MagicMirror.\e[0m"
echo " "

103
js/app.js
View File

@@ -7,6 +7,7 @@
var fs = require("fs");
var Server = require(__dirname + "/server.js");
var Utils = require(__dirname + "/utils.js");
var defaultModules = require(__dirname + "/../modules/default/defaultmodules.js");
var path = require("path");
@@ -17,6 +18,16 @@ console.log("Starting MagicMirror: v" + global.version);
// global absolute root path
global.root_path = path.resolve(__dirname + "/../");
if (process.env.MM_CONFIG_FILE) {
global.configuration_file = process.env.MM_CONFIG_FILE;
}
// FIXME: Hotfix Pull Request
// https://github.com/MichMich/MagicMirror/pull/673
if (process.env.MM_PORT) {
global.mmPort = process.env.MM_PORT;
}
// The next part is here to prevent a major exception when there
// is no internet connection. This could probable be solved better.
process.on("uncaughtException", function (err) {
@@ -41,32 +52,58 @@ var App = function() {
var loadConfig = function(callback) {
console.log("Loading config ...");
var defaults = require(__dirname + "/defaults.js");
// For this check proposed to TestSuite
// https://forum.magicmirror.builders/topic/1456/test-suite-for-magicmirror/8
var configFilename = path.resolve(global.root_path + "/config/config.js");
if (typeof(global.configuration_file) !== "undefined") {
configFilename = path.resolve(global.configuration_file);
}
try {
fs.accessSync(configFilename, fs.F_OK);
var c = require(configFilename);
checkDeprecatedOptions(c);
var config = Object.assign(defaults, c);
callback(config);
} catch (e) {
if (e.code == "ENOENT") {
console.error("WARNING! Could not find config file. Please create one. Starting with default configuration.");
callback(defaults);
console.error(Utils.colors.error("WARNING! Could not find config file. Please create one. Starting with default configuration."));
} else if (e instanceof ReferenceError || e instanceof SyntaxError) {
console.error("WARNING! Could not validate config file. Please correct syntax errors. Starting with default configuration.");
callback(defaults);
console.error(Utils.colors.error("WARNING! Could not validate config file. Please correct syntax errors. Starting with default configuration."));
} else {
console.error("WARNING! Could not load config file. Starting with default configuration. Error found: " + e);
callback(defaults);
console.error(Utils.colors.error("WARNING! Could not load config file. Starting with default configuration. Error found: " + e));
}
callback(defaults);
}
};
var checkDeprecatedOptions = function(userConfig) {
var deprecated = require(global.root_path + "/js/deprecated.js");
var deprecatedOptions = deprecated.configs;
var usedDeprecated = [];
deprecatedOptions.forEach(function(option) {
if (userConfig.hasOwnProperty(option)) {
usedDeprecated.push(option);
}
});
if (usedDeprecated.length > 0) {
console.warn(Utils.colors.warn(
"WARNING! Your config is using deprecated options: " +
usedDeprecated.join(", ") +
". Check README and CHANGELOG for more up-to-date ways of getting the same functionality.")
);
}
}
/* loadModule(module)
* Loads a specific module.
*
* argument module string - The name of the module (including subpath).
*/
var loadModule = function(module) {
var loadModule = function(module, callback) {
var elements = module.split("/");
var moduleName = elements[elements.length - 1];
@@ -103,6 +140,10 @@ var App = function() {
m.setName(moduleName);
m.setPath(path.resolve(moduleFolder));
nodeHelpers.push(m);
m.loaded(callback);
} else {
callback();
}
};
@@ -111,14 +152,24 @@ var App = function() {
*
* argument module string - The name of the module (including subpath).
*/
var loadModules = function(modules) {
var loadModules = function(modules, callback) {
console.log("Loading module helpers ...");
for (var m in modules) {
loadModule(modules[m]);
}
var loadNextModule = function() {
if (modules.length > 0) {
var nextModule = modules[0];
loadModule(nextModule, function() {
modules = modules.slice(1);
loadNextModule();
});
} else {
// All modules are loaded
console.log("All module helpers loaded.");
callback();
}
};
console.log("All module helpers loaded.");
loadNextModule();
};
/* cmpVersions(a,b)
@@ -164,24 +215,24 @@ var App = function() {
}
}
loadModules(modules);
loadModules(modules, function() {
var server = new Server(config, function(app, io) {
console.log("Server started ...");
var server = new Server(config, function(app, io) {
console.log("Server started ...");
for (var h in nodeHelpers) {
var nodeHelper = nodeHelpers[h];
nodeHelper.setExpressApp(app);
nodeHelper.setSocketIO(io);
nodeHelper.start();
}
for (var h in nodeHelpers) {
var nodeHelper = nodeHelpers[h];
nodeHelper.setExpressApp(app);
nodeHelper.setSocketIO(io);
nodeHelper.start();
}
console.log("Sockets connected & modules started ...");
console.log("Sockets connected & modules started ...");
if (typeof callback === "function") {
callback(config);
}
if (typeof callback === "function") {
callback(config);
}
});
});
});
};

View File

@@ -7,8 +7,12 @@
* MIT Licensed.
*/
var port = 8080;
if (typeof(mmPort) !== "undefined") {
port = mmPort;
}
var defaults = {
port: 8080,
port: port,
kioskmode: false,
electronOptions: {},
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],

14
js/deprecated.js Normal file
View File

@@ -0,0 +1,14 @@
/* Magic Mirror Deprecated Config Options List
*
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.
*
* Olex S. original idea this deprecated option
*/
var deprecated = {
configs: ["kioskmode"],
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = deprecated;}

View File

@@ -28,7 +28,8 @@ function createWindow() {
webPreferences: {
nodeIntegration: false,
zoomFactor: config.zoom
}
},
backgroundColor: "#000000"
}
// DEPRECATED: "kioskmode" backwards compatibility, to be removed

View File

@@ -186,6 +186,11 @@ var Loader = (function() {
script.onload = function() {
if (typeof callback === "function") {callback();}
};
script.onerror = function() {
console.error("Error on loading script:", fileName);
if (typeof callback === "function") {callback();}
};
document.getElementsByTagName("body")[0].appendChild(script);
break;
case "css":
@@ -197,6 +202,11 @@ var Loader = (function() {
stylesheet.onload = function() {
if (typeof callback === "function") {callback();}
};
stylesheet.onerror = function() {
console.error("Error on loading stylesheet:", fileName);
if (typeof callback === "function") {callback();}
};
document.getElementsByTagName("head")[0].appendChild(stylesheet);
break;
}

View File

@@ -66,7 +66,7 @@ var MM = (function() {
var classes = position.replace("_"," ");
var parentWrapper = document.getElementsByClassName(classes);
if (parentWrapper.length > 0) {
var wrapper = parentWrapper[0].getElementsByClassName("container");
var wrapper = parentWrapper[0].getElementsByClassName("container");
if (wrapper.length > 0) {
return wrapper[0];
}
@@ -232,6 +232,8 @@ var MM = (function() {
return;
}
module.hidden = false;
// If forced show, clean current lockstrings.
if (module.lockStrings.length !== 0 && options.force === true) {
Log.log("Force show of module: " + module.name);
@@ -243,10 +245,13 @@ var MM = (function() {
moduleWrapper.style.transition = "opacity " + speed / 1000 + "s";
// Restore the postition. See hideModule() for more info.
moduleWrapper.style.position = "static";
moduleWrapper.style.opacity = 1;
updateWrapperStates();
// Waiting for DOM-changes done in updateWrapperStates before we can start the animation.
var dummy = moduleWrapper.parentElement.parentElement.offsetHeight;
moduleWrapper.style.opacity = 1;
clearTimeout(module.showHideTimer);
module.showHideTimer = setTimeout(function() {
if (typeof callback === "function") { callback(); }
@@ -306,43 +311,36 @@ var MM = (function() {
var setSelectionMethodsForModules = function(modules) {
/* withClass(className)
* filters a collection of modules based on classname(s).
* calls modulesByClass to filter modules with the specified classes.
*
* argument className string/array - one or multiple classnames. (array or space divided)
*
* return array - Filtered collection of modules.
*/
var withClass = function(className) {
var searchClasses = className;
if (typeof className === "string") {
searchClasses = className.split(" ");
}
var newModules = modules.filter(function(module) {
var classes = module.data.classes.toLowerCase().split(" ");
for (var c in searchClasses) {
var searchClass = searchClasses[c];
if (classes.indexOf(searchClass.toLowerCase()) !== -1) {
return true;
}
}
return false;
});
setSelectionMethodsForModules(newModules);
return newModules;
return modulesByClass(className, true);
};
/* exceptWithClass(className)
* filters a collection of modules based on classname(s). (NOT)
* calls modulesByClass to filter modules without the specified classes.
*
* argument className string/array - one or multiple classnames. (array or space divided)
*
* return array - Filtered collection of modules.
*/
var exceptWithClass = function(className) {
return modulesByClass(className, false);
};
/* modulesByClass(className, include)
* filters a collection of modules based on classname(s).
*
* argument className string/array - one or multiple classnames. (array or space divided)
* argument include boolean - if the filter should include or exclude the modules with the specific classes.
*
* return array - Filtered collection of modules.
*/
var modulesByClass = function(className, include) {
var searchClasses = className;
if (typeof className === "string") {
searchClasses = className.split(" ");
@@ -354,11 +352,11 @@ var MM = (function() {
for (var c in searchClasses) {
var searchClass = searchClasses[c];
if (classes.indexOf(searchClass.toLowerCase()) !== -1) {
return false;
return include;
}
}
return true;
return !include;
});
setSelectionMethodsForModules(newModules);
@@ -504,7 +502,7 @@ var MM = (function() {
* argument options object - Optional settings for the hide method.
*/
showModule: function(module, speed, callback, options) {
module.hidden = false;
// do not change module.hidden yet, only if we really show it later
showModule(module, speed, callback, options);
}
};

View File

@@ -203,22 +203,7 @@ var Module = Class.extend({
* argument callback function - Function called when done.
*/
loadStyles: function (callback) {
var self = this;
var styles = this.getStyles();
var loadNextStyle = function () {
if (styles.length > 0) {
var nextStyle = styles[0];
Loader.loadFile(nextStyle, self, function () {
styles = styles.slice(1);
loadNextStyle();
});
} else {
callback();
}
};
loadNextStyle();
this.loadDependencies("getStyles", callback);
},
/* loadScripts()
@@ -227,22 +212,32 @@ var Module = Class.extend({
* argument callback function - Function called when done.
*/
loadScripts: function (callback) {
var self = this;
var scripts = this.getScripts();
this.loadDependencies("getScripts", callback);
},
var loadNextScript = function () {
if (scripts.length > 0) {
var nextScript = scripts[0];
Loader.loadFile(nextScript, self, function () {
scripts = scripts.slice(1);
loadNextScript();
/* loadDependencies(funcName, callback)
* Helper method to load all dependencies.
*
* argument funcName string - Function name to call to get scripts or styles.
* argument callback function - Function called when done.
*/
loadDependencies: function (funcName, callback) {
var self = this;
var dependencies = this[funcName]();
var loadNextDependency = function () {
if (dependencies.length > 0) {
var nextDependency = dependencies[0];
Loader.loadFile(nextDependency, self, function () {
dependencies = dependencies.slice(1);
loadNextDependency();
});
} else {
callback();
}
};
loadNextScript();
loadNextDependency();
},
/* loadScripts()
@@ -415,3 +410,11 @@ Module.register = function (name, moduleDefinition) {
Log.log("Module registered: " + name);
Module.definitions[name] = moduleDefinition;
};
if (typeof exports != "undefined") { // For testing purpose only
// A good a idea move the function cmpversions a helper file.
// It's used into other side.
exports._test = {
cmpVersions: cmpVersions
}
}

View File

@@ -15,9 +15,20 @@ var fs = require("fs");
var helmet = require("helmet");
var Server = function(config, callback) {
console.log("Starting server op port " + config.port + " ... ");
console.log("Starting server on port " + config.port + " ... ");
server.listen(config.port, config.address ? config.address : null);
var port = config.port;
if (process.env.MM_PORT) {
port = process.env.MM_PORT;
}
console.log("Starting server op port " + port + " ... ");
server.listen(port, config.address ? config.address : null);
if (config.ipWhitelist instanceof Array && config.ipWhitelist.length == 0) {
console.info("You're using a full whitelist configuration to allow for all IPs")
}
app.use(function(req, res, next) {
var result = ipfilter(config.ipWhitelist, {mode: "allow", log: false})(req, res, function(err) {
@@ -31,12 +42,12 @@ var Server = function(config, callback) {
app.use(helmet());
app.use("/js", express.static(__dirname));
app.use("/config", express.static(path.resolve(global.root_path + "/config")));
app.use("/css", express.static(path.resolve(global.root_path + "/css")));
app.use("/fonts", express.static(path.resolve(global.root_path + "/fonts")));
app.use("/modules", express.static(path.resolve(global.root_path + "/modules")));
app.use("/vendor", express.static(path.resolve(global.root_path + "/vendor")));
app.use("/translations", express.static(path.resolve(global.root_path + "/translations")));
var directories = ["/config", "/css", "/fonts", "/modules", "/vendor", "/translations", "/tests/configs"];
var directory;
for (i in directories) {
directory = directories[i];
app.use(directory, express.static(path.resolve(global.root_path + directory)));
}
app.get("/version", function(req,res) {
res.send(global.version);
@@ -46,6 +57,12 @@ var Server = function(config, callback) {
var html = fs.readFileSync(path.resolve(global.root_path + "/index.html"), {encoding: "utf8"});
html = html.replace("#VERSION#", global.version);
configFile = "config/config.js";
if (typeof(global.configuration_file) !== "undefined") {
configFile = global.configuration_file;
}
html = html.replace("#CONFIG_FILE#", configFile);
res.send(html);
});

18
js/utils.js Normal file
View File

@@ -0,0 +1,18 @@
/* exported Utils */
/* Magic Mirror
* Utils
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var colors = require("colors/safe");
var Utils = {
colors: {
warn: colors.yellow,
error: colors.red
}
};
if (typeof module !== "undefined") {module.exports = Utils;}

View File

@@ -96,6 +96,21 @@ requiresVersion: "2.1.0",
####`init()`
This method is called when a module gets instantiated. In most cases you do not need to subclass this method.
####`loaded(callback)`
*Introduced in version: 2.1.1.*
This method is called when a module is loaded. Subsequent modules in the config are not yet loaded. The `callback` function MUST be called when the module is done loading. In most cases you do not need to subclass this method.
**Example:**
````javascript
loaded: function(callback) {
this.finishLoading();
Log.log(this.name + ' is loaded!');
callback();
}
````
####`start()`
This method is called when all modules are loaded an the system is ready to boot up. Keep in mind that the dom object for the module is not yet created. The start method is a perfect place to define any additional module properties:

View File

@@ -7,10 +7,10 @@ To use this module, add it to the modules array in the config/config.js file:
```
modules: [
{
module: 'alert',
module: "alert",
config: {
// The config property is optional.
// See 'Configuration options' for more information.
// See 'Configuration options' for more information.
}
}
]
@@ -21,144 +21,43 @@ modules: [
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>effect</code></td>
<td>The animation effect to use for notifications.<br>
<br><b>Possible values:</b> <code>scale</code> <code>slide</code> <code>genie</code> <code>jelly</code> <code>flip</code> <code>exploader</code> <code>bouncyflip</code>
<br><b>Default value:</b> <code>slide</code>
</td>
</tr>
<td><code>alert_effect</code></td>
<td>The animation effect to use for alerts.<br>
<br><b>Possible values:</b> <code>scale</code> <code>slide</code> <code>genie</code> <code>jelly</code> <code>flip</code> <code>exploader</code> <code>bouncyflip</code>
<br><b>Default value:</b> <code>jelly</code>
</td>
</tr>
<tr>
<td><code>display_time</code></td>
<td>Time a notification is displayed in milliseconds.<br>
<br><b>Possible values:</b> <code>int</code>
<br><b>Default value:</b> <code>3500</code>
</td>
</tr>
<tr>
<tr>
<td><code>position</code></td>
<td>Position where the notifications should be displayed.<br>
<br><b>Possible values:</b> <code>left</code> <code>center</code> <code>right</code>
<br><b>Default value:</b> <code>center</code>
</td>
</tr>
<tr>
<td><code>welcome_message</code></td>
<td>Message shown at startup.<br>
<br><b>Possible values:</b> <code>string</code> <code>false</code>
<br><b>Default value:</b> <code>false</code> (no message at startup)
</td>
</tr>
</tbody>
</table>
| Option | Description
| ----------------- | -----------
| `effect` | The animation effect to use for notifications. <br><br> **Possible values:** `scale` `slide` `genie` `jelly` `flip` `exploader` `bouncyflip` <br> **Default value:** `slide`
| `alert_effect` | The animation effect to use for alerts. <br><br> **Possible values:** `scale` `slide` `genie` `jelly` `flip` `exploader` `bouncyflip` <br> **Default value:** `jelly`
| `display_time` | Time a notification is displayed in milliseconds. <br><br> **Possible values:** `int` <br> **Default value:** `3500`
| `position` | Position where the notifications should be displayed. <br><br> **Possible values:** `left` `center` `right` <br> **Default value:** `center`
| `welcome_message` | Message shown at startup. <br><br> **Possible values:** `string` `false` <br> **Default value:** `false` (no message at startup)
## Developer notes
For notifications use:
```
self.sendNotification("SHOW_ALERT", {type: "notification"});
self.sendNotification("SHOW_ALERT", {type: "notification"});
```
For alerts use:
```
self.sendNotification("SHOW_ALERT", {});
self.sendNotification("SHOW_ALERT", {});
```
### Notification params
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>title</code></td>
<td>The title of the notification.<br>
<br><b>Possible values:</b> <code>text</code> or <code>html</code>
</td>
</tr>
<tr>
<td><code>message</code></td>
<td>The message of the notification.<br>
<br><b>Possible values:</b> <code>text</code> or <code>html</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| --------- | -----------
| `title` | The title of the notification. <br><br> **Possible values:** `text` or `html`
| `message` | The message of the notification. <br><br> **Possible values:** `text` or `html`
### Alert params
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>title</code></td>
<td>The title of the alert.<br>
<br><b>Possible values:</b> <code>text</code> or <code>html</code>
</td>
</tr>
<tr>
<td><code>message</code></td>
<td>The message of the alert.<br>
<br><b>Possible values:</b> <code>text</code> or <code>html</code>
</td>
</tr>
<tr>
<td><code>imageUrl</code> (optional)</td>
<td>Image to show in the alert<br>
<br><b>Possible values:</b> <code>url</code> <code>path</code>
<br><b>Default value:</b> <code>none</code>
</td>
</tr>
<tr>
<td><code>imageFA</code> (optional)</td>
<td>Font Awesome icon to show in the alert<br>
<br><b>Possible values:</b> See <a href="http://fontawesome.io/icons/" target="_blank">Font Awsome</a> website.
<br><b>Default value:</b> <code>none</code>
</td>
</tr>
<tr>
<td><code>imageHeight</code> (optional even with imageUrl set)</td>
<td>Height of the image<br>
<br><b>Possible values:</b> <code>intpx</code>
<br><b>Default value:</b> <code>80px</code>
</td>
</tr>
<tr>
<td><code>timer</code> (optional)</td>
<td>How long the alert should stay visible in ms.
<br><b>Important:</b> If you do not use the <code>timer</code>, it is your duty to hide the alert by using <code>self.sendNotification("HIDE_ALERT");</code>!<br>
<br><b>Possible values:</b> <code>int</code> <code>float</code>
<br><b>Default value:</b> <code>none</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| ----------------------------------------------- | -----------
| `title` | The title of the alert. <br><br> **Possible values:** `text` or `html`
| `message` | The message of the alert. <br><br> **Possible values:** `text` or `html`
| `imageUrl` (optional) | Image to show in the alert <br><br> **Possible values:** `url` `path` <br> **Default value:** `none`
| `imageFA` (optional) | Font Awesome icon to show in the alert <br><br> **Possible values:** See [Font Awsome](http://fontawesome.io/icons/) website. <br> **Default value:** `none`
| `imageHeight` (optional even with imageUrl set) | Height of the image <br><br> **Possible values:** `intpx` <br> **Default value:** `80px`
| `timer` (optional) | How long the alert should stay visible in ms. <br> **Important:** If you do not use the `timer`, it is your duty to hide the alert by using `self.sendNotification("HIDE_ALERT");`! <br><br>**Possible values:** `int` `float` <br> **Default value:** `none`
## Open Source Licenses
###[NotificationStyles](https://github.com/codrops/NotificationStyles)

View File

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

View File

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

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'calendar',
position: 'top_left', // This can be any of the regions. Best results in left or right regions.
module: "calendar",
position: "top_left", // This can be any of the regions. Best results in left or right regions.
config: {
// The config property is optional.
// If no config is set, an example calendar is shown.
@@ -24,206 +24,66 @@ modules: [
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>maximumEntries</code></td>
<td>The maximum number of events shown.<br>
<br><b>Possible values:</b> <code>0</code> - <code>100</code>
<br><b>Default value:</b> <code>10</code>
</td>
</tr>
<tr>
<td><code>maximumNumberOfDays</code></td>
<td>The maximum number of days in the future.<br>
<br><b>Default value:</b> <code>365</code>
</td>
</tr>
<tr>
<td><code>displaySymbol</code></td>
<td>Display a symbol in front of an entry.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>defaultSymbol</code></td>
<td>The default symbol.<br>
<br><b>Possible values:</b> See <a href="http://fontawesome.io/icons/" target="_blank">Font Awsome</a> website.
<br><b>Default value:</b> <code>calendar</code>
</td>
</tr>
<tr>
<td><code>maxTitleLength</code></td>
<td>The maximum title length.<br>
<br><b>Possible values:</b> <code>10</code> - <code>50</code>
<br><b>Default value:</b> <code>25</code>
</td>
</tr>
<tr>
<td><code>fetchInterval</code></td>
<td>How often does the content needs to be fetched? (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>86400000</code>
<br><b>Default value:</b> <code>300000</code> (5 minutes)
</td>
</tr>
<tr>
<td><code>animationSpeed</code></td>
<td>Speed of the update animation. (Milliseconds)<br>
<br><b>Possible values:</b><code>0</code> - <code>5000</code>
<br><b>Default value:</b> <code>2000</code> (2 seconds)
</td>
</tr>
<tr>
<td><code>fade</code></td>
<td>Fade the future events to black. (Gradient)<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>fadePoint</code></td>
<td>Where to start fade?<br>
<br><b>Possible values:</b> <code>0</code> (top of the list) - <code>1</code> (bottom of list)
<br><b>Default value:</b> <code>0.25</code>
</td>
</tr>
<tr>
<td><code>calendars</code></td>
<td>The list of calendars.<br>
<br><b>Possible values:</b> An array, see <i>calendar configuration</i> below.
<br><b>Default value:</b> <i>An example calendar.</i>
</td>
</tr>
<tr>
<td><code>titleReplace</code></td>
<td>An object of textual replacements applied to the tile of the event. This allow to remove or replace certains words in the title.<br>
<br><b>Example:</b> <br>
<code>
titleReplace: {'Birthday of ' : '', 'foo':'bar'}
</code>
<br><b>Default value:</b>
<code>
{
"De verjaardag van ": "",
"'s birthday": ""
}
</code>
</td>
</tr>
<tr>
<td><code>displayRepeatingCountTitle</code></td>
<td>Show count title for yearly repeating events (e.g. "X. Birthday", "X. Anniversary")<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>dateFormat</code></td>
<td>Format to use for the date of events (when using absolute dates)<br>
<br><b>Possible values:</b> See <a href="http://momentjs.com/docs/#/parsing/string-format/">Moment.js formats</a>
<br><b>Default value:</b> <code>MMM Do</code> (e.g. Jan 18th)
</td>
</tr>
<tr>
<td><code>timeFormat</code></td>
<td>Display event times as absolute dates, or relative time<br>
<br><b>Possible values:</b> <code>absolute</code> or <code>relative</code>
<br><b>Default value:</b> <code>relative</code>
</td>
</tr>
<tr>
<td><code>getRelative</code></td>
<td>How much time (in hours) should be left until calendar events start getting relative?<br>
<br><b>Possible values:</b> <code>0</code> (events stay absolute) - <code>48</code> (48 hours before the event starts)
<br><b>Default value:</b> <code>6</code>
</td>
</tr>
<tr>
<td><code>urgency</code></td>
<td>When using a timeFormat of <code>absolute</code>, the <code>urgency</code> setting allows you to display events within a specific time frame as <code>relative</code>
This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates<br>
<br><b>Possible values:</b> a positive integer representing the number of days for which you want a relative date, for example <code>7</code> (for 7 days)<br>
<br><b>Default value:</b> <code>7</code>
</td>
</tr>
<tr>
<td><code>broadcastEvents</code></td>
<td>If this property is set to true, the calendar will broadcast all the events to all other modules with the notification message: <code>CALENDAR_EVENTS</code>. The event objects are stored in an array and contain the following fields: <code>title</code>, <code>startDate</code>, <code>endDate</code>, <code>fullDayEvent</code>, <code>location</code> and <code>geo</code>.<br>
<br><b>Possible values:</b> <code>true</code>, <code>false</code> <br>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>hidePrivate</code></td>
<td>Hides private calendar events.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| ---------------------------- | -----------
| `maximumEntries` | The maximum number of events shown. / **Possible values:** `0` - `100` <br> **Default value:** `10`
| `maximumNumberOfDays` | The maximum number of days in the future. <br><br> **Default value:** `365`
| `displaySymbol` | Display a symbol in front of an entry. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `defaultSymbol` | The default symbol. <br><br> **Possible values:** See [Font Awsome](http://fontawesome.io/icons/) website. <br> **Default value:** `calendar`
| `maxTitleLength` | The maximum title length. <br><br> **Possible values:** `10` - `50` <br> **Default value:** `25`
| `fetchInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `300000` (5 minutes)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2000` (2 seconds)
| `fade` | Fade the future events to black. (Gradient) <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `fadePoint` | Where to start fade? <br><br> **Possible values:** `0` (top of the list) - `1` (bottom of list) <br> **Default value:** `0.25`
| `calendars` | The list of calendars. <br><br> **Possible values:** An array, see _calendar configuration_ below. <br> **Default value:** _An example calendar._
| `titleReplace` | An object of textual replacements applied to the tile of the event. This allow to remove or replace certains words in the title. <br><br> **Example:** `{'Birthday of ' : '', 'foo':'bar'}` <br> **Default value:** `{ "De verjaardag van ": "", "'s birthday": "" }`
| `displayRepeatingCountTitle` | Show count title for yearly repeating events (e.g. "X. Birthday", "X. Anniversary") <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `dateFormat` | Format to use for the date of events (when using absolute dates) <br><br> **Possible values:** See [Moment.js formats](http://momentjs.com/docs/#/parsing/string-format/) <br> **Default value:** `MMM Do` (e.g. Jan 18th)
| `timeFormat` | Display event times as absolute dates, or relative time <br><br> **Possible values:** `absolute` or `relative` <br> **Default value:** `relative`
| `getRelative` | How much time (in hours) should be left until calendar events start getting relative? <br><br> **Possible values:** `0` (events stay absolute) - `48` (48 hours before the event starts) <br> **Default value:** `6`
| `urgency` | When using a timeFormat of `absolute`, the `urgency` setting allows you to display events within a specific time frame as `relative`. This allows events within a certain time frame to be displayed as relative (in xx days) while others are displayed as absolute dates <br><br> **Possible values:** a positive integer representing the number of days for which you want a relative date, for example `7` (for 7 days) <br><br> **Default value:** `7`
| `broadcastEvents` | If this property is set to true, the calendar will broadcast all the events to all other modules with the notification message: `CALENDAR_EVENTS`. The event objects are stored in an array and contain the following fields: `title`, `startDate`, `endDate`, `fullDayEvent`, `location` and `geo`. <br><br> **Possible values:** `true`, `false` <br><br> **Default value:** `true`
| `hidePrivate` | Hides private calendar events. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `excludedEvents` | An array of words / phrases from event titles that will be excluded from being shown. <br><br> **Example:** `['Birthday', 'Hide This Event']` <br> **Default value:** `[]`
### Calendar configuration
The `calendars` property contains an array of the configured calendars.
The `colored` property gives the option for an individual color for each calendar.
#### Default value:
````javascript
config: {
colored: false,
calendars: [
{
url: 'http://www.calendarlabs.com/templates/ical/US-Holidays.ics',
symbol: 'calendar',
auth: {
user: 'username',
pass: 'superstrongpassword',
method: 'basic'
}
},
],
}
````
#### Calendar configuration options:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>url</code></td>
<td>The url of the calendar .ical. This property is required.<br>
<br><b>Possible values:</b> Any public accessble .ical calendar.
</td>
</tr>
<tr>
<td><code>symbol</code></td>
<td>The symbol to show in front of an event. This property is optional.<br>
<br><b>Possible values:</b> See <a href="http://fontawesome.io/icons/" target="_blank">Font Awesome</a> website.
</td>
</tr>
<tr>
<td><code>repeatingCountTitle</code></td>
<td>The count title for yearly repating events in this calendar. <br>
<br><b>Example:</b> <br>
<code>'Birthday'</code>
</td>
</tr>
<tr>
<td><code>user</code></td>
<td>The username for HTTP Basic authentication.</td>
</tr>
<tr>
<td><code>pass</code></td>
<td>The password for HTTP Basic authentication.</td>
</tr>
</tbody>
</table>
| Option | Description
| --------------------- | -----------
| `url` | The url of the calendar .ical. This property is required. <br><br> **Possible values:** Any public accessble .ical calendar.
| `symbol` | The symbol to show in front of an event. This property is optional. <br><br> **Possible values:** See [Font Awesome](http://fontawesome.io/icons/) website. To have multiple symbols you can define them in an array e.g. `["calendar", "plane"]`
| `color` | The font color of an event from this calendar. This property should be set if the config is set to colored: true. <br><br> **Possible values:** HEX, RGB or RGBA values (#efefef, rgb(242,242,242), rgba(242,242,242,0.5)).
| `repeatingCountTitle` | The count title for yearly repating events in this calendar. <br><br> **Example:** `'Birthday'`
| `maximumEntries` | The maximum number of events shown. Overrides global setting. **Possible values:** `0` - `100`
| `maximumNumberOfDays` | The maximum number of days in the future. Overrides global setting
| `auth` | The object containing options for authentication against the calendar.
#### Calendar authentication options:
| Option | Description
| --------------------- | -----------
| `user` | The username for HTTP authentication.
| `pass` | The password for HTTP authentication. (If you use Bearer authentication, this should be your BearerToken.)
| `method` | Which authentication method should be used. HTTP Basic, Digest and Bearer authentication methods are supported. Basic authentication is used by default if this option is omitted. **Possible values:** `digest`, `basic`, `bearer` **Default value:** `basic`

View File

@@ -27,6 +27,7 @@ Module.register("calendar", {
getRelative: 6,
fadePoint: 0.25, // Start on 1/4th of the list.
hidePrivate: false,
colored: false,
calendars: [
{
symbol: "calendar",
@@ -37,7 +38,8 @@ Module.register("calendar", {
"De verjaardag van ": "",
"'s birthday": ""
},
broadcastEvents: true
broadcastEvents: true,
excludedEvents: []
},
// Define required scripts.
@@ -52,8 +54,8 @@ Module.register("calendar", {
// Define required translations.
getTranslations: function () {
// The translations for the defaut modules are defined in the core translation files.
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
// 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;
},
@@ -68,7 +70,21 @@ Module.register("calendar", {
for (var c in this.config.calendars) {
var calendar = this.config.calendars[c];
calendar.url = calendar.url.replace("webcal://", "http://");
this.addCalendar(calendar.url, calendar.user, calendar.pass);
var calendarConfig = {
maximumEntries: calendar.maximumEntries,
maximumNumberOfDays: calendar.maximumNumberOfDays
};
// we check user and password here for backwards compatibility with old configs
if(calendar.user && calendar.pass){
calendar.auth = {
user: calendar.user,
pass: calendar.pass
}
}
this.addCalendar(calendar.url, calendar.auth, calendarConfig);
}
this.calendarData = {};
@@ -113,15 +129,43 @@ Module.register("calendar", {
for (var e in events) {
var event = events[e];
var excluded = false;
for (var f in this.config.excludedEvents) {
var filter = this.config.excludedEvents[f];
if (event.title.toLowerCase().includes(filter.toLowerCase())) {
excluded = true;
break;
}
}
if (excluded) {
continue;
}
var eventWrapper = document.createElement("tr");
if (this.config.colored) {
eventWrapper.style.cssText = "color:" + this.colorForUrl(event.url);
}
eventWrapper.className = "normal";
if (this.config.displaySymbol) {
var symbolWrapper = document.createElement("td");
symbolWrapper.className = "symbol";
var symbol = document.createElement("span");
symbol.className = "fa fa-" + this.symbolForUrl(event.url);
symbolWrapper.appendChild(symbol);
symbolWrapper.className = "symbol align-right";
var symbols = this.symbolsForUrl(event.url);
if(typeof symbols === "string") {
symbols = [symbols];
}
for(var i = 0; i < symbols.length; i++) {
var symbol = document.createElement("span");
symbol.className = "fa fa-" + symbols[i];
if(i > 0){
symbol.style.paddingLeft = "5px";
}
symbolWrapper.appendChild(symbol);
}
eventWrapper.appendChild(symbolWrapper);
}
@@ -142,7 +186,13 @@ Module.register("calendar", {
}
titleWrapper.innerHTML = this.titleTransform(event.title) + repeatingCountTitle;
titleWrapper.className = "title bright";
if (!this.config.colored) {
titleWrapper.className = "title bright";
} else {
titleWrapper.className = "title";
}
eventWrapper.appendChild(titleWrapper);
var timeWrapper = document.createElement("td");
@@ -244,7 +294,7 @@ Module.register("calendar", {
/* hasCalendarURL(url)
* Check if this config contains the calendar url.
*
* argument url sting - Url to look for.
* argument url string - Url to look for.
*
* return bool - Has calendar url
*/
@@ -273,8 +323,8 @@ Module.register("calendar", {
var event = calendar[e];
if(this.config.hidePrivate) {
if(event.class === "PRIVATE") {
// do not add the current event, skip it
continue;
// do not add the current event, skip it
continue;
}
}
event.url = c;
@@ -293,60 +343,77 @@ Module.register("calendar", {
/* createEventList(url)
* Requests node helper to add calendar url.
*
* argument url sting - Url to add.
* argument url string - Url to add.
*/
addCalendar: function (url, user, pass) {
addCalendar: function (url, auth, calendarConfig) {
this.sendSocketNotification("ADD_CALENDAR", {
url: url,
maximumEntries: this.config.maximumEntries,
maximumNumberOfDays: this.config.maximumNumberOfDays,
maximumEntries: calendarConfig.maximumEntries || this.config.maximumEntries,
maximumNumberOfDays: calendarConfig.maximumNumberOfDays || this.config.maximumNumberOfDays,
fetchInterval: this.config.fetchInterval,
user: user,
pass: pass
auth: auth
});
},
/* symbolForUrl(url)
* Retrieves the symbol for a specific url.
/* symbolsForUrl(url)
* Retrieves the symbols for a specific url.
*
* argument url sting - Url to look for.
* argument url string - Url to look for.
*
* return string - The Symbol
* return string/array - The Symbols
*/
symbolForUrl: function (url) {
for (var c in this.config.calendars) {
var calendar = this.config.calendars[c];
if (calendar.url === url && typeof calendar.symbol === "string") {
return calendar.symbol;
}
}
return this.config.defaultSymbol;
symbolsForUrl: function (url) {
return this.getCalendarProperty(url, "symbol", this.config.defaultSymbol);
},
/* colorForUrl(url)
* Retrieves the color for a specific url.
*
* argument url string - Url to look for.
*
* return string - The Color
*/
colorForUrl: function (url) {
return this.getCalendarProperty(url, "color", "#fff");
},
/* countTitleForUrl(url)
* Retrieves the name for a specific url.
*
* argument url sting - Url to look for.
* argument url string - Url to look for.
*
* return string - The Symbol
*/
countTitleForUrl: function (url) {
return this.getCalendarProperty(url, "repeatingCountTitle", this.config.defaultRepeatingCountTitle);
},
/* getCalendarProperty(url, property, defaultValue)
* Helper method to retrieve the property for a specific url.
*
* argument url string - Url to look for.
* argument property string - Property to look for.
* argument defaultValue string - Value if property is not found.
*
* return string - The Property
*/
getCalendarProperty: function (url, property, defaultValue) {
for (var c in this.config.calendars) {
var calendar = this.config.calendars[c];
if (calendar.url === url && typeof calendar.repeatingCountTitle === "string") {
return calendar.repeatingCountTitle;
if (calendar.url === url && calendar.hasOwnProperty(property)) {
return calendar[property];
}
}
return this.config.defaultRepeatingCountTitle;
return defaultValue;
},
/* shorten(string, maxLength)
* Shortens a sting if it's longer than maxLenthg.
* Shortens a string if it's longer than maxLength.
* Adds an ellipsis to the end.
*
* argument string string - The string to shorten.
* argument maxLength number - The max lenth of the string.
* argument maxLength number - The max length of the string.
*
* return string - The shortened string.
*/
@@ -360,7 +427,7 @@ Module.register("calendar", {
/* capFirst(string)
* Capitalize the first letter of a string
* Eeturn capitalized string
* Return capitalized string
*/
capFirst: function (string) {
@@ -379,6 +446,13 @@ Module.register("calendar", {
titleTransform: function (title) {
for (var needle in this.config.titleReplace) {
var replacement = this.config.titleReplace[needle];
var regParts = needle.match(/^\/(.+)\/([gim]*)$/);
if (regParts) {
// the parsed pattern is a regexp.
needle = new RegExp(regParts[1], regParts[2]);
}
title = title.replace(needle, replacement);
}

View File

@@ -8,7 +8,7 @@
var ical = require("./vendor/ical.js");
var moment = require("moment");
var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumberOfDays, user, pass) {
var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumberOfDays, auth) {
var self = this;
var reloadTimer = null;
@@ -32,11 +32,23 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
}
};
if (user && pass) {
opts.auth = {
user: user,
pass: pass,
sendImmediately: true
if (auth) {
if(auth.method === "bearer"){
opts.auth = {
bearer: auth.pass
}
}else{
opts.auth = {
user: auth.user,
pass: auth.pass
};
if(auth.method === "digest"){
opts.auth.sendImmediately = false;
}else{
opts.auth.sendImmediately = true;
}
}
}
@@ -47,11 +59,15 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
return;
}
//console.log(data);
// console.log(data);
newEvents = [];
var limitFunction = function(date, i) {return i < maximumEntries;};
var eventDate = function(event, time) {
return (event[time].length === 8) ? moment(event[time], "YYYYMMDD") : moment(new Date(event[time]));
};
for (var e in data) {
var event = data[e];
var now = new Date();
@@ -70,10 +86,10 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
if (event.type === "VEVENT") {
var startDate = (event.start.length === 8) ? moment(event.start, "YYYYMMDD") : moment(new Date(event.start));
var startDate = eventDate(event, "start");
var endDate;
if (typeof event.end !== "undefined") {
endDate = (event.end.length === 8) ? moment(event.end, "YYYYMMDD") : moment(new Date(event.end));
endDate = eventDate(event, "end");
} else {
if (!isFacebookBirthday) {
endDate = startDate;

View File

@@ -8,14 +8,22 @@
var CalendarFetcher = require("./calendarfetcher.js");
var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics";
var url = "https://calendar.google.com/calendar/ical/pkm1t2uedjbp0uvq1o7oj1jouo%40group.calendar.google.com/private-08ba559f89eec70dd74bbd887d0a3598/basic.ics"; // Standard test URL
// var url = "https://www.googleapis.com/calendar/v3/calendars/primary/events/"; // URL for Bearer auth (must be configured in Google OAuth2 first)
var fetchInterval = 60 * 60 * 1000;
var maximumEntries = 10;
var maximumNumberOfDays = 365;
var user = "magicmirror";
var pass = "MyStrongPass";
var auth = {
user: user,
pass: pass
};
console.log("Create fetcher ...");
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays);
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays, auth);
fetcher.onReceive(function(fetcher) {
console.log(fetcher.events());
@@ -29,4 +37,4 @@ fetcher.onError(function(fetcher, error) {
fetcher.startFetch();
console.log("Create fetcher done! ");
console.log("Create fetcher done! ");

View File

@@ -12,7 +12,6 @@ var CalendarFetcher = require("./calendarfetcher.js");
module.exports = NodeHelper.create({
// Override start method.
start: function() {
var self = this;
var events = [];
this.fetchers = [];
@@ -25,7 +24,7 @@ module.exports = NodeHelper.create({
socketNotificationReceived: function(notification, payload) {
if (notification === "ADD_CALENDAR") {
//console.log('ADD_CALENDAR: ');
this.createFetcher(payload.url, payload.fetchInterval, payload.maximumEntries, payload.maximumNumberOfDays, payload.user, payload.pass);
this.createFetcher(payload.url, payload.fetchInterval, payload.maximumEntries, payload.maximumNumberOfDays, payload.auth);
}
},
@@ -37,7 +36,7 @@ module.exports = NodeHelper.create({
* attribute reloadInterval number - Reload interval in milliseconds.
*/
createFetcher: function(url, fetchInterval, maximumEntries, maximumNumberOfDays, user, pass) {
createFetcher: function(url, fetchInterval, maximumEntries, maximumNumberOfDays, auth) {
var self = this;
if (!validUrl.isUri(url)) {
@@ -48,7 +47,7 @@ module.exports = NodeHelper.create({
var fetcher;
if (typeof self.fetchers[url] === "undefined") {
console.log("Create new calendar fetcher for url: " + url + " - Interval: " + fetchInterval);
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays, user, pass);
fetcher = new CalendarFetcher(url, fetchInterval, maximumEntries, maximumNumberOfDays, auth);
fetcher.onReceive(function(fetcher) {
//console.log('Broadcast events.');

View File

@@ -90,7 +90,6 @@
return dt
}
var dateParam = function(name){
return function(val, params, curr){
@@ -143,6 +142,16 @@
}
}
var exdateParam = function(name){
return function(val, params, curr){
var date = dateParam(name)(val, params, curr);
if (date.exdates === undefined) {
date.exdates = [];
}
date.exdates.push(date.exdate);
return date;
}
}
var geoParam = function(name){
return function(val, params, curr){
@@ -240,6 +249,7 @@
, 'LOCATION' : storeParam('location')
, 'DTSTART' : dateParam('start')
, 'DTEND' : dateParam('end')
, 'EXDATE' : exdateParam('exdate')
,' CLASS' : storeParam('class')
, 'TRANSP' : storeParam('transparency')
, 'GEO' : geoParam('geo')

View File

@@ -17,7 +17,8 @@ exports.parseFile = function(filename){
}
var rrule = require('rrule').RRule
var rrule = require('rrule-alt').RRule
var rrulestr = rrule.rrulestr
ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){
curr.rrule = line;
@@ -26,7 +27,7 @@ ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){
var originalEnd = ical.objectHandlers['END'];
ical.objectHandlers['END'] = function(val, params, curr, stack){
if (curr.rrule) {
var rule = curr.rrule.replace('RRULE:', '');
var rule = curr.rrule;
if (rule.indexOf('DTSTART') === -1) {
if (curr.start.length === 8) {
@@ -36,10 +37,14 @@ ical.objectHandlers['END'] = function(val, params, curr, stack){
}
}
rule += ';DTSTART=' + curr.start.toISOString().replace(/[-:]/g, '');
rule += ' DTSTART:' + curr.start.toISOString().replace(/[-:]/g, '');
rule = rule.replace(/\.[0-9]{3}/, '');
}
curr.rrule = rrule.fromString(rule);
for (var i in curr.exdates) {
rule += ' EXDATE:' + curr.exdates[i].toISOString().replace(/[-:]/g, '');
rule = rule.replace(/\.[0-9]{3}/, '');
}
curr.rrule = rrulestr(rule);
}
return originalEnd.call(this, val, params, curr, stack);
}

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'clock',
position: 'top_left', // This can be any of the regions.
module: "clock",
position: "top_left", // This can be any of the regions.
config: {
// The config property is optional.
// See 'Configuration options' for more information.
@@ -22,106 +22,20 @@ modules: [
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>timeFormat</code></td>
<td>Use 12 or 24 hour format.<br>
<br><b>Possible values:</b> <code>12</code> or <code>24</code>
<br><b>Default value:</b> uses value of <i>config.timeFormat</i>
</td>
</tr>
<tr>
<td><code>displaySeconds</code></td>
<td>Display seconds.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>showPeriod</code></td>
<td>Show the period (am/pm) with 12 hour format.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>showPeriodUpper</code></td>
<td>Show the period (AM/PM) with 12 hour format as uppercase.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>clockBold</code></td>
<td>Remove the colon and bold the minutes to make a more modern look.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>showDate</code></td>
<td>Turn off or on the Date section.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>displayType</code></td>
<td>Display a digital clock, analog clock, or both together.<br>
<br><b>Possible values:</b> <code>digital</code>, <code>analog</code>, or <code>both</code>
<br><b>Default value:</b> <code>digital</code>
</td>
</tr>
<tr>
<td><code>analogSize</code></td>
<td><strong>Specific to the analog clock.</strong> Defines how large the analog display is.<br>
<br><b>Possible values:</b> A positive number of pixels</code>
<br><b>Default value:</b> <code>200px</code>
</td>
</tr>
<tr>
<td><code>analogFace</code></td>
<td><strong>Specific to the analog clock.</strong> Specifies which clock face to use.<br>
<br><b>Possible values:</b> <code>simple</code> for a simple border, <code>none</code> for no face or border, or <code>face-###</code> (where ### is currently a value between 001 and 012, inclusive)
<br><b>Default value:</b> <code>simple</code>
</td>
</tr>
<tr>
<td><code>secondsColor</code></td>
<td><strong>Specific to the analog clock.</strong> Specifies what color to make the 'seconds' hand.<br>
<br><b>Possible values:</b> <code>any HTML RGB Color</code>
<br><b>Default value:</b> <code>#888888</code>
</td>
</tr>
<tr>
<td><code>analogPlacement</code></td>
<td><strong>Specific to the analog clock. <em>(requires displayType set to <code>'both'</code>)</em></strong> Specifies where the analog clock is in relation to the digital clock<br>
<br><b>Possible values:</b> <code>top</code>, <code>right</code>, <code>bottom</code>, or <code>left</code>
<br><b>Default value:</b> <code>bottom</code>
</td>
</tr>
<tr>
<td><code>analogShowDate</code></td>
<td><strong>Specific to the analog clock.</strong> If the clock is used as a separate module and set to analog only, this configures whether a date is also displayed with the clock.<br>
<br><b>Possible values:</b> <code>false</code>, <code>top</code>, or <code>bottom</code>
<br><b>Default value:</b> <code>top</code>
</td>
</tr>
<tr>
<td><code>timezone</code></td>
<td>Specific a timezone to show clock.<br>
<br><b>Possible examples values:</b> <code>America/New_York</code>, <code>America/Santiago</code>, <code>Etc/GMT+10</code>
<br><b>Default value:</b> <code>none</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| ----------------- | -----------
| `timeFormat` | Use 12 or 24 hour format. <br><br> **Possible values:** `12` or `24` <br> **Default value:** uses value of _config.timeFormat_
| `displaySeconds` | Display seconds. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showPeriod` | Show the period (am/pm) with 12 hour format. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showPeriodUpper` | Show the period (AM/PM) with 12 hour format as uppercase. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `clockBold` | Remove the colon and bold the minutes to make a more modern look. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `showDate` | Turn off or on the Date section. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showWeek` | Turn off or on the Week section. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `dateFormat` | Configure the date format as you like. <br><br> **Possible values:** [Docs](http://momentjs.com/docs/#/displaying/format/) <br> **Default value:** `"dddd, LL"`
| `displayType` | Display a digital clock, analog clock, or both together. <br><br> **Possible values:** `digital`, `analog`, or `both` <br> **Default value:** `digital`
| `analogSize` | **Specific to the analog clock.** Defines how large the analog display is. <br><br> **Possible values:** A positive number of pixels` <br> **Default value:** `200px`
| `analogFace` | **Specific to the analog clock.** Specifies which clock face to use. <br><br> **Possible values:** `simple` for a simple border, `none` for no face or border, or `face-###` (where ### is currently a value between 001 and 012, inclusive) <br> **Default value:** `simple`
| `secondsColor` | **Specific to the analog clock.** Specifies what color to make the 'seconds' hand. <br><br> **Possible values:** `any HTML RGB Color` <br> **Default value:** `#888888`
| `analogPlacement` | **Specific to the analog clock. _(requires displayType set to `'both'`)_** Specifies where the analog clock is in relation to the digital clock <br><br> **Possible values:** `top`, `right`, `bottom`, or `left` <br> **Default value:** `bottom`
| `analogShowDate` | **Specific to the analog clock.** If the clock is used as a separate module and set to analog only, this configures whether a date is also displayed with the clock. <br><br> **Possible values:** `false`, `top`, or `bottom` <br> **Default value:** `top`
| `timezone` | Specific a timezone to show clock. <br><br> **Possible examples values:** `America/New_York`, `America/Santiago`, `Etc/GMT+10` <br> **Default value:** `none`. See more informations about configuration value [here](https://momentjs.com/timezone/docs/#/data-formats/packed-format/)

View File

@@ -16,6 +16,8 @@ Module.register("clock",{
showPeriodUpper: false,
clockBold: false,
showDate: true,
showWeek: false,
dateFormat: "dddd, LL",
/* specific to the analog clock */
analogSize: "200px",
@@ -60,10 +62,12 @@ Module.register("clock",{
var timeWrapper = document.createElement("div");
var secondsWrapper = document.createElement("sup");
var periodWrapper = document.createElement("span");
var weekWrapper = document.createElement("div")
// Style Wrappers
dateWrapper.className = "date normal medium";
timeWrapper.className = "time bright large light";
secondsWrapper.className = "dimmed";
weekWrapper.className = "week dimmed medium"
// Set content of wrappers.
// The moment().format("h") method has a bug on the Raspberry Pi.
@@ -74,25 +78,23 @@ Module.register("clock",{
if (this.config.timezone) {
now.tz(this.config.timezone);
}
if (this.config.clockBold === true) {
timeString = now.format("HH[<span class=\"bold\">]mm[</span>]");
} else {
timeString = now.format("HH:mm");
var hourSymbol = "HH";
if (this.config.timeFormat !== 24) {
hourSymbol = "h";
}
if (this.config.timeFormat !== 24) {
// var now = new Date();
// var hours = now.getHours() % 12 || 12;
if (this.config.clockBold === true) {
//timeString = hours + moment().format("[<span class=\"bold\">]mm[</span>]");
timeString = now.format("h[<span class=\"bold\">]mm[</span>]");
} else {
//timeString = hours + moment().format(":mm");
timeString = now.format("h:mm");
}
if (this.config.clockBold === true) {
timeString = now.format(hourSymbol + "[<span class=\"bold\">]mm[</span>]");
} else {
timeString = now.format(hourSymbol + ":mm");
}
if(this.config.showDate){
dateWrapper.innerHTML = now.format("dddd, LL");
dateWrapper.innerHTML = now.format(this.config.dateFormat);
}
if (this.config.showWeek) {
weekWrapper.innerHTML = this.translate("WEEK") + " " + now.week();
}
timeWrapper.innerHTML = timeString;
secondsWrapper.innerHTML = now.format("ss");
@@ -134,6 +136,10 @@ Module.register("clock",{
if (this.config.analogFace != "" && this.config.analogFace != "simple" && this.config.analogFace != "none") {
clockCircle.style.background = "url("+ this.data.path + "faces/" + this.config.analogFace + ".svg)";
clockCircle.style.backgroundSize = "100%";
// The following line solves issue: https://github.com/MichMich/MagicMirror/issues/611
clockCircle.style.border = "1px solid black";
} else if (this.config.analogFace != "none") {
clockCircle.style.border = "2px solid white";
}
@@ -172,16 +178,25 @@ Module.register("clock",{
// Display only a digital clock
wrapper.appendChild(dateWrapper);
wrapper.appendChild(timeWrapper);
wrapper.appendChild(weekWrapper);
} else if (this.config.displayType === "analog") {
// Display only an analog clock
dateWrapper.style.textAlign = "center";
dateWrapper.style.paddingBottom = "15px";
if (this.config.showWeek) {
weekWrapper.style.paddingBottom = "15px";
} else {
dateWrapper.style.paddingBottom = "15px";
}
if (this.config.analogShowDate === "top") {
wrapper.appendChild(dateWrapper);
wrapper.appendChild(weekWrapper);
wrapper.appendChild(clockCircle);
} else if (this.config.analogShowDate === "bottom") {
wrapper.appendChild(clockCircle);
wrapper.appendChild(dateWrapper);
wrapper.appendChild(weekWrapper);
} else {
wrapper.appendChild(clockCircle);
}
@@ -198,31 +213,31 @@ Module.register("clock",{
digitalWrapper.style.cssFloat = "none";
digitalWrapper.appendChild(dateWrapper);
digitalWrapper.appendChild(timeWrapper);
digitalWrapper.appendChild(weekWrapper);
var appendClocks = function(condition, pos1, pos2) {
var padding = [0,0,0,0];
padding[(placement === condition) ? pos1 : pos2] = "20px";
analogWrapper.style.padding = padding.join(" ");
if (placement === condition) {
wrapper.appendChild(analogWrapper);
wrapper.appendChild(digitalWrapper);
} else {
wrapper.appendChild(digitalWrapper);
wrapper.appendChild(analogWrapper);
}
};
if (placement === "left" || placement === "right") {
digitalWrapper.style.display = "inline-block";
digitalWrapper.style.verticalAlign = "top";
analogWrapper.style.display = "inline-block";
if (placement === "left") {
analogWrapper.style.padding = "0 20px 0 0";
wrapper.appendChild(analogWrapper);
wrapper.appendChild(digitalWrapper);
} else {
analogWrapper.style.padding = "0 0 0 20px";
wrapper.appendChild(digitalWrapper);
wrapper.appendChild(analogWrapper);
}
appendClocks("left", 1, 3);
} else {
digitalWrapper.style.textAlign = "center";
if (placement === "top") {
analogWrapper.style.padding = "0 0 20px 0";
wrapper.appendChild(analogWrapper);
wrapper.appendChild(digitalWrapper);
} else {
analogWrapper.style.padding = "20px 0 0 0";
wrapper.appendChild(digitalWrapper);
wrapper.appendChild(analogWrapper);
}
appendClocks("top", 2, 0);
}
}

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'compliments',
position: 'lower_third', // This can be any of the regions.
module: "compliments",
position: "lower_third", // This can be any of the regions.
// Best results in one of the middle regions like: lower_third
config: {
// The config property is optional.
@@ -25,85 +25,49 @@ modules: [
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>updateInterval</code></td>
<td>How often does the compliment have to change? (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>86400000</code>
<br><b>Default value:</b> <code>30000</code> (30 seconds)
</td>
</tr>
<tr>
<td><code>fadeSpeed</code></td>
<td>Speed of the update animation. (Milliseconds)<br>
<br><b>Possible values:</b><code>0</code> - <code>5000</code>
<br><b>Default value:</b> <code>4000</code> (4 seconds)
</td>
</tr>
<tr>
<td><code>compliments</code></td>
<td>The list of compliments.<br>
<br><b>Possible values:</b> An object with three arrays: <code>morning</code>, <code>afternoon</code> and<code>evening</code>. See <i>compliment configuration</i> below.
<br><b>Default value:</b> See <i>compliment configuration</i> below.
</td>
</tr>
<tr>
<td><code>remoteFile</code></td>
<td>External file from which to load the compliments<br>
<br><b>Possible values:</b>Path to a JSON file containing compliments, configured
as per the value of the <i>compliments configuration</i> (see below). An object with three arrays:
morning, afternoon and evening. - <code>compliments.json</code>
<br><b>Default value:</b> <code>null</code> (Do not load from file)
</td>
</tr>
</tbody>
</table>
| Option | Description
| ---------------- | -----------
| `updateInterval` | How often does the compliment have to change? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `30000` (30 seconds)
| `fadeSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `4000` (4 seconds)
| `compliments` | The list of compliments. <br><br> **Possible values:** An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. See _compliment configuration_ below. <br> **Default value:** See _compliment configuration_ below.
| `remoteFile` | External file from which to load the compliments <br><br> **Possible values:** Path to a JSON file containing compliments, configured as per the value of the _compliments configuration_ (see below). An object with four arrays: `morning`, `afternoon`, `evening` and `anytime`. - `compliments.json` <br> **Default value:** `null` (Do not load from file)
### Compliment configuration
The `compliments` property contains an object with three arrays: <code>morning</code>, <code>afternoon</code> and<code>evening</code>. Based on the time of the day, the compliments will be picked out of one of these arrays. The arrays contain one or multiple compliments.
The `compliments` property contains an object with four arrays: <code>morning</code>, <code>afternoon</code>, <code>evening</code> and <code>anytime</code>. Based on the time of the day, the compliments will be picked out of one of these arrays. The arrays contain one or multiple compliments.
If use the currentweather is possible use a actual weather for set compliments. The availables properties are:
* <code>day_sunny</code>
* <code>day_cloudy</code>
* <code>cloudy</code>
* <code>cloudy_windy</code>
* <code>showers</code>
* <code>rain</code>
* <code>thunderstorm</code>
* <code>snow</code>
* <code>fog</code>
* <code>night_clear</code>
* <code>night_cloudy</code>
* <code>night_showers</code>
* <code>night_rain</code>
* <code>night_thunderstorm</code>
* <code>night_snow</code>
* <code>night_alt_cloudy_windy</code>
* `day_sunny`
* `day_cloudy`
* `cloudy`
* `cloudy_windy`
* `showers`
* `rain`
* `thunderstorm`
* `snow`
* `fog`
* `night_clear`
* `night_cloudy`
* `night_showers`
* `night_rain`
* `night_thunderstorm`
* `night_snow`
* `night_alt_cloudy_windy`
#### Example use with currentweather module
````javascript
config: {
compliments: {
day_sunny: [
'Today is a sunny day',
'It\'s a beautiful day'
"Today is a sunny day",
"It's a beautiful day"
],
snow: [
'Snowball battle!'
"Snowball battle!"
],
rain: [
'Don\'t forget your umbrella'
"Don't forget your umbrella"
]
}
}
@@ -114,20 +78,23 @@ config: {
````javascript
config: {
compliments: {
anytime: [
"Hey there sexy!"
],
morning: [
'Good morning, handsome!',
'Enjoy your day!',
'How was your sleep?'
"Good morning, handsome!",
"Enjoy your day!",
"How was your sleep?"
],
afternoon: [
'Hello, beauty!',
"Hello, beauty!",
'You look sexy!',
'Looking good today!'
"Looking good today!"
],
evening: [
'Wow, you look hot!',
'You look nice!',
'Hi, sexy!'
"Wow, you look hot!",
"You look nice!",
"Hi, sexy!"
]
}
}
@@ -143,6 +110,9 @@ around them ("morning", "afternoon", "evening", "snow", "rain", etc.).
#### Example compliments.json file:
````json
{
"anytime" : [
"Hey there sexy!"
],
"morning" : [
"Good morning, sunshine!",
"Who needs coffee when you have your smile?",

View File

@@ -6,12 +6,14 @@
* By Michael Teeuw http://michaelteeuw.nl
* MIT Licensed.
*/
Module.register("compliments",{
Module.register("compliments", {
// Module config defaults.
defaults: {
compliments: {
anytime: [
"Hey there sexy!"
],
morning: [
"Good morning, handsome!",
"Enjoy your day!",
@@ -94,7 +96,7 @@ Module.register("compliments",{
*/
complimentArray: function() {
var hour = moment().hour();
var compliments = null;
var compliments = null;
if (hour >= 3 && hour < 12) {
compliments = this.config.compliments.morning;
@@ -104,9 +106,16 @@ Module.register("compliments",{
compliments = this.config.compliments.evening;
}
if ( this.currentWeatherType in this.config.compliments) {
if (typeof compliments === "undefined") {
compliments = new Array();
}
if (this.currentWeatherType in this.config.compliments) {
compliments.push.apply(compliments, this.config.compliments[this.currentWeatherType]);
}
compliments.push.apply(compliments, this.config.compliments.anytime);
return compliments;
},
@@ -118,7 +127,7 @@ Module.register("compliments",{
var xobj = new XMLHttpRequest();
xobj.overrideMimeType("application/json");
xobj.open("GET", this.file(this.config.remoteFile), true);
xobj.onreadystatechange = function () {
xobj.onreadystatechange = function() {
if (xobj.readyState == 4 && xobj.status == "200") {
callback(xobj.responseText);
}
@@ -184,4 +193,4 @@ Module.register("compliments",{
}
},
});
});

View File

@@ -8,14 +8,14 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'currentweather',
position: 'top_right', // This can be any of the regions.
module: "currentweather",
position: "top_right", // This can be any of the regions.
// Best results in left or right regions.
config: {
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
locationID: '', //Location ID from http://openweathermap.org/help/city_list.txt
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
location: "Amsterdam,Netherlands",
locationID: "", //Location ID from http://openweathermap.org/help/city_list.txt
appid: "abcde12345abcde12345abcde12345ab" //openweathermap.org API key.
}
}
]
@@ -26,189 +26,53 @@ modules: [
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>location</code></td>
<td>The location used for weather information.<br>
<br><b>Example:</b> <code>'Amsterdam,Netherlands'</code>
<br><b>Default value:</b> <code>false</code><br><br>
<strong>Note:</strong> When the <code>location</code> and <code>locationID</code> are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
</td>
</tr>
<tr>
<td><code>locationID</code></td>
<td>Location ID from <a href="http://openweathermap.org/help/city_list.txt">OpenWeatherMap</a> <b>This will override anything you put in location.</b><br>Leave blank if you want to use location.
<br><b>Example:</b> <code>1234567</code>
<br><b>Default value:</b> <code>false</code><br><br>
<strong>Note:</strong> When the <code>location</code> and <code>locationID</code> are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
</td>
</tr>
<tr>
<td><code>appid</code></td>
<td>The <a href="https://home.openweathermap.org" target="_blank">OpenWeatherMap</a> API key, which can be obtained by creating an OpenWeatherMap account.<br>
<br> This value is <b>REQUIRED</b>
</td>
</tr>
<tr>
<td><code>units</code></td>
<td>What units to use. Specified by config.js<br>
<br><b>Possible values:</b> <code>config.units</code> = Specified by config.js, <code>default</code> = Kelvin, <code>metric</code> = Celsius, <code>imperial</code> =Fahrenheit
<br><b>Default value:</b> <code>config.units</code>
</td>
</tr>
<tr>
<td><code>roundTemp</code></td>
<td>Round temperature value to nearest integer.<br>
<br><b>Possible values:</b> <code>true</code> (round to integer) or <code>false</code> (display exact value with decimal point)
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>updateInterval</code></td>
<td>How often does the content needs to be fetched? (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>86400000</code>
<br><b>Default value:</b> <code>600000</code> (10 minutes)
</td>
</tr>
<tr>
<td><code>animationSpeed</code></td>
<td>Speed of the update animation. (Milliseconds)<br>
<br><b>Possible values:</b><code>0</code> - <code>5000</code>
<br><b>Default value:</b> <code>1000</code> (1 second)
</td>
</tr>
<tr>
<td><code>timeFormat</code></td>
<td>Use 12 or 24 hour format.<br>
<br><b>Possible values:</b> <code>12</code> or <code>24</code>
<br><b>Default value:</b> uses value of <i>config.timeFormat</i>
</td>
</tr>
<tr>
<td><code>showPeriod</code></td>
<td>Show the period (am/pm) with 12 hour format<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>showPeriodUpper</code></td>
<td>Show the period (AM/PM) with 12 hour format as uppercase<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>showWindDirection</code></td>
<td>Show the wind direction next to the wind speed.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>showHumidity</code></td>
<td>Show the current humidity<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>onlyTemp</code></td>
<td>Show only current Temperature and weather icon.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>useBeaufort</code></td>
<td>Pick between using the Beaufort scale for wind speed or using the default units.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>lang</code></td>
<td>The language of the days.<br>
<br><b>Possible values:</b> <code>en</code>, <code>nl</code>, <code>ru</code>, etc ...
<br><b>Default value:</b> uses value of <i>config.language</i>
</td>
</tr>
<tr>
<td><code>initialLoadDelay</code></td>
<td>The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>5000</code>
<br><b>Default value:</b> <code>0</code>
</td>
</tr>
<tr>
<td><code>retryDelay</code></td>
<td>The delay before retrying after a request failure. (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>60000</code>
<br><b>Default value:</b> <code>2500</code>
</td>
</tr>
<tr>
<td><code>apiVersion</code></td>
<td>The OpenWeatherMap API version to use.<br>
<br><b>Default value:</b> <code>2.5</code>
</td>
</tr>
<tr>
<td><code>apiBase</code></td>
<td>The OpenWeatherMap base URL.<br>
<br><b>Default value:</b> <code>'http://api.openweathermap.org/data/'</code>
</td>
</tr>
<tr>
<td><code>weatherEndpoint</code></td>
<td>The OpenWeatherMap API endPoint.<br>
<br><b>Default value:</b> <code>'weather'</code>
</td>
</tr>
<tr>
<td><code>appendLocationNameToHeader</code></td>
<td>If set to <code>true</code>, the returned location name will be appended to the header of the module, if the header is enabled. This is mainly intresting when using calender based weather.<br>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>calendarClass</code></td>
<td>The class for the calender module to base the event based weather information on.<br>
<br><b>Default value:</b> <code>'calendar'</code>
</td>
</tr>
<tr>
<td><code>iconTable</code></td>
<td>The conversion table to convert the weather conditions to weather-icons.<br>
<br><b>Default value:</b> <code>iconTable: {
'01d':'wi-day-sunny',
'02d':'wi-day-cloudy',
'03d':'wi-cloudy',
'04d':'wi-cloudy-windy',
'09d':'wi-showers',
'10d':'wi-rain',
'11d':'wi-thunderstorm',
'13d':'wi-snow',
'50d':'wi-fog',
'01n':'wi-night-clear',
'02n':'wi-night-cloudy',
'03n':'wi-night-cloudy',
'04n':'wi-night-cloudy',
'09n':'wi-night-showers',
'10n':'wi-night-rain',
'11n':'wi-night-thunderstorm',
'13n':'wi-night-snow',
'50n':'wi-night-alt-cloudy-windy'
}</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| ---------------------------- | -----------
| `location` | The location used for weather information. <br><br> **Example:** `'Amsterdam,Netherlands'` <br> **Default value:** `false` <br><br> **Note:** When the `location` and `locationID` are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
| `locationID` | Location ID from [OpenWeatherMap](http://openweathermap.org/help/city_list.txt) **This will override anything you put in location.** <br> Leave blank if you want to use location. <br> **Example:** `1234567` <br> **Default value:** `false` <br><br> **Note:** When the `location` and `locationID` are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
| `appid` | The [OpenWeatherMap](https://home.openweathermap.org) API key, which can be obtained by creating an OpenWeatherMap account. <br><br> This value is **REQUIRED**
| `units` | What units to use. Specified by config.js <br><br> **Possible values:** `config.units` = Specified by config.js, `default` = Kelvin, `metric` = Celsius, `imperial` =Fahrenheit <br> **Default value:** `config.units`
| `roundTemp` | Round temperature value to nearest integer. <br><br> **Possible values:** `true` (round to integer) or `false` (display exact value with decimal point) <br> **Default value:** `false`
| `degreeLabel` | Show the degree label for your chosen units (Metric = C, Imperial = F, Kelvins = K). <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `updateInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `600000` (10 minutes)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `1000` (1 second)
| `timeFormat` | Use 12 or 24 hour format. <br><br> **Possible values:** `12` or `24` <br> **Default value:** uses value of _config.timeFormat_
| `showPeriod` | Show the period (am/pm) with 12 hour format <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showPeriodUpper` | Show the period (AM/PM) with 12 hour format as uppercase <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `showWindDirection` | Show the wind direction next to the wind speed. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showHumidity` | Show the current humidity <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `onlyTemp` | Show only current Temperature and weather icon. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `useBeaufort` | Pick between using the Beaufort scale for wind speed or using the default units. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_
| `initialLoadDelay` | The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) <br><br> **Possible values:** `1000` - `5000` <br> **Default value:** `0`
| `retryDelay` | The delay before retrying after a request failure. (Milliseconds) <br><br> **Possible values:** `1000` - `60000` <br> **Default value:** `2500`
| `apiVersion` | The OpenWeatherMap API version to use. <br><br> **Default value:** `2.5`
| `apiBase` | The OpenWeatherMap base URL. <br><br> **Default value:** `'http://api.openweathermap.org/data/'`
| `weatherEndpoint` | The OpenWeatherMap API endPoint. <br><br> **Default value:** `'weather'`
| `appendLocationNameToHeader` | If set to `true`, the returned location name will be appended to the header of the module, if the header is enabled. This is mainly intresting when using calender based weather. <br><br> **Default value:** `true`
| `calendarClass` | The class for the calender module to base the event based weather information on. <br><br> **Default value:** `'calendar'`
| `iconTable` | The conversion table to convert the weather conditions to weather-icons. <br><br> **Default value:** view tabel below.
#### Default Icon Table
````javascript
iconTable: {
'01d': 'wi-day-sunny',
'02d': 'wi-day-cloudy',
'03d': 'wi-cloudy',
'04d': 'wi-cloudy-windy',
'09d': 'wi-showers',
'10d': 'wi-rain',
'11d': 'wi-thunderstorm',
'13d': 'wi-snow',
'50d': 'wi-fog',
'01n': 'wi-night-clear',
'02n': 'wi-night-cloudy',
'03n': 'wi-night-cloudy',
'04n': 'wi-night-cloudy',
'09n': 'wi-night-showers',
'10n': 'wi-night-rain',
'11n': 'wi-night-thunderstorm',
'13n': 'wi-night-snow',
'50n': 'wi-night-alt-cloudy-windy'
}
````

View File

@@ -24,6 +24,7 @@ Module.register("currentweather",{
useBeaufort: true,
lang: config.language,
showHumidity: false,
degreeLabel: false,
initialLoadDelay: 0, // 0 seconds delay
retryDelay: 2500,
@@ -78,8 +79,8 @@ Module.register("currentweather",{
// Define required translations.
getTranslations: function() {
// The translations for the defaut modules are defined in the core translation files.
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
// 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 yiur own module including translations, check out the documentation.
return false;
},
@@ -182,9 +183,24 @@ Module.register("currentweather",{
weatherIcon.className = "wi weathericon " + this.weatherType;
large.appendChild(weatherIcon);
var degreeLabel = "";
if (this.config.degreeLabel) {
switch (this.config.units ) {
case "metric":
degreeLabel = "C";
break;
case "imperial":
degreeLabel = "F";
break;
case "default":
degreeLabel = "K";
break;
}
}
var temperature = document.createElement("span");
temperature.className = "bright";
temperature.innerHTML = " " + this.temperature + "&deg;";
temperature.innerHTML = " " + this.temperature + "&deg;" + degreeLabel;
large.appendChild(temperature);
wrapper.appendChild(large);
@@ -296,7 +312,7 @@ Module.register("currentweather",{
*/
processWeather: function(data) {
if (!data || !data.main || !data.main.temp) {
if (!data || !data.main || typeof data.main.temp === "undefined") {
// Did not receive usable new data.
// Maybe this needs a better check?
return;

View File

@@ -6,11 +6,11 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'helloworld',
position: 'bottom_bar', // This can be any of the regions.
module: "helloworld",
position: "bottom_bar", // This can be any of the regions.
config: {
// See 'Configuration options' for more information.
text: 'Hello world!'
text: "Hello world!"
}
}
]
@@ -20,23 +20,6 @@ modules: [
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>text</code></td>
<td>The text to display.<br>
<br><b>Example:</b> <code>'Hello world!'</code>
<br><b>Default value:</b> <code>'Hello world!'</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| ------ | -----------
| `text` | The text to display. <br><br> **Example:** `'Hello world!'` <br> **Default value:** `'Hello world!'`

View File

@@ -1,15 +1,16 @@
# Module: News Feed
The `newsfeed ` module is one of the default modules of the MagicMirror.
This module displays news headlines based on an RSS feed.
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.
## Using the module
### Configuration
To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'newsfeed',
position: 'bottom_bar', // This can be any of the regions. Best results in center regions.
module: "newsfeed",
position: "bottom_bar", // This can be any of the regions. Best results in center regions.
config: {
// The config property is optional.
// If no config is set, an example calendar is shown.
@@ -30,152 +31,56 @@ modules: [
]
````
### Notifications
#### Interacting with the module
MagicMirror's [notification mechanism](https://github.com/MichMich/MagicMirror/tree/master/modules#thissendnotificationnotification-payload) allows to send notifications to the `newsfeed` module. The following notifications are supported:
| Notification Identifier | Description
| ----------------------- | -----------
| `ARTICLE_NEXT` | Shows the next news title (hiding the summary or previously fully displayed article)
| `ARTICLE_PREVIOUS` | Shows the previous news title (hiding the summary or previously fully displayed article)
| `ARTICLE_MORE_DETAILS` | When received the _first time_, shows the corresponding description of the currently displayed news title. <br> The module expects that the module's configuration option `showDescription` is set to `false` (default value). <br><br> When received a _second consecutive time_, shows the full news article in an IFRAME. <br> This requires that the news page can be embedded in an IFRAME, e.g. doesn't have the HTTP response header [X-Frame-Options](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options) set to e.g. `DENY`.
| `ARTICLE_LESS_DETAILS` | Hides the summary or full news article and only displays the news title of the currently viewed news item.
Note the payload of the sent notification event is ignored.
#### Example
The following example shows how the next news article title can be displayed on the MagicMirror.
````javascript
this.sendNotification('ARTICLE_NEXT');
````
#### `newsfeed` specific notification emitting modules
The third party [MMM-Gestures](https://github.com/thobach/MMM-Gestures) module supports above notifications when moving your hand up, down, left or right in front of a gesture sensor attached to the MagicMirror. See module's readme for more details.
## Configuration options
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>feeds</code></td>
<td>An array of feed urls that will be used as source.<br>
More info about this object can be found below.
<br><b>Default value:</b> <code>[
{
title: "New York Times",
url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml",
encoding: "UTF-8"
}
]</code>
</td>
</tr>
<tr>
<td><code>showSourceTitle</code></td>
<td>Display the title of the source.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>showPublishDate</code></td>
<td>Display the publish date of an headline.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>showDescription</code></td>
<td>Display the description of an item.<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>reloadInterval</code></td>
<td>How often does the content needs to be fetched? (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>86400000</code>
<br><b>Default value:</b> <code>300000</code> (5 minutes)
</td>
</tr>
<tr>
<td><code>updateInterval</code></td>
<td>How often do you want to display a new headline? (Milliseconds)<br>
<br><b>Possible values:</b><code>1000</code> - <code>60000</code>
<br><b>Default value:</b> <code>10000</code> (10 seconds)
</td>
</tr>
<tr>
<td><code>animationSpeed</code></td>
<td>Speed of the update animation. (Milliseconds)<br>
<br><b>Possible values:</b><code>0</code> - <code>5000</code>
<br><b>Default value:</b> <code>2500</code> (2.5 seconds)
</td>
</tr>
<tr>
<td><code>maxNewsItems</code></td>
<td>Total amount of news items to cycle through. (0 for unlimited)<br>
<br><b>Possible values:</b><code>0</code> - <code>...</code>
<br><b>Default value:</b> <code>0</code>
</td>
</tr>
removeStartTags: false,
removeEndTags: false,
startTags: [],
endTags: []
<tr>
<td><code>removeStartTags</code></td>
<td>Some newsfeeds feature tags at the <B>beginning</B> of their titles or descriptions, such as <em>[VIDEO]</em>.
This setting allows for the removal of specified tags from the beginning of an item's description and/or title.<br>
<br><b>Possible values:</b><code>'title'</code>, <code>'description'</code>, <code>'both'</code>
</td>
</tr>
<tr>
<td><code>startTags</code></td>
<td>List the tags you would like to have removed at the beginning of the feed item<br>
<br><b>Possible values:</b> <code>['TAG']</code> or <code>['TAG1','TAG2',...]</code>
</td>
</tr>
<tr>
<td><code>removeEndTags</code></td>
<td>Remove specified tags from the <B>end</B> of an item's description and/or title.<br>
<br><b>Possible values:</b><code>'title'</code>, <code>'description'</code>, <code>'both'</code>
</td>
</tr>
<tr>
<td><code>endTags</code></td>
<td>List the tags you would like to have removed at the end of the feed item<br>
<br><b>Possible values:</b> <code>['TAG']</code> or <code>['TAG1','TAG2',...]</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| ----------------- | -----------
| `feeds` | An array of feed urls that will be used as source. <br> More info about this object can be found below. <br> **Default value:** `[{ title: "New York Times", url: "http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml", encoding: "UTF-8" }]`
| `showSourceTitle` | Display the title of the source. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showPublishDate` | Display the publish date of an headline. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `showDescription` | Display the description of an item. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `wrapTitle` | Wrap the title of the item to multiple lines. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `wrapDescription` | Wrap the description of the item to multiple lines. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `hideLoading` | Hide module instead of showing LOADING status. <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false`
| `reloadInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `300000` (5 minutes)
| `updateInterval` | How often do you want to display a new headline? (Milliseconds) <br><br> **Possible values:**`1000` - `60000` <br> **Default value:** `10000` (10 seconds)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `2500` (2.5 seconds)
| `maxNewsItems` | Total amount of news items to cycle through. (0 for unlimited) <br><br> **Possible values:**`0` - `...` <br> **Default value:** `0`
| `ignoreOldItems` | Ignore news items that are outdated. <br><br> **Possible values:**`true` or `false <br> **Default value:** `false`
| `ignoreOlderThan` | How old should news items be before they are considered outdated? (Milliseconds) <br><br> **Possible values:**`1` - `...` <br> **Default value:** `86400000` (1 day)
| `removeStartTags` | Some newsfeeds feature tags at the **beginning** of their titles or descriptions, such as _[VIDEO]_. This setting allows for the removal of specified tags from the beginning of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`
| `startTags` | List the tags you would like to have removed at the beginning of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]`
| `removeEndTags` | Remove specified tags from the **end** of an item's description and/or title. <br><br> **Possible values:**`'title'`, `'description'`, `'both'`
| `endTags` | List the tags you would like to have removed at the end of the feed item <br><br> **Possible values:** `['TAG']` or `['TAG1','TAG2',...]`
The `feeds` property contains an array with multiple objects. These objects have the following properties:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>title</code></td>
<td>The name of the feed source to be displayed above the news items.<br>
<br>This property is optional.
</td>
</tr>
<tr>
<td><code>url</code></td>
<td>The url of the feed used for the headlines.<br>
<br><b>Example:</b> <code>'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml'</code>
</td>
</tr>
<tr>
<td><code>encoding</code></td>
<td>The encoding of the news feed.<br>
<br>This property is optional.
<br><b>Possible values:</b><code>'UTF-8'</code>, <code>'ISO-8859-1'</code>, etc ...
<br><b>Default value:</b> <code>'UTF-8'</code>
</td>
</tr>
</tbody>
</table>
| Option | Description
| ---------- | -----------
| `title` | The name of the feed source to be displayed above the news items. <br><br> This property is optional.
| `url` | The url of the feed used for the headlines. <br><br> **Example:** `'http://www.nytimes.com/services/xml/rss/nyt/HomePage.xml'`
| `encoding` | The encoding of the news feed. <br><br> This property is optional. <br> **Possible values:**`'UTF-8'`, `'ISO-8859-1'`, etc ... <br> **Default value:** `'UTF-8'`

View File

@@ -85,7 +85,12 @@ var Fetcher = function(url, reloadInterval, encoding) {
nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
headers = {"User-Agent": "Mozilla/5.0 (Node.js "+ nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"}
request({uri: url, encoding: null, headers: headers}).pipe(iconv.decodeStream(encoding)).pipe(parser);
request({uri: url, encoding: null, headers: headers})
.on("error", function(error) {
fetchFailedCallback(self, error);
scheduleTimer();
})
.pipe(iconv.decodeStream(encoding)).pipe(parser);
};

View File

@@ -21,10 +21,15 @@ Module.register("newsfeed",{
showSourceTitle: true,
showPublishDate: true,
showDescription: false,
wrapTitle: true,
wrapDescription: true,
hideLoading: false,
reloadInterval: 5 * 60 * 1000, // every 5 minutes
updateInterval: 10 * 1000,
animationSpeed: 2.5 * 1000,
maxNewsItems: 0, // 0 for unlimited
ignoreOldItems: false,
ignoreOlderThan: 24 * 60 * 60 * 1000, // 1 day
removeStartTags: "",
removeEndTags: "",
startTags: [],
@@ -39,9 +44,9 @@ Module.register("newsfeed",{
// Define required translations.
getTranslations: function() {
// The translations for the defaut modules are defined in the core translation files.
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
// If you're trying to build yiur own module including translations, check out the documentation.
// 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;
},
@@ -89,7 +94,8 @@ Module.register("newsfeed",{
if (this.newsItems.length > 0) {
if (this.config.showSourceTitle || this.config.showPublishDate) {
// this.config.showFullArticle is a run-time configuration, triggered by optional notifications
if (!this.config.showFullArticle && (this.config.showSourceTitle || this.config.showPublishDate)) {
var sourceAndTimestamp = document.createElement("div");
sourceAndTimestamp.className = "light small dimmed";
@@ -111,7 +117,7 @@ Module.register("newsfeed",{
//Remove selected tags from the beginning of rss feed items (title or description)
if (this.config.removeStartTags == "title" || "both") {
if (this.config.removeStartTags == "title" || this.config.removeStartTags == "both") {
for (f=0; f<this.config.startTags.length;f++) {
if (this.newsItems[this.activeItem].title.slice(0,this.config.startTags[f].length) == this.config.startTags[f]) {
@@ -121,7 +127,7 @@ Module.register("newsfeed",{
}
if (this.config.removeStartTags == "description" || "both") {
if (this.config.removeStartTags == "description" || this.config.removeStartTags == "both") {
if (this.config.showDescription) {
for (f=0; f<this.config.startTags.length;f++) {
@@ -152,21 +158,44 @@ Module.register("newsfeed",{
}
var title = document.createElement("div");
title.className = "bright medium light";
title.innerHTML = this.newsItems[this.activeItem].title;
wrapper.appendChild(title);
if(!this.config.showFullArticle){
var title = document.createElement("div");
title.className = "bright medium light" + (!this.config.wrapTitle ? " no-wrap" : "");
title.innerHTML = this.newsItems[this.activeItem].title;
wrapper.appendChild(title);
}
if (this.config.showDescription) {
var description = document.createElement("div");
description.className = "small light";
description.className = "small light" + (!this.config.wrapDescription ? " no-wrap" : "");
description.innerHTML = this.newsItems[this.activeItem].description;
wrapper.appendChild(description);
}
if (this.config.showFullArticle) {
var fullArticle = document.createElement("iframe");
fullArticle.className = "";
fullArticle.style.width = "100%";
fullArticle.style.top = "0";
fullArticle.style.left = "0";
fullArticle.style.position = "fixed";
fullArticle.height = window.innerHeight;
fullArticle.style.border = "none";
fullArticle.src = this.newsItems[this.activeItem].url;
wrapper.appendChild(fullArticle);
}
if (this.config.hideLoading) {
this.show();
}
} else {
wrapper.innerHTML = this.translate("LOADING");
wrapper.className = "small dimmed";
if (this.config.hideLoading) {
this.hide();
} else {
wrapper.innerHTML = this.translate("LOADING");
wrapper.className = "small dimmed";
}
}
return wrapper;
@@ -175,7 +204,6 @@ Module.register("newsfeed",{
/* registerFeeds()
* registers the feeds to be used by the backend.
*/
registerFeeds: function() {
for (var f in this.config.feeds) {
var feed = this.config.feeds[f];
@@ -186,10 +214,10 @@ Module.register("newsfeed",{
}
},
/* registerFeeds()
/* generateFeed()
* Generate an ordered list of items for this configured module.
*
* attribute feeds object - An object with feeds returned by the nod helper.
* attribute feeds object - An object with feeds returned by the node helper.
*/
generateFeed: function(feeds) {
var newsItems = [];
@@ -199,7 +227,9 @@ Module.register("newsfeed",{
for (var i in feedItems) {
var item = feedItems[i];
item.sourceTitle = this.titleForFeed(feed);
newsItems.push(item);
if (!(this.config.ignoreOldItems && ((Date.now() - new Date(item.pubdate)) > this.config.ignoreOlderThan))) {
newsItems.push(item);
}
}
}
}
@@ -231,7 +261,7 @@ Module.register("newsfeed",{
return false;
},
/* subscribedToFeed(feedUrl)
/* titleForFeed(feedUrl)
* Returns title for a specific feed Url.
*
* attribute feedUrl string - Url of the feed to check.
@@ -256,7 +286,7 @@ Module.register("newsfeed",{
self.updateDom(self.config.animationSpeed);
setInterval(function() {
timer = setInterval(function() {
self.activeItem++;
self.updateDom(self.config.animationSpeed);
}, this.config.updateInterval);
@@ -273,5 +303,50 @@ Module.register("newsfeed",{
return string.charAt(0).toUpperCase() + string.slice(1);
},
resetDescrOrFullArticleAndTimer: function() {
this.config.showDescription = false;
this.config.showFullArticle = false;
if(!timer){
this.scheduleUpdateInterval();
}
},
notificationReceived: function(notification, payload, sender) {
Log.info(this.name + " - received notification: " + notification);
if(notification == "ARTICLE_NEXT"){
var before = this.activeItem;
this.activeItem++;
if (this.activeItem >= this.newsItems.length) {
this.activeItem = 0;
}
this.resetDescrOrFullArticleAndTimer();
Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")");
this.updateDom(100);
} else if(notification == "ARTICLE_PREVIOUS"){
var before = this.activeItem;
this.activeItem--;
if (this.activeItem < 0) {
this.activeItem = this.newsItems.length - 1;
}
this.resetDescrOrFullArticleAndTimer();
Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")");
this.updateDom(100);
}
// if "more details" is received the first time: show article summary, on second time show full article
else if(notification == "ARTICLE_MORE_DETAILS"){
this.config.showDescription = !this.config.showDescription;
this.config.showFullArticle = !this.config.showDescription;
clearInterval(timer);
timer = null;
Log.info(this.name + " - showing " + this.config.showDescription ? "article description" : "full article");
this.updateDom(100);
} else if(notification == "ARTICLE_LESS_DETAILS"){
this.resetDescrOrFullArticleAndTimer();
Log.info(this.name + " - showing only article titles again");
this.updateDom(100);
} else {
Log.info(this.name + " - unknown notification, ignoring: " + notification);
}
},
});

View File

@@ -24,14 +24,13 @@ module.exports = NodeHelper.create({
}
},
/* createFetcher(url, reloadInterval)
* Creates a fetcher for a new url if it doesn't exist yet.
* Otherwise it reoses the existing one.
/* createFetcher(feed, config)
* Creates a fetcher for a new feed if it doesn't exist yet.
* Otherwise it reuses the existing one.
*
* attribute url string - URL of the news feed.
* attribute reloadInterval number - Reload interval in milliseconds.
* attribute feed object - A feed object.
* attribute config object - A configuration object containing reload interval in milliseconds.
*/
createFetcher: function(feed, config) {
var self = this;

View File

@@ -8,8 +8,8 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'updatenotification',
position: 'top_center', // This can be any of the regions.
module: "updatenotification",
position: "top_center", // This can be any of the regions.
config: {
// The config property is optional.
// See 'Configuration options' for more information.
@@ -22,21 +22,6 @@ modules: [
The following properties can be configured:
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>updateInterval</code></td>
<td>How often do you want to check for a new version? This value represents the interval in milliseconds.<br>
<br><b>Possible values:</b> Any value above <code>60000</code> (1 minute);
<br><b>Default value:</b> <code>600000</code> (10 minutes);
</td>
</tr>
</tbody>
</table>
| Option | Description
| ---------------- | -----------
| `updateInterval` | How often do you want to check for a new version? This value represents the interval in milliseconds. <br><br> **Possible values:** Any value above `60000` (1 minute) <br> **Default value:** `600000` (10 minutes);

View File

@@ -8,14 +8,14 @@ To use this module, add it to the modules array in the `config/config.js` file:
````javascript
modules: [
{
module: 'weatherforecast',
position: 'top_right', // This can be any of the regions.
module: "weatherforecast",
position: "top_right", // This can be any of the regions.
// Best results in left or right regions.
config: {
// See 'Configuration options' for more information.
location: 'Amsterdam,Netherlands',
locationID: '', //Location ID from http://openweathermap.org/help/city_list.txt
appid: 'abcde12345abcde12345abcde12345ab' //openweathermap.org API key.
location: "Amsterdam,Netherlands",
locationID: "", //Location ID from http://openweathermap.org/help/city_list.txt
appid: "abcde12345abcde12345abcde12345ab" //openweathermap.org API key.
}
}
]
@@ -25,171 +25,50 @@ modules: [
The following properties can be configured:
| Option | Description
| ---------------------------- | -----------
| `location` | The location used for weather information. <br><br> **Example:** `'Amsterdam,Netherlands'` <br> **Default value:** `false` <br><br> **Note:** When the `location` and `locationID` are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
| `locationID` | Location ID from [OpenWeatherMap](http://openweathermap.org/help/city_list.txt) **This will override anything you put in location.** <br> Leave blank if you want to use location. <br> **Example:** `1234567` <br> **Default value:** `false` <br><br> **Note:** When the `location` and `locationID` are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
| `appid` | The [OpenWeatherMap](https://home.openweathermap.org) API key, which can be obtained by creating an OpenWeatherMap account. <br><br> This value is **REQUIRED**
| `units` | What units to use. Specified by config.js <br><br> **Possible values:** `config.units` = Specified by config.js, `default` = Kelvin, `metric` = Celsius, `imperial` =Fahrenheit <br> **Default value:** `config.units`
| `roundTemp` | Round temperature values to nearest integer. <br><br> **Possible values:** `true` (round to integer) or `false` (display exact value with decimal point) <br> **Default value:** `false`
| `maxNumberOfDays` | How many days of forecast to return. Specified by config.js <br><br> **Possible values:** `1` - `16` <br> **Default value:** `7` (7 days) <br> This value is optional. By default the weatherforecast module will return 7 days.
| `showRainAmount` | Should the predicted rain amount be displayed? <br><br> **Possible values:** `true` or `false` <br> **Default value:** `false` <br> This value is optional. By default the weatherforecast module will not display the predicted amount of rain.
| `updateInterval` | How often does the content needs to be fetched? (Milliseconds) <br><br> **Possible values:** `1000` - `86400000` <br> **Default value:** `600000` (10 minutes)
| `animationSpeed` | Speed of the update animation. (Milliseconds) <br><br> **Possible values:**`0` - `5000` <br> **Default value:** `1000` (1 second)
| `lang` | The language of the days. <br><br> **Possible values:** `en`, `nl`, `ru`, etc ... <br> **Default value:** uses value of _config.language_
| `fade` | Fade the future events to black. (Gradient) <br><br> **Possible values:** `true` or `false` <br> **Default value:** `true`
| `fadePoint` | Where to start fade? <br><br> **Possible values:** `0` (top of the list) - `1` (bottom of list) <br> **Default value:** `0.25`
| `initialLoadDelay` | The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds) <br><br> **Possible values:** `1000` - `5000` <br> **Default value:** `2500` (2.5 seconds delay. This delay is used to keep the OpenWeather API happy.)
| `retryDelay` | The delay before retrying after a request failure. (Milliseconds) <br><br> **Possible values:** `1000` - `60000` <br> **Default value:** `2500`
| `apiVersion` | The OpenWeatherMap API version to use. <br><br> **Default value:** `2.5`
| `apiBase` | The OpenWeatherMap base URL. <br><br> **Default value:** `'http://api.openweathermap.org/data/'`
| `forecastEndpoint` | The OpenWeatherMap API endPoint. <br><br> **Default value:** `'forecast/daily'`
| `appendLocationNameToHeader` | If set to `true`, the returned location name will be appended to the header of the module, if the header is enabled. This is mainly intresting when using calender based weather. <br><br> **Default value:** `true`
| `calendarClass` | The class for the calender module to base the event based weather information on. <br><br> **Default value:** `'calendar'`
| `iconTable` | The conversion table to convert the weather conditions to weather-icons. <br><br> **Default value:** view table below
`colored` | If set 'colored' to true the min-temp get a blue tone and the max-temp get a red tone. <br><br> **Default value:** `'false'`
<table width="100%">
<!-- why, markdown... -->
<thead>
<tr>
<th>Option</th>
<th width="100%">Description</th>
</tr>
<thead>
<tbody>
<tr>
<td><code>location</code></td>
<td>The location used for weather information.<br>
<br><b>Example:</b> <code>'Amsterdam,Netherlands'</code>
<br><b>Default value:</b> <code>false</code><br><br>
<strong>Note:</strong> When the <code>location</code> and <code>locationID</code> are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
</td>
</tr>
<tr>
<td><code>locationID</code></td>
<td>Location ID from <a href="http://openweathermap.org/help/city_list.txt">OpenWeatherMap</a> <b>This will override anything you put in location.</b><br>Leave blank if you want to use location.
<br><b>Example:</b> <code>1234567</code>
<br><b>Default value:</b> <code>false</code><br><br>
<strong>Note:</strong> When the <code>location</code> and <code>locationID</code> are both not set, the location will be based on the information provided by the calendar module. The first upcoming event with location data will be used.
</td>
</tr>
<tr>
<td><code>appid</code></td>
<td>The <a href="https://home.openweathermap.org" target="_blank">OpenWeatherMap</a> API key, which can be obtained by creating an OpenWeatherMap account.<br>
<br> This value is <b>REQUIRED</b>
</td>
</tr>
<tr>
<td><code>units</code></td>
<td>What units to use. Specified by config.js<br>
<br><b>Possible values:</b> <code>config.units</code> = Specified by config.js, <code>default</code> = Kelvin, <code>metric</code> = Celsius, <code>imperial</code> =Fahrenheit
<br><b>Default value:</b> <code>config.units</code>
</td>
</tr>
<tr>
<td><code>roundTemp</code></td>
<td>Round temperature values to nearest integer.<br>
<br><b>Possible values:</b> <code>true</code> (round to integer) or <code>false</code> (display exact value with decimal point)
<br><b>Default value:</b> <code>false</code>
</td>
</tr>
<tr>
<td><code>maxNumberOfDays</code></td>
<td>How many days of forecast to return. Specified by config.js<br>
<br><b>Possible values:</b> <code>1</code> - <code>16</code>
<br><b>Default value:</b> <code>7</code> (7 days)
<br>This value is optional. By default the weatherforecast module will return 7 days.
</td>
</tr>
<tr>
<td><code>showRainAmount</code></td>
<td>Should the predicted rain amount be displayed?<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>false</code>
<br>This value is optional. By default the weatherforecast module will not display the predicted amount of rain.
</td>
</tr>
<tr>
<td><code>updateInterval</code></td>
<td>How often does the content needs to be fetched? (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>86400000</code>
<br><b>Default value:</b> <code>600000</code> (10 minutes)
</td>
</tr>
<tr>
<td><code>animationSpeed</code></td>
<td>Speed of the update animation. (Milliseconds)<br>
<br><b>Possible values:</b><code>0</code> - <code>5000</code>
<br><b>Default value:</b> <code>1000</code> (1 second)
</td>
</tr>
<tr>
<td><code>lang</code></td>
<td>The language of the days.<br>
<br><b>Possible values:</b> <code>en</code>, <code>nl</code>, <code>ru</code>, etc ...
<br><b>Default value:</b> uses value of <i>config.language</i>
</td>
</tr>
<tr>
<td><code>fade</code></td>
<td>Fade the future events to black. (Gradient)<br>
<br><b>Possible values:</b> <code>true</code> or <code>false</code>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>fadePoint</code></td>
<td>Where to start fade?<br>
<br><b>Possible values:</b> <code>0</code> (top of the list) - <code>1</code> (bottom of list)
<br><b>Default value:</b> <code>0.25</code>
</td>
</tr>
<tr>
<td><code>initialLoadDelay</code></td>
<td>The initial delay before loading. If you have multiple modules that use the same API key, you might want to delay one of the requests. (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>5000</code>
<br><b>Default value:</b> <code>2500</code> (2.5 seconds delay. This delay is used to keep the OpenWeather API happy.)
</td>
</tr>
<tr>
<td><code>retryDelay</code></td>
<td>The delay before retrying after a request failure. (Milliseconds)<br>
<br><b>Possible values:</b> <code>1000</code> - <code>60000</code>
<br><b>Default value:</b> <code>2500</code>
</td>
</tr>
<tr>
<td><code>apiVersion</code></td>
<td>The OpenWeatherMap API version to use.<br>
<br><b>Default value:</b> <code>2.5</code>
</td>
</tr>
<tr>
<td><code>apiBase</code></td>
<td>The OpenWeatherMap base URL.<br>
<br><b>Default value:</b> <code>'http://api.openweathermap.org/data/'</code>
</td>
</tr>
<tr>
<td><code>forecastEndpoint</code></td>
<td>The OpenWeatherMap API endPoint.<br>
<br><b>Default value:</b> <code>'forecast/daily'</code>
</td>
</tr>
<tr>
<td><code>appendLocationNameToHeader</code></td>
<td>If set to <code>true</code>, the returned location name will be appended to the header of the module, if the header is enabled. This is mainly intresting when using calender based weather.<br>
<br><b>Default value:</b> <code>true</code>
</td>
</tr>
<tr>
<td><code>calendarClass</code></td>
<td>The class for the calender module to base the event based weather information on.<br>
<br><b>Default value:</b> <code>'calendar'</code>
</td>
</tr>
<tr>
<td><code>iconTable</code></td>
<td>The conversion table to convert the weather conditions to weather-icons.<br>
<br><b>Default value:</b> <code>iconTable: {
'01d':'wi-day-sunny',
'02d':'wi-day-cloudy',
'03d':'wi-cloudy',
'04d':'wi-cloudy-windy',
'09d':'wi-showers',
'10d':'wi-rain',
'11d':'wi-thunderstorm',
'13d':'wi-snow',
'50d':'wi-fog',
'01n':'wi-night-clear',
'02n':'wi-night-cloudy',
'03n':'wi-night-cloudy',
'04n':'wi-night-cloudy',
'09n':'wi-night-showers',
'10n':'wi-night-rain',
'11n':'wi-night-thunderstorm',
'13n':'wi-night-snow',
'50n':'wi-night-alt-cloudy-windy'
}</code>
</td>
</tr>
</tbody>
</table>
#### Default Icon Table
````javascript
iconTable: {
'01d': 'wi-day-sunny',
'02d': 'wi-day-cloudy',
'03d': 'wi-cloudy',
'04d': 'wi-cloudy-windy',
'09d': 'wi-showers',
'10d': 'wi-rain',
'11d': 'wi-thunderstorm',
'13d': 'wi-snow',
'50d': 'wi-fog',
'01n': 'wi-night-clear',
'02n': 'wi-night-cloudy',
'03n': 'wi-night-cloudy',
'04n': 'wi-night-cloudy',
'09n': 'wi-night-showers',
'10n': 'wi-night-rain',
'11n': 'wi-night-thunderstorm',
'13n': 'wi-night-snow',
'50n': 'wi-night-alt-cloudy-windy'
}
````

View File

@@ -17,3 +17,11 @@
padding-left: 20px;
padding-right: 0;
}
.weatherforecast tr.colored .min-temp {
color: #BCDDFF;
}
.weatherforecast tr.colored .max-temp {
color: #FF8E99;
}

View File

@@ -23,6 +23,7 @@ Module.register("weatherforecast",{
lang: config.language,
fade: true,
fadePoint: 0.25, // Start on 1/4th of the list.
colored: false,
initialLoadDelay: 2500, // 2.5 seconds delay. This delay is used to keep the OpenWeather API happy.
retryDelay: 2500,
@@ -76,8 +77,8 @@ Module.register("weatherforecast",{
// Define required translations.
getTranslations: function() {
// The translations for the defaut modules are defined in the core translation files.
// Therefor we can just return false. Otherwise we should have returned a dictionairy.
// 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 yiur own module including translations, check out the documentation.
return false;
},
@@ -120,6 +121,9 @@ Module.register("weatherforecast",{
var forecast = this.forecast[f];
var row = document.createElement("tr");
if (this.config.colored) {
row.className = "colored";
}
table.appendChild(row);
var dayCell = document.createElement("td");
@@ -150,7 +154,11 @@ Module.register("weatherforecast",{
if (isNaN(forecast.rain)) {
rainCell.innerHTML = "";
} else {
rainCell.innerHTML = forecast.rain + " mm";
if(config.units !== "imperial") {
rainCell.innerHTML = forecast.rain + " mm";
} else {
rainCell.innerHTML = (parseFloat(forecast.rain) / 25.4).toFixed(2) + " in";
}
}
rainCell.className = "align-right bright rain";
row.appendChild(rainCell);

View File

@@ -14,6 +14,11 @@ NodeHelper = Class.extend({
console.log("Initializing new module helper ...");
},
loaded: function(callback) {
console.log("Module helper loaded: " + this.name);
callback();
},
start: function() {
console.log("Staring module helper: " + this.name);
},
@@ -21,7 +26,7 @@ NodeHelper = Class.extend({
/* socketNotificationReceived(notification, payload)
* This method is called when a socket notification arrives.
*
* argument notification string - The identifier of the noitication.
* argument notification string - The identifier of the notification.
* argument payload mixed - The payload of the notification.
*/
socketNotificationReceived: function(notification, payload) {
@@ -49,7 +54,7 @@ NodeHelper = Class.extend({
/* sendSocketNotification(notification, payload)
* Send a socket notification to the node helper.
*
* argument notification string - The identifier of the noitication.
* argument notification string - The identifier of the notification.
* argument payload mixed - The payload of the notification.
*/
sendSocketNotification: function(notification, payload) {

View File

@@ -1,10 +1,15 @@
{
"name": "magicmirror",
"version": "2.1.0",
"description": "A modular interface for smart mirrors.",
"version": "2.1.1",
"description": "The open source modular smart mirror platform.",
"main": "js/electron.js",
"scripts": {
"start": "electron js/electron.js"
"start": "sh run-start.sh",
"install": "cd vendor && npm install",
"postinstall": "sh installers/postinstall/postinstall.sh",
"test": "./node_modules/mocha/bin/mocha tests --recursive",
"test:unit": "./node_modules/mocha/bin/mocha tests/unit --recursive",
"test:e2e": "./node_modules/mocha/bin/mocha tests/e2e --recursive"
},
"repository": {
"type": "git",
@@ -26,16 +31,22 @@
},
"homepage": "https://github.com/MichMich/MagicMirror#readme",
"devDependencies": {
"chai": "^3.5.0",
"chai-as-promised": "^6.0.0",
"grunt": "latest",
"grunt-eslint": "latest",
"grunt-jsonlint": "latest",
"grunt-markdownlint": "^1.0.13",
"grunt-stylelint": "latest",
"grunt-yamllint": "latest",
"http-auth": "^3.1.3",
"mocha": "^3.2.0",
"spectron": "^3.4.1",
"stylelint-config-standard": "latest",
"time-grunt": "latest"
},
"dependencies": {
"colors": "^1.1.2",
"electron": "^1.4.7",
"express": "^4.14.0",
"express-ipfilter": "latest",
@@ -44,9 +55,9 @@
"iconv-lite": "latest",
"moment": "latest",
"request": "^2.78.0",
"rrule": "latest",
"rrule-alt": "^2.2.3",
"simple-git": "^1.62.0",
"socket.io": "^1.5.1",
"socket.io": "^1.7.3",
"valid-url": "latest",
"walk": "latest"
}

4
run-start.sh Normal file
View File

@@ -0,0 +1,4 @@
if [ -z "$DISPLAY" ]; then #If not set DISPLAY is SSH remote or tty
export DISPLAY=:0 # Set by defaul display
fi
electron js/electron.js $1

View File

@@ -1,7 +1,15 @@
screen_width = Window.GetWidth();
screen_height = Window.GetHeight();
theme_image = Image("splash.png");
if (Plymouth.GetMode() != "shutdown")
{
theme_image = Image("splash.png");
}
else
{
theme_image = Image("splash_halt.png");
}
image_width = theme_image.GetWidth();
image_height = theme_image.GetHeight();
@@ -30,11 +38,8 @@ else
image_y = (screen_height - image_height) / 2;
}
if (Plymouth.GetMode() != "shutdown")
{
sprite = Sprite (resized_image);
sprite.SetPosition (image_x, image_y, -100);
}
sprite = Sprite (resized_image);
sprite.SetPosition (image_x, image_y, -100);
message_sprite = Sprite();
message_sprite.SetPosition(screen_width * 0.1, screen_height * 0.9, 10000);

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -0,0 +1,190 @@
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:MagicMirrorTest
X-WR-TIMEZONE:America/Santiago
X-WR-CALDESC:Testing propose MagicMirror
BEGIN:VTIMEZONE
TZID:America/Santiago
X-LIC-LOCATION:America/Santiago
BEGIN:STANDARD
TZOFFSETFROM:-0300
TZOFFSETTO:-0400
TZNAME:-04
DTSTART:19700510T000000
RDATE:19700510T030000
RDATE:19710509T030000
RDATE:19720514T030000
RDATE:19730513T030000
RDATE:19740512T030000
RDATE:19750511T030000
RDATE:19760509T030000
RDATE:19770515T030000
RDATE:19780514T030000
RDATE:19790513T030000
RDATE:19800511T030000
RDATE:19810510T030000
RDATE:19820509T030000
RDATE:19830515T030000
RDATE:19840513T030000
RDATE:19850512T030000
RDATE:19860511T030000
RDATE:19870510T030000
RDATE:19880515T030000
RDATE:19890514T030000
RDATE:19900513T030000
RDATE:19910512T030000
RDATE:19920510T030000
RDATE:19930509T030000
RDATE:19940515T030000
RDATE:19950514T030000
RDATE:19960512T030000
RDATE:19970511T030000
RDATE:19980510T030000
RDATE:19990509T030000
RDATE:20000514T030000
RDATE:20010513T030000
RDATE:20020512T030000
RDATE:20030511T030000
RDATE:20040509T030000
RDATE:20050515T030000
RDATE:20060514T030000
RDATE:20070513T030000
RDATE:20080511T030000
RDATE:20090510T030000
RDATE:20100509T030000
RDATE:20110515T030000
RDATE:20120513T030000
RDATE:20130512T030000
RDATE:20140511T030000
RDATE:20150510T030000
RDATE:20160515T030000
RDATE:20170514T030000
RDATE:20180513T030000
RDATE:20190512T030000
RDATE:20200510T030000
RDATE:20210509T030000
RDATE:20220515T030000
RDATE:20230514T030000
RDATE:20240512T030000
RDATE:20250511T030000
RDATE:20260510T030000
RDATE:20270509T030000
RDATE:20280514T030000
RDATE:20290513T030000
RDATE:20300512T030000
RDATE:20310511T030000
RDATE:20320509T030000
RDATE:20330515T030000
RDATE:20340514T030000
RDATE:20350513T030000
RDATE:20360511T030000
RDATE:20370510T030000
END:STANDARD
BEGIN:STANDARD
TZOFFSETFROM:-0300
TZOFFSETTO:-0400
TZNAME:-04
DTSTART:20380509T000000
RRULE:FREQ=YEARLY;BYMONTH=5;BYDAY=2SU
END:STANDARD
BEGIN:DAYLIGHT
TZOFFSETFROM:-0400
TZOFFSETTO:-0300
TZNAME:-03
DTSTART:19700809T000000
RDATE:19700809T040000
RDATE:19710815T040000
RDATE:19720813T040000
RDATE:19730812T040000
RDATE:19740811T040000
RDATE:19750810T040000
RDATE:19760815T040000
RDATE:19770814T040000
RDATE:19780813T040000
RDATE:19790812T040000
RDATE:19800810T040000
RDATE:19810809T040000
RDATE:19820815T040000
RDATE:19830814T040000
RDATE:19840812T040000
RDATE:19850811T040000
RDATE:19860810T040000
RDATE:19870809T040000
RDATE:19880814T040000
RDATE:19890813T040000
RDATE:19900812T040000
RDATE:19910811T040000
RDATE:19920809T040000
RDATE:19930815T040000
RDATE:19940814T040000
RDATE:19950813T040000
RDATE:19960811T040000
RDATE:19970810T040000
RDATE:19980809T040000
RDATE:19990815T040000
RDATE:20000813T040000
RDATE:20010812T040000
RDATE:20020811T040000
RDATE:20030810T040000
RDATE:20040815T040000
RDATE:20050814T040000
RDATE:20060813T040000
RDATE:20070812T040000
RDATE:20080810T040000
RDATE:20090809T040000
RDATE:20100815T040000
RDATE:20110814T040000
RDATE:20120812T040000
RDATE:20130811T040000
RDATE:20140810T040000
RDATE:20150809T040000
RDATE:20160814T040000
RDATE:20170813T040000
RDATE:20180812T040000
RDATE:20190811T040000
RDATE:20200809T040000
RDATE:20210815T040000
RDATE:20220814T040000
RDATE:20230813T040000
RDATE:20240811T040000
RDATE:20250810T040000
RDATE:20260809T040000
RDATE:20270815T040000
RDATE:20280813T040000
RDATE:20290812T040000
RDATE:20300811T040000
RDATE:20310810T040000
RDATE:20320815T040000
RDATE:20330814T040000
RDATE:20340813T040000
RDATE:20350812T040000
RDATE:20360810T040000
RDATE:20370809T040000
END:DAYLIGHT
BEGIN:DAYLIGHT
TZOFFSETFROM:-0400
TZOFFSETTO:-0300
TZNAME:-03
DTSTART:20380815T000000
RRULE:FREQ=YEARLY;BYMONTH=8;BYDAY=2SU
END:DAYLIGHT
END:VTIMEZONE
BEGIN:VEVENT
DTSTART;TZID=America/Santiago:20170309T100000
DTEND;TZID=America/Santiago:20170309T110000
RRULE:FREQ=MONTHLY;INTERVAL=30;BYMONTHDAY=9
DTSTAMP:20170310T172720Z
UID:80rl9kuu5bq49gme99eklov27k@google.com
CREATED:20170310T172400Z
DESCRIPTION:
LAST-MODIFIED:20170310T172400Z
LOCATION:
SEQUENCE:0
STATUS:CONFIRMED
SUMMARY:TestEvent
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR

View File

@@ -0,0 +1,25 @@
/* Magic Mirror Test config sample ipWhitelist
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: [],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

25
tests/configs/env.js Normal file
View File

@@ -0,0 +1,25 @@
/* Magic Mirror Test config sample enviroment
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,41 @@
/* Magic Mirror Test config default calendar with auth by default
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
calendars: [
{
maximumNumberOfDays: 10000,
url: "http://localhost:8011/tests/configs/data/calendar_test.ics",
auth: {
user: "MagicMirror",
pass: "CallMeADog"
}
}
]
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,42 @@
/* Magic Mirror Test config default calendar
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
calendars: [
{
maximumNumberOfDays: 10000,
url: "http://localhost:8010/tests/configs/data/calendar_test.ics",
auth: {
user: "MagicMirror",
pass: "CallMeADog",
method: "basic"
}
}
]
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,37 @@
/* Magic Mirror Test config default calendar
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
calendars: [
{
maximumNumberOfDays: 10000,
url: "http://localhost:8080/tests/configs/data/calendar_test.ics"
}
]
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,44 @@
/* Magic Mirror Test calendar calendar
*
* This configuration is a wrong authentication
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
calendars: [
{
maximumNumberOfDays: 10000,
url: "http://localhost:8020/tests/configs/data/calendar_test.ics",
auth: {
user: "MagicMirror",
pass: "StairwayToHeaven",
method: "basic"
}
}
]
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,39 @@
/* Magic Mirror Test config default calendar
* with authenticacion old config
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "calendar",
position: "bottom_bar",
config: {
calendars: [
{
maximumNumberOfDays: 10000,
url: "http://localhost:8012/tests/configs/data/calendar_test.ics",
user: "MagicMirror",
pass: "CallMeADog"
}
]
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,29 @@
/* Magic Mirror Test config for default clock module
*
* By Sergey Morozov
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center"
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,29 @@
/* Magic Mirror Test config for default clock module
*
* By Sergey Morozov
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center"
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,32 @@
/* Magic Mirror Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center",
config: {
displaySeconds: false
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,32 @@
/* Magic Mirror Test config for default clock module
*
* By Sergey Morozov
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center",
config: {
showPeriodUpper: true
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,32 @@
/* Magic Mirror Test config for default clock module
*
* By Johan Hammar
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center",
config: {
showWeek: true
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,29 @@
/* Magic Mirror Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "es",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center"
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,29 @@
/* Magic Mirror Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "es",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center"
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,32 @@
/* Magic Mirror Test config for default clock module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "es",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "clock",
position: "middle_center",
config: {
showPeriodUpper: true
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,38 @@
/* Magic Mirror Test config compliments with anytime type
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "compliments",
position: "middle_center",
config: {
compliments: {
morning: [],
afternoon: [],
evening: [],
anytime: ["Anytime here"]
}
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,35 @@
/* Magic Mirror Test config compliments with anytime type
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "compliments",
position: "middle_center",
config: {
compliments: {
anytime: ["Anytime here"]
}
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,42 @@
/* Magic Mirror Test config for default compliments
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 12,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "compliments",
position: "middle_center",
config: {
compliments: {
morning: [
"Hi", "Good Morning", "Morning test"
],
afternoon: [
"Hello", "Good Afternoon", "Afternoon test"
],
evening: [
"Hello There", "Good Evening", "Evening test"
]
}
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,32 @@
/* Magic Mirror Test config sample module hello world
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
{
module: "helloworld",
position: "bottom_bar",
config: {
text: "Test HelloWorld Module"
}
}
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,43 @@
/* Magic Mirror Test config for position setters module
*
* For this case is using helloworld module
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
ipWhitelist: [],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules:
// Using exotic content. This is why dont accept go to JSON configuration file
(function() {
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
"bottom_bar", "fullscreen_above", "fullscreen_below"];
var modules = Array();
for (idx in positions) {
modules.push({
module: "helloworld",
position: positions[idx],
config: {
text: "Text in " + positions[idx]
}
});
}
return modules;
})(),
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,25 @@
/* Magic Mirror Test config sample ipWhitelist
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["x.x.x.x"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,25 @@
/* Magic Mirror Test config sample enviroment set por 8090
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8090,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
},
modules: [
]
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

View File

@@ -0,0 +1,23 @@
/* Magic Mirror Test default config for modules
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*/
var config = {
port: 8080,
ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1", "::ffff:192.168.10.1"],
language: "en",
timeFormat: 24,
units: "metric",
electronOptions: {
webPreferences: {
nodeIntegration: true,
},
}
};
/*************** DO NOT EDIT THE LINE BELOW ***************/
if (typeof module !== "undefined") {module.exports = config;}

51
tests/e2e/dev_console.js Normal file
View File

@@ -0,0 +1,51 @@
const Application = require("spectron").Application;
const path = require("path");
const chai = require("chai");
const expect = chai.expect;
const chaiAsPromised = require("chai-as-promised");
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
if (process.platform === "win32") {
electronPath += ".cmd";
}
var appPath = path.join(__dirname, "../../js/electron.js");
var app = new Application({
path: electronPath
});
global.before(function () {
chai.should();
chai.use(chaiAsPromised);
});
describe("Argument 'dev'", function () {
this.timeout(20000);
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("should not open dev console when absent", function () {
app.args = [appPath];
return app.start().then(function() {
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(false);
});
});
it("should open dev console when provided", function () {
app.args = [appPath, "dev"];
return app.start().then(function() {
return expect(app.browserWindow.isDevToolsOpened()).to.eventually.equal(true);
});
});
});

47
tests/e2e/env_spec.js Normal file
View File

@@ -0,0 +1,47 @@
const globalSetup = require("./global-setup");
const app = globalSetup.app;
const request = require("request");
const chai = require("chai");
const expect = chai.expect;
describe("Electron app environment", function () {
this.timeout(20000);
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/env.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("is set to open new app window", function () {
return app.client.waitUntilWindowLoaded()
.getWindowCount().should.eventually.equal(1);
});
it("sets correct window title", function () {
return app.client.waitUntilWindowLoaded()
.getTitle().should.eventually.equal("Magic Mirror");
});
it("get request from http://localhost:8080 should return 200", function (done) {
request.get("http://localhost:8080", function (err, res, body) {
expect(res.statusCode).to.equal(200);
done();
});
});
it("get request from http://localhost:8080/nothing should return 404", function (done) {
request.get("http://localhost:8080/nothing", function (err, res, body) {
expect(res.statusCode).to.equal(404);
done();
});
});
});

34
tests/e2e/global-setup.js Normal file
View File

@@ -0,0 +1,34 @@
/*
* Magic Mirror
*
* Global Setup Test Suite
*
* By Rodrigo Ramírez Norambuena https://rodrigoramirez.com
* MIT Licensed.
*
*/
const Application = require("spectron").Application;
const path = require("path");
const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
if (process.platform === "win32") {
electronPath += ".cmd";
}
var appPath = path.join(__dirname, "../../js/electron.js");
var app = new Application({
path: electronPath,
args: [appPath]
});
global.before(function () {
chai.should();
chai.use(chaiAsPromised);
});
exports.app = app;

View File

@@ -0,0 +1,46 @@
const globalSetup = require("./global-setup");
const app = globalSetup.app;
const request = require("request");
const chai = require("chai");
const expect = chai.expect;
describe("ipWhitelist directive configuration", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
describe("Set ipWhitelist without access", function () {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
});
it("should return 403", function (done) {
request.get("http://localhost:8080", function (err, res, body) {
expect(res.statusCode).to.equal(403);
done();
});
});
});
describe("Set ipWhitelist []", function () {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
});
it("should return 200", function (done) {
request.get("http://localhost:8080", function (err, res, body) {
expect(res.statusCode).to.equal(200);
done();
});
});
});
});

View File

@@ -0,0 +1,81 @@
const globalSetup = require("../global-setup");
const serverBasicAuth = require("../../servers/basic-auth.js");
const app = globalSetup.app;
const chai = require("chai");
const expect = chai.expect;
describe("Calendar module", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
describe("Default configuration", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/default.js";
});
it("Should return TestEvents", function () {
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
});
});
describe("Basic auth", function() {
before(function() {
serverBasicAuth.listen(8010);
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/basic-auth.js";
});
it("Should return TestEvents", function () {
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
});
});
describe("Basic auth by default", function() {
before(function() {
serverBasicAuth.listen(8011);
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/auth-default.js";
});
it("Should return TestEvents", function () {
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
});
});
describe("Basic auth backward compatibilty configuration", function() {
before(function() {
serverBasicAuth.listen(8012);
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/old-basic-auth.js";
});
it("Should return TestEvents", function () {
return app.client.waitUntilTextExists(".calendar", "TestEvent", 10000);
});
});
describe("Fail Basic auth", function() {
before(function() {
serverBasicAuth.listen(8020);
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/calendar/fail-basic-auth.js";
});
it("Should return No upcoming events", function () {
return app.client.waitUntilTextExists(".calendar", "No upcoming events.", 10000);
});
});
});

View File

@@ -0,0 +1,81 @@
const globalSetup = require("../global-setup");
const app = globalSetup.app;
describe("Clock set to spanish language module", function () {
this.timeout(20000);
describe("with default 24hr clock config", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_24hr.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows date with correct format", function () {
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 24hr format", function() {
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/
return app.client.waitUntilWindowLoaded()
.getText(".clock .time").should.eventually.match(timeRegex);
});
});
describe("with default 12hr clock config", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_12hr.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows date with correct format", function () {
const dateRegex = /^(?:lunes|martes|miércoles|jueves|viernes|sábado|domingo), \d{1,2} de (?:enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre) de \d{4}$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 12hr format", function() {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .time").should.eventually.match(timeRegex);
});
});
describe("with showPeriodUpper config enabled", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/es/clock_showPeriodUpper.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows 12hr time with upper case AM/PM", function() {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .time").should.eventually.match(timeRegex);
});
});
});

View File

@@ -0,0 +1,124 @@
const globalSetup = require("../global-setup");
const app = globalSetup.app;
describe("Clock module", function () {
this.timeout(20000);
describe("with default 24hr clock config", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_24hr.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows date with correct format", function () {
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 24hr format", function() {
const timeRegex = /^(?:2[0-3]|[01]\d):[0-5]\d[0-5]\d$/
return app.client.waitUntilWindowLoaded()
.getText(".clock .time").should.eventually.match(timeRegex);
});
});
describe("with default 12hr clock config", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_12hr.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows date with correct format", function () {
const dateRegex = /^(?:Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (?:January|February|March|April|May|June|July|August|September|October|November|December) \d{1,2}, \d{4}$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .date").should.eventually.match(dateRegex);
});
it("shows time in 12hr format", function() {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[ap]m$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .time").should.eventually.match(timeRegex);
});
});
describe("with showPeriodUpper config enabled", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showPeriodUpper.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows 12hr time with upper case AM/PM", function() {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[0-5]\d[AP]M$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .time").should.eventually.match(timeRegex);
});
});
describe("with displaySeconds config disabled", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_displaySeconds_false.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows 12hr time without seconds am/pm", function() {
const timeRegex = /^(?:1[0-2]|[1-9]):[0-5]\d[ap]m$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .time").should.eventually.match(timeRegex);
});
});
describe("with showWeek config enabled", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/clock/clock_showWeek.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("shows week with correct format", function() {
const weekRegex = /^Week [0-9]{1,2}$/;
return app.client.waitUntilWindowLoaded()
.getText(".clock .week").should.eventually.match(weekRegex);
});
});
});

View File

@@ -0,0 +1,95 @@
const globalSetup = require("../global-setup");
const app = globalSetup.app;
const chai = require("chai");
const expect = chai.expect;
describe("Compliments module", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
describe("parts of days", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_parts_day.js";
});
it("if Morning compliments for that part of day", function () {
var hour = new Date().getHours();
if (hour >= 3 && hour < 12) {
// if morning check
return app.client.waitUntilWindowLoaded()
.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hi", "Good Morning", "Morning test"]);
})
}
});
it("if Afternoon show Compliments for that part of day", function () {
var hour = new Date().getHours();
if (hour >= 12 && hour < 17) {
// if morning check
return app.client.waitUntilWindowLoaded()
.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hello", "Good Afternoon", "Afternoon test"]);
})
}
});
it("if Evening show Compliments for that part of day", function () {
var hour = new Date().getHours();
if (!(hour >= 3 && hour < 12) && !(hour >= 12 && hour < 17)) {
// if evening check
return app.client.waitUntilWindowLoaded()
.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Hello There", "Good Evening", "Evening test"]);
})
}
});
});
describe("Feature anytime in compliments module", function() {
describe("Set anytime and empty compliments for morning, evening and afternoon ", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_anytime.js";
});
it("Show anytime because if configure empty parts of day compliments and set anytime compliments", function () {
return app.client.waitUntilWindowLoaded()
.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Anytime here"]);
})
});
});
describe("Only anytime present in configuration compliments", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/compliments/compliments_only_anytime.js";
});
it("Show anytime compliments", function () {
return app.client.waitUntilWindowLoaded()
.getText(".compliments").then(function (text) {
expect(text).to.be.oneOf(["Anytime here"]);
})
});
});
});
});

View File

@@ -0,0 +1,24 @@
const globalSetup = require("../global-setup");
const app = globalSetup.app;
describe("Test helloworld module", function () {
this.timeout(20000);
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/helloworld/helloworld.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("Test message helloworld module", function () {
return app.client.waitUntilWindowLoaded()
.getText(".helloworld").should.eventually.equal("Test HelloWorld Module");
});
});

View File

@@ -0,0 +1,42 @@
const globalSetup = require("./global-setup");
const app = globalSetup.app;
const chai = require("chai");
const expect = chai.expect;
describe("Position of modules", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
describe("Using helloworld", function() {
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/modules/positions.js";
});
var positions = ["top_bar", "top_left", "top_center", "top_right", "upper_third",
"middle_center", "lower_third", "bottom_left", "bottom_center", "bottom_right",
"bottom_bar", "fullscreen_above", "fullscreen_below"];
var position;
var className;
for (idx in positions) {
position = positions[idx];
className = position.replace("_", ".");
it("show text in " + position , function () {
return app.client.waitUntilWindowLoaded()
.getText("." + className).should.eventually.equal("Text in " + position);
});
}
});
});

51
tests/e2e/port_config.js Normal file
View File

@@ -0,0 +1,51 @@
const globalSetup = require("./global-setup");
const app = globalSetup.app;
const request = require("request");
const chai = require("chai");
const expect = chai.expect;
describe("port directive configuration", function () {
this.timeout(20000);
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
describe("Set port 8090", function () {
before(function() {
// Set config sample for use in this test
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
});
it("should return 200", function (done) {
request.get("http://localhost:8090", function (err, res, body) {
expect(res.statusCode).to.equal(200);
done();
});
});
});
describe("Set port 8100 on enviroment variable MM_PORT", function () {
before(function() {
process.env.MM_PORT = 8100;
// Set config sample for use in this test
process.env.MM_CONFIG_FILE = "tests/configs/port_8090.js";
});
after(function(){
delete process.env.MM_PORT;
});
it("should return 200", function (done) {
request.get("http://localhost:8100", function (err, res, body) {
expect(res.statusCode).to.equal(200);
done();
});
});
});
});

View File

@@ -0,0 +1,53 @@
const Application = require("spectron").Application;
const path = require("path");
const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
var electronPath = path.join(__dirname, "../../", "node_modules", ".bin", "electron");
if (process.platform === "win32") {
electronPath += ".cmd";
}
var appPath = path.join(__dirname, "../../js/electron.js");
var app = new Application({
path: electronPath,
args: [appPath]
});
global.before(function () {
chai.should();
chai.use(chaiAsPromised);
});
describe("Check configuration without modules", function () {
this.timeout(20000);
before(function() {
// Set config sample for use in test
process.env.MM_CONFIG_FILE = "tests/configs/without_modules.js";
});
beforeEach(function (done) {
app.start().then(function() { done(); } );
});
afterEach(function (done) {
app.stop().then(function() { done(); });
});
it("Show the message MagicMirror title", function () {
return app.client.waitUntilWindowLoaded()
.getText("#module_1_helloworld .module-content").should.eventually.equal("Magic Mirror2")
});
it("Show the text Michael's website", function () {
return app.client.waitUntilWindowLoaded()
.getText("#module_5_helloworld .module-content").should.eventually.equal("www.michaelteeuw.nl");
});
});

View File

@@ -0,0 +1,30 @@
var http = require("http");
var path = require("path");
var auth = require("http-auth");
var express = require("express")
var basic = auth.basic({
realm: "MagicMirror Area restricted."
}, (username, password, callback) => {
callback(username === "MagicMirror" && password === "CallMeADog");
});
this.server = express();
this.server.use(auth.connect(basic));
// Set directories availables
var directories = ["/tests/configs"];
var directory;
rootPath = path.resolve(__dirname + "/../../");
for (i in directories) {
directory = directories[i];
this.server.use(directory, express.static(path.resolve(rootPath + directory)));
}
exports.listen = function () {
this.server.listen.apply(this.server, arguments);
};
exports.close = function (callback) {
this.server.close(callback);
};

View File

@@ -0,0 +1,20 @@
var chai = require("chai");
var expect = chai.expect;
var classMM = require("../../../js/class.js"); // require for load module.js
var moduleMM = require("../../../js/module.js")
describe("Test function cmpVersions in js/module.js", function() {
it("should return -1 when comparing 2.1 to 2.2", function() {
expect(moduleMM._test.cmpVersions("2.1", "2.2")).to.equal(-1);
});
it("should be return 0 when comparing 2.2 to 2.2", function() {
expect(moduleMM._test.cmpVersions("2.2", "2.2")).to.equal(0);
});
it("should be return 1 when comparing 1.1 to 1.0", function() {
expect(moduleMM._test.cmpVersions("1.1", "1.0")).to.equal(1);
});
});

View File

@@ -0,0 +1,71 @@
var fs = require("fs");
var path = require("path");
var chai = require("chai");
var expect = chai.expect;
var vm = require("vm");
before(function() {
var basedir = path.join(__dirname, "../../..");
var fileName = "js/app.js";
var filePath = path.join(basedir, fileName);
var code = fs.readFileSync(filePath);
this.sandbox = {
module: {},
__dirname: path.dirname(filePath),
global: {},
console: {
log: function() { /*console.log("console.log(", arguments, ")");*/ }
},
process: {
on: function() { /*console.log("process.on called with: ", arguments);*/ },
env: {}
}
};
this.sandbox.require = function(filename) {
// This modifies the global slightly,
// but supplies vm with essential code
return require(filename);
};
vm.runInNewContext(code, this.sandbox, fileName);
});
after(function() {
//console.log(global);
});
describe("'global.root_path' set in js/app.js", function() {
var expectedSubPaths = [
"modules",
"serveronly",
"js",
"js/app.js",
"js/main.js",
"js/electron.js",
"config"
];
expectedSubPaths.forEach(subpath => {
it(`contains a file/folder "${subpath}"`, function() {
expect(fs.existsSync(path.join(this.sandbox.global.root_path, subpath))).to.equal(true);
});
});
it("should not modify global.root_path for testing", function() {
expect(global.root_path).to.equal(undefined);
});
it("should not modify global.version for testing", function() {
expect(global.version).to.equal(undefined);
});
it("should expect the global.version equals package.json file", function() {
version_package = JSON.parse(fs.readFileSync("package.json", "utf8")).version;
expect(this.sandbox.global.version).to.equal(version_package);
});
});

View File

@@ -0,0 +1,115 @@
var fs = require("fs");
var path = require("path");
var chai = require("chai");
var expect = chai.expect;
describe("Translations have the same keys as en.js", function() {
var translations = require("../../../translations/translations.js");
var base = JSON.parse(stripComments(fs.readFileSync("translations/en.json", "utf8")));
var baseKeys = Object.keys(base).sort();
Object.keys(translations).forEach(function(tr) {
var fileName = translations[tr];
var fileContent = stripComments(fs.readFileSync(fileName, "utf8"));
var fileTranslations = JSON.parse(fileContent);
var fileKeys = Object.keys(fileTranslations).sort();
it(fileName + " keys should be in base", function() {
fileKeys.forEach(function(key) {
expect( baseKeys.indexOf(key) ).to.be.at.least(0);
});
});
it(fileName + " should contain all base keys", function() {
var test = this;
baseKeys.forEach(function(key) {
// TODO: when all translations are fixed, use
// expect(fileKeys).to.deep.equal(baseKeys);
// instead of the try-catch-block
try {
expect(fileKeys).to.deep.equal(baseKeys);
} catch(e) {
if (e instanceof chai.AssertionError) {
test.skip();
} else {
throw e;
}
}
});
});
});
});
// Copied from js/translator.js
function stripComments(str, opts) {
// strip comments copied from: https://github.com/sindresorhus/strip-json-comments
var singleComment = 1;
var multiComment = 2;
function stripWithoutWhitespace() {
return "";
}
function stripWithWhitespace(str, start, end) {
return str.slice(start, end).replace(/\S/g, " ");
}
opts = opts || {};
var currentChar;
var nextChar;
var insideString = false;
var insideComment = false;
var offset = 0;
var ret = "";
var strip = opts.whitespace === false ? stripWithoutWhitespace : stripWithWhitespace;
for (var i = 0; i < str.length; i++) {
currentChar = str[i];
nextChar = str[i + 1];
if (!insideComment && currentChar === "\"") {
var escaped = str[i - 1] === "\\" && str[i - 2] !== "\\";
if (!escaped) {
insideString = !insideString;
}
}
if (insideString) {
continue;
}
if (!insideComment && currentChar + nextChar === "//") {
ret += str.slice(offset, i);
offset = i;
insideComment = singleComment;
i++;
} else if (insideComment === singleComment && currentChar + nextChar === "\r\n") {
i++;
insideComment = false;
ret += strip(str, offset, i);
offset = i;
continue;
} else if (insideComment === singleComment && currentChar === "\n") {
insideComment = false;
ret += strip(str, offset, i);
offset = i;
} else if (!insideComment && currentChar + nextChar === "/*") {
ret += str.slice(offset, i);
offset = i;
insideComment = multiComment;
i++;
continue;
} else if (insideComment === multiComment && currentChar + nextChar === "*/") {
i++;
insideComment = false;
ret += strip(str, offset, i + 1);
offset = i + 1;
continue;
}
}
return ret + (insideComment ? strip(str.substr(offset)) : str.substr(offset));
}

30
translations/af.json Normal file
View File

@@ -0,0 +1,30 @@
{
"LOADING": "Besig om te laai &hellip;",
"TODAY": "Vandag",
"TOMORROW": "Môre",
"DAYAFTERTOMORROW": "Oormôre",
"RUNNING": "Eindig in",
"EMPTY": "Geen komende gebeurtenisse.",
"N": "N",
"NNE": "NNO",
"NE": "NO",
"ENE": "ONO",
"E": "O",
"ESE": "OSO",
"SE": "SO",
"SSE": "SSO",
"S": "S",
"SSW": "SSW",
"SW": "SW",
"WSW": "WSW",
"W": "W",
"WNW": "WNW",
"NW": "NW",
"NNW": "NNW",
"UPDATE_NOTIFICATION": "MagicMirror² update beskikbaar.",
"UPDATE_NOTIFICATION_MODULE": "Update beskikbaar vir MODULE_NAME module.",
"UPDATE_INFO": "Die huidige installasie is COMMIT_COUNT agter op die BRANCH_NAME branch."
}

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