Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/web/html
diff options
context:
space:
mode:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-03-11 23:26:23 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-03-11 23:26:23 +0300
commit0917eb2742003fa9cf83a522e6b9d758c4b3a7de (patch)
tree118083cc1b45bacb5280ccf515d5f2b8fb5616b2 /web/html
parentf8be7a7649388647ac1fe1b1d5b707bb2e3dee9c (diff)
Fix empty log path handling
Diffstat (limited to 'web/html')
-rw-r--r--web/html/xui/xray.html17
1 files changed, 6 insertions, 11 deletions
diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html
index 54665c27..ba6f0771 100644
--- a/web/html/xui/xray.html
+++ b/web/html/xui/xray.html
@@ -1408,21 +1408,16 @@
templateSettings: {
get: function () {
const parsedSettings = this.xraySetting ? JSON.parse(this.xraySetting) : null;
- let accessLogPath = "./access.log";
- let errorLogPath = "./error.log";
- if (parsedSettings) {
- // 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];
+ const setLogPath = (type, defaultValue) => parsedSettings?.log?.[type] !== "none" ? parsedSettings.log[type] : defaultValue;
+ this.access = ["none", setLogPath("access", "./access.log")];
+ this.error = ["none", setLogPath("error", "./error.log")];
return parsedSettings;
},
set: function (newValue) {
this.xraySetting = JSON.stringify(newValue, null, 2);
- this.access = ["none", newValue.log.access];
- this.error = ["none", newValue.log.error];
+ const setLogPath = (type, defaultValue) => newValue.log?.[type] ? newValue.log[type] : defaultValue;
+ this.access = ["none", setLogPath("access", "./access.log")];
+ this.error = ["none", setLogPath("error", "./error.log")];
},
},
inboundSettings: {