Skip to content

Commit 96c8853

Browse files
Merge branch 'develop' into weather_errors
2 parents 518e986 + 931fe55 commit 96c8853

26 files changed

+2621
-1960
lines changed

.github/CODE_OF_CONDUCT.md

Lines changed: 137 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,137 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our
6+
community a harassment-free experience for everyone, regardless of age, body
7+
size, visible or invisible disability, ethnicity, sex characteristics, gender
8+
identity and expression, level of experience, education, socio-economic status,
9+
nationality, personal appearance, race, caste, color, religion, or sexual
10+
identity and orientation.
11+
12+
We pledge to act and interact in ways that contribute to an open, welcoming,
13+
diverse, inclusive, and healthy community.
14+
15+
## Our Standards
16+
17+
Examples of behavior that contributes to a positive environment for our
18+
community include:
19+
20+
- Demonstrating empathy and kindness toward other people
21+
- Being respectful of differing opinions, viewpoints, and experiences
22+
- Giving and gracefully accepting constructive feedback
23+
- Accepting responsibility and apologizing to those affected by our mistakes,
24+
and learning from the experience
25+
- Focusing on what is best not just for us as individuals, but for the overall
26+
community
27+
28+
Examples of unacceptable behavior include:
29+
30+
- The use of sexualized language or imagery, and sexual attention or advances of
31+
any kind
32+
- Trolling, insulting or derogatory comments, and personal or political attacks
33+
- Public or private harassment
34+
- Publishing others' private information, such as a physical or email address,
35+
without their explicit permission
36+
- Other conduct which could reasonably be considered inappropriate in a
37+
professional setting
38+
39+
## Enforcement Responsibilities
40+
41+
Community leaders are responsible for clarifying and enforcing our standards of
42+
acceptable behavior and will take appropriate and fair corrective action in
43+
response to any behavior that they deem inappropriate, threatening, offensive,
44+
or harmful.
45+
46+
Community leaders have the right and responsibility to remove, edit, or reject
47+
comments, commits, code, wiki edits, issues, and other contributions that are
48+
not aligned to this Code of Conduct, and will communicate reasons for moderation
49+
decisions when appropriate.
50+
51+
## Scope
52+
53+
This Code of Conduct applies within all community spaces, and also applies when
54+
an individual is officially representing the community in public spaces.
55+
Examples of representing our community include using an official email address,
56+
posting via an official social media account, or acting as an appointed
57+
representative at an online or offline event.
58+
59+
## Enforcement
60+
61+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
62+
reported to the community leaders responsible for enforcement:
63+
Contact [Rejas](https://forum.magicmirror.builders/user/rejas),
64+
[Karsten](https://forum.magicmirror.builders/user/karsten13),
65+
[Sam](https://forum.magicmirror.builders/user/sdetweil) or
66+
[Kristjan](https://forum.magicmirror.builders/user/kristjanesperanto)
67+
via private message in the forum.
68+
69+
All complaints will be reviewed and investigated promptly and fairly.
70+
71+
All community leaders are obligated to respect the privacy and security of the
72+
reporter of any incident.
73+
74+
## Enforcement Guidelines
75+
76+
Community leaders will follow these Community Impact Guidelines in determining
77+
the consequences for any action they deem in violation of this Code of Conduct:
78+
79+
### 1. Correction
80+
81+
**Community Impact**: Use of inappropriate language or other behavior deemed
82+
unprofessional or unwelcome in the community.
83+
84+
**Consequence**: A private, written warning from community leaders, providing
85+
clarity around the nature of the violation and an explanation of why the
86+
behavior was inappropriate. A public apology may be requested.
87+
88+
### 2. Warning
89+
90+
**Community Impact**: A violation through a single incident or series of
91+
actions.
92+
93+
**Consequence**: A warning with consequences for continued behavior. No
94+
interaction with the people involved, including unsolicited interaction with
95+
those enforcing the Code of Conduct, for a specified period of time. This
96+
includes avoiding interactions in community spaces as well as external channels
97+
like social media. Violating these terms may lead to a temporary or permanent
98+
ban.
99+
100+
### 3. Temporary Ban
101+
102+
**Community Impact**: A serious violation of community standards, including
103+
sustained inappropriate behavior.
104+
105+
**Consequence**: A temporary ban from any sort of interaction or public
106+
communication with the community for a specified period of time. No public or
107+
private interaction with the people involved, including unsolicited interaction
108+
with those enforcing the Code of Conduct, is allowed during this period.
109+
Violating these terms may lead to a permanent ban.
110+
111+
### 4. Permanent Ban
112+
113+
**Community Impact**: Demonstrating a pattern of violation of community
114+
standards, including sustained inappropriate behavior, harassment of an
115+
individual, or aggression toward or disparagement of classes of individuals.
116+
117+
**Consequence**: A permanent ban from any sort of public interaction within the
118+
community.
119+
120+
## Attribution
121+
122+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
123+
version 2.1, available at
124+
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
125+
126+
Community Impact Guidelines were inspired by
127+
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
128+
129+
For answers to common questions about this code of conduct, see the FAQ at
130+
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
131+
[https://www.contributor-covenant.org/translations][translations].
132+
133+
[homepage]: https://www.contributor-covenant.org
134+
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
135+
[Mozilla CoC]: https://github.com/mozilla/diversity
136+
[FAQ]: https://www.contributor-covenant.org/faq
137+
[translations]: https://www.contributor-covenant.org/translations

CHANGELOG.md

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
❤️ **Donate:** Enjoying MagicMirror²? [Please consider a donation!](https://magicmirror.builders/#donate) With your help we can continue to improve the MagicMirror².
99

10-
## [2.32.0] - unreleased
10+
## [2.33.0] - unreleased
1111

12-
planned for 2025-07-01
12+
planned for 2025-10-01
13+
14+
Thanks to: @dathbe.
15+
16+
### Changed
17+
18+
- [clock] Add CSS to prevent line breaking of sunset/sunrise time display (#3816)
19+
- [core] Enhance system information logging format and include additional env and RAM details (#3839, #3843)
20+
- [refactor] Add new file `js/module_functions.js` to move code used in several modules to one place (#3837)
21+
22+
### Updated
23+
24+
- [core] Update dependencies including electron to v37 (#3831)
25+
26+
### Fixed
27+
28+
- [calendar] Fixed broken unittest that only broke at 1st of july and 1st of january (#3830)
29+
- [clock] Fixed missing icons when no other modules with icons is loaded (#3834)
30+
- [weather] Add error handling to fetch functions including cors (#3791)
31+
32+
## [2.32.0] - 2025-07-01
33+
34+
Thanks to: @bughaver, @bugsounet, @khassel, @KristjanESPERANTO, @plebcity, @rejas, @sdetweil.
35+
36+
> ⚠️ This release needs nodejs version `v22.14.0 or higher`
1337
1438
### Added
1539

@@ -38,6 +62,8 @@ planned for 2025-07-01
3862
- Removed as many of the date conversions as possible
3963
- Use `moment-timezone` when calculating recurring events, this will fix problems from the past with offsets and DST not being handled properly
4064
- Added some tests to test the behavior of the refactored methods to make sure the correct event dates are returned
65+
- [linter] Enable ESLint rule `no-console` and replace `console` with `Log` in some files (#3810)
66+
- [tests] Review and refactor translation tests (#3792)
4167

4268
### Fixed
4369

@@ -46,11 +72,13 @@ planned for 2025-07-01
4672
- [feat] Add rule `no-undef` in config file validation to fix #3785 (#3786)
4773
- [fonts] Fix `roboto.css` to avoid error message `Unknown descriptor 'var(' in @font-face rule.` in firefox console (#3787)
4874
- [tests] Fix and refactor e2e test `Same keys` in `translations_spec.js` (#3809)
49-
- [weather] Add error handling to fetch functions including cors (#3791)
75+
- [tests] Fix e2e tests newsfeed and calendar to exit without open handles (#3817)
5076

5177
### Updated
5278

53-
- [core] Update dependencies including electron to v36 (#3774, #3788)
79+
- [core] Update dependencies including electron to v36 (#3774, #3788, #3811, #3804, #3815, #3823)
80+
- [core] Update package type to `commonjs`
81+
- [logger] Review factory code part: use `switch/case` instead of `if/else if` (#3812)
5482

5583
## [2.31.0] - 2025-04-01
5684

@@ -1765,7 +1793,8 @@ It includes (but is not limited to) the following features:
17651793

17661794
This was part of the blogpost: [https://michaelteeuw.nl/post/83916869600/magic-mirror-part-vi-production-of-the](https://michaelteeuw.nl/post/83916869600/magic-mirror-part-vi-production-of-the)
17671795

1768-
[2.32.0]: https://github.com/MagicMirrorOrg/MagicMirror/compare/v2.31.0...develop
1796+
[2.33.0]: https://github.com/MagicMirrorOrg/MagicMirror/compare/v2.32.0...develop
1797+
[2.32.0]: https://github.com/MagicMirrorOrg/MagicMirror/compare/v2.31.0...v2.32.0
17691798
[2.31.0]: https://github.com/MagicMirrorOrg/MagicMirror/compare/v2.30.0...v2.31.0
17701799
[2.30.0]: https://github.com/MagicMirrorOrg/MagicMirror/compare/v2.29.0...v2.30.0
17711800
[2.29.0]: https://github.com/MagicMirrorOrg/MagicMirror/compare/v2.28.0...v2.29.0

cspell.config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"sdetweil",
194194
"sendheaders",
195195
"serveronly",
196+
"sexualized",
196197
"skpanagiotis",
197198
"SMHI",
198199
"Snille",

eslint.config.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,16 @@ export default defineConfig([
8484
"sort-keys": "off"
8585
}
8686
},
87+
{
88+
files: ["**/*.js"],
89+
ignores: [
90+
"clientonly/index.js",
91+
"modules/default/calendar/debug.js",
92+
"js/logger.js",
93+
"tests/**/*.js"
94+
],
95+
rules: {"no-console": "error"}
96+
},
8797
{
8898
files: ["**/package.json"],
8999
plugins: {packageJson},

jest.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ module.exports = async () => {
2020
},
2121
{
2222
displayName: "e2e",
23-
setupFilesAfterEnv: ["<rootDir>/tests/e2e/helpers/mock-console.js"],
2423
testMatch: ["**/tests/e2e/**/*.[jt]s?(x)"],
2524
modulePaths: ["<rootDir>/js/"],
2625
testPathIgnorePatterns: ["<rootDir>/tests/e2e/helpers", "<rootDir>/tests/e2e/mocks"]

js/app.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ global.mmTestMode = process.env.mmTestMode === "true";
2222
Log.log(`Starting MagicMirror: v${global.version}`);
2323

2424
// Log system information.
25-
Utils.logSystemInformation();
25+
Utils.logSystemInformation(global.version);
2626

2727
// global absolute root path
2828
global.root_path = path.resolve(`${__dirname}/../`);
@@ -364,7 +364,7 @@ function App () {
364364
}
365365
} catch (error) {
366366
Log.error(`Error when stopping node_helper for module ${nodeHelper.name}:`);
367-
console.error(error);
367+
Log.error(error);
368368
}
369369
}
370370

js/logger.js

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,26 +11,35 @@
1111
label: (arg) => {
1212
const { method, defaultTokens } = arg;
1313
let label = defaultTokens.label(arg);
14-
if (method === "error") {
15-
label = styleText("red", label);
16-
} else if (method === "warn") {
17-
label = styleText("yellow", label);
18-
} else if (method === "debug") {
19-
label = styleText("bgBlue", label);
20-
} else if (method === "info") {
21-
label = styleText("blue", label);
14+
switch (method) {
15+
case "error":
16+
label = styleText("red", label);
17+
break;
18+
case "warn":
19+
label = styleText("yellow", label);
20+
break;
21+
case "debug":
22+
label = styleText("bgBlue", label);
23+
break;
24+
case "info":
25+
label = styleText("blue", label);
26+
break;
2227
}
2328
return label;
2429
},
2530
msg: (arg) => {
2631
const { method, defaultTokens } = arg;
2732
let msg = defaultTokens.msg(arg);
28-
if (method === "error") {
29-
msg = styleText("red", msg);
30-
} else if (method === "warn") {
31-
msg = styleText("yellow", msg);
32-
} else if (method === "info") {
33-
msg = styleText("blue", msg);
33+
switch (method) {
34+
case "error":
35+
msg = styleText("red", msg);
36+
break;
37+
case "warn":
38+
msg = styleText("yellow", msg);
39+
break;
40+
case "info":
41+
msg = styleText("blue", msg);
42+
break;
3443
}
3544
return msg;
3645
}

js/main.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -617,7 +617,7 @@ const MM = (function () {
617617
if (startUp !== curr) {
618618
startUp = "";
619619
window.location.reload(true);
620-
console.warn("Refreshing Website because server was restarted");
620+
Log.warn("Refreshing Website because server was restarted");
621621
}
622622
} catch (err) {
623623
Log.error(`MagicMirror not reachable: ${err}`);

js/module_functions.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Schedule the timer for the next update
3+
* @param {object} timer The timer of the module
4+
* @param {bigint} intervalMS interval in milliseconds
5+
* @param {Function} callback function to call when the timer expires
6+
*/
7+
const scheduleTimer = function (timer, intervalMS, callback) {
8+
if (process.env.JEST_WORKER_ID === undefined) {
9+
// only set timer when not running in jest
10+
let tmr = timer;
11+
clearTimeout(tmr);
12+
tmr = setTimeout(function () {
13+
callback();
14+
}, intervalMS);
15+
}
16+
};
17+
18+
module.exports = { scheduleTimer };

0 commit comments

Comments
 (0)