mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
Merge branch 'develop' into develop
This commit is contained in:
commit
fc68321bd5
@ -13,10 +13,12 @@ _This release is scheduled to be released on 2021-01-01._
|
|||||||
|
|
||||||
- Added new log level "debug" to the logger.
|
- Added new log level "debug" to the logger.
|
||||||
- Added new parameter "useKmh" to weather module for displaying wind speed as kmh.
|
- Added new parameter "useKmh" to weather module for displaying wind speed as kmh.
|
||||||
|
- Chuvash translation.
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
|
|
||||||
- Weather module - forecast now show TODAY and TOMORROW instead of weekday, to make it easier to understand
|
- Weather module - forecast now show TODAY and TOMORROW instead of weekday, to make it easier to understand
|
||||||
|
- Update dependencies to latest versions
|
||||||
|
|
||||||
### Deleted
|
### Deleted
|
||||||
|
|
||||||
|
@ -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.");
|
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));
|
app.use("/js", express.static(__dirname));
|
||||||
var directories = ["/config", "/css", "/fonts", "/modules", "/vendor", "/translations", "/tests/configs"];
|
var directories = ["/config", "/css", "/fonts", "/modules", "/vendor", "/translations", "/tests/configs"];
|
||||||
|
@ -32,7 +32,6 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
let reloadTimer = null;
|
let reloadTimer = null;
|
||||||
let events = [];
|
let events = [];
|
||||||
let debug = false;
|
|
||||||
|
|
||||||
let fetchFailedCallback = function () {};
|
let fetchFailedCallback = function () {};
|
||||||
let eventsReceivedCallback = function () {};
|
let eventsReceivedCallback = function () {};
|
||||||
@ -216,7 +215,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dates = rule.between(pastLocal, futureLocal, true, limitFunction);
|
const dates = rule.between(pastLocal, futureLocal, true, limitFunction);
|
||||||
if (debug) Log.log("title=" + event.summary.val + " dates=" + JSON.stringify(dates));
|
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
|
// 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
|
// 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,
|
// had its date changed from outside the range to inside the range. For the time being,
|
||||||
@ -246,18 +245,18 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
// for full day events, the time might be off from RRULE/Luxon problem
|
// for full day events, the time might be off from RRULE/Luxon problem
|
||||||
if (isFullDayEvent(event)) {
|
if (isFullDayEvent(event)) {
|
||||||
if (debug) Log.log("fullday");
|
Log.debug("fullday");
|
||||||
// if the offset is negative, east of GMT where the problem is
|
// if the offset is negative, east of GMT where the problem is
|
||||||
if (date.getTimezoneOffset() < 0) {
|
if (date.getTimezoneOffset() < 0) {
|
||||||
// get the offset of today when we are processing
|
// get the offset of today when we are processing
|
||||||
// this will be the correction we need to apply
|
// this will be the correction we need to apply
|
||||||
let nowOffset = new Date().getTimezoneOffset();
|
let nowOffset = new Date().getTimezoneOffset();
|
||||||
if (debug) Log.log("now offset is " + nowOffset);
|
Log.debug("now offset is " + nowOffset);
|
||||||
// reduce the time by the offset
|
// reduce the time by the offset
|
||||||
if (debug) Log.log(" recurring date is " + date + " offset is " + date.getTimezoneOffset());
|
Log.debug(" recurring date is " + date + " offset is " + date.getTimezoneOffset());
|
||||||
// apply the correction to the date/time to get it UTC relative
|
// apply the correction to the date/time to get it UTC relative
|
||||||
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
|
date = new Date(date.getTime() - Math.abs(nowOffset) * 60000);
|
||||||
if (debug) Log.log("new recurring date is " + date);
|
Log.debug("new recurring date is " + date);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
startDate = moment(date);
|
startDate = moment(date);
|
||||||
@ -389,10 +388,10 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
let adjustHours = 0;
|
let adjustHours = 0;
|
||||||
// if a timezone was specified
|
// if a timezone was specified
|
||||||
if (!event.start.tz) {
|
if (!event.start.tz) {
|
||||||
if (debug) Log.log(" if no tz, guess based on now");
|
Log.debug(" if no tz, guess based on now");
|
||||||
event.start.tz = moment.tz.guess();
|
event.start.tz = moment.tz.guess();
|
||||||
}
|
}
|
||||||
if (debug) Log.log("initial tz=" + event.start.tz);
|
Log.debug("initial tz=" + event.start.tz);
|
||||||
|
|
||||||
// if there is a start date specified
|
// if there is a start date specified
|
||||||
if (event.start.tz) {
|
if (event.start.tz) {
|
||||||
@ -405,10 +404,10 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
if (tz) {
|
if (tz) {
|
||||||
// change the timezone to the IANA name
|
// change the timezone to the IANA name
|
||||||
event.start.tz = tz;
|
event.start.tz = tz;
|
||||||
// if(debug) Log.log("corrected timezone="+event.start.tz)
|
Log.debug("corrected timezone=" + event.start.tz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug) Log.log("corrected tz=" + event.start.tz);
|
Log.debug("corrected tz=" + event.start.tz);
|
||||||
let mmo = 0; // offset from TZ string or calculated
|
let mmo = 0; // offset from TZ string or calculated
|
||||||
let mm = 0; // date with tz or offset
|
let mm = 0; // date with tz or offset
|
||||||
let mms = 0; // utc offset of created with tz
|
let mms = 0; // utc offset of created with tz
|
||||||
@ -417,45 +416,45 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
const regex = /[+|-]\d*:\d*/;
|
const regex = /[+|-]\d*:\d*/;
|
||||||
mmo = event.start.tz.match(regex).toString();
|
mmo = event.start.tz.match(regex).toString();
|
||||||
mms = mmo;
|
mms = mmo;
|
||||||
if (debug) Log.log("ical offset=" + mmo + " date=" + date);
|
Log.debug("ical offset=" + mmo + " date=" + date);
|
||||||
mm = moment(date);
|
mm = moment(date);
|
||||||
mm = mm.utcOffset(mmo);
|
mm = mm.utcOffset(mmo);
|
||||||
} else {
|
} else {
|
||||||
// get the start time in that timezone
|
// get the start time in that timezone
|
||||||
if (debug) Log.log("ttttttt=" + moment(event.start).toDate());
|
Log.debug("ttttttt=" + moment(event.start).toDate());
|
||||||
mms = moment.tz(moment(event.start), event.start.tz).utcOffset();
|
mms = moment.tz(moment(event.start), event.start.tz).utcOffset();
|
||||||
if (debug) Log.log("ms offset=" + mms);
|
Log.debug("ms offset=" + mms);
|
||||||
|
|
||||||
if (debug) Log.log("start date =" + moment.tz(moment(event.start), event.start.tz).toDate());
|
Log.debug("start date =" + moment.tz(moment(event.start), event.start.tz).toDate());
|
||||||
|
|
||||||
// get the specified date in that timezone
|
// get the specified date in that timezone
|
||||||
mm = moment.tz(moment(date), event.start.tz);
|
mm = moment.tz(moment(date), event.start.tz);
|
||||||
if (debug) Log.log("mm=" + mm.toDate());
|
Log.debug("mm=" + mm.toDate());
|
||||||
mmo = mm.utcOffset();
|
mmo = mm.utcOffset();
|
||||||
}
|
}
|
||||||
if (debug) Log.log("mm ofset=" + mmo + " hour=" + mm.format("H") + " event date=" + mm.toDate());
|
Log.debug("mm ofset=" + mmo + " hour=" + mm.format("H") + " event date=" + mm.toDate());
|
||||||
// if the offset is greater than 0, east of london
|
// if the offset is greater than 0, east of london
|
||||||
if (mmo !== mms) {
|
if (mmo !== mms) {
|
||||||
// big offset
|
// big offset
|
||||||
if (debug) Log.log("offset");
|
Log.debug("offset");
|
||||||
let h = parseInt(mm.format("H"));
|
let h = parseInt(mm.format("H"));
|
||||||
// check if the event time is less than the offset
|
// check if the event time is less than the offset
|
||||||
if (h > 0 && h < Math.abs(mmo) / 60) {
|
if (h > 0 && h < Math.abs(mmo) / 60) {
|
||||||
// if so, rrule created a wrong date (utc day, oops, with utc yesterday adjusted time)
|
// if so, rrule created a wrong date (utc day, oops, with utc yesterday adjusted time)
|
||||||
// we need to fix that
|
// we need to fix that
|
||||||
adjustHours = 24;
|
adjustHours = 24;
|
||||||
// if(debug) Log.log("adjusting date")
|
Log.debug("adjusting date");
|
||||||
}
|
}
|
||||||
if (Math.abs(mmo) > Math.abs(mms)) {
|
if (Math.abs(mmo) > Math.abs(mms)) {
|
||||||
adjustHours += 1;
|
adjustHours += 1;
|
||||||
if (debug) Log.log("adjust up 1 hour dst change");
|
Log.debug("adjust up 1 hour dst change");
|
||||||
} else if (Math.abs(mmo) < Math.abs(mms)) {
|
} else if (Math.abs(mmo) < Math.abs(mms)) {
|
||||||
adjustHours -= 1;
|
adjustHours -= 1;
|
||||||
if (debug) Log.log("adjust down 1 hour dst change");
|
Log.debug("adjust down 1 hour dst change");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (debug) Log.log("adjustHours=" + adjustHours);
|
Log.debug("adjustHours=" + adjustHours);
|
||||||
return adjustHours;
|
return adjustHours;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
5654
package-lock.json
generated
5654
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
31
package.json
31
package.json
@ -44,46 +44,47 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"chai": "^4.2.0",
|
"chai": "^4.2.0",
|
||||||
"chai-as-promised": "^7.1.1",
|
"chai-as-promised": "^7.1.1",
|
||||||
"danger": "^3.1.3",
|
"danger": "^10.5.1",
|
||||||
"eslint-config-prettier": "^6.11.0",
|
"eslint-config-prettier": "^6.15.0",
|
||||||
"eslint-plugin-jsdoc": "^30.5.1",
|
"eslint-plugin-jsdoc": "^30.7.7",
|
||||||
"eslint-plugin-prettier": "^3.1.4",
|
"eslint-plugin-prettier": "^3.1.4",
|
||||||
"http-auth": "^3.2.3",
|
"express-basic-auth": "^1.2.0",
|
||||||
"husky": "^4.3.0",
|
"husky": "^4.3.0",
|
||||||
"jsdom": "^11.6.2",
|
"jsdom": "^16.4.0",
|
||||||
"lodash": "^4.17.20",
|
"lodash": "^4.17.20",
|
||||||
"mocha": "^7.1.2",
|
"mocha": "^8.2.1",
|
||||||
"mocha-each": "^2.0.1",
|
"mocha-each": "^2.0.1",
|
||||||
"mocha-logger": "^1.0.6",
|
"mocha-logger": "^1.0.7",
|
||||||
"nyc": "^15.1.0",
|
"nyc": "^15.1.0",
|
||||||
"prettier": "^2.1.2",
|
"prettier": "^2.1.2",
|
||||||
"pretty-quick": "^3.0.2",
|
"pretty-quick": "^3.1.0",
|
||||||
"spectron": "^8.0.0",
|
"spectron": "^10.0.1",
|
||||||
"stylelint": "^13.7.1",
|
"stylelint": "^13.7.2",
|
||||||
"stylelint-config-prettier": "^8.0.2",
|
"stylelint-config-prettier": "^8.0.2",
|
||||||
"stylelint-config-standard": "^20.0.0",
|
"stylelint-config-standard": "^20.0.0",
|
||||||
"stylelint-prettier": "^1.1.2"
|
"stylelint-prettier": "^1.1.2"
|
||||||
},
|
},
|
||||||
"optionalDependencies": {
|
"optionalDependencies": {
|
||||||
"electron": "^6.1.7"
|
"electron": "^8.5.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"colors": "^1.4.0",
|
"colors": "^1.4.0",
|
||||||
"console-stamp": "^0.2.9",
|
"console-stamp": "^0.2.9",
|
||||||
"eslint": "^7.9.0",
|
"electron": "^8.5.3",
|
||||||
|
"eslint": "^7.13.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-ipfilter": "^1.1.2",
|
"express-ipfilter": "^1.1.2",
|
||||||
"feedme": "^1.2.0",
|
"feedme": "^1.2.0",
|
||||||
"helmet": "^3.23.3",
|
"helmet": "^4.2.0",
|
||||||
"ical": "^0.8.0",
|
"ical": "^0.8.0",
|
||||||
"iconv-lite": "^0.6.2",
|
"iconv-lite": "^0.6.2",
|
||||||
"module-alias": "^2.2.2",
|
"module-alias": "^2.2.2",
|
||||||
"moment": "^2.28.0",
|
"moment": "^2.29.1",
|
||||||
"node-ical": "^0.12.3",
|
"node-ical": "^0.12.3",
|
||||||
"request": "^2.88.2",
|
"request": "^2.88.2",
|
||||||
"rrule": "^2.6.6",
|
"rrule": "^2.6.6",
|
||||||
"rrule-alt": "^2.2.8",
|
"rrule-alt": "^2.2.8",
|
||||||
"simple-git": "^1.85.0",
|
"simple-git": "^2.21.0",
|
||||||
"socket.io": "^2.3.0",
|
"socket.io": "^2.3.0",
|
||||||
"valid-url": "^1.0.9"
|
"valid-url": "^1.0.9"
|
||||||
},
|
},
|
||||||
|
@ -46,7 +46,7 @@ describe("Translations", function () {
|
|||||||
it(`should parse ${language}`, function (done) {
|
it(`should parse ${language}`, function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
@ -68,7 +68,7 @@ describe("Translations", function () {
|
|||||||
before(function (done) {
|
before(function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
@ -92,7 +92,7 @@ describe("Translations", function () {
|
|||||||
before(function (done) {
|
before(function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var translations = ${JSON.stringify(translations)}; var Log = {log: function(){}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
|
@ -1,20 +1,16 @@
|
|||||||
const path = require("path");
|
const path = require("path");
|
||||||
const auth = require("http-auth");
|
const auth = require("express-basic-auth");
|
||||||
const express = require("express");
|
const express = require("express");
|
||||||
const app = express();
|
const app = express();
|
||||||
|
|
||||||
var server;
|
var server;
|
||||||
|
|
||||||
var basic = auth.basic(
|
var basicAuth = auth({
|
||||||
{
|
realm: "MagicMirror Area restricted.",
|
||||||
realm: "MagicMirror Area restricted."
|
users: { MagicMirror: "CallMeADog" }
|
||||||
},
|
});
|
||||||
(username, password, callback) => {
|
|
||||||
callback(username === "MagicMirror" && password === "CallMeADog");
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
app.use(auth.connect(basic));
|
app.use(basicAuth);
|
||||||
|
|
||||||
// Set available directories
|
// Set available directories
|
||||||
var directories = ["/tests/configs"];
|
var directories = ["/tests/configs"];
|
||||||
|
@ -10,7 +10,7 @@ describe("File js/class", function () {
|
|||||||
before(function (done) {
|
before(function (done) {
|
||||||
dom = new JSDOM(
|
dom = new JSDOM(
|
||||||
`<script>var Log = {log: function() {}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
|
@ -65,7 +65,7 @@ describe("Translator", function () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
it("should return custom module translation", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
setTranslations(Translator);
|
setTranslations(Translator);
|
||||||
@ -78,7 +78,7 @@ describe("Translator", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return core translation", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
setTranslations(Translator);
|
setTranslations(Translator);
|
||||||
@ -91,7 +91,7 @@ describe("Translator", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return custom module translation fallback", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
setTranslations(Translator);
|
setTranslations(Translator);
|
||||||
@ -102,7 +102,7 @@ describe("Translator", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return core translation fallback", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
setTranslations(Translator);
|
setTranslations(Translator);
|
||||||
@ -113,7 +113,7 @@ describe("Translator", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return translation with placeholder for missing variables", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
setTranslations(Translator);
|
setTranslations(Translator);
|
||||||
@ -124,7 +124,7 @@ describe("Translator", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return key if no translation was found", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
setTranslations(Translator);
|
setTranslations(Translator);
|
||||||
@ -144,7 +144,7 @@ describe("Translator", function () {
|
|||||||
};
|
};
|
||||||
|
|
||||||
it("should load translations", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
const file = "TranslationTest.json";
|
const file = "TranslationTest.json";
|
||||||
@ -158,7 +158,7 @@ describe("Translator", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should load translation fallbacks", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator } = dom.window;
|
const { Translator } = dom.window;
|
||||||
const file = "TranslationTest.json";
|
const file = "TranslationTest.json";
|
||||||
@ -172,7 +172,7 @@ describe("Translator", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should not load translations, if module fallback exists", function (done) {
|
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 () {
|
dom.window.onload = function () {
|
||||||
const { Translator, XMLHttpRequest } = dom.window;
|
const { Translator, XMLHttpRequest } = dom.window;
|
||||||
const file = "TranslationTest.json";
|
const file = "TranslationTest.json";
|
||||||
@ -200,7 +200,7 @@ describe("Translator", function () {
|
|||||||
it("should load core translations and fallback", function (done) {
|
it("should load core translations and fallback", function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
@ -219,7 +219,7 @@ describe("Translator", function () {
|
|||||||
it("should load core fallback if language cannot be found", function (done) {
|
it("should load core fallback if language cannot be found", function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
@ -240,7 +240,7 @@ describe("Translator", function () {
|
|||||||
it("should load core translations fallback", function (done) {
|
it("should load core translations fallback", function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var translations = {en: "http://localhost:3000/translations/en.json"}; var Log = {log: function(){}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
@ -258,7 +258,7 @@ describe("Translator", function () {
|
|||||||
it("should load core fallback if language cannot be found", function (done) {
|
it("should load core fallback if language cannot be found", function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var translations = {}; var Log = {log: function(){}};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
|
@ -8,7 +8,7 @@ describe("Test function cmpVersions in js/module.js", function () {
|
|||||||
before(function (done) {
|
before(function (done) {
|
||||||
const dom = new JSDOM(
|
const dom = new JSDOM(
|
||||||
`<script>var Class = {extend: function() { return {}; }};</script>\
|
`<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" }
|
{ runScripts: "dangerously", resources: "usable" }
|
||||||
);
|
);
|
||||||
dom.window.onload = function () {
|
dom.window.onload = function () {
|
||||||
|
34
translations/cv.json
Normal file
34
translations/cv.json
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
{
|
||||||
|
"LOADING": "Тиенет …",
|
||||||
|
|
||||||
|
"TODAY": "Паян",
|
||||||
|
"TOMORROW": "Ыран",
|
||||||
|
"DAYAFTERTOMORROW": "Виҫмине",
|
||||||
|
"RUNNING": "Хальхи",
|
||||||
|
"EMPTY": "Пулас ӗҫ ҫук",
|
||||||
|
|
||||||
|
"WEEK": "{weekNumber} эрне",
|
||||||
|
|
||||||
|
"N": "Ҫ",
|
||||||
|
"NNE": "ҪҪТ",
|
||||||
|
"NE": "ҪТ",
|
||||||
|
"ENE": "ТҪТ",
|
||||||
|
"E": "Т",
|
||||||
|
"ESE": "ТКТ",
|
||||||
|
"SE": "КТ",
|
||||||
|
"SSE": "ККТ",
|
||||||
|
"S": "К",
|
||||||
|
"SSW": "ККА",
|
||||||
|
"SW": "КА",
|
||||||
|
"WSW": "АКА",
|
||||||
|
"W": "А",
|
||||||
|
"WNW": "АҪА",
|
||||||
|
"NW": "ҪА",
|
||||||
|
"NNW": "ҪҪА",
|
||||||
|
"FEELS": "Туйӑннӑ",
|
||||||
|
|
||||||
|
"UPDATE_NOTIFICATION": "MagicMirror² валли ҫӗнетӳ пур.",
|
||||||
|
"UPDATE_NOTIFICATION_MODULE": "{MODULE_NAME} модуль валли ҫӗнетӳ пур.",
|
||||||
|
"UPDATE_INFO_SINGLE": "Ҫак инсталляци {BRANCH_NAME} commit турат {COMMIT_COUNT} коммитпа кая уйрӑлса тӑрать.",
|
||||||
|
"UPDATE_INFO_MULTIPLE": "Ҫак инсталляци {BRANCH_NAME} commit турат {COMMIT_COUNT} коммитпа кая уйрӑлса тӑрать."
|
||||||
|
}
|
@ -14,6 +14,7 @@ var translations = {
|
|||||||
fy: "translations/fy.json", // Frysk
|
fy: "translations/fy.json", // Frysk
|
||||||
es: "translations/es.json", // Spanish
|
es: "translations/es.json", // Spanish
|
||||||
ca: "translations/ca.json", // Catalan
|
ca: "translations/ca.json", // Catalan
|
||||||
|
cv: "translations/cv.json", // Chuvash
|
||||||
nb: "translations/nb.json", // Norsk bokmål
|
nb: "translations/nb.json", // Norsk bokmål
|
||||||
nn: "translations/nn.json", // Norsk nynorsk
|
nn: "translations/nn.json", // Norsk nynorsk
|
||||||
pt: "translations/pt.json", // Português
|
pt: "translations/pt.json", // Português
|
||||||
|
Loading…
x
Reference in New Issue
Block a user