diff --git a/config/config.js.sample b/config/config.js.sample index 115e2dd2..1d780e23 100644 --- a/config/config.js.sample +++ b/config/config.js.sample @@ -25,11 +25,11 @@ var config = { timeFormat: 24, units: "metric", // serverOnly: true/false/"local" , - // local for armv6l processors, default + // local for armv6l processors, default // starts serveronly and then starts chrome browser // false, default for all NON-armv6l devices // true, force serveronly mode, because you want to.. no UI on this device - + modules: [ { module: "alert", diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index d705905c..57c1586d 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -184,7 +184,14 @@ var CalendarFetcher = function(url, reloadInterval, excludedEvents, maximumEntri // For recurring events, get the set of start dates that fall within the range // of dates we"re looking for. - var dates = rule.between(past, future, true, limitFunction); + // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time + var pastLocal = moment(past).subtract(past.getTimezoneOffset(), "minutes").toDate(); + var futureLocal = moment(past).subtract(future.getTimezoneOffset(), "minutes").toDate(); + var datesLocal = rule.between(pastLocal, futureLocal, true, limitFunction); + var dates = datesLocal.map(function(dateLocal) { + var date = moment(dateLocal).add(dateLocal.getTimezoneOffset(), "minutes").toDate(); + return date; + }); // The "dates" array contains the set of dates within our desired date range range that are valid // for the recurrence rule. *However*, it"s possible for us to have a specific recurrence that diff --git a/modules/default/calendar/vendor/ical.js/node-ical.js b/modules/default/calendar/vendor/ical.js/node-ical.js index 14855d63..1da04375 100644 --- a/modules/default/calendar/vendor/ical.js/node-ical.js +++ b/modules/default/calendar/vendor/ical.js/node-ical.js @@ -26,6 +26,17 @@ exports.parseFile = function(filename){ var rrule = require('rrule').RRule +function getLocaleISOString(date) { + var year = date.getFullYear().toString(10).padStart(4,'0'); + var month = date.getMonth().toString(10).padStart(2,'0'); + var day = date.getDate().toString(10).padStart(2,'0'); + var hour = date.getHours().toString(10).padStart(2,'0'); + var minute = date.getMinutes().toString(10).padStart(2,'0'); + var second = date.getSeconds().toString(10).padStart(2,'0'); + + return `${year}${month}${day}T${hour}${minute}${second}Z`; +} + ical.objectHandlers['RRULE'] = function(val, params, curr, stack, line){ curr.rrule = line; return curr @@ -50,8 +61,8 @@ ical.objectHandlers['END'] = function (val, params, curr, stack) { if (typeof curr.start.toISOString === 'function') { try { - rule += ';DTSTART=' + curr.start.toISOString().replace(/[-:]/g, ''); - rule = rule.replace(/\.[0-9]{3}/, ''); + // kblankenship1989 - to fix issue #1798, converting all dates to locale time first, then converting back to UTC time + rule += ';DTSTART=' + getLocaleISOString(curr.start); } catch (error) { console.error("ERROR when trying to convert to ISOString", error); } diff --git a/modules/default/compliments/compliments.js b/modules/default/compliments/compliments.js index 198664b7..606da1df 100644 --- a/modules/default/compliments/compliments.js +++ b/modules/default/compliments/compliments.js @@ -39,7 +39,7 @@ Module.register("compliments", { afternoonEndTime: 17, random: true }, - lastIndexUsed:-1, + lastIndexUsed:-1, // Set currentweather from module currentWeatherType: "", @@ -151,7 +151,7 @@ Module.register("compliments", { // get the current time of day compliments list var compliments = this.complimentArray(); // variable for index to next message to display - let index=0 + let index=0; // are we randomizing if(this.config.random){ // yes @@ -160,28 +160,28 @@ Module.register("compliments", { else{ // no, sequetial // if doing sequential, don't fall off the end - index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed + index = (this.lastIndexUsed >= (compliments.length-1))?0: ++this.lastIndexUsed; } return compliments[index]; }, -// Override dom generator. + // Override dom generator. getDom: function() { var wrapper = document.createElement("div"); wrapper.className = this.config.classes ? this.config.classes : "thin xlarge bright pre-line"; - // get the compliment text + // get the compliment text var complimentText = this.randomCompliment(); - // split it into parts on newline text - var parts= complimentText.split('\n') + // split it into parts on newline text + var parts= complimentText.split("\n"); // create a span to hold it all - var compliment=document.createElement('span') - // process all the parts of the compliment text + var compliment=document.createElement("span"); + // process all the parts of the compliment text for (part of parts){ // create a text element for each part - compliment.appendChild(document.createTextNode(part)) + compliment.appendChild(document.createTextNode(part)); // add a break ` - compliment.appendChild(document.createElement('BR')) + compliment.appendChild(document.createElement("BR")); } // remove the last break compliment.lastElementChild.remove(); diff --git a/tests/configs/modules/weather/forecastweather_default.js b/tests/configs/modules/weather/forecastweather_default.js index 697cbeb4..c87ca260 100644 --- a/tests/configs/modules/weather/forecastweather_default.js +++ b/tests/configs/modules/weather/forecastweather_default.js @@ -6,31 +6,31 @@ */ let config = { - port: 8080, - ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], - language: "en", - timeFormat: 12, - units: "metric", - electronOptions: { - webPreferences: { - nodeIntegration: true, - }, - }, + language: "en", + timeFormat: 12, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true, + }, + }, - modules: [ - { - module: "weather", - position: "bottom_bar", - config: { - type: "forecast", - location: "Munich", - apiKey: "fake key", - weatherEndpoint: "/forecast/daily", - initialLoadDelay: 3000 - } - } - ] + modules: [ + { + module: "weather", + position: "bottom_bar", + config: { + type: "forecast", + location: "Munich", + apiKey: "fake key", + weatherEndpoint: "/forecast/daily", + initialLoadDelay: 3000 + } + } + ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ diff --git a/tests/configs/modules/weather/forecastweather_options.js b/tests/configs/modules/weather/forecastweather_options.js index cc1b8773..82e3da08 100644 --- a/tests/configs/modules/weather/forecastweather_options.js +++ b/tests/configs/modules/weather/forecastweather_options.js @@ -6,34 +6,34 @@ */ let config = { - port: 8080, - ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], + port: 8080, + ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"], - language: "en", - timeFormat: 12, - units: "metric", - electronOptions: { - webPreferences: { - nodeIntegration: true, - }, - }, + language: "en", + timeFormat: 12, + units: "metric", + electronOptions: { + webPreferences: { + nodeIntegration: true, + }, + }, - modules: [ - { - module: "weather", - position: "bottom_bar", - config: { - type: "forecast", - location: "Munich", - apiKey: "fake key", - weatherEndpoint: "/forecast/daily", - initialLoadDelay: 3000, - showPrecipitationAmount: true, - colored: true, - tableClass: "myTableClass" - } - } - ] + modules: [ + { + module: "weather", + position: "bottom_bar", + config: { + type: "forecast", + location: "Munich", + apiKey: "fake key", + weatherEndpoint: "/forecast/daily", + initialLoadDelay: 3000, + showPrecipitationAmount: true, + colored: true, + tableClass: "myTableClass" + } + } + ] }; /*************** DO NOT EDIT THE LINE BELOW ***************/ diff --git a/tests/e2e/modules/mocks/weather_current.js b/tests/e2e/modules/mocks/weather_current.js index cd87aa11..807ee559 100644 --- a/tests/e2e/modules/mocks/weather_current.js +++ b/tests/e2e/modules/mocks/weather_current.js @@ -1,54 +1,54 @@ -const _ = require('lodash'); +const _ = require("lodash"); function generateWeather(extendedData = {}) { - return JSON.stringify(_.merge({}, { - coord:{ - lon: 11.58, - lat: 48.14 - }, - weather:[ - { - id: 615, - main: "Snow", - description: "light rain and snow", - icon: "13d" - }, - { - id: 500, - main: "Rain", - description: "light rain", - icon: "10d" - } - ], - base: "stations", - main:{ - temp: 1.49, - pressure: 1005, - humidity: 93.7, - temp_min: 1, - temp_max: 2 - }, - visibility: 7000, - wind:{ - speed: 11.8, - deg: 250 - }, - clouds:{ - all: 75 - }, - dt: 1547387400, - sys:{ - type: 1, - id: 1267, - message: 0.0031, - country: "DE", - sunrise: 1547362817, - sunset: 1547394301 - }, - id: 2867714, - name: "Munich", - cod: 200 - }, extendedData)); + return JSON.stringify(_.merge({}, { + coord:{ + lon: 11.58, + lat: 48.14 + }, + weather:[ + { + id: 615, + main: "Snow", + description: "light rain and snow", + icon: "13d" + }, + { + id: 500, + main: "Rain", + description: "light rain", + icon: "10d" + } + ], + base: "stations", + main:{ + temp: 1.49, + pressure: 1005, + humidity: 93.7, + temp_min: 1, + temp_max: 2 + }, + visibility: 7000, + wind:{ + speed: 11.8, + deg: 250 + }, + clouds:{ + all: 75 + }, + dt: 1547387400, + sys:{ + type: 1, + id: 1267, + message: 0.0031, + country: "DE", + sunrise: 1547362817, + sunset: 1547394301 + }, + id: 2867714, + name: "Munich", + cod: 200 + }, extendedData)); } module.exports = generateWeather; diff --git a/tests/e2e/modules/mocks/weather_forecast.js b/tests/e2e/modules/mocks/weather_forecast.js index 420367a0..9e74262f 100644 --- a/tests/e2e/modules/mocks/weather_forecast.js +++ b/tests/e2e/modules/mocks/weather_forecast.js @@ -1,97 +1,97 @@ -const _ = require('lodash'); +const _ = require("lodash"); function generateWeatherForecast(extendedData = {}) { - return JSON.stringify(_.merge({}, { - "city": { - "id": 2867714, - "name": "Munich", - "coord": {"lon": 11.5754, "lat": 48.1371}, - "country": "DE", - "population": 1260391, - "timezone": 7200 - }, - "cod": "200", - "message": 0.9653487, - "cnt": 7, - "list": [{ - "dt": 1568372400, - "sunrise": 1568350044, - "sunset": 1568395948, - "temp": {"day": 24.44, "min": 15.35, "max": 24.44, "night": 15.35, "eve": 18, "morn": 23.03}, - "pressure": 1031.65, - "humidity": 70, - "weather": [{"id": 801, "main": "Clouds", "description": "few clouds", "icon": "02d"}], - "speed": 3.35, - "deg": 314, - "clouds": 21 - }, { - "dt": 1568458800, - "sunrise": 1568436525, - "sunset": 1568482223, - "temp": {"day": 20.81, "min": 13.56, "max": 21.02, "night": 13.56, "eve": 16.6, "morn": 15.88}, - "pressure": 1028.81, - "humidity": 72, - "weather": [{"id": 500, "main": "Rain", "description": "light rain", "icon": "10d"}], - "speed": 2.21, - "deg": 81, - "clouds": 100 - }, { - "dt": 1568545200, - "sunrise": 1568523007, - "sunset": 1568568497, - "temp": {"day": 22.65, "min": 13.76, "max": 22.88, "night": 15.27, "eve": 17.45, "morn": 13.76}, - "pressure": 1023.75, - "humidity": 64, - "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], - "speed": 1.15, - "deg": 7, - "clouds": 0 - }, { - "dt": 1568631600, - "sunrise": 1568609489, - "sunset": 1568654771, - "temp": {"day": 23.45, "min": 13.95, "max": 23.45, "night": 13.95, "eve": 17.75, "morn": 15.21}, - "pressure": 1020.41, - "humidity": 64, - "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], - "speed": 3.07, - "deg": 298, - "clouds": 7 - }, { - "dt": 1568718000, - "sunrise": 1568695970, - "sunset": 1568741045, - "temp": {"day": 20.55, "min": 10.95, "max": 20.55, "night": 10.95, "eve": 14.82, "morn": 13.24}, - "pressure": 1019.4, - "humidity": 66, - "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], - "speed": 2.8, - "deg": 333, - "clouds": 2 - }, { - "dt": 1568804400, - "sunrise": 1568782452, - "sunset": 1568827319, - "temp": {"day": 18.15, "min": 7.75, "max": 18.15, "night": 7.75, "eve": 12.45, "morn": 9.41}, - "pressure": 1017.56, - "humidity": 52, - "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], - "speed": 2.92, - "deg": 34, - "clouds": 0 - }, { - "dt": 1568890800, - "sunrise": 1568868934, - "sunset": 1568913593, - "temp": {"day": 14.85, "min": 5.56, "max": 15.05, "night": 5.56, "eve": 9.56, "morn": 6.25}, - "pressure": 1022.7, - "humidity": 59, - "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], - "speed": 2.89, - "deg": 51, - "clouds": 1 - }] - }, extendedData)); + return JSON.stringify(_.merge({}, { + "city": { + "id": 2867714, + "name": "Munich", + "coord": {"lon": 11.5754, "lat": 48.1371}, + "country": "DE", + "population": 1260391, + "timezone": 7200 + }, + "cod": "200", + "message": 0.9653487, + "cnt": 7, + "list": [{ + "dt": 1568372400, + "sunrise": 1568350044, + "sunset": 1568395948, + "temp": {"day": 24.44, "min": 15.35, "max": 24.44, "night": 15.35, "eve": 18, "morn": 23.03}, + "pressure": 1031.65, + "humidity": 70, + "weather": [{"id": 801, "main": "Clouds", "description": "few clouds", "icon": "02d"}], + "speed": 3.35, + "deg": 314, + "clouds": 21 + }, { + "dt": 1568458800, + "sunrise": 1568436525, + "sunset": 1568482223, + "temp": {"day": 20.81, "min": 13.56, "max": 21.02, "night": 13.56, "eve": 16.6, "morn": 15.88}, + "pressure": 1028.81, + "humidity": 72, + "weather": [{"id": 500, "main": "Rain", "description": "light rain", "icon": "10d"}], + "speed": 2.21, + "deg": 81, + "clouds": 100 + }, { + "dt": 1568545200, + "sunrise": 1568523007, + "sunset": 1568568497, + "temp": {"day": 22.65, "min": 13.76, "max": 22.88, "night": 15.27, "eve": 17.45, "morn": 13.76}, + "pressure": 1023.75, + "humidity": 64, + "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], + "speed": 1.15, + "deg": 7, + "clouds": 0 + }, { + "dt": 1568631600, + "sunrise": 1568609489, + "sunset": 1568654771, + "temp": {"day": 23.45, "min": 13.95, "max": 23.45, "night": 13.95, "eve": 17.75, "morn": 15.21}, + "pressure": 1020.41, + "humidity": 64, + "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], + "speed": 3.07, + "deg": 298, + "clouds": 7 + }, { + "dt": 1568718000, + "sunrise": 1568695970, + "sunset": 1568741045, + "temp": {"day": 20.55, "min": 10.95, "max": 20.55, "night": 10.95, "eve": 14.82, "morn": 13.24}, + "pressure": 1019.4, + "humidity": 66, + "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], + "speed": 2.8, + "deg": 333, + "clouds": 2 + }, { + "dt": 1568804400, + "sunrise": 1568782452, + "sunset": 1568827319, + "temp": {"day": 18.15, "min": 7.75, "max": 18.15, "night": 7.75, "eve": 12.45, "morn": 9.41}, + "pressure": 1017.56, + "humidity": 52, + "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], + "speed": 2.92, + "deg": 34, + "clouds": 0 + }, { + "dt": 1568890800, + "sunrise": 1568868934, + "sunset": 1568913593, + "temp": {"day": 14.85, "min": 5.56, "max": 15.05, "night": 5.56, "eve": 9.56, "morn": 6.25}, + "pressure": 1022.7, + "humidity": 59, + "weather": [{"id": 800, "main": "Clear", "description": "sky is clear", "icon": "01d"}], + "speed": 2.89, + "deg": 51, + "clouds": 1 + }] + }, extendedData)); } module.exports = generateWeatherForecast; diff --git a/tests/e2e/vendor_spec.js b/tests/e2e/vendor_spec.js index 7e53ec5b..834c90d6 100644 --- a/tests/e2e/vendor_spec.js +++ b/tests/e2e/vendor_spec.js @@ -36,9 +36,9 @@ describe("Vendors", function () { urlVendor = "http://localhost:8080/vendor/" + vendors[vendor]; request.get(urlVendor, function (err, res, body) { if (!err) - expect(res.statusCode).to.equal(200); + {expect(res.statusCode).to.equal(200);} else - mlog.pending(`There error vendor 200 test ${err}`); + {mlog.pending(`There error vendor 200 test ${err}`);} }); }); }); @@ -48,9 +48,9 @@ describe("Vendors", function () { urlVendor = "http://localhost:8080/" + vendors[vendor]; request.get(urlVendor, function (err, res, body) { if (!err) - expect(res.statusCode).to.equal(404); + {expect(res.statusCode).to.equal(404);} else - mlog.pending(`There error vendor 404 test ${err}`); + {mlog.pending(`There error vendor 404 test ${err}`);} }); }); }); diff --git a/vendor/package-lock.json b/vendor/package-lock.json index 3253cc4e..61c1d19e 100644 --- a/vendor/package-lock.json +++ b/vendor/package-lock.json @@ -703,7 +703,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-2.0.0.tgz", "integrity": "sha1-gTg9ctsFT8zPUzbaqQLxgvbtuyg=", - "optional": true, "requires": { "is-glob": "^2.0.0" } @@ -717,8 +716,7 @@ "inherits": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "optional": true + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=" }, "invert-kv": { "version": "1.0.0", @@ -737,8 +735,7 @@ "is-buffer": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", - "optional": true + "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=" }, "is-dotfile": { "version": "1.0.3", @@ -764,8 +761,7 @@ "is-extglob": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-1.0.0.tgz", - "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=", - "optional": true + "integrity": "sha1-rEaBd8SUNAWgkvyPKXYMb/xiBsA=" }, "is-fullwidth-code-point": { "version": "1.0.0", @@ -779,7 +775,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-2.0.1.tgz", "integrity": "sha1-0Jb5JqPe1WAPP9/ZEZjLCIjC2GM=", - "optional": true, "requires": { "is-extglob": "^1.0.0" } @@ -808,8 +803,7 @@ "isarray": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "optional": true + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, "isobject": { "version": "2.1.0", @@ -824,7 +818,6 @@ "version": "3.2.2", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "optional": true, "requires": { "is-buffer": "^1.1.5" } @@ -890,7 +883,6 @@ "version": "2.1.1", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "optional": true, "requires": { "remove-trailing-separator": "^1.0.1" } @@ -1039,14 +1031,12 @@ "remove-trailing-separator": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.1.0.tgz", - "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=", - "optional": true + "integrity": "sha1-wkvOKig62tW8P1jg1IJJuSN52O8=" }, "repeat-element": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "optional": true + "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=" }, "repeat-string": { "version": "1.6.1", @@ -1057,8 +1047,7 @@ "safe-buffer": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==", - "optional": true + "integrity": "sha512-kKvNJn6Mm93gAczWVJg7wH+wGYWNrDHdWvpUmHyEsgCtIwwo3bqPtV4tR5tuPaUhTOo/kvhVwd8XwwOllGYkbg==" }, "set-immediate-shim": { "version": "1.0.1",