mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Merge with upstream
This commit is contained in:
commit
03964d6f68
@ -22,6 +22,7 @@ _This release is scheduled to be released on 2021-04-01._
|
|||||||
- `module.show` has now the option for a callback on error.
|
- `module.show` has now the option for a callback on error.
|
||||||
- Added locale to sample config file
|
- Added locale to sample config file
|
||||||
- Added support for self-signed certificates for the default calendar module (#466)
|
- Added support for self-signed certificates for the default calendar module (#466)
|
||||||
|
- Added hiddenOnStartup flag to module config (#2475)
|
||||||
|
|
||||||
### Updated
|
### Updated
|
||||||
|
|
||||||
@ -36,10 +37,12 @@ _This release is scheduled to be released on 2021-04-01._
|
|||||||
- Dont update the DOM when a module is not displayed.
|
- Dont update the DOM when a module is not displayed.
|
||||||
- Cleaned up jsdoc and tests.
|
- Cleaned up jsdoc and tests.
|
||||||
- Exposed logger as node module for easier access for 3rd party modules
|
- Exposed logger as node module for easier access for 3rd party modules
|
||||||
|
- Replaced deprecated `request` package with `node-fetch` and `digest-fetch`
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
- Removed danger.js library.
|
- Removed danger.js library.
|
||||||
|
- Removed `ical` which was substituted by `node-ical` in release `v2.13.0`. Module developers must install this dependency themselves in the module folder if needed.
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
@ -53,6 +56,7 @@ _This release is scheduled to be released on 2021-04-01._
|
|||||||
- 3rd party module language loading if language is English
|
- 3rd party module language loading if language is English
|
||||||
- Fix e2e tests after spectron update
|
- Fix e2e tests after spectron update
|
||||||
- Fix updatenotification creating zombie processes by setting a timeout for the git process
|
- Fix updatenotification creating zombie processes by setting a timeout for the git process
|
||||||
|
- Fix weather module openweathermap not loading if lat and lon set without onecall.
|
||||||
|
|
||||||
## [2.14.0] - 2021-01-01
|
## [2.14.0] - 2021-01-01
|
||||||
|
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
<a href="https://codecov.io/gh/MichMich/MagicMirror"><img src="https://codecov.io/gh/MichMich/MagicMirror/branch/master/graph/badge.svg?token=LEG1KitZR6"/></a>
|
<a href="https://codecov.io/gh/MichMich/MagicMirror"><img src="https://codecov.io/gh/MichMich/MagicMirror/branch/master/graph/badge.svg?token=LEG1KitZR6"/></a>
|
||||||
<a href="https://choosealicense.com/licenses/mit"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
<a href="https://choosealicense.com/licenses/mit"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
||||||
<a href="https://github.com/MichMich/MagicMirror/actions?query=workflow%3A%22Automated+Tests%22"><img src="https://github.com/MichMich/MagicMirror/workflows/Automated%20Tests/badge.svg" alt="Tests"></a>
|
<a href="https://github.com/MichMich/MagicMirror/actions?query=workflow%3A%22Automated+Tests%22"><img src="https://github.com/MichMich/MagicMirror/workflows/Automated%20Tests/badge.svg" alt="Tests"></a>
|
||||||
|
<a href="https://codecov.io/gh/MichMich/MagicMirror"><img src="https://codecov.io/gh/MichMich/MagicMirror/branch/master/graph/badge.svg" /></a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](https://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors).
|
**MagicMirror²** is an open source modular smart mirror platform. With a growing list of installable modules, the **MagicMirror²** allows you to convert your hallway or bathroom mirror into your personal assistant. **MagicMirror²** is built by the creator of [the original MagicMirror](https://michaelteeuw.nl/tagged/magicmirror) with the incredible help of a [growing community of contributors](https://github.com/MichMich/MagicMirror/graphs/contributors).
|
||||||
|
@ -54,6 +54,14 @@ var Loader = (function () {
|
|||||||
|
|
||||||
// Notify core of loaded modules.
|
// Notify core of loaded modules.
|
||||||
MM.modulesStarted(moduleObjects);
|
MM.modulesStarted(moduleObjects);
|
||||||
|
|
||||||
|
// Starting modules also hides any modules that have requested to be initially hidden
|
||||||
|
for (let thisModule of moduleObjects) {
|
||||||
|
if (thisModule.data.hiddenOnStartup) {
|
||||||
|
Log.info("Initially hiding " + thisModule.name);
|
||||||
|
thisModule.hide();
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -97,6 +105,7 @@ var Loader = (function () {
|
|||||||
path: moduleFolder + "/",
|
path: moduleFolder + "/",
|
||||||
file: moduleName + ".js",
|
file: moduleName + ".js",
|
||||||
position: moduleData.position,
|
position: moduleData.position,
|
||||||
|
hiddenOnStartup: moduleData.hiddenOnStartup,
|
||||||
header: moduleData.header,
|
header: moduleData.header,
|
||||||
configDeepMerge: typeof moduleData.configDeepMerge === "boolean" ? moduleData.configDeepMerge : false,
|
configDeepMerge: typeof moduleData.configDeepMerge === "boolean" ? moduleData.configDeepMerge : false,
|
||||||
config: moduleData.config,
|
config: moduleData.config,
|
||||||
|
@ -6,7 +6,10 @@
|
|||||||
*/
|
*/
|
||||||
const Log = require("logger");
|
const Log = require("logger");
|
||||||
const ical = require("node-ical");
|
const ical = require("node-ical");
|
||||||
const request = require("request");
|
const fetch = require("node-fetch");
|
||||||
|
const digest = require("digest-fetch");
|
||||||
|
const https = require("https");
|
||||||
|
const base64 = require("base-64");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moment date
|
* Moment date
|
||||||
@ -43,55 +46,52 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
const fetchCalendar = function () {
|
const fetchCalendar = function () {
|
||||||
clearTimeout(reloadTimer);
|
clearTimeout(reloadTimer);
|
||||||
reloadTimer = null;
|
reloadTimer = null;
|
||||||
|
|
||||||
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
||||||
const opts = {
|
let fetcher = null;
|
||||||
headers: {
|
let httpsAgent = null;
|
||||||
|
let headers = {
|
||||||
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"
|
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)"
|
||||||
},
|
|
||||||
gzip: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (selfSignedCert) {
|
if (selfSignedCert) {
|
||||||
var agentOptions = {
|
httpsAgent = new https.Agent({
|
||||||
rejectUnauthorized: false
|
rejectUnauthorized: false
|
||||||
};
|
});
|
||||||
opts.agentOptions = agentOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth) {
|
if (auth) {
|
||||||
if (auth.method === "bearer") {
|
if (auth.method === "bearer") {
|
||||||
opts.auth = {
|
headers.Authorization = "Bearer " + auth.pass;
|
||||||
bearer: auth.pass
|
} else if (auth.method === "digest") {
|
||||||
};
|
fetcher = new digest(auth.user, auth.pass).fetch(url, { headers: headers, httpsAgent: httpsAgent });
|
||||||
} else {
|
} else {
|
||||||
opts.auth = {
|
headers.Authorization = "Basic " + base64.encode(auth.user + ":" + auth.pass);
|
||||||
user: auth.user,
|
|
||||||
pass: auth.pass,
|
|
||||||
sendImmediately: auth.method !== "digest"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (fetcher === null) {
|
||||||
|
fetcher = fetch(url, { headers: headers, httpsAgent: httpsAgent });
|
||||||
|
}
|
||||||
|
|
||||||
request(url, opts, function (err, r, requestData) {
|
fetcher
|
||||||
if (err) {
|
.catch((error) => {
|
||||||
fetchFailedCallback(self, err);
|
fetchFailedCallback(self, error);
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
return;
|
})
|
||||||
} else if (r.statusCode !== 200) {
|
.then((response) => {
|
||||||
fetchFailedCallback(self, r.statusCode + ": " + r.statusMessage);
|
if (response.status !== 200) {
|
||||||
|
fetchFailedCallback(self, response.statusText);
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
return response;
|
||||||
|
})
|
||||||
|
.then((response) => response.text())
|
||||||
|
.then((responseData) => {
|
||||||
let data = [];
|
let data = [];
|
||||||
|
|
||||||
try {
|
try {
|
||||||
data = ical.parseICS(requestData);
|
data = ical.parseICS(responseData);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
fetchFailedCallback(self, error.message);
|
fetchFailedCallback(self, error.message);
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Log.debug(" parsed data=" + JSON.stringify(data));
|
Log.debug(" parsed data=" + JSON.stringify(data));
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
const Log = require("logger");
|
const Log = require("logger");
|
||||||
const FeedMe = require("feedme");
|
const FeedMe = require("feedme");
|
||||||
const request = require("request");
|
const fetch = require("node-fetch");
|
||||||
const iconv = require("iconv-lite");
|
const iconv = require("iconv-lite");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -79,22 +79,20 @@ const NewsfeedFetcher = function (url, reloadInterval, encoding, logFeedWarnings
|
|||||||
});
|
});
|
||||||
|
|
||||||
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
||||||
const opts = {
|
const headers = {
|
||||||
headers: {
|
|
||||||
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)",
|
"User-Agent": "Mozilla/5.0 (Node.js " + nodeVersion + ") MagicMirror/" + global.version + " (https://github.com/MichMich/MagicMirror/)",
|
||||||
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
|
"Cache-Control": "max-age=0, no-cache, no-store, must-revalidate",
|
||||||
Pragma: "no-cache"
|
Pragma: "no-cache"
|
||||||
},
|
|
||||||
encoding: null
|
|
||||||
};
|
};
|
||||||
|
|
||||||
request(url, opts)
|
fetch(url, { headers: headers })
|
||||||
.on("error", function (error) {
|
.catch((error) => {
|
||||||
fetchFailedCallback(self, error);
|
fetchFailedCallback(self, error);
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
})
|
})
|
||||||
.pipe(iconv.decodeStream(encoding))
|
.then((res) => {
|
||||||
.pipe(parser);
|
res.body.pipe(iconv.decodeStream(encoding)).pipe(parser);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -465,6 +465,8 @@ WeatherProvider.register("openweathermap", {
|
|||||||
} else {
|
} else {
|
||||||
params += "&exclude=minutely";
|
params += "&exclude=minutely";
|
||||||
}
|
}
|
||||||
|
} else if (this.config.lat && this.config.lon) {
|
||||||
|
params += "lat=" + this.config.lat + "&lon=" + this.config.lon;
|
||||||
} else if (this.config.locationID) {
|
} else if (this.config.locationID) {
|
||||||
params += "id=" + this.config.locationID;
|
params += "id=" + this.config.locationID;
|
||||||
} else if (this.config.location) {
|
} else if (this.config.location) {
|
||||||
|
2145
package-lock.json
generated
2145
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -71,17 +71,17 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"colors": "^1.4.0",
|
"colors": "^1.4.0",
|
||||||
"console-stamp": "^3.0.0-rc4.2",
|
"console-stamp": "^3.0.0-rc4.2",
|
||||||
|
"digest-fetch": "^1.1.6",
|
||||||
"eslint": "^7.20.0",
|
"eslint": "^7.20.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-ipfilter": "^1.1.2",
|
"express-ipfilter": "^1.1.2",
|
||||||
"feedme": "^2.0.2",
|
"feedme": "^2.0.2",
|
||||||
"helmet": "^4.4.1",
|
"helmet": "^4.4.1",
|
||||||
"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.29.1",
|
"moment": "^2.29.1",
|
||||||
|
"node-fetch": "^2.6.1",
|
||||||
"node-ical": "^0.12.8",
|
"node-ical": "^0.12.8",
|
||||||
"request": "^2.88.2",
|
|
||||||
"rrule": "^2.6.8",
|
"rrule": "^2.6.8",
|
||||||
"rrule-alt": "^2.2.8",
|
"rrule-alt": "^2.2.8",
|
||||||
"simple-git": "^2.36.2",
|
"simple-git": "^2.36.2",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const request = require("request");
|
const fetch = require("node-fetch");
|
||||||
const expect = require("chai").expect;
|
const expect = require("chai").expect;
|
||||||
|
|
||||||
const describe = global.describe;
|
const describe = global.describe;
|
||||||
@ -46,15 +46,15 @@ describe("Electron app environment", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("get request from http://localhost:8080 should return 200", function (done) {
|
it("get request from http://localhost:8080 should return 200", function (done) {
|
||||||
request.get("http://localhost:8080", function (err, res, body) {
|
fetch("http://localhost:8080").then((res) => {
|
||||||
expect(res.statusCode).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("get request from http://localhost:8080/nothing should return 404", function (done) {
|
it("get request from http://localhost:8080/nothing should return 404", function (done) {
|
||||||
request.get("http://localhost:8080/nothing", function (err, res, body) {
|
fetch("http://localhost:8080/nothing").then((res) => {
|
||||||
expect(res.statusCode).to.equal(404);
|
expect(res.status).to.equal(404);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const request = require("request");
|
const fetch = require("node-fetch");
|
||||||
const expect = require("chai").expect;
|
const expect = require("chai").expect;
|
||||||
const forEach = require("mocha-each");
|
const forEach = require("mocha-each");
|
||||||
|
|
||||||
@ -40,8 +40,8 @@ describe("All font files from roboto.css should be downloadable", function () {
|
|||||||
|
|
||||||
forEach(fontFiles).it("should return 200 HTTP code for file '%s'", (fontFile, done) => {
|
forEach(fontFiles).it("should return 200 HTTP code for file '%s'", (fontFile, done) => {
|
||||||
var fontUrl = "http://localhost:8080/fonts/" + fontFile;
|
var fontUrl = "http://localhost:8080/fonts/" + fontFile;
|
||||||
request.get(fontUrl, function (err, res, body) {
|
fetch(fontUrl).then((res) => {
|
||||||
expect(res.statusCode).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const request = require("request");
|
const fetch = require("node-fetch");
|
||||||
const expect = require("chai").expect;
|
const expect = require("chai").expect;
|
||||||
|
|
||||||
const describe = global.describe;
|
const describe = global.describe;
|
||||||
@ -32,8 +32,8 @@ describe("ipWhitelist directive configuration", function () {
|
|||||||
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/noIpWhiteList.js";
|
||||||
});
|
});
|
||||||
it("should return 403", function (done) {
|
it("should return 403", function (done) {
|
||||||
request.get("http://localhost:8080", function (err, res, body) {
|
fetch("http://localhost:8080").then((res) => {
|
||||||
expect(res.statusCode).to.equal(403);
|
expect(res.status).to.equal(403);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -45,8 +45,8 @@ describe("ipWhitelist directive configuration", function () {
|
|||||||
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
process.env.MM_CONFIG_FILE = "tests/configs/empty_ipWhiteList.js";
|
||||||
});
|
});
|
||||||
it("should return 200", function (done) {
|
it("should return 200", function (done) {
|
||||||
request.get("http://localhost:8080", function (err, res, body) {
|
fetch("http://localhost:8080").then((res) => {
|
||||||
expect(res.statusCode).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const request = require("request");
|
const fetch = require("node-fetch");
|
||||||
const expect = require("chai").expect;
|
const expect = require("chai").expect;
|
||||||
|
|
||||||
const describe = global.describe;
|
const describe = global.describe;
|
||||||
@ -33,8 +33,8 @@ describe("port directive configuration", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return 200", function (done) {
|
it("should return 200", function (done) {
|
||||||
request.get("http://localhost:8090", function (err, res, body) {
|
fetch("http://localhost:8090").then((res) => {
|
||||||
expect(res.statusCode).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -52,8 +52,8 @@ describe("port directive configuration", function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should return 200", function (done) {
|
it("should return 200", function (done) {
|
||||||
request.get("http://localhost:8100", function (err, res, body) {
|
fetch("http://localhost:8100").then((res) => {
|
||||||
expect(res.statusCode).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
const helpers = require("./global-setup");
|
const helpers = require("./global-setup");
|
||||||
const request = require("request");
|
const fetch = require("node-fetch");
|
||||||
const expect = require("chai").expect;
|
const expect = require("chai").expect;
|
||||||
|
|
||||||
const describe = global.describe;
|
const describe = global.describe;
|
||||||
@ -32,8 +32,8 @@ describe("Vendors", function () {
|
|||||||
Object.keys(vendors).forEach((vendor) => {
|
Object.keys(vendors).forEach((vendor) => {
|
||||||
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
it(`should return 200 HTTP code for vendor "${vendor}"`, function () {
|
||||||
var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
var urlVendor = "http://localhost:8080/vendor/" + vendors[vendor];
|
||||||
request.get(urlVendor, function (err, res, body) {
|
fetch(urlVendor).then((res) => {
|
||||||
expect(res.statusCode).to.equal(200);
|
expect(res.status).to.equal(200);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -41,8 +41,8 @@ describe("Vendors", function () {
|
|||||||
Object.keys(vendors).forEach((vendor) => {
|
Object.keys(vendors).forEach((vendor) => {
|
||||||
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function () {
|
it(`should return 404 HTTP code for vendor https://localhost/"${vendor}"`, function () {
|
||||||
var urlVendor = "http://localhost:8080/" + vendors[vendor];
|
var urlVendor = "http://localhost:8080/" + vendors[vendor];
|
||||||
request.get(urlVendor, function (err, res, body) {
|
fetch(urlVendor).then((res) => {
|
||||||
expect(res.statusCode).to.equal(404);
|
expect(res.status).to.equal(404);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user