diff options
Diffstat (limited to 'web/html/xui')
| -rw-r--r-- | web/html/xui/client_modal.html | 6 | ||||
| -rw-r--r-- | web/html/xui/index.html | 17 |
2 files changed, 16 insertions, 7 deletions
diff --git a/web/html/xui/client_modal.html b/web/html/xui/client_modal.html index e8236778..a2d29417 100644 --- a/web/html/xui/client_modal.html +++ b/web/html/xui/client_modal.html @@ -124,12 +124,14 @@ try { const msg = await HttpUtil.post(`/panel/inbound/clientIps/${email}`); if (!msg.success) { + document.getElementById("clientIPs").value = msg.obj; return; } - const ips = JSON.parse(msg.obj).join(",\n"); + const ips = Array.isArray(msg.obj) ? msg.obj.join(",\n") : msg.obj; document.getElementById("clientIPs").value = ips; } catch (error) { - document.getElementById("clientIPs").value = msg.obj; + console.error(error); + document.getElementById("clientIPs").value = 'An error occurred while making the request'; } }, async clearDBClientIps(email) { diff --git a/web/html/xui/index.html b/web/html/xui/index.html index 9795e87d..989aa286 100644 --- a/web/html/xui/index.html +++ b/web/html/xui/index.html @@ -449,9 +449,13 @@ this.loadingTip = tip; }, async getStatus() { - const msg = await HttpUtil.post('/server/status'); - if (msg.success) { - this.setStatus(msg.obj); + try { + const msg = await HttpUtil.post('/server/status'); + if (msg.success) { + this.setStatus(msg.obj); + } + } catch (e) { + console.error("Failed to get status:", e); } }, setStatus(data) { @@ -560,11 +564,14 @@ }, }, async mounted() { - while (true) { + let retries = 0; + while (retries < 5) { try { await this.getStatus(); + retries = 0; } catch (e) { - console.error(e); + console.error("Error occurred while fetching status:", e); + retries++; } await PromiseUtil.sleep(2000); } |
