diff --git a/CHANGELOG.md b/CHANGELOG.md index 9eeb658d..789c016d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,12 +18,14 @@ _This release is scheduled to be released on 2022-10-01._ - Removed DAYAFTERTOMORROW from English - Update electron to v20 and other dependencies. +- Updated jsdoc ## Fixed - Broadcast all calendar events while still honoring global and per-calendar maximumEntries. - Respect rss ttl provided by newsfeed (#2883). - Fix multi day calendar events always presented as "(1/X)" instead of the amount of days the event has progressed. +- Fix weatherbit provider to use type config value instead of endpoint ## [2.20.0] - 2022-07-02 @@ -33,13 +35,13 @@ Special thanks to the following contributors: @eouia, @khassel, @kolbyjack, @Kri - Added a new config option `httpHeaders` used by helmet (see https://helmetjs.github.io/). You can now set own httpHeaders which will override the defaults in `js/defauls.js` which is useful e.g. if you want to embed MagicMirror into annother website (solves #2847). - Show endDate for calendar events when dateHeader is enabled and showEnd is set to true (#2192). -- Added the notification emitting from the weather module on infromation updated. -- Use recommended file extention for YAML files (#2864). +- Added the notification emitting from the weather module on information updated. +- Use recommended file extension for YAML files (#2864). ### Updated - Use latest node 18 when running tests on github actions. -- Update `electron` to v19 and other dependencies. +- Updated `electron` to v19 and other dependencies. - Use internal fetch function of node instead external `node-fetch` library if used node version >= `v18`. - Include duplicate events in broadcasts. @@ -65,12 +67,12 @@ Special thanks to the following contributors: @10bias, @CFenner, @JHWelch, @k1rd ### Updated - Deprecated roboto fonts package `roboto-fontface-bower` replaced with `fontsource`. -- Update `electron` to v17, `helmet` to v5 (use defaults of v4) and other dependencies -- Updates Font Awesome css class to new default style (fixes #2768) +- Updated `electron` to v17, `helmet` to v5 (use defaults of v4) and other dependencies +- Updated Font Awesome css class to new default style (fixes #2768) - Replaced deprecated modules `currentweather` and `weatherforecast` with dummy modules only displaying that they have to be replaced. - Include all calendar events from the configured date range when broadcasting. -- Update Danish and German translation. -- Update `node-ical` to v0.15 and added `luxon` as dependency for not breaking the "no-optional" install (see #2718 and #2824). +- Updated Danish and German translation. +- Updated `node-ical` to v0.15 and added `luxon` as dependency for not breaking the "no-optional" install (see #2718 and #2824). ### Fixed @@ -96,8 +98,8 @@ Special thanks to the following contributors: @AmpioRosso, @eouia, @fewieden, @j - ESLint version supports now ECMAScript 2018. - Cleaned up `updatenotification` module and switched to nunjuck template. - Moved calendar tests from category `electron` to `e2e`. -- Update missed translations for Korean language (ko.json). -- Update missed translations for Dutch language (nl.json). +- Updated missed translations for Korean language (ko.json). +- Updated missed translations for Dutch language (nl.json). - Cleaned up `alert` module and switched to nunjuck template. - Moved weather tests from category `electron` to `e2e`. - Updated github actions. @@ -148,14 +150,14 @@ Special thanks to the following contributors: @apiontek, @eouia, @jupadin, @khas - Refactor test configs, use default test config for all tests. - Updated github templates. - Actually test all js and css files when lint script is run. -- Update jsdocs and print warnings during testing too. -- Update weathergov provider to try fetching not just current, but also foreacst, when API URLs available. +- Updated jsdocs and print warnings during testing too. +- Updated weathergov provider to try fetching not just current, but also foreacst, when API URLs available. - Refactored clock layout. - Refactored methods from weatherproviders into weatherobject (isDaytime, updateSunTime). - Use of `logger.js` in jest tests. - Run prettier over all relevant files. - Move tests needing electron in new category `electron`, use `server only` mode in `e2e` tests. -- Update dependencies in package.json. +- Updated dependencies in package.json. ### Fixed @@ -189,13 +191,13 @@ Special thanks to the following contributors: @210954, @B1gG, @codac, @Crazylegs - Refactor code into es6 where possible (e.g. var -> let/const). - Use node v16 in github workflow (replacing node v10). - Moved some files into better suited directories. -- Update dependencies in package.json, require node >= v12, remove `rrule-alt` and `rrule`. -- Update dependencies in package.json and migrate husky to v6, fix husky setup in prod environment. +- Updated dependencies in package.json, require node >= v12, remove `rrule-alt` and `rrule`. +- Updated dependencies in package.json and migrate husky to v6, fix husky setup in prod environment. - Cleaned up error handling in newsfeed and calendar modules for real. - Updated default WEATHER module such that a provider can optionally set a custom unit-of-measure for precipitation (`weatherObject.precipitationUnits`). -- Update documentation. -- Update jest tests: Reset changes on js/logger.js, mock logger.js in global_vars tests. -- Update dependencies in package.json. +- Updated documentation. +- Updated jest tests: Reset changes on js/logger.js, mock logger.js in global_vars tests. +- Updated dependencies in package.json. ### Removed @@ -307,10 +309,10 @@ Special thanks to the following contributors: @Alvinger, @AndyPoms, @ashishtank, - Merging .gitignore in the config-folder with the .gitignore in the root-folder. - Weather module - forecast now show TODAY and TOMORROW instead of weekday, to make it easier to understand. -- Update dependencies to latest versions. -- Update dependencies eslint, feedme, simple-git and socket.io to latest versions. -- Update lithuanian translation. -- Update config sample. +- Updated dependencies to latest versions. +- Updated dependencies eslint, feedme, simple-git and socket.io to latest versions. +- Updated lithuanian translation. +- Updated config sample. - Highlight required version mismatch. - No select Text for TouchScreen use. - Corrected logic for timeFormat "relative" and "absolute". @@ -338,12 +340,12 @@ Special thanks to the following contributors: @Alvinger, @AndyPoms, @ashishtank, - Catch errors when parsing calendar data with ical. (#2022) - Fix Default Alert Module does not hide black overlay when alert is dismissed manually. (#2228) - Weather module - Always displays night icons when local is other than English. (#2221) -- Update node-ical 0.12.4, fix invalid RRULE format in cal entries +- Updated node-ical 0.12.4, fix invalid RRULE format in cal entries - Fix package.json for optional electron dependency (2378) -- Update node-ical version again, 0.12.5, change RRULE fix (#2371, #2379) +- Updated node-ical version again, 0.12.5, change RRULE fix (#2371, #2379) - Remove undefined objects from modules array (#2382) -- Update node-ical version again, 0.12.7, change RRULE fix (#2371, #2379), node-ical now throws error (which we catch) -- Update simple-git version to 2.31 unhandled promise rejection (#2383) +- Updated node-ical version again, 0.12.7, change RRULE fix (#2371, #2379), node-ical now throws error (which we catch) +- Updated simple-git version to 2.31 unhandled promise rejection (#2383) ## [2.13.0] - 2020-10-01 @@ -568,10 +570,10 @@ Special thanks to @sdetweil for all his great contributions! - English translation for "Feels" to "Feels like" - Fixed the example calendar url in `config.js.sample` -- Update `ical.js` to solve various calendar issues. -- Update weather city list url [#1676](https://github.com/MichMich/MagicMirror/issues/1676) +- Updated `ical.js` to solve various calendar issues. +- Updated weather city list url [#1676](https://github.com/MichMich/MagicMirror/issues/1676) - Only update clock once per minute when seconds aren't shown -- Update weatherprovider documentation. +- Updated weatherprovider documentation. ### Fixed @@ -591,7 +593,7 @@ Special thanks to @sdetweil for all his great contributions! - use current username vs hardcoded 'pi' to support non-pi install - check for npm installed. node install doesn't do npm anymore - check for mac as part of PM2 install, add install option string -- update pm2 config with current username instead of hard coded 'pi' +- Updated pm2 config with current username instead of hard coded 'pi' - check for screen saver config, "/etc/xdg/lxsession", bypass if not setup ## [2.7.1] - 2019-04-02 @@ -799,7 +801,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we - Add types for module. - Implement Danger.js to notify contributors when CHANGELOG.md is missing in PR. - Allow scrolling in full page article view of default newsfeed module with gesture events from [MMM-Gestures](https://github.com/thobach/MMM-Gestures) -- Changed 'compliments.js' - update DOM if remote compliments are loaded instead of waiting one updateInterval to show custom compliments +- Changed 'compliments.js' - Updated DOM if remote compliments are loaded instead of waiting one updateInterval to show custom compliments - Automated unit tests utils, deprecated, translator, cloneObject(lockstrings) - Automated integration tests translations - Add advanced filtering to the excludedEvents configuration of the default calendar module @@ -811,7 +813,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we - Add link to GitHub repository which contains the respective Dockerfile. - Optimized automated unit tests cloneObject, cmpVersions -- Update notifications use now translation templates instead of normal strings. +- Updated notifications use now translation templates instead of normal strings. - Yarn can be used now as an installation tool - Changed Electron dependency to v1.7.13. @@ -1018,7 +1020,7 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we ### Fixed -- Update .gitignore to not ignore default modules folder. +- Updated .gitignore to not ignore default modules folder. - Remove white flash on boot up. - Added `update` in Raspberry Pi installation script. - Fix an issue where the analog clock looked scrambled. ([#611](https://github.com/MichMich/MagicMirror/issues/611)) @@ -1103,8 +1105,8 @@ A huge, huge, huge thanks to user @fewieden for all his hard work on the new `we ### Updated - Force fullscreen when kioskmode is active. -- Update the .github templates and information with more modern information. -- Update the Gruntfile with a more functional StyleLint implementation. +- Updated the .github templates and information with more modern information. +- Updated the Gruntfile with a more functional StyleLint implementation. ## [2.0.4] - 2016-08-07 diff --git a/LICENSE.md b/LICENSE.md index c511b4cb..e3fe8802 100644 --- a/LICENSE.md +++ b/LICENSE.md @@ -1,6 +1,6 @@ # The MIT License (MIT) -Copyright © 2016-2021 Michael Teeuw +Copyright © 2016-2022 Michael Teeuw Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation diff --git a/js/node_helper.js b/js/node_helper.js index 8c2e2b90..fa8c5688 100644 --- a/js/node_helper.js +++ b/js/node_helper.js @@ -22,39 +22,38 @@ const NodeHelper = Class.extend({ Log.log(`Starting module helper: ${this.name}`); }, - /* stop() + /** * Called when the MagicMirror² server receives a `SIGINT` * Close any open connections, stop any sub-processes and * gracefully exit the module. - * */ stop() { Log.log(`Stopping module helper: ${this.name}`); }, - /* socketNotificationReceived(notification, payload) + /** * This method is called when a socket notification arrives. * - * argument notification string - The identifier of the notification. - * argument payload mixed - The payload of the notification. + * @param {string} notification The identifier of the notification. + * @param {*} payload The payload of the notification. */ socketNotificationReceived(notification, payload) { Log.log(`${this.name} received a socket notification: ${notification} - Payload: ${payload}`); }, - /* setName(name) + /** * Set the module name. * - * argument name string - Module name. + * @param {string} name Module name. */ setName(name) { this.name = name; }, - /* setPath(path) + /** * Set the module path. * - * argument path string - Module path. + * @param {string} path Module path. */ setPath(path) { this.path = path; diff --git a/modules/default/calendar/calendar.js b/modules/default/calendar/calendar.js index 080e10b9..1242dedf 100644 --- a/modules/default/calendar/calendar.js +++ b/modules/default/calendar/calendar.js @@ -727,7 +727,7 @@ Module.register("calendar", { * Retrieves the maximum entry count for a specific calendar url. * * @param {string} url The calendar url - * @returns {int} The maximum entry count + * @returns {number} The maximum entry count */ maximumEntriesForUrl: function (url) { return this.getCalendarProperty(url, "maximumEntries", this.config.maximumEntries); diff --git a/modules/default/weather/providers/weatherbit.js b/modules/default/weather/providers/weatherbit.js index 06a3f503..66d496a3 100644 --- a/modules/default/weather/providers/weatherbit.js +++ b/modules/default/weather/providers/weatherbit.js @@ -18,7 +18,6 @@ WeatherProvider.register("weatherbit", { // Set the default config properties that is specific to this provider defaults: { apiBase: "https://api.weatherbit.io/v2.0", - weatherEndpoint: "/current", apiKey: "", lat: 0, lon: 0 @@ -69,6 +68,31 @@ WeatherProvider.register("weatherbit", { .finally(() => this.updateAvailable()); }, + /** + * Overrides method for setting config to check if endpoint is correct for hourly + * + * @param {object} config The configuration object + */ + setConfig(config) { + this.config = config; + if (!this.config.weatherEndpoint) { + switch (this.config.type) { + case "hourly": + this.config.weatherEndpoint = "/forecast/hourly"; + break; + case "daily": + case "forecast": + this.config.weatherEndpoint = "/forecast/daily"; + break; + case "current": + this.config.weatherEndpoint = "/current"; + break; + default: + Log.error("weatherEndpoint not configured and could not resolve it based on type"); + } + } + }, + // Create a URL from the config and base URL. getUrl() { const units = this.units[this.config.units] || "auto";