diff --git a/web/html/modals/inbound_info_modal.html b/web/html/modals/inbound_info_modal.html index 4fee720e..d67dfc53 100644 --- a/web/html/modals/inbound_info_modal.html +++ b/web/html/modals/inbound_info_modal.html @@ -650,7 +650,7 @@ this.dbInbound = new DBInbound(dbInbound); this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null; this.isExpired = this.inbound.clients ? this.inbound.isExpiry(index) : this.dbInbound.isExpiry; - this.clientStats = (this.inbound.clients && this.clientSettings) + this.clientStats = (this.inbound.clients && this.clientSettings && Array.isArray(this.dbInbound.clientStats)) ? (this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) || null) : null; diff --git a/web/html/settings.html b/web/html/settings.html index 4560d96f..ce3f1fbe 100644 --- a/web/html/settings.html +++ b/web/html/settings.html @@ -26,6 +26,15 @@ + + + + + + @@ -119,6 +128,7 @@ }, oldAllSetting: new AllSetting(), allSetting: new AllSetting(), + loadFailed: false, saveBtnDisable: true, entryHost: null, entryPort: null, @@ -266,15 +276,15 @@ const msg = await HttpUtil.post("/panel/setting/all"); if (msg.success) { - if (!this.loadingStates.fetched) { - this.loadingStates.fetched = true - } - this.oldAllSetting = new AllSetting(msg.obj); this.allSetting = new AllSetting(msg.obj); app.changeRemarkSample(); this.saveBtnDisable = true; + this.loadFailed = false; + return true; } + this.loadFailed = true; + return false; }, async loadInboundTags() { const msg = await HttpUtil.get("/panel/api/inbounds/list"); @@ -622,12 +632,16 @@ this.entryPort = window.location.port; this.entryProtocol = window.location.protocol; this.entryIsIP = this._isIp(this.entryHost); + let settingsLoaded = false; try { - await this.getAllSetting(); + settingsLoaded = await this.getAllSetting(); await this.loadInboundTags(); } finally { this.loadingStates.fetched = true; } + if (!settingsLoaded) { + return; + } while (true) { await PromiseUtil.sleep(1000); this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting); diff --git a/web/html/xray.html b/web/html/xray.html index 721c2edc..d9881ce6 100644 --- a/web/html/xray.html +++ b/web/html/xray.html @@ -29,6 +29,15 @@ + + + + + + @@ -253,6 +262,7 @@ }, oldXraySetting: '', xraySetting: '', + loadFailed: false, outboundTestUrl: 'https://www.google.com/generate_204', oldOutboundTestUrl: 'https://www.google.com/generate_204', inboundTags: [], @@ -394,10 +404,6 @@ const msg = await HttpUtil.post("/panel/xray/"); if (msg.success) { - if (!this.loadingStates.fetched) { - this.loadingStates.fetched = true - } - const result = JSON.parse(msg.obj); const xs = JSON.stringify(result.xraySetting, null, 2); this.oldXraySetting = xs; @@ -406,7 +412,11 @@ this.outboundTestUrl = result.outboundTestUrl || 'https://www.google.com/generate_204'; this.oldOutboundTestUrl = this.outboundTestUrl; this.saveBtnDisable = true; + this.loadFailed = false; + return true; } + this.loadFailed = true; + return false; }, async updateXraySetting() { this.loading(true); @@ -1064,13 +1074,17 @@ if (window.location.protocol !== "https:") { this.showAlert = true; } + let settingsLoaded = false; try { - await this.getXraySetting(); + settingsLoaded = await this.getXraySetting(); await this.getXrayResult(); await this.getOutboundsTraffic(); } finally { this.loadingStates.fetched = true; } + if (!settingsLoaded) { + return; + } if (window.wsClient) { window.wsClient.connect();