From 64a5a9f1bc91297bf46ddda9fc3575e582acd83f Mon Sep 17 00:00:00 2001
From: Hamidreza <70919649+hamid-gh98@users.noreply.github.com>
Date: Mon, 11 Mar 2024 01:01:24 +0330
Subject: Some fixes and improvements (#1997)
* [refactor] api controller
* [fix] access log path
better to not hardcode the access log path, maybe some ppl dont want to use the default ./access.log
* [fix] set select options from logs paths in xray settings
* [update] .gitignore
* [lint] all .go files
* [update] use status code for jsonMsg and 401 to unauthorize
* [update] handle response status code via axios
* [fix] set correct value if log paths is set to 'none'
we also use the default value for the paths if its set to none
* [fix] iplimit - only warning access log if f2b is installed
---
web/html/xui/xray.html | 42 +++++++++++++++++++++++++++++-------------
1 file changed, 29 insertions(+), 13 deletions(-)
(limited to 'web/html/xui/xray.html')
diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html
index 0e9f15e4..20a36f63 100644
--- a/web/html/xui/xray.html
+++ b/web/html/xui/xray.html
@@ -180,7 +180,7 @@
- [[ s ]]
+ [[ s ]]
@@ -193,7 +193,7 @@
- [[ s ]]
+ [[ s ]]
@@ -765,8 +765,8 @@
},
routingDomainStrategies: ["AsIs", "IPIfNonMatch", "IPOnDemand"],
logLevel: ["none" , "debug" , "info" , "warning", "error"],
- access: ["none" , "./access.log" ],
- error: ["none" , "./error.log" ],
+ access: [],
+ error: [],
settingsData: {
protocols: {
bittorrent: ["bittorrent"],
@@ -869,10 +869,10 @@
},
async getXrayResult() {
const msg = await HttpUtil.get("/panel/xray/getXrayResult");
- if(msg.success){
- this.restartResult=msg.obj;
- if(msg.obj.length > 1) Vue.prototype.$message.error(msg.obj);
- }
+ if (msg.success) {
+ this.restartResult=msg.obj;
+ if(msg.obj.length > 1) Vue.prototype.$message.error(msg.obj);
+ }
},
async fetchUserSecret() {
this.loading(true);
@@ -910,9 +910,9 @@
},
async toggleToken(value) {
if (value) {
- await this.getNewSecret();
+ await this.getNewSecret();
} else {
- this.user.loginSecret = "";
+ this.user.loginSecret = "";
}
},
async resetXrayConfigToDefault() {
@@ -1001,7 +1001,7 @@
this.cm = CodeMirror.fromTextArea(textAreaObj, this.cmOptions);
this.cm.on('change',editor => {
value = editor.getValue();
- if(this.isJsonString(value)){
+ if (this.isJsonString(value)) {
this[this.advSettings] = value;
}
});
@@ -1403,8 +1403,24 @@
},
computed: {
templateSettings: {
- get: function () { return this.xraySetting ? JSON.parse(this.xraySetting) : null; },
- set: function (newValue) { this.xraySetting = JSON.stringify(newValue, null, 2); },
+ 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];
+ return parsedSettings;
+ },
+ set: function (newValue) {
+ this.xraySetting = JSON.stringify(newValue, null, 2);
+ this.access = ["none", newValue.log.access];
+ this.error = ["none", newValue.log.error];
+ },
},
inboundSettings: {
get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; },
--
cgit v1.2.3