Merge pull request #2458 from codac/patch-2

This is supposed to make self signed certs work with the calendar module
This commit is contained in:
Michael Teeuw
2021-02-23 14:09:13 +01:00
committed by GitHub
4 changed files with 20 additions and 7 deletions

View File

@@ -25,9 +25,10 @@ const moment = require("moment");
* @param {number} maximumNumberOfDays The maximum number of days an event should be in the future.
* @param {object} auth The object containing options for authentication against the calendar.
* @param {boolean} includePastEvents If true events from the past maximumNumberOfDays will be fetched too
* @param {boolean} selfSignedCert If true, the server certificate is not verified against the list of supplied CAs.
* @class
*/
const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, includePastEvents) {
const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEntries, maximumNumberOfDays, auth, includePastEvents, selfSignedCert) {
const self = this;
let reloadTimer = null;
@@ -51,6 +52,13 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
gzip: true
};
if (selfSignedCert) {
var agentOptions = {
rejectUnauthorized: false
};
opts.agentOptions = agentOptions;
}
if (auth) {
if (auth.method === "bearer") {
opts.auth = {