From 04cf250a547bb64265d256e7d15af7cea5ecfa67 Mon Sep 17 00:00:00 2001 From: Ali Rahimi Date: Thu, 23 Jan 2025 21:33:47 +0100 Subject: [PATCH 1/2] 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 2/2] 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}`);