fix last commit
This commit is contained in:
@@ -17,26 +17,6 @@ class WTVShared {
|
|||||||
minisrv_config = [];
|
minisrv_config = [];
|
||||||
|
|
||||||
constructor(minisrv_config, quiet = false) {
|
constructor(minisrv_config, quiet = false) {
|
||||||
Object.prototype.clone = Array.prototype.clone = function () {
|
|
||||||
if (Object.prototype.toString.call(this) === '[object Array]') {
|
|
||||||
var clone = [];
|
|
||||||
for (var i = 0; i < this.length; i++)
|
|
||||||
clone[i] = this[i].clone();
|
|
||||||
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
else if (typeof (this) == "object") {
|
|
||||||
var clone = {};
|
|
||||||
for (var prop in this)
|
|
||||||
if (this.hasOwnProperty(prop))
|
|
||||||
clone[prop] = this[prop].clone();
|
|
||||||
|
|
||||||
return clone;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (minisrv_config == null) this.minisrv_config = this.readMiniSrvConfig(true, !quiet);
|
if (minisrv_config == null) this.minisrv_config = this.readMiniSrvConfig(true, !quiet);
|
||||||
else this.minisrv_config = minisrv_config;
|
else this.minisrv_config = minisrv_config;
|
||||||
|
|
||||||
@@ -59,6 +39,10 @@ class WTVShared {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
cloneObj(obj) {
|
||||||
|
return JSON.parse(JSON.stringify(obj));
|
||||||
|
}
|
||||||
|
|
||||||
getServiceString(service, overrides = {}) {
|
getServiceString(service, overrides = {}) {
|
||||||
// used externally by service scripts
|
// used externally by service scripts
|
||||||
if (service === "all") {
|
if (service === "all") {
|
||||||
@@ -412,7 +396,7 @@ class WTVShared {
|
|||||||
return obj.substr(0, 6) + ('*').repeat(9);
|
return obj.substr(0, 6) + ('*').repeat(9);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var newobj = obj.clone();
|
var newobj = this.cloneObj(obj);
|
||||||
if (obj.post_data) newobj.post_data = obj.post_data;
|
if (obj.post_data) newobj.post_data = obj.post_data;
|
||||||
if (newobj["wtv-client-serial-number"]) {
|
if (newobj["wtv-client-serial-number"]) {
|
||||||
var ssid = newobj["wtv-client-serial-number"];
|
var ssid = newobj["wtv-client-serial-number"];
|
||||||
@@ -434,7 +418,7 @@ class WTVShared {
|
|||||||
filterRequestLog(obj) {
|
filterRequestLog(obj) {
|
||||||
if (this.minisrv_config.config.filter_passwords_in_logs === true) {
|
if (this.minisrv_config.config.filter_passwords_in_logs === true) {
|
||||||
if (obj.query) {
|
if (obj.query) {
|
||||||
var newobj = obj.clone();
|
var newobj = this.cloneObj(obj);
|
||||||
Object.keys(newobj.query).forEach(function (k) {
|
Object.keys(newobj.query).forEach(function (k) {
|
||||||
var key = k.toLowerCase();
|
var key = k.toLowerCase();
|
||||||
switch (true) {
|
switch (true) {
|
||||||
|
|||||||
Reference in New Issue
Block a user