mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-28 12:12:20 +00:00
snapshot
This commit is contained in:
parent
53e300bd31
commit
92a35692f2
@ -6,7 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
const Log = require("logger");
|
const Log = require("logger");
|
||||||
const ical = require("node-ical");
|
const ical = require("node-ical");
|
||||||
const fetch = require("node-fetch");
|
const fetch = require("digest-fetch");
|
||||||
const https = require('https');
|
const https = require('https');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -45,6 +45,8 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
clearTimeout(reloadTimer);
|
clearTimeout(reloadTimer);
|
||||||
reloadTimer = null;
|
reloadTimer = null;
|
||||||
httpsAgent = null;
|
httpsAgent = null;
|
||||||
|
user = "";
|
||||||
|
password = "";
|
||||||
|
|
||||||
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
const nodeVersion = Number(process.version.match(/^v(\d+\.\d+)/)[1]);
|
||||||
const headers = {
|
const headers = {
|
||||||
@ -59,22 +61,21 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
|
|||||||
|
|
||||||
// todo: auth,
|
// todo: auth,
|
||||||
// https://github.com/devfans/digest-fetch
|
// https://github.com/devfans/digest-fetch
|
||||||
|
// https://github.com/pablopunk/auth-fetch/blob/master/index.js
|
||||||
// https://hackersandslackers.com/making-api-requests-with-nodejs/
|
// https://hackersandslackers.com/making-api-requests-with-nodejs/
|
||||||
if (auth) {
|
if (auth) {
|
||||||
if (auth.method === "bearer") {
|
if (auth.method === "bearer") {
|
||||||
opts.auth = {
|
// opts.auth = {
|
||||||
bearer: auth.pass
|
// bearer: auth.pass
|
||||||
};
|
// };
|
||||||
} else {
|
} else {
|
||||||
opts.auth = {
|
user = auth.user;
|
||||||
user: auth.user,
|
password = auth.pass;
|
||||||
pass: auth.pass,
|
|
||||||
sendImmediately: auth.method !== "digest"
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fetch(url, { headers: headers, httpsAgent: httpsAgent })
|
const client = new fetch(user, password) ;
|
||||||
|
client.fetch(url, { headers: headers, httpsAgent: httpsAgent })
|
||||||
.catch(error => {
|
.catch(error => {
|
||||||
fetchFailedCallback(self, error);
|
fetchFailedCallback(self, error);
|
||||||
scheduleTimer();
|
scheduleTimer();
|
||||||
|
@ -71,6 +71,7 @@
|
|||||||
"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.19.0",
|
"eslint": "^7.19.0",
|
||||||
"express": "^4.17.1",
|
"express": "^4.17.1",
|
||||||
"express-ipfilter": "^1.1.2",
|
"express-ipfilter": "^1.1.2",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user