UNPKG

homebridge-http-sensors-switches

Version:

This plugin communicates with your devices over HTTP or MQTT. Currently it supports Light Bulb, Switches, Outlets, Fan, Garage Door, Shades / Blinds, Temperature/Humidity, Motion, Contact and Occupancy sensor, Door, Sprinkler, Valve, Air Quality, Smoke, C

26 lines 871 B
import https from 'https'; export class HttpsAgentManager { trustedCert; ignoreCertErrors; url; httpsAgent; constructor(trustedCert, ignoreCertErrors, url) { this.trustedCert = trustedCert; this.ignoreCertErrors = ignoreCertErrors; this.url = url; } getAgent() { if (this.httpsAgent) { return this.httpsAgent; } if (this.trustedCert && this.url?.toLowerCase().startsWith('https://')) { const normalizedCert = this.trustedCert.replace(/\\n/g, '\n'); this.httpsAgent = new https.Agent({ ca: normalizedCert, rejectUnauthorized: true }); } else if (this.ignoreCertErrors) { this.httpsAgent = new https.Agent({ rejectUnauthorized: false }); } return this.httpsAgent; } } //# sourceMappingURL=HttpsAgentManager.js.map