mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 11:50:00 +00:00
Use es6 notation in clientonly
This commit is contained in:
parent
2dea9398f2
commit
11122d3f81
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
// Use separate scope to prevent global scope pollution
|
// Use separate scope to prevent global scope pollution
|
||||||
(function () {
|
(function () {
|
||||||
var config = {};
|
const config = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper function to get server address/hostname from either the commandline or env
|
* Helper function to get server address/hostname from either the commandline or env
|
||||||
@ -17,8 +17,8 @@
|
|||||||
* @returns {string} the value of the parameter
|
* @returns {string} the value of the parameter
|
||||||
*/
|
*/
|
||||||
function getCommandLineParameter(key, defaultValue = undefined) {
|
function getCommandLineParameter(key, defaultValue = undefined) {
|
||||||
var index = process.argv.indexOf(`--${key}`);
|
const index = process.argv.indexOf(`--${key}`);
|
||||||
var value = index > -1 ? process.argv[index + 1] : undefined;
|
const value = index > -1 ? process.argv[index + 1] : undefined;
|
||||||
return value !== undefined ? String(value) : defaultValue;
|
return value !== undefined ? String(value) : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -43,7 +43,7 @@
|
|||||||
// Select http or https module, depending on requested url
|
// Select http or https module, depending on requested url
|
||||||
const lib = url.startsWith("https") ? require("https") : require("http");
|
const lib = url.startsWith("https") ? require("https") : require("http");
|
||||||
const request = lib.get(url, (response) => {
|
const request = lib.get(url, (response) => {
|
||||||
var configData = "";
|
let configData = "";
|
||||||
|
|
||||||
// Gather incoming data
|
// Gather incoming data
|
||||||
response.on("data", function (chunk) {
|
response.on("data", function (chunk) {
|
||||||
@ -79,15 +79,15 @@
|
|||||||
getServerAddress();
|
getServerAddress();
|
||||||
|
|
||||||
(config.address && config.port) || fail();
|
(config.address && config.port) || fail();
|
||||||
var prefix = config.tls ? "https://" : "http://";
|
const prefix = config.tls ? "https://" : "http://";
|
||||||
|
|
||||||
// Only start the client if a non-local server was provided
|
// Only start the client if a non-local server was provided
|
||||||
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
|
if (["localhost", "127.0.0.1", "::1", "::ffff:127.0.0.1", undefined].indexOf(config.address) === -1) {
|
||||||
getServerConfig(`${prefix}${config.address}:${config.port}/config/`)
|
getServerConfig(`${prefix}${config.address}:${config.port}/config/`)
|
||||||
.then(function (configReturn) {
|
.then(function (configReturn) {
|
||||||
// Pass along the server config via an environment variable
|
// Pass along the server config via an environment variable
|
||||||
var env = Object.create(process.env);
|
const env = Object.create(process.env);
|
||||||
var options = { env: env };
|
const options = { env: env };
|
||||||
configReturn.address = config.address;
|
configReturn.address = config.address;
|
||||||
configReturn.port = config.port;
|
configReturn.port = config.port;
|
||||||
configReturn.tls = config.tls;
|
configReturn.tls = config.tls;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user