From 04cf250a547bb64265d256e7d15af7cea5ecfa67 Mon Sep 17 00:00:00 2001 From: Ali Rahimi Date: Thu, 23 Jan 2025 21:33:47 +0100 Subject: [PATCH 01/16] json post base path bug fixed (#2647) * json post base path bug fixed * added comment field to group client management --- web/assets/js/util/utils.js | 2 +- web/html/xui/client_modal.html | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/web/assets/js/util/utils.js b/web/assets/js/util/utils.js index 28ec95c7..10825490 100644 --- a/web/assets/js/util/utils.js +++ b/web/assets/js/util/utils.js @@ -81,7 +81,7 @@ class HttpUtil { }, body: JSON.stringify(data), }; - const resp = await fetch(url, requestOptions); + const resp = await fetch(basePath + url.replace(/^\/+|\/+$/g, ''), requestOptions); const response = await resp.json(); msg = this._respToMsg({data : response}); diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index de7915a5..ef4e14a1 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -36,12 +36,13 @@ ok() { if (app.subSettings.enable && clientModal.group.isGroup && clientModal.group.canGroup) { const currentClient = clientModal.group.currentClient; - const { limitIp, totalGB, expiryTime, reset, enable, subId, tgId, flow } = currentClient; + const { limitIp, comment, totalGB, expiryTime, reset, enable, subId, tgId, flow } = currentClient; const uniqueEmails = clientModalApp.makeGroupEmailsUnique(clientModal.dbInbounds, currentClient.email, clientModal.group.clients); clientModal.group.clients.forEach((client, index) => { client.email = uniqueEmails[index]; client.limitIp = limitIp; + client.comment = comment; client.totalGB = totalGB; client.expiryTime = expiryTime; client.reset = reset; From 2dec7f48f5857c86f85270952c7f1593d3bae77b Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Fri, 24 Jan 2025 17:16:16 +0100 Subject: [PATCH 02/16] bug fix - get client ips --- web/html/xui/client_modal.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index ef4e14a1..8071e6b4 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -260,6 +260,23 @@ return generatedEmails; }, + async getDBClientIps(email) { + const msg = await HttpUtil.post(`/panel/inbound/clientIps/${email}`); + if (!msg.success) { + document.getElementById("clientIPs").value = msg.obj; + return; + } + let ips = msg.obj; + if (typeof ips === 'string' && ips.startsWith('[') && ips.endsWith(']')) { + try { + ips = JSON.parse(ips); + ips = Array.isArray(ips) ? ips.join("\n") : ips; + } catch (e) { + console.error('Error parsing JSON:', e); + } + } + document.getElementById("clientIPs").value = ips; + }, async clearDBClientIps(email) { try { const msg = await HttpUtil.post(`/panel/inbound/clearClientIps/${email}`); From dd4c2adb37000593725ea47eedf86558ce4210fa Mon Sep 17 00:00:00 2001 From: Ivan Zorin Date: Sun, 26 Jan 2025 13:03:06 +0300 Subject: [PATCH 03/16] Fix non-MultiUser dbInbounds (#2649) --- web/html/xui/client_modal.html | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index 8071e6b4..f2ea30d0 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -120,9 +120,11 @@ this.group.isGroup = true; dbInbounds.forEach((dbInboundItem) => { this.showProcess(dbInboundItem); - this.addClient(this.inbound.protocol, this.clients); - this.group.inbounds.push(dbInboundItem.id) - this.group.clients.push(this.clients[this.index]) + if (this.dbInbound.isMultiUser()) { + this.addClient(this.inbound.protocol, this.clients); + this.group.inbounds.push(dbInboundItem.id) + this.group.clients.push(this.clients[this.index]) + } }) this.group.currentClient = this.clients[this.index] } @@ -140,9 +142,11 @@ showProcess(dbInbound, index = null) { this.dbInbound = new DBInbound(dbInbound); this.inbound = dbInbound.toInbound(); - this.clients = this.inbound.clients; - this.index = index === null ? this.clients.length : index; - this.delayedStart = false; + if (this.dbInbound.isMultiUser()) { + this.clients = this.inbound.clients; + this.index = index === null ? this.clients.length : index; + this.delayedStart = false; + } }, singleEditClientProcess(index) { if (this.clients[index].expiryTime < 0) { From 5c4e2dfd39a9c32dbc6ea259571c4e3b08dfb225 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sun, 26 Jan 2025 11:07:35 +0100 Subject: [PATCH 04/16] default setting - scStreamUpServerSecs --- web/assets/js/model/inbound.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index dab45509..21809091 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -493,7 +493,7 @@ class xHTTPStreamSettings extends XrayCommonClass { headers = [], scMaxBufferedPosts = 30, scMaxEachPostBytes = "1000000", - scStreamUpServerSecs = "0", + scStreamUpServerSecs = "20-80", noSSEHeader = false, xPaddingBytes = "100-1000", mode = MODE_OPTION.AUTO, From b34956647bba85444951ccd7416d872e1c2c9dd2 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sun, 26 Jan 2025 11:07:45 +0100 Subject: [PATCH 05/16] minor change --- web/html/xui/inbounds.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 5d4d918b..9dce8982 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -1455,7 +1455,7 @@ if (clients != null){ clients.forEach(c => { if (c.subId && c.subId.length>0){ - subLinks.push(this.subSettings.subURI + c.subId + "?name=" + c.subId) + subLinks.push(this.subSettings.subURI + c.subId) } }) } @@ -1482,7 +1482,7 @@ if (clients != null){ clients.forEach(c => { if (c.subId && c.subId.length>0){ - subLinks.push(this.subSettings.subURI + c.subId + "?name=" + c.subId) + subLinks.push(this.subSettings.subURI + c.subId) } }) } From 51220917c4ef60c5ff886925792c8323f46cf5f2 Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sun, 26 Jan 2025 11:22:42 +0100 Subject: [PATCH 06/16] outbound Traffic - default false if you need it you need to change it manually to true --- web/service/config.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web/service/config.json b/web/service/config.json index 54eecd54..e7425ac0 100644 --- a/web/service/config.json +++ b/web/service/config.json @@ -51,8 +51,8 @@ "system": { "statsInboundDownlink": true, "statsInboundUplink": true, - "statsOutboundDownlink": true, - "statsOutboundUplink": true + "statsOutboundDownlink": false, + "statsOutboundUplink": false } }, "routing": { From 46ef506aa66e0feda7ade495b48f8c06b020b8ac Mon Sep 17 00:00:00 2001 From: mhsanaei Date: Sun, 26 Jan 2025 19:33:50 +0100 Subject: [PATCH 07/16] TLS - serverNameToVerify --- web/assets/js/model/inbound.js | 4 ++++ web/html/xui/form/stream/stream_xhttp.html | 2 +- web/html/xui/form/tls_settings.html | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/web/assets/js/model/inbound.js b/web/assets/js/model/inbound.js index 21809091..f4ab4f53 100644 --- a/web/assets/js/model/inbound.js +++ b/web/assets/js/model/inbound.js @@ -554,6 +554,7 @@ class TlsStreamSettings extends XrayCommonClass { maxVersion = TLS_VERSION_OPTION.TLS13, cipherSuites = '', rejectUnknownSni = false, + serverNameToVerify = 'dns.google', disableSystemRoot = false, enableSessionResumption = false, certificates = [new TlsStreamSettings.Cert()], @@ -566,6 +567,7 @@ class TlsStreamSettings extends XrayCommonClass { this.maxVersion = maxVersion; this.cipherSuites = cipherSuites; this.rejectUnknownSni = rejectUnknownSni; + this.serverNameToVerify = serverNameToVerify; this.disableSystemRoot = disableSystemRoot; this.enableSessionResumption = enableSessionResumption; this.certs = certificates; @@ -597,6 +599,7 @@ class TlsStreamSettings extends XrayCommonClass { json.maxVersion, json.cipherSuites, json.rejectUnknownSni, + json.serverNameToVerify, json.disableSystemRoot, json.enableSessionResumption, certs, @@ -612,6 +615,7 @@ class TlsStreamSettings extends XrayCommonClass { maxVersion: this.maxVersion, cipherSuites: this.cipherSuites, rejectUnknownSni: this.rejectUnknownSni, + serverNameToVerify: this.serverNameToVerify, disableSystemRoot: this.disableSystemRoot, enableSessionResumption: this.enableSessionResumption, certificates: TlsStreamSettings.toJsonArray(this.certs), diff --git a/web/html/xui/form/stream/stream_xhttp.html b/web/html/xui/form/stream/stream_xhttp.html index 2731511d..601d0cb4 100644 --- a/web/html/xui/form/stream/stream_xhttp.html +++ b/web/html/xui/form/stream/stream_xhttp.html @@ -33,7 +33,7 @@ - + diff --git a/web/html/xui/form/tls_settings.html b/web/html/xui/form/tls_settings.html index 4eff7698..70ad7d05 100644 --- a/web/html/xui/form/tls_settings.html +++ b/web/html/xui/form/tls_settings.html @@ -57,6 +57,9 @@ + + +