mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-06 21:24:10 +00:00
fix settings and xray load failure regressions
This commit is contained in:
parent
266f368b07
commit
537c73c1b2
3 changed files with 39 additions and 11 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -26,6 +26,15 @@
|
|||
<a-spin tip='{{ i18n "loading" }}'></a-spin>
|
||||
</a-card>
|
||||
</a-row>
|
||||
<a-row v-else-if="loadFailed">
|
||||
<a-col>
|
||||
<a-alert type="error" show-icon
|
||||
message="Failed to load settings"
|
||||
description="The current page data was not loaded. Refresh and retry before editing or saving."
|
||||
:style="{ marginTop: '10px' }">
|
||||
</a-alert>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[isMobile ? 8 : 16, isMobile ? 0 : 12]" v-else>
|
||||
<a-col>
|
||||
<a-card hoverable>
|
||||
|
|
@ -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);
|
||||
|
|
|
|||
|
|
@ -29,6 +29,15 @@
|
|||
<a-spin tip='{{ i18n "loading" }}'></a-spin>
|
||||
</a-card>
|
||||
</a-row>
|
||||
<a-row v-else-if="loadFailed">
|
||||
<a-col>
|
||||
<a-alert type="error" show-icon
|
||||
message="Failed to load Xray settings"
|
||||
description="The current page data was not loaded. Refresh and retry before editing or saving."
|
||||
:style="{ marginTop: '10px' }">
|
||||
</a-alert>
|
||||
</a-col>
|
||||
</a-row>
|
||||
<a-row :gutter="[isMobile ? 8 : 16, isMobile ? 0 : 12]" v-else>
|
||||
<a-col>
|
||||
<a-card hoverable>
|
||||
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Reference in a new issue