diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ed14915..f7f90c37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ _This release is scheduled to be released on 2021-01-01._ ### Added - Added new log level "debug" to the logger. -- Added Weatherbit as a provider to Weather module +- Added Weatherbit as a provider to Weather module. ### Updated diff --git a/config/config.js.sample b/config/config.js.sample index a0164198..55e84cb4 100644 --- a/config/config.js.sample +++ b/config/config.js.sample @@ -28,7 +28,7 @@ var config = { httpsCertificate: "", // HTTPS Certificate path, only require when useHttps is true language: "en", - logLevel: ["INFO", "LOG", "WARN", "ERROR"], + logLevel: ["DEBUG", "INFO", "LOG", "WARN", "ERROR"], timeFormat: 24, units: "metric", // serverOnly: true/false/"local" , diff --git a/js/logger.js b/js/logger.js index 0f33b473..e9e17c52 100644 --- a/js/logger.js +++ b/js/logger.js @@ -20,10 +20,11 @@ } })(this, function (config) { const logLevel = { + debug: Function.prototype.bind.call(console.debug, console), info: Function.prototype.bind.call(console.info, console), log: Function.prototype.bind.call(console.log, console), - error: Function.prototype.bind.call(console.error, console), warn: Function.prototype.bind.call(console.warn, console), + error: Function.prototype.bind.call(console.error, console), group: Function.prototype.bind.call(console.group, console), groupCollapsed: Function.prototype.bind.call(console.groupCollapsed, console), groupEnd: Function.prototype.bind.call(console.groupEnd, console), diff --git a/js/translator.js b/js/translator.js index 0f4bc00a..5dc50045 100644 --- a/js/translator.js +++ b/js/translator.js @@ -19,7 +19,15 @@ var Translator = (function () { xhr.open("GET", file, true); xhr.onreadystatechange = function () { if (xhr.readyState === 4 && xhr.status === 200) { - callback(JSON.parse(xhr.responseText)); + // needs error handler try/catch at least + let fileinfo = null; + try { + fileinfo = JSON.parse(xhr.responseText); + } catch (exception) { + // nothing here, but don't die + Log.error(" loading json file =" + file + " failed"); + } + callback(fileinfo); } }; xhr.send(null); diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index af804139..b2737586 100755 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -58,6 +58,8 @@ Module.register("calendar", { nextDaysRelative: false }, + requiresVersion: "2.1.0", + // Define required scripts. getStyles: function () { return ["calendar.css", "font-awesome.css"]; @@ -83,6 +85,12 @@ Module.register("calendar", { // Set locale. moment.updateLocale(config.language, this.getLocaleSpecification(config.timeFormat)); + // clear data holder before start + this.calendarData = {}; + + // indicate no data available yet + this.loaded = false; + for (var c in this.config.calendars) { var calendar = this.config.calendars[c]; calendar.url = calendar.url.replace("webcal://", "http://"); @@ -112,18 +120,10 @@ Module.register("calendar", { }; } + // tell helper to start a fetcher for this calendar + // fetcher till cycle this.addCalendar(calendar.url, calendar.auth, calendarConfig); - - // Trigger ADD_CALENDAR every fetchInterval to make sure there is always a calendar - // fetcher running on the server side. - var self = this; - setInterval(function () { - self.addCalendar(calendar.url, calendar.auth, calendarConfig); - }, self.config.fetchInterval); } - - this.calendarData = {}; - this.loaded = false; }, // Override socket notification handler. @@ -541,6 +541,8 @@ Module.register("calendar", { * @param {object} calendarConfig The config of the specific calendar */ addCalendar: function (url, auth, calendarConfig) { + var self = this; + this.sendSocketNotification("ADD_CALENDAR", { id: this.identifier, url: url, diff --git a/modules/default/calendar/calendarfetcher.js b/modules/default/calendar/calendarfetcher.js index 964cb955..3927897e 100644 --- a/modules/default/calendar/calendarfetcher.js +++ b/modules/default/calendar/calendarfetcher.js @@ -110,14 +110,15 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn if (event.type === "VEVENT") { let startDate = eventDate(event, "start"); let endDate; - + // Log.log("\nevent="+JSON.stringify(event)) if (typeof event.end !== "undefined") { endDate = eventDate(event, "end"); } else if (typeof event.duration !== "undefined") { endDate = startDate.clone().add(moment.duration(event.duration)); } else { if (!isFacebookBirthday) { - endDate = startDate; + // make copy of start date, separate storage area + endDate = moment(startDate.format("x"), "x"); } else { endDate = moment(startDate).add(1, "days"); } @@ -212,8 +213,9 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn pastLocal = pastMoment.subtract(past.getTimezoneOffset(), "minutes").toDate(); futureLocal = futureMoment.subtract(future.getTimezoneOffset(), "minutes").toDate(); } - const dates = rule.between(pastLocal, futureLocal, true, limitFunction); + const dates = rule.between(pastLocal, futureLocal, true, limitFunction); + Log.debug("title=" + event.summary.val + " dates=" + JSON.stringify(dates)); // 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 // had its date changed from outside the range to inside the range. For the time being, @@ -233,7 +235,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn // Loop through the set of date entries to see which recurrences should be added to our event list. for (let d in dates) { - const date = dates[d]; + let date = dates[d]; // ical.js started returning recurrences and exdates as ISOStrings without time information. // .toISOString().substring(0,10) is the method they use to calculate keys, so we'll do the same // (see https://github.com/peterbraden/ical.js/pull/84 ) @@ -241,8 +243,26 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn let curEvent = event; let showRecurrence = true; + // for full day events, the time might be off from RRULE/Luxon problem + if (isFullDayEvent(event)) { + Log.debug("fullday"); + // if the offset is negative, east of GMT where the problem is + if (date.getTimezoneOffset() < 0) { + // get the offset of today when we are processing + // this will be the correction we need to apply + let nowOffset = new Date().getTimezoneOffset(); + Log.debug("now offset is " + nowOffset); + // reduce the time by the offset + Log.debug(" recurring date is " + date + " offset is " + date.getTimezoneOffset()); + // apply the correction to the date/time to get it UTC relative + date = new Date(date.getTime() - Math.abs(nowOffset) * 60000); + Log.debug("new recurring date is " + date); + } + } startDate = moment(date); + let adjustDays = getCorrection(event, date); + // For each date that we're checking, it's possible that there is a recurrence override for that one day. if (curEvent.recurrences !== undefined && curEvent.recurrences[dateKey] !== undefined) { // We found an override, so for this recurrence, use a potentially different title, start date, and duration. @@ -256,6 +276,8 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn showRecurrence = false; } + //Log.log("duration="+duration) + endDate = moment(parseInt(startDate.format("x")) + duration, "x"); if (startDate.format("x") === endDate.format("x")) { endDate = endDate.endOf("day"); @@ -277,8 +299,8 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn addedEvents++; newEvents.push({ title: recurrenceTitle, - startDate: startDate.format("x"), - endDate: endDate.format("x"), + startDate: (adjustDays ? (adjustDays > 0 ? startDate.add(adjustDays, "hours") : startDate.subtract(Math.abs(adjustDays), "hours")) : startDate).format("x"), + endDate: (adjustDays ? (adjustDays > 0 ? endDate.add(adjustDays, "hours") : endDate.subtract(Math.abs(adjustDays), "hours")) : endDate).format("x"), fullDayEvent: isFullDayEvent(event), recurringEvent: true, class: event.class, @@ -293,7 +315,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn } else { // Single event. const fullDayEvent = isFacebookBirthday ? true : isFullDayEvent(event); - + // Log.log("full day event") if (includePastEvents) { // Past event is too far in the past, so skip. if (endDate < past) { @@ -324,12 +346,18 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn if (fullDayEvent && startDate <= today) { startDate = moment(today); } - + // if the start and end are the same, then make end the 'end of day' value (start is at 00:00:00) + if (fullDayEvent && startDate.format("x") === endDate.format("x")) { + //Log.log("end same as start") + endDate = endDate.endOf("day"); + } + // get correction for date saving and dst change between now and then + let adjustDays = getCorrection(event, startDate.toDate()); // Every thing is good. Add it to the list. newEvents.push({ title: title, - startDate: startDate.format("x"), - endDate: endDate.format("x"), + startDate: (adjustDays ? (adjustDays > 0 ? startDate.add(adjustDays, "hours") : startDate.subtract(Math.abs(adjustDays), "hours")) : startDate).format("x"), + endDate: (adjustDays ? (adjustDays > 0 ? endDate.add(adjustDays, "hours") : endDate.subtract(Math.abs(adjustDays), "hours")) : endDate).format("x"), fullDayEvent: fullDayEvent, class: event.class, location: location, @@ -351,6 +379,101 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn }); }; + /* + * + * get the time correction, either dst/std or full day in cases where utc time is day before plus offset + * + */ + const getCorrection = function (event, date) { + let adjustHours = 0; + // if a timezone was specified + if (!event.start.tz) { + Log.debug(" if no tz, guess based on now"); + event.start.tz = moment.tz.guess(); + } + Log.debug("initial tz=" + event.start.tz); + + // if there is a start date specified + if (event.start.tz) { + // if this is a windows timezone + if (event.start.tz.includes(" ")) { + // use the lookup table to get theIANA name as moment and date don't know MS timezones + let tz = getIanaTZFromMS(event.start.tz); + // watch out for unregistered windows timezone names + // if we had a successfule lookup + if (tz) { + // change the timezone to the IANA name + event.start.tz = tz; + Log.debug("corrected timezone=" + event.start.tz); + } + } + Log.debug("corrected tz=" + event.start.tz); + let mmo = 0; // offset from TZ string or calculated + let mm = 0; // date with tz or offset + let mms = 0; // utc offset of created with tz + // if there is still an offset, lookup failed, use it + if (event.start.tz.startsWith("(")) { + const regex = /[+|-]\d*:\d*/; + mmo = event.start.tz.match(regex).toString(); + mms = mmo; + Log.debug("ical offset=" + mmo + " date=" + date); + mm = moment(date); + mm = mm.utcOffset(mmo); + } else { + // get the start time in that timezone + Log.debug("ttttttt=" + moment(event.start).toDate()); + mms = moment.tz(moment(event.start), event.start.tz).utcOffset(); + Log.debug("ms offset=" + mms); + + Log.debug("start date =" + moment.tz(moment(event.start), event.start.tz).toDate()); + + // get the specified date in that timezone + mm = moment.tz(moment(date), event.start.tz); + Log.debug("mm=" + mm.toDate()); + mmo = mm.utcOffset(); + } + Log.debug("mm ofset=" + mmo + " hour=" + mm.format("H") + " event date=" + mm.toDate()); + // if the offset is greater than 0, east of london + if (mmo !== mms) { + // big offset + Log.debug("offset"); + let h = parseInt(mm.format("H")); + // check if the event time is less than the offset + if (h > 0 && h < Math.abs(mmo) / 60) { + // if so, rrule created a wrong date (utc day, oops, with utc yesterday adjusted time) + // we need to fix that + adjustHours = 24; + Log.debug("adjusting date"); + } + if (Math.abs(mmo) > Math.abs(mms)) { + adjustHours += 1; + Log.debug("adjust up 1 hour dst change"); + } else if (Math.abs(mmo) < Math.abs(mms)) { + adjustHours -= 1; + Log.debug("adjust down 1 hour dst change"); + } + } + } + Log.debug("adjustHours=" + adjustHours); + return adjustHours; + }; + + /** + * + * lookup iana tz from windows + */ + let zoneTable = null; + const getIanaTZFromMS = function (msTZName) { + if (!zoneTable) { + const p = require("path"); + zoneTable = require(p.join(__dirname, "windowsZones.json")); + } + // Get hash entry + const he = zoneTable[msTZName]; + // If found return iana name, else null + return he ? he.iana[0] : null; + }; + /** * Schedule the timer for the next update. */ @@ -368,7 +491,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn * @returns {boolean} True if the event is a fullday event, false otherwise */ const isFullDayEvent = function (event) { - if (event.start.length === 8 || event.start.dateOnly) { + if (event.start.length === 8 || event.start.dateOnly || event.datetype === "date") { return true; } diff --git a/modules/default/calendar/node_helper.js b/modules/default/calendar/node_helper.js index 862755a0..06fa28ec 100644 --- a/modules/default/calendar/node_helper.js +++ b/modules/default/calendar/node_helper.js @@ -70,7 +70,6 @@ module.exports = NodeHelper.create({ } else { Log.log("Use existing calendar fetcher for url: " + url); fetcher = self.fetchers[identifier + url]; - fetcher.broadcastEvents(); } fetcher.startFetch(); diff --git a/modules/default/calendar/windowsZones.json b/modules/default/calendar/windowsZones.json new file mode 100644 index 00000000..cad82bb9 --- /dev/null +++ b/modules/default/calendar/windowsZones.json @@ -0,0 +1,237 @@ +{ + "Dateline Standard Time": { "iana": ["Etc/GMT+12"] }, + "UTC-11": { "iana": ["Etc/GMT+11"] }, + "Aleutian Standard Time": { "iana": ["America/Adak"] }, + "Hawaiian Standard Time": { "iana": ["Pacific/Honolulu"] }, + "Marquesas Standard Time": { "iana": ["Pacific/Marquesas"] }, + "Alaskan Standard Time": { "iana": ["America/Anchorage"] }, + "UTC-09": { "iana": ["Etc/GMT+9"] }, + "Pacific Standard Time (Mexico)": { "iana": ["America/Tijuana"] }, + "UTC-08": { "iana": ["Etc/GMT+8"] }, + "Pacific Standard Time": { "iana": ["America/Los_Angeles"] }, + "US Mountain Standard Time": { "iana": ["America/Phoenix"] }, + "Mountain Standard Time (Mexico)": { "iana": ["America/Chihuahua"] }, + "Mountain Standard Time": { "iana": ["America/Denver"] }, + "Central America Standard Time": { "iana": ["America/Guatemala"] }, + "Central Standard Time": { "iana": ["America/Chicago"] }, + "Easter Island Standard Time": { "iana": ["Pacific/Easter"] }, + "Central Standard Time (Mexico)": { "iana": ["America/Mexico_City"] }, + "Canada Central Standard Time": { "iana": ["America/Regina"] }, + "SA Pacific Standard Time": { "iana": ["America/Bogota"] }, + "Eastern Standard Time (Mexico)": { "iana": ["America/Cancun"] }, + "Eastern Standard Time": { "iana": ["America/New_York"] }, + "Haiti Standard Time": { "iana": ["America/Port-au-Prince"] }, + "Cuba Standard Time": { "iana": ["America/Havana"] }, + "US Eastern Standard Time": { "iana": ["America/Indianapolis"] }, + "Turks And Caicos Standard Time": { "iana": ["America/Grand_Turk"] }, + "Paraguay Standard Time": { "iana": ["America/Asuncion"] }, + "Atlantic Standard Time": { "iana": ["America/Halifax"] }, + "Venezuela Standard Time": { "iana": ["America/Caracas"] }, + "Central Brazilian Standard Time": { "iana": ["America/Cuiaba"] }, + "SA Western Standard Time": { "iana": ["America/La_Paz"] }, + "Pacific SA Standard Time": { "iana": ["America/Santiago"] }, + "Newfoundland Standard Time": { "iana": ["America/St_Johns"] }, + "Tocantins Standard Time": { "iana": ["America/Araguaina"] }, + "E. South America Standard Time": { "iana": ["America/Sao_Paulo"] }, + "SA Eastern Standard Time": { "iana": ["America/Cayenne"] }, + "Argentina Standard Time": { "iana": ["America/Buenos_Aires"] }, + "Greenland Standard Time": { "iana": ["America/Godthab"] }, + "Montevideo Standard Time": { "iana": ["America/Montevideo"] }, + "Magallanes Standard Time": { "iana": ["America/Punta_Arenas"] }, + "Saint Pierre Standard Time": { "iana": ["America/Miquelon"] }, + "Bahia Standard Time": { "iana": ["America/Bahia"] }, + "UTC-02": { "iana": ["Etc/GMT+2"] }, + "Azores Standard Time": { "iana": ["Atlantic/Azores"] }, + "Cape Verde Standard Time": { "iana": ["Atlantic/Cape_Verde"] }, + "UTC": { "iana": ["Etc/GMT"] }, + "GMT Standard Time": { "iana": ["Europe/London"] }, + "Greenwich Standard Time": { "iana": ["Atlantic/Reykjavik"] }, + "Sao Tome Standard Time": { "iana": ["Africa/Sao_Tome"] }, + "Morocco Standard Time": { "iana": ["Africa/Casablanca"] }, + "W. Europe Standard Time": { "iana": ["Europe/Berlin"] }, + "Central Europe Standard Time": { "iana": ["Europe/Budapest"] }, + "Romance Standard Time": { "iana": ["Europe/Paris"] }, + "Central European Standard Time": { "iana": ["Europe/Warsaw"] }, + "W. Central Africa Standard Time": { "iana": ["Africa/Lagos"] }, + "Jordan Standard Time": { "iana": ["Asia/Amman"] }, + "GTB Standard Time": { "iana": ["Europe/Bucharest"] }, + "Middle East Standard Time": { "iana": ["Asia/Beirut"] }, + "Egypt Standard Time": { "iana": ["Africa/Cairo"] }, + "E. Europe Standard Time": { "iana": ["Europe/Chisinau"] }, + "Syria Standard Time": { "iana": ["Asia/Damascus"] }, + "West Bank Standard Time": { "iana": ["Asia/Hebron"] }, + "South Africa Standard Time": { "iana": ["Africa/Johannesburg"] }, + "FLE Standard Time": { "iana": ["Europe/Kiev"] }, + "Israel Standard Time": { "iana": ["Asia/Jerusalem"] }, + "Kaliningrad Standard Time": { "iana": ["Europe/Kaliningrad"] }, + "Sudan Standard Time": { "iana": ["Africa/Khartoum"] }, + "Libya Standard Time": { "iana": ["Africa/Tripoli"] }, + "Namibia Standard Time": { "iana": ["Africa/Windhoek"] }, + "Arabic Standard Time": { "iana": ["Asia/Baghdad"] }, + "Turkey Standard Time": { "iana": ["Europe/Istanbul"] }, + "Arab Standard Time": { "iana": ["Asia/Riyadh"] }, + "Belarus Standard Time": { "iana": ["Europe/Minsk"] }, + "Russian Standard Time": { "iana": ["Europe/Moscow"] }, + "E. Africa Standard Time": { "iana": ["Africa/Nairobi"] }, + "Iran Standard Time": { "iana": ["Asia/Tehran"] }, + "Arabian Standard Time": { "iana": ["Asia/Dubai"] }, + "Astrakhan Standard Time": { "iana": ["Europe/Astrakhan"] }, + "Azerbaijan Standard Time": { "iana": ["Asia/Baku"] }, + "Russia Time Zone 3": { "iana": ["Europe/Samara"] }, + "Mauritius Standard Time": { "iana": ["Indian/Mauritius"] }, + "Saratov Standard Time": { "iana": ["Europe/Saratov"] }, + "Georgian Standard Time": { "iana": ["Asia/Tbilisi"] }, + "Volgograd Standard Time": { "iana": ["Europe/Volgograd"] }, + "Caucasus Standard Time": { "iana": ["Asia/Yerevan"] }, + "Afghanistan Standard Time": { "iana": ["Asia/Kabul"] }, + "West Asia Standard Time": { "iana": ["Asia/Tashkent"] }, + "Ekaterinburg Standard Time": { "iana": ["Asia/Yekaterinburg"] }, + "Pakistan Standard Time": { "iana": ["Asia/Karachi"] }, + "Qyzylorda Standard Time": { "iana": ["Asia/Qyzylorda"] }, + "India Standard Time": { "iana": ["Asia/Calcutta"] }, + "Sri Lanka Standard Time": { "iana": ["Asia/Colombo"] }, + "Nepal Standard Time": { "iana": ["Asia/Katmandu"] }, + "Central Asia Standard Time": { "iana": ["Asia/Almaty"] }, + "Bangladesh Standard Time": { "iana": ["Asia/Dhaka"] }, + "Omsk Standard Time": { "iana": ["Asia/Omsk"] }, + "Myanmar Standard Time": { "iana": ["Asia/Rangoon"] }, + "SE Asia Standard Time": { "iana": ["Asia/Bangkok"] }, + "Altai Standard Time": { "iana": ["Asia/Barnaul"] }, + "W. Mongolia Standard Time": { "iana": ["Asia/Hovd"] }, + "North Asia Standard Time": { "iana": ["Asia/Krasnoyarsk"] }, + "N. Central Asia Standard Time": { "iana": ["Asia/Novosibirsk"] }, + "Tomsk Standard Time": { "iana": ["Asia/Tomsk"] }, + "China Standard Time": { "iana": ["Asia/Shanghai"] }, + "North Asia East Standard Time": { "iana": ["Asia/Irkutsk"] }, + "Singapore Standard Time": { "iana": ["Asia/Singapore"] }, + "W. Australia Standard Time": { "iana": ["Australia/Perth"] }, + "Taipei Standard Time": { "iana": ["Asia/Taipei"] }, + "Ulaanbaatar Standard Time": { "iana": ["Asia/Ulaanbaatar"] }, + "Aus Central W. Standard Time": { "iana": ["Australia/Eucla"] }, + "Transbaikal Standard Time": { "iana": ["Asia/Chita"] }, + "Tokyo Standard Time": { "iana": ["Asia/Tokyo"] }, + "North Korea Standard Time": { "iana": ["Asia/Pyongyang"] }, + "Korea Standard Time": { "iana": ["Asia/Seoul"] }, + "Yakutsk Standard Time": { "iana": ["Asia/Yakutsk"] }, + "Cen. Australia Standard Time": { "iana": ["Australia/Adelaide"] }, + "AUS Central Standard Time": { "iana": ["Australia/Darwin"] }, + "E. Australia Standard Time": { "iana": ["Australia/Brisbane"] }, + "AUS Eastern Standard Time": { "iana": ["Australia/Sydney"] }, + "West Pacific Standard Time": { "iana": ["Pacific/Port_Moresby"] }, + "Tasmania Standard Time": { "iana": ["Australia/Hobart"] }, + "Vladivostok Standard Time": { "iana": ["Asia/Vladivostok"] }, + "Lord Howe Standard Time": { "iana": ["Australia/Lord_Howe"] }, + "Bougainville Standard Time": { "iana": ["Pacific/Bougainville"] }, + "Russia Time Zone 10": { "iana": ["Asia/Srednekolymsk"] }, + "Magadan Standard Time": { "iana": ["Asia/Magadan"] }, + "Norfolk Standard Time": { "iana": ["Pacific/Norfolk"] }, + "Sakhalin Standard Time": { "iana": ["Asia/Sakhalin"] }, + "Central Pacific Standard Time": { "iana": ["Pacific/Guadalcanal"] }, + "Russia Time Zone 11": { "iana": ["Asia/Kamchatka"] }, + "New Zealand Standard Time": { "iana": ["Pacific/Auckland"] }, + "UTC+12": { "iana": ["Etc/GMT-12"] }, + "Fiji Standard Time": { "iana": ["Pacific/Fiji"] }, + "Chatham Islands Standard Time": { "iana": ["Pacific/Chatham"] }, + "UTC+13": { "iana": ["Etc/GMT-13"] }, + "Tonga Standard Time": { "iana": ["Pacific/Tongatapu"] }, + "Samoa Standard Time": { "iana": ["Pacific/Apia"] }, + "Line Islands Standard Time": { "iana": ["Pacific/Kiritimati"] }, + "(UTC-12:00) International Date Line West": { "iana": ["Etc/GMT+12"] }, + "(UTC-11:00) Midway Island, Samoa": { "iana": ["Pacific/Apia"] }, + "(UTC-10:00) Hawaii": { "iana": ["Pacific/Honolulu"] }, + "(UTC-09:00) Alaska": { "iana": ["America/Anchorage"] }, + "(UTC-08:00) Pacific Time (US & Canada); Tijuana": { "iana": ["America/Los_Angeles"] }, + "(UTC-08:00) Pacific Time (US and Canada); Tijuana": { "iana": ["America/Los_Angeles"] }, + "(UTC-07:00) Mountain Time (US & Canada)": { "iana": ["America/Denver"] }, + "(UTC-07:00) Mountain Time (US and Canada)": { "iana": ["America/Denver"] }, + "(UTC-07:00) Chihuahua, La Paz, Mazatlan": { "iana": [null] }, + "(UTC-07:00) Arizona": { "iana": ["America/Phoenix"] }, + "(UTC-06:00) Central Time (US & Canada)": { "iana": ["America/Chicago"] }, + "(UTC-06:00) Central Time (US and Canada)": { "iana": ["America/Chicago"] }, + "(UTC-06:00) Saskatchewan": { "iana": ["America/Regina"] }, + "(UTC-06:00) Guadalajara, Mexico City, Monterrey": { "iana": [null] }, + "(UTC-06:00) Central America": { "iana": ["America/Guatemala"] }, + "(UTC-05:00) Eastern Time (US & Canada)": { "iana": ["America/New_York"] }, + "(UTC-05:00) Eastern Time (US and Canada)": { "iana": ["America/New_York"] }, + "(UTC-05:00) Indiana (East)": { "iana": ["America/Indianapolis"] }, + "(UTC-05:00) Bogota, Lima, Quito": { "iana": ["America/Bogota"] }, + "(UTC-04:00) Atlantic Time (Canada)": { "iana": ["America/Halifax"] }, + "(UTC-04:00) Georgetown, La Paz, San Juan": { "iana": ["America/La_Paz"] }, + "(UTC-04:00) Santiago": { "iana": ["America/Santiago"] }, + "(UTC-03:30) Newfoundland": { "iana": [null] }, + "(UTC-03:00) Brasilia": { "iana": ["America/Sao_Paulo"] }, + "(UTC-03:00) Georgetown": { "iana": ["America/Cayenne"] }, + "(UTC-03:00) Greenland": { "iana": ["America/Godthab"] }, + "(UTC-02:00) Mid-Atlantic": { "iana": [null] }, + "(UTC-01:00) Azores": { "iana": ["Atlantic/Azores"] }, + "(UTC-01:00) Cape Verde Islands": { "iana": ["Atlantic/Cape_Verde"] }, + "(UTC) Greenwich Mean Time: Dublin, Edinburgh, Lisbon, London": { "iana": [null] }, + "(UTC) Monrovia, Reykjavik": { "iana": ["Atlantic/Reykjavik"] }, + "(UTC+01:00) Belgrade, Bratislava, Budapest, Ljubljana, Prague": { "iana": ["Europe/Budapest"] }, + "(UTC+01:00) Sarajevo, Skopje, Warsaw, Zagreb": { "iana": ["Europe/Warsaw"] }, + "(UTC+01:00) Brussels, Copenhagen, Madrid, Paris": { "iana": ["Europe/Paris"] }, + "(UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna": { "iana": ["Europe/Berlin"] }, + "(UTC+01:00) West Central Africa": { "iana": ["Africa/Lagos"] }, + "(UTC+02:00) Minsk": { "iana": ["Europe/Chisinau"] }, + "(UTC+02:00) Cairo": { "iana": ["Africa/Cairo"] }, + "(UTC+02:00) Helsinki, Kiev, Riga, Sofia, Tallinn, Vilnius": { "iana": ["Europe/Kiev"] }, + "(UTC+02:00) Athens, Bucharest, Istanbul": { "iana": ["Europe/Bucharest"] }, + "(UTC+02:00) Jerusalem": { "iana": ["Asia/Jerusalem"] }, + "(UTC+02:00) Harare, Pretoria": { "iana": ["Africa/Johannesburg"] }, + "(UTC+03:00) Moscow, St. Petersburg, Volgograd": { "iana": ["Europe/Moscow"] }, + "(UTC+03:00) Kuwait, Riyadh": { "iana": ["Asia/Riyadh"] }, + "(UTC+03:00) Nairobi": { "iana": ["Africa/Nairobi"] }, + "(UTC+03:00) Baghdad": { "iana": ["Asia/Baghdad"] }, + "(UTC+03:30) Tehran": { "iana": ["Asia/Tehran"] }, + "(UTC+04:00) Abu Dhabi, Muscat": { "iana": ["Asia/Dubai"] }, + "(UTC+04:00) Baku, Tbilisi, Yerevan": { "iana": ["Asia/Yerevan"] }, + "(UTC+04:30) Kabul": { "iana": [null] }, + "(UTC+05:00) Ekaterinburg": { "iana": ["Asia/Yekaterinburg"] }, + "(UTC+05:00) Tashkent": { "iana": ["Asia/Tashkent"] }, + "(UTC+05:30) Chennai, Kolkata, Mumbai, New Delhi": { "iana": ["Asia/Calcutta"] }, + "(UTC+05:45) Kathmandu": { "iana": ["Asia/Katmandu"] }, + "(UTC+06:00) Astana, Dhaka": { "iana": ["Asia/Almaty"] }, + "(UTC+06:00) Sri Jayawardenepura": { "iana": ["Asia/Colombo"] }, + "(UTC+06:00) Almaty, Novosibirsk": { "iana": ["Asia/Novosibirsk"] }, + "(UTC+06:30) Yangon (Rangoon)": { "iana": ["Asia/Rangoon"] }, + "(UTC+07:00) Bangkok, Hanoi, Jakarta": { "iana": ["Asia/Bangkok"] }, + "(UTC+07:00) Krasnoyarsk": { "iana": ["Asia/Krasnoyarsk"] }, + "(UTC+08:00) Beijing, Chongqing, Hong Kong, Urumqi": { "iana": ["Asia/Shanghai"] }, + "(UTC+08:00) Kuala Lumpur, Singapore": { "iana": ["Asia/Singapore"] }, + "(UTC+08:00) Taipei": { "iana": ["Asia/Taipei"] }, + "(UTC+08:00) Perth": { "iana": ["Australia/Perth"] }, + "(UTC+08:00) Irkutsk, Ulaanbaatar": { "iana": ["Asia/Irkutsk"] }, + "(UTC+09:00) Seoul": { "iana": ["Asia/Seoul"] }, + "(UTC+09:00) Osaka, Sapporo, Tokyo": { "iana": ["Asia/Tokyo"] }, + "(UTC+09:00) Yakutsk": { "iana": ["Asia/Yakutsk"] }, + "(UTC+09:30) Darwin": { "iana": ["Australia/Darwin"] }, + "(UTC+09:30) Adelaide": { "iana": ["Australia/Adelaide"] }, + "(UTC+10:00) Canberra, Melbourne, Sydney": { "iana": ["Australia/Sydney"] }, + "(GMT+10:00) Canberra, Melbourne, Sydney": { "iana": ["Australia/Sydney"] }, + "(UTC+10:00) Brisbane": { "iana": ["Australia/Brisbane"] }, + "(UTC+10:00) Hobart": { "iana": ["Australia/Hobart"] }, + "(UTC+10:00) Vladivostok": { "iana": ["Asia/Vladivostok"] }, + "(UTC+10:00) Guam, Port Moresby": { "iana": ["Pacific/Port_Moresby"] }, + "(UTC+11:00) Magadan, Solomon Islands, New Caledonia": { "iana": ["Pacific/Guadalcanal"] }, + "(UTC+12:00) Fiji, Kamchatka, Marshall Is.": { "iana": [null] }, + "(UTC+12:00) Auckland, Wellington": { "iana": ["Pacific/Auckland"] }, + "(UTC+13:00) Nuku'alofa": { "iana": ["Pacific/Tongatapu"] }, + "(UTC-03:00) Buenos Aires": { "iana": ["America/Buenos_Aires"] }, + "(UTC+02:00) Beirut": { "iana": ["Asia/Beirut"] }, + "(UTC+02:00) Amman": { "iana": ["Asia/Amman"] }, + "(UTC-06:00) Guadalajara, Mexico City, Monterrey - New": { "iana": ["America/Mexico_City"] }, + "(UTC-07:00) Chihuahua, La Paz, Mazatlan - New": { "iana": ["America/Chihuahua"] }, + "(UTC-08:00) Tijuana, Baja California": { "iana": ["America/Tijuana"] }, + "(UTC+02:00) Windhoek": { "iana": ["Africa/Windhoek"] }, + "(UTC+03:00) Tbilisi": { "iana": ["Asia/Tbilisi"] }, + "(UTC-04:00) Manaus": { "iana": ["America/Cuiaba"] }, + "(UTC-03:00) Montevideo": { "iana": ["America/Montevideo"] }, + "(UTC+04:00) Yerevan": { "iana": [null] }, + "(UTC-04:30) Caracas": { "iana": ["America/Caracas"] }, + "(UTC) Casablanca": { "iana": ["Africa/Casablanca"] }, + "(UTC+05:00) Islamabad, Karachi": { "iana": ["Asia/Karachi"] }, + "(UTC+04:00) Port Louis": { "iana": ["Indian/Mauritius"] }, + "(UTC) Coordinated Universal Time": { "iana": ["Etc/GMT"] }, + "(UTC-04:00) Asuncion": { "iana": ["America/Asuncion"] }, + "(UTC+12:00) Petropavlovsk-Kamchatsky": { "iana": [null] } +} diff --git a/modules/default/clock/clock.js b/modules/default/clock/clock.js index 1c7109b6..6e3d7090 100644 --- a/modules/default/clock/clock.js +++ b/modules/default/clock/clock.js @@ -187,10 +187,10 @@ Module.register("clock", { '"> ' + untilNextEventString + "" + - '' + + ' ' + formatTime(this.config, sunTimes.sunrise) + "" + - '' + + ' ' + formatTime(this.config, sunTimes.sunset) + ""; } diff --git a/modules/default/newsfeed/newsfeed.js b/modules/default/newsfeed/newsfeed.js index 2ff02888..7fe2fb21 100644 --- a/modules/default/newsfeed/newsfeed.js +++ b/modules/default/newsfeed/newsfeed.js @@ -350,7 +350,7 @@ Module.register("newsfeed", { this.activeItem = 0; } this.resetDescrOrFullArticleAndTimer(); - Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")"); + Log.debug(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")"); this.updateDom(100); } else if (notification === "ARTICLE_PREVIOUS") { this.activeItem--; @@ -358,7 +358,7 @@ Module.register("newsfeed", { this.activeItem = this.newsItems.length - 1; } this.resetDescrOrFullArticleAndTimer(); - Log.info(this.name + " - going from article #" + before + " to #" + this.activeItem + " (of " + this.newsItems.length + ")"); + Log.debug(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 @@ -367,8 +367,8 @@ Module.register("newsfeed", { if (this.config.showFullArticle === true) { this.scrollPosition += this.config.scrollLength; window.scrollTo(0, this.scrollPosition); - Log.info(this.name + " - scrolling down"); - Log.info(this.name + " - ARTICLE_MORE_DETAILS, scroll position: " + this.config.scrollLength); + Log.debug(this.name + " - scrolling down"); + Log.debug(this.name + " - ARTICLE_MORE_DETAILS, scroll position: " + this.config.scrollLength); } else { this.showFullArticle(); } @@ -376,12 +376,12 @@ Module.register("newsfeed", { if (this.config.showFullArticle === true) { this.scrollPosition -= this.config.scrollLength; window.scrollTo(0, this.scrollPosition); - Log.info(this.name + " - scrolling up"); - Log.info(this.name + " - ARTICLE_SCROLL_UP, scroll position: " + this.config.scrollLength); + Log.debug(this.name + " - scrolling up"); + Log.debug(this.name + " - ARTICLE_SCROLL_UP, scroll position: " + this.config.scrollLength); } } else if (notification === "ARTICLE_LESS_DETAILS") { this.resetDescrOrFullArticleAndTimer(); - Log.info(this.name + " - showing only article titles again"); + Log.debug(this.name + " - showing only article titles again"); this.updateDom(100); } else if (notification === "ARTICLE_TOGGLE_FULL") { if (this.config.showFullArticle) { @@ -411,7 +411,7 @@ Module.register("newsfeed", { } clearInterval(this.timer); this.timer = null; - Log.info(this.name + " - showing " + this.isShowingDescription ? "article description" : "full article"); + Log.debug(this.name + " - showing " + this.isShowingDescription ? "article description" : "full article"); this.updateDom(100); } }); diff --git a/modules/default/weather/forecast.njk b/modules/default/weather/forecast.njk index 7d0f515d..85ed0fef 100644 --- a/modules/default/weather/forecast.njk +++ b/modules/default/weather/forecast.njk @@ -10,7 +10,13 @@ {% set forecast = forecast.slice(0, numSteps) %} {% for f in forecast %} - {{ f.date.format('ddd') }} + {% if (currentStep == 0) %} + {{ "TODAY" | translate }} + {% elif (currentStep == 1) %} + {{ "TOMORROW" | translate }} + {% else %} + {{ f.date.format('ddd') }} + {% endif %} {{ f.maxTemperature | roundValue | unit("temperature") }} diff --git a/modules/default/weather/providers/ukmetofficedatahub.js b/modules/default/weather/providers/ukmetofficedatahub.js index 9ed74684..505732d3 100644 --- a/modules/default/weather/providers/ukmetofficedatahub.js +++ b/modules/default/weather/providers/ukmetofficedatahub.js @@ -87,7 +87,7 @@ WeatherProvider.register("ukmetofficedatahub", { // Did not receive usable new data. // Maybe this needs a better check? Log.error("Possibly bad current/hourly data?"); - Log.info(data); + Log.error(data); return; } @@ -158,7 +158,7 @@ WeatherProvider.register("ukmetofficedatahub", { // Did not receive usable new data. // Maybe this needs a better check? Log.error("Possibly bad forecast data?"); - Log.info(data); + Log.error(data); return; } diff --git a/package-lock.json b/package-lock.json index 01c38c4d..5ac7aa7a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "magicmirror", - "version": "2.13.0", + "version": "2.14.0-develop", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -5723,24 +5723,20 @@ "dev": true }, "node-ical": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/node-ical/-/node-ical-0.12.0.tgz", - "integrity": "sha512-whPA/GABFAWMVzqKeTuBjzPGCfNR9eoCSWPHE6MkHyDlQqScdVfyWr0dRy50Lvfz9JCNqFqiko1GpHJ21pn8YA==", + "version": "0.12.3", + "resolved": "https://registry.npmjs.org/node-ical/-/node-ical-0.12.3.tgz", + "integrity": "sha512-MCr71z5mUcF7LuC3iIPKMKcaQ4Mr5cft0Uh00BBnkOrsm6vdS2xTUOKy1vhaYZ1V711LJmSAwQakxBXxLlHY3g==", "requires": { "moment-timezone": "^0.5.31", "request": "^2.88.2", - "rrule": "2.6.4", - "uuid": "^3.3.2" + "rrule": "2.6.6", + "uuid": "^8.3.1" }, "dependencies": { - "rrule": { - "version": "2.6.4", - "resolved": "https://registry.npmjs.org/rrule/-/rrule-2.6.4.tgz", - "integrity": "sha512-sLdnh4lmjUqq8liFiOUXD5kWp/FcnbDLPwq5YAc/RrN6120XOPb86Ae5zxF7ttBVq8O3LxjjORMEit1baluahA==", - "requires": { - "luxon": "^1.21.3", - "tslib": "^1.10.0" - } + "uuid": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.1.tgz", + "integrity": "sha512-FOmRr+FmWEIG8uhZv6C2bTgEVXsHk08kE7mPlrBbEe+c3r9pjceVPgupIfNIhc4yx55H69OXANrUaSuu9eInKg==" } } }, diff --git a/package.json b/package.json index 5e4de9ac..c3ff7aa3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "magicmirror", - "version": "2.13.0", + "version": "2.14.0-develop", "description": "The open source modular smart mirror platform.", "main": "js/electron.js", "scripts": { @@ -79,7 +79,7 @@ "iconv-lite": "^0.6.2", "module-alias": "^2.2.2", "moment": "^2.28.0", - "node-ical": "^0.12.0", + "node-ical": "^0.12.3", "request": "^2.88.2", "rrule": "^2.6.6", "rrule-alt": "^2.2.8", diff --git a/tests/e2e/modules/weather_spec.js b/tests/e2e/modules/weather_spec.js index d87a44cd..2d9f3f01 100644 --- a/tests/e2e/modules/weather_spec.js +++ b/tests/e2e/modules/weather_spec.js @@ -186,7 +186,7 @@ describe("Weather module", function () { const weather = generateWeatherForecast(); await setup({ template, data: weather }); - const days = ["Fri", "Sat", "Sun", "Mon", "Tue"]; + const days = ["Today", "Tomorrow", "Sun", "Mon", "Tue"]; for (const [index, day] of days.entries()) { await app.client.waitUntilTextExists(`.weather table.small tr:nth-child(${index + 1}) td:nth-child(1)`, day, 10000); diff --git a/translations/gr.json b/translations/el.json similarity index 100% rename from translations/gr.json rename to translations/el.json diff --git a/translations/translations.js b/translations/translations.js index 7d0fcfa0..b972b9a8 100644 --- a/translations/translations.js +++ b/translations/translations.js @@ -25,7 +25,7 @@ var translations = { "zh-tw": "translations/zh-tw.json", // Traditional Chinese ja: "translations/ja.json", // Japanese pl: "translations/pl.json", // Polish - gr: "translations/gr.json", // Greek + el: "translations/el.json", // Greek da: "translations/da.json", // Danish tr: "translations/tr.json", // Turkish ru: "translations/ru.json", // Russian