mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 21:42:24 +00:00
Fix empty log path handling
This commit is contained in:
parent
f8be7a7649
commit
0917eb2742
1 changed files with 6 additions and 11 deletions
|
@ -1408,21 +1408,16 @@
|
||||||
templateSettings: {
|
templateSettings: {
|
||||||
get: function () {
|
get: function () {
|
||||||
const parsedSettings = this.xraySetting ? JSON.parse(this.xraySetting) : null;
|
const parsedSettings = this.xraySetting ? JSON.parse(this.xraySetting) : null;
|
||||||
let accessLogPath = "./access.log";
|
const setLogPath = (type, defaultValue) => parsedSettings?.log?.[type] !== "none" ? parsedSettings.log[type] : defaultValue;
|
||||||
let errorLogPath = "./error.log";
|
this.access = ["none", setLogPath("access", "./access.log")];
|
||||||
if (parsedSettings) {
|
this.error = ["none", setLogPath("error", "./error.log")];
|
||||||
// if its set to "none" add default value
|
|
||||||
if (parsedSettings.log.access !== "none") accessLogPath = parsedSettings.log.access;
|
|
||||||
if (parsedSettings.log.error !== "none") errorLogPath = parsedSettings.log.error;
|
|
||||||
}
|
|
||||||
this.access = ["none", accessLogPath];
|
|
||||||
this.error = ["none", errorLogPath];
|
|
||||||
return parsedSettings;
|
return parsedSettings;
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
this.xraySetting = JSON.stringify(newValue, null, 2);
|
this.xraySetting = JSON.stringify(newValue, null, 2);
|
||||||
this.access = ["none", newValue.log.access];
|
const setLogPath = (type, defaultValue) => newValue.log?.[type] ? newValue.log[type] : defaultValue;
|
||||||
this.error = ["none", newValue.log.error];
|
this.access = ["none", setLogPath("access", "./access.log")];
|
||||||
|
this.error = ["none", setLogPath("error", "./error.log")];
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
inboundSettings: {
|
inboundSettings: {
|
||||||
|
|
Loading…
Reference in a new issue