mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge remote-tracking branch 'upstream/develop' into single_line_news
This commit is contained in:
commit
41a15f90cb
2
CHANGELOG.md
Executable file → Normal file
2
CHANGELOG.md
Executable file → Normal file
@ -48,7 +48,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- Add test for compliments module for parts of day
|
||||
- Korean Translation.
|
||||
- Added console warning on startup when deprecated config options are used
|
||||
- Added `DAYAFTERTOMORROW`, `UPDATE_NOTIFICATION`, `UPDATE_NOTIFICATION_MODULE`, `UPDATE_INFO` to Norwegian translations (`nn` and `nb`).
|
||||
- Added ability to disable wrapping of news items
|
||||
|
||||
### Fixed
|
||||
@ -60,7 +59,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
- 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)
|
||||
- Fixed missing animation on `this.show(speed)` when module is alone in a region.
|
||||
|
||||
## [2.1.0] - 2016-12-31
|
||||
|
||||
|
@ -46,7 +46,7 @@ var config = {
|
||||
position: "top_right",
|
||||
config: {
|
||||
location: "New York",
|
||||
locationID: "", //ID from http://www.openweathermap.org
|
||||
locationID: "", //ID from http://www.openweathermap.org/help/city_list.txt
|
||||
appid: "YOUR_OPENWEATHER_API_KEY"
|
||||
}
|
||||
},
|
||||
@ -56,7 +56,7 @@ var config = {
|
||||
header: "Weather Forecast",
|
||||
config: {
|
||||
location: "New York",
|
||||
locationID: "5128581", //ID from http://www.openweathermap.org
|
||||
locationID: "5128581", //ID from http://www.openweathermap.org/help/city_list.txt
|
||||
appid: "YOUR_OPENWEATHER_API_KEY"
|
||||
}
|
||||
},
|
||||
|
@ -69,12 +69,14 @@ var App = function() {
|
||||
} catch (e) {
|
||||
if (e.code == "ENOENT") {
|
||||
console.error("WARNING! Could not find config file. Please create one. Starting with default configuration.");
|
||||
callback(defaults);
|
||||
} 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);
|
||||
} else {
|
||||
console.error("WARNING! Could not load config file. Starting with default configuration. Error found: " + e);
|
||||
callback(defaults);
|
||||
}
|
||||
callback(defaults);
|
||||
}
|
||||
};
|
||||
|
||||
|
7
js/main.js
Executable file → Normal file
7
js/main.js
Executable file → Normal file
@ -245,18 +245,15 @@ 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(); }
|
||||
}, speed);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -53,25 +53,36 @@ The `colored` property gives the option for an individual color for each calenda
|
||||
#### Default value:
|
||||
````javascript
|
||||
config: {
|
||||
colored: false,
|
||||
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:
|
||||
| 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.
|
||||
| `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)).
|
||||
| `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'`
|
||||
| `user` | The username for HTTP Basic authentication.
|
||||
| `pass` | The password for HTTP Basic authentication.
|
||||
| `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`
|
||||
|
@ -72,10 +72,18 @@ Module.register("calendar", {
|
||||
|
||||
var calendarConfig = {
|
||||
maximumEntries: calendar.maximumEntries,
|
||||
maximumNumberOfDays: calendar.maximumNumberOfDays,
|
||||
maximumNumberOfDays: calendar.maximumNumberOfDays
|
||||
};
|
||||
|
||||
this.addCalendar(calendar.url, calendar.user, calendar.pass, calendarConfig);
|
||||
// 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 = {};
|
||||
@ -313,14 +321,13 @@ Module.register("calendar", {
|
||||
*
|
||||
* argument url string - Url to add.
|
||||
*/
|
||||
addCalendar: function (url, user, pass, calendarConfig) {
|
||||
addCalendar: function (url, auth, calendarConfig) {
|
||||
this.sendSocketNotification("ADD_CALENDAR", {
|
||||
url: url,
|
||||
maximumEntries: calendarConfig.maximumEntries || this.config.maximumEntries,
|
||||
maximumNumberOfDays: calendarConfig.maximumNumberOfDays || this.config.maximumNumberOfDays,
|
||||
fetchInterval: this.config.fetchInterval,
|
||||
user: user,
|
||||
pass: pass
|
||||
auth: auth
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -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,7 +59,7 @@ var CalendarFetcher = function(url, reloadInterval, maximumEntries, maximumNumbe
|
||||
return;
|
||||
}
|
||||
|
||||
//console.log(data);
|
||||
// console.log(data);
|
||||
newEvents = [];
|
||||
|
||||
var limitFunction = function(date, i) {return i < maximumEntries;};
|
||||
|
@ -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! ");
|
@ -24,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);
|
||||
}
|
||||
},
|
||||
|
||||
@ -36,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)) {
|
||||
@ -47,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.');
|
||||
|
@ -38,6 +38,7 @@
|
||||
"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",
|
||||
|
190
tests/configs/data/calendar_test.ics
Normal file
190
tests/configs/data/calendar_test.ics
Normal 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
|
41
tests/configs/modules/calendar/auth-default.js
Normal file
41
tests/configs/modules/calendar/auth-default.js
Normal 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;}
|
42
tests/configs/modules/calendar/basic-auth.js
Normal file
42
tests/configs/modules/calendar/basic-auth.js
Normal 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;}
|
37
tests/configs/modules/calendar/default.js
Normal file
37
tests/configs/modules/calendar/default.js
Normal 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;}
|
39
tests/configs/modules/calendar/old-basic-auth.js
Normal file
39
tests/configs/modules/calendar/old-basic-auth.js
Normal 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;}
|
25
tests/configs/noIpWhiteList.js
Normal file
25
tests/configs/noIpWhiteList.js
Normal 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;}
|
30
tests/e2e/ipWhistlist_spec.js
Normal file
30
tests/e2e/ipWhistlist_spec.js
Normal file
@ -0,0 +1,30 @@
|
||||
const globalSetup = require("./global-setup");
|
||||
const app = globalSetup.app;
|
||||
const request = require("request");
|
||||
const chai = require("chai");
|
||||
const expect = chai.expect;
|
||||
|
||||
describe("Set ipWhitelist without access", function () {
|
||||
|
||||
this.timeout(20000);
|
||||
|
||||
before(function() {
|
||||
// Set config sample for use in test
|
||||
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
||||
});
|
||||
|
||||
beforeEach(function (done) {
|
||||
app.start().then(function() { done(); } );
|
||||
});
|
||||
|
||||
afterEach(function (done) {
|
||||
app.stop().then(function() { done(); });
|
||||
});
|
||||
|
||||
it("should return 403", function (done) {
|
||||
request.get("http://localhost:8080", function (err, res, body) {
|
||||
expect(res.statusCode).to.equal(403);
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
70
tests/e2e/modules/calendar_spec.js
Normal file
70
tests/e2e/modules/calendar_spec.js
Normal file
@ -0,0 +1,70 @@
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
});
|
30
tests/servers/basic-auth.js
Normal file
30
tests/servers/basic-auth.js
Normal 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);
|
||||
};
|
@ -24,7 +24,7 @@
|
||||
"NW": "ÉNy",
|
||||
"NNW": "ÉÉNy",
|
||||
|
||||
"UPDATE_NOTIFICATION": "Elérhető MagicMirror² frissítés.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Frissítés érhető el a MODULE_NAME modulhoz.",
|
||||
"UPDATE_INFO": "A jelenlegi telepített verzió COMMIT_COUNT commit-al régebbi a BRANCH_NAME branch-en."
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² elérhető egy frissítés!",
|
||||
"UPDATE_NOTIFICATION_MODULE": "A frissítés MODULE_NAME modul néven érhető el.",
|
||||
"UPDATE_INFO": "A jelenlegi telepítés COMMIT_COUNT mögött BRANCH_NAME ágon található."
|
||||
}
|
||||
|
@ -1,30 +0,0 @@
|
||||
{
|
||||
"LOADING": "Memuat …",
|
||||
|
||||
"TODAY": "Hari ini",
|
||||
"TOMORROW": "Besok",
|
||||
"DAYAFTERTOMORROW": "Lusa",
|
||||
"RUNNING": "Berakhir dalam",
|
||||
"EMPTY": "Tidak ada agenda",
|
||||
|
||||
"N": "U",
|
||||
"NNE": "UUT",
|
||||
"NE": "NE",
|
||||
"ENE": "TUT",
|
||||
"E": "T",
|
||||
"ESE": "TST",
|
||||
"SE": "ST",
|
||||
"SSE": "SST",
|
||||
"S": "S",
|
||||
"SSW": "SSB",
|
||||
"SW": "SB",
|
||||
"WSW": "BSB",
|
||||
"W": "B",
|
||||
"WNW": "BUB",
|
||||
"NW": "UB",
|
||||
"NNW": "UUB",
|
||||
|
||||
"UPDATE_NOTIFICATION": "Update MagicMirror² tersedia.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Update tersedia untuk modul MODULE_NAME.",
|
||||
"UPDATE_INFO": "Instalasi saat ini tertinggal COMMIT_COUNT pada cabang BRANCH_NAME."
|
||||
}
|
7
translations/nb.json
Executable file → Normal file
7
translations/nb.json
Executable file → Normal file
@ -3,7 +3,6 @@
|
||||
|
||||
"TODAY": "I dag",
|
||||
"TOMORROW": "I morgen",
|
||||
"DAYAFTERTOMORROW": "I overmorgen",
|
||||
"RUNNING": "Slutter om",
|
||||
"EMPTY": "Ingen kommende arrangementer.",
|
||||
|
||||
@ -22,9 +21,5 @@
|
||||
"W": "V",
|
||||
"WNW": "VNV",
|
||||
"NW": "NV",
|
||||
"NNW": "NNV",
|
||||
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² oppdatering er tilgjengelig.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Oppdatering tilgjengelig for modulen MODULE_NAME.",
|
||||
"UPDATE_INFO": "Nåværende installasjon er COMMIT_COUNT bak BRANCH_NAME grenen."
|
||||
"NNW": "NNV"
|
||||
}
|
||||
|
7
translations/nn.json
Executable file → Normal file
7
translations/nn.json
Executable file → Normal file
@ -3,7 +3,6 @@
|
||||
|
||||
"TODAY": "I dag",
|
||||
"TOMORROW": "I morgon",
|
||||
"DAYAFTERTOMORROW": "I overmorgon",
|
||||
"RUNNING": "Sluttar om",
|
||||
"EMPTY": "Ingen komande hendingar.",
|
||||
|
||||
@ -22,9 +21,5 @@
|
||||
"W": "V",
|
||||
"WNW": "VNV",
|
||||
"NW": "NV",
|
||||
"NNW": "NNV",
|
||||
|
||||
"UPDATE_NOTIFICATION": "MagicMirror² oppdatering er tilgjengeleg.",
|
||||
"UPDATE_NOTIFICATION_MODULE": "Oppdatering tilgjengeleg for modulen MODULE_NAME.",
|
||||
"UPDATE_INFO": "noverande installasjon er COMMIT_COUNT bak BRANCH_NAME greinen."
|
||||
"NNW": "NNV"
|
||||
}
|
||||
|
@ -18,7 +18,6 @@ var translations = {
|
||||
"pt" : "translations/pt.json", // Português
|
||||
"pt_br" : "translations/pt_br.json", // Português Brasileiro
|
||||
"sv" : "translations/sv.json", // Svenska
|
||||
"id" : "translations/id.json", // Indonesian
|
||||
"it" : "translations/it.json", // Italian
|
||||
"zh_cn" : "translations/zh_cn.json", // Simplified Chinese
|
||||
"zh_tw" : "translations/zh_tw.json", // Traditional Chinese
|
||||
|
Loading…
x
Reference in New Issue
Block a user