mirror of
https://github.com/Ylianst/MeshCentral.git
synced 2024-12-26 23:25:53 -05:00
Support http or https for config URL's
This commit is contained in:
parent
6d3673a858
commit
b3731ad27f
@ -201,9 +201,13 @@ module.exports.pluginHandler = function (parent) {
|
|||||||
|
|
||||||
obj.getPluginConfig = function(configUrl) {
|
obj.getPluginConfig = function(configUrl) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
var https = require('https');
|
if (configUrl.indexOf('https://') >= 0) {
|
||||||
|
var http = require('https');
|
||||||
|
} else {
|
||||||
|
var http = require('http');
|
||||||
|
}
|
||||||
if (configUrl.indexOf('://') === -1) reject('Unable to fetch the config: Bad URL (' + configUrl + ')');
|
if (configUrl.indexOf('://') === -1) reject('Unable to fetch the config: Bad URL (' + configUrl + ')');
|
||||||
https.get(configUrl, function(res) {
|
http.get(configUrl, function(res) {
|
||||||
var configStr = '';
|
var configStr = '';
|
||||||
res.on('data', function(chunk){
|
res.on('data', function(chunk){
|
||||||
configStr += chunk;
|
configStr += chunk;
|
||||||
|
Loading…
Reference in New Issue
Block a user