Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ _This release is scheduled to be released on 2021-01-01._
### Updated

- Weather module - forecast now show TODAY and TOMORROW instead of weekday, to make it easier to understand
- Update dependencies to latest versions

### Deleted

Expand Down
2 changes: 1 addition & 1 deletion js/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ var Server = function (config, callback) {
res.status(403).send("This device is not allowed to access your mirror. <br> Please check your config.js or config.js.sample to change this.");
});
});
app.use(helmet());
app.use(helmet({ contentSecurityPolicy: false }));

app.use("/js", express.static(__dirname));
var directories = ["/config", "/css", "/fonts", "/modules", "/vendor", "/translations", "/tests/configs"];
Expand Down
19,578 changes: 9,928 additions & 9,650 deletions package-lock.json

Large diffs are not rendered by default.

31 changes: 16 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,46 +44,47 @@
"devDependencies": {
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"danger": "^3.1.3",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jsdoc": "^30.5.1",
"danger": "^10.5.1",
"eslint-config-prettier": "^6.15.0",
"eslint-plugin-jsdoc": "^30.7.7",
"eslint-plugin-prettier": "^3.1.4",
"http-auth": "^3.2.3",
"express-basic-auth": "^1.2.0",
"husky": "^4.3.0",
"jsdom": "^11.6.2",
"jsdom": "^16.4.0",
"lodash": "^4.17.20",
"mocha": "^7.1.2",
"mocha": "^8.2.1",
"mocha-each": "^2.0.1",
"mocha-logger": "^1.0.6",
"mocha-logger": "^1.0.7",
"nyc": "^15.1.0",
"prettier": "^2.1.2",
"pretty-quick": "^3.0.2",
"spectron": "^8.0.0",
"stylelint": "^13.7.1",
"pretty-quick": "^3.1.0",
"spectron": "^10.0.1",
"stylelint": "^13.7.2",
"stylelint-config-prettier": "^8.0.2",
"stylelint-config-standard": "^20.0.0",
"stylelint-prettier": "^1.1.2"
},
"optionalDependencies": {
"electron": "^6.1.7"
"electron": "^8.5.3"
},
"dependencies": {
"colors": "^1.4.0",
"console-stamp": "^0.2.9",
"eslint": "^7.9.0",
"electron": "^8.5.3",
"eslint": "^7.13.0",
"express": "^4.17.1",
"express-ipfilter": "^1.1.2",
"feedme": "^1.2.0",
"helmet": "^3.23.3",
"helmet": "^4.2.0",
"ical": "^0.8.0",
"iconv-lite": "^0.6.2",
"module-alias": "^2.2.2",
"moment": "^2.28.0",
"moment": "^2.29.1",
"node-ical": "^0.12.3",
"request": "^2.88.2",
"rrule": "^2.6.6",
"rrule-alt": "^2.2.8",
"simple-git": "^1.85.0",
"simple-git": "^2.21.0",
"socket.io": "^2.3.0",
"valid-url": "^1.0.9"
},
Expand Down
6 changes: 3 additions & 3 deletions tests/e2e/translations_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe("Translations", function () {
it(`should parse ${language}`, function (done) {
const dom = new JSDOM(
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand All @@ -68,7 +68,7 @@ describe("Translations", function () {
before(function (done) {
const dom = new JSDOM(
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand All @@ -92,7 +92,7 @@ describe("Translations", function () {
before(function (done) {
const dom = new JSDOM(
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
<script src="${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "js", "translator.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand Down
16 changes: 6 additions & 10 deletions tests/servers/basic-auth.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,16 @@
const path = require("path");
const auth = require("http-auth");
const auth = require("express-basic-auth");
const express = require("express");
const app = express();

var server;

var basic = auth.basic(
{
realm: "MagicMirror Area restricted."
},
(username, password, callback) => {
callback(username === "MagicMirror" && password === "CallMeADog");
}
);
var basicAuth = auth({
realm: "MagicMirror Area restricted.",
users: { MagicMirror: "CallMeADog" }
});

app.use(auth.connect(basic));
app.use(basicAuth);

// Set available directories
var directories = ["/tests/configs"];
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/classes/class_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe("File js/class", function () {
before(function (done) {
dom = new JSDOM(
`<script>var Log = {log: function() {}};</script>\
<script src="${path.join(__dirname, "..", "..", "..", "js", "class.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "..", "js", "class.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand Down
26 changes: 13 additions & 13 deletions tests/unit/classes/translator_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ describe("Translator", function () {
}

it("should return custom module translation", function (done) {
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
setTranslations(Translator);
Expand All @@ -78,7 +78,7 @@ describe("Translator", function () {
});

it("should return core translation", function (done) {
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
setTranslations(Translator);
Expand All @@ -91,7 +91,7 @@ describe("Translator", function () {
});

it("should return custom module translation fallback", function (done) {
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
setTranslations(Translator);
Expand All @@ -102,7 +102,7 @@ describe("Translator", function () {
});

it("should return core translation fallback", function (done) {
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
setTranslations(Translator);
Expand All @@ -113,7 +113,7 @@ describe("Translator", function () {
});

it("should return translation with placeholder for missing variables", function (done) {
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
setTranslations(Translator);
Expand All @@ -124,7 +124,7 @@ describe("Translator", function () {
});

it("should return key if no translation was found", function (done) {
const dom = new JSDOM(`<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
setTranslations(Translator);
Expand All @@ -144,7 +144,7 @@ describe("Translator", function () {
};

it("should load translations", function (done) {
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
const file = "TranslationTest.json";
Expand All @@ -158,7 +158,7 @@ describe("Translator", function () {
});

it("should load translation fallbacks", function (done) {
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator } = dom.window;
const file = "TranslationTest.json";
Expand All @@ -172,7 +172,7 @@ describe("Translator", function () {
});

it("should not load translations, if module fallback exists", function (done) {
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
const dom = new JSDOM(`<script>var Log = {log: function(){}};</script><script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`, { runScripts: "dangerously", resources: "usable" });
dom.window.onload = function () {
const { Translator, XMLHttpRequest } = dom.window;
const file = "TranslationTest.json";
Expand Down Expand Up @@ -200,7 +200,7 @@ describe("Translator", function () {
it("should load core translations and fallback", function (done) {
const dom = new JSDOM(
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand All @@ -219,7 +219,7 @@ describe("Translator", function () {
it("should load core fallback if language cannot be found", function (done) {
const dom = new JSDOM(
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand All @@ -240,7 +240,7 @@ describe("Translator", function () {
it("should load core translations fallback", function (done) {
const dom = new JSDOM(
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand All @@ -258,7 +258,7 @@ describe("Translator", function () {
it("should load core fallback if language cannot be found", function (done) {
const dom = new JSDOM(
`<script>var translations = {}; var Log = {log: function(){}};</script>\
<script src="${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "..", "js", "translator.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/functions/cmp_versions_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Test function cmpVersions in js/module.js", function () {
before(function (done) {
const dom = new JSDOM(
`<script>var Class = {extend: function() { return {}; }};</script>\
<script src="${path.join(__dirname, "..", "..", "..", "js", "module.js")}">`,
<script src="file://${path.join(__dirname, "..", "..", "..", "js", "module.js")}">`,
{ runScripts: "dangerously", resources: "usable" }
);
dom.window.onload = function () {
Expand Down