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.dbInbound = new DBInbound(dbInbound);
|
||||||
this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null;
|
this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null;
|
||||||
this.isExpired = this.inbound.clients ? this.inbound.isExpiry(index) : this.dbInbound.isExpiry;
|
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)
|
? (this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) || null)
|
||||||
: null;
|
: null;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,15 @@
|
||||||
<a-spin tip='{{ i18n "loading" }}'></a-spin>
|
<a-spin tip='{{ i18n "loading" }}'></a-spin>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-row>
|
</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-row :gutter="[isMobile ? 8 : 16, isMobile ? 0 : 12]" v-else>
|
||||||
<a-col>
|
<a-col>
|
||||||
<a-card hoverable>
|
<a-card hoverable>
|
||||||
|
|
@ -119,6 +128,7 @@
|
||||||
},
|
},
|
||||||
oldAllSetting: new AllSetting(),
|
oldAllSetting: new AllSetting(),
|
||||||
allSetting: new AllSetting(),
|
allSetting: new AllSetting(),
|
||||||
|
loadFailed: false,
|
||||||
saveBtnDisable: true,
|
saveBtnDisable: true,
|
||||||
entryHost: null,
|
entryHost: null,
|
||||||
entryPort: null,
|
entryPort: null,
|
||||||
|
|
@ -266,15 +276,15 @@
|
||||||
const msg = await HttpUtil.post("/panel/setting/all");
|
const msg = await HttpUtil.post("/panel/setting/all");
|
||||||
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
if (!this.loadingStates.fetched) {
|
|
||||||
this.loadingStates.fetched = true
|
|
||||||
}
|
|
||||||
|
|
||||||
this.oldAllSetting = new AllSetting(msg.obj);
|
this.oldAllSetting = new AllSetting(msg.obj);
|
||||||
this.allSetting = new AllSetting(msg.obj);
|
this.allSetting = new AllSetting(msg.obj);
|
||||||
app.changeRemarkSample();
|
app.changeRemarkSample();
|
||||||
this.saveBtnDisable = true;
|
this.saveBtnDisable = true;
|
||||||
|
this.loadFailed = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
this.loadFailed = true;
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
async loadInboundTags() {
|
async loadInboundTags() {
|
||||||
const msg = await HttpUtil.get("/panel/api/inbounds/list");
|
const msg = await HttpUtil.get("/panel/api/inbounds/list");
|
||||||
|
|
@ -622,12 +632,16 @@
|
||||||
this.entryPort = window.location.port;
|
this.entryPort = window.location.port;
|
||||||
this.entryProtocol = window.location.protocol;
|
this.entryProtocol = window.location.protocol;
|
||||||
this.entryIsIP = this._isIp(this.entryHost);
|
this.entryIsIP = this._isIp(this.entryHost);
|
||||||
|
let settingsLoaded = false;
|
||||||
try {
|
try {
|
||||||
await this.getAllSetting();
|
settingsLoaded = await this.getAllSetting();
|
||||||
await this.loadInboundTags();
|
await this.loadInboundTags();
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingStates.fetched = true;
|
this.loadingStates.fetched = true;
|
||||||
}
|
}
|
||||||
|
if (!settingsLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
while (true) {
|
while (true) {
|
||||||
await PromiseUtil.sleep(1000);
|
await PromiseUtil.sleep(1000);
|
||||||
this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting);
|
this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting);
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,15 @@
|
||||||
<a-spin tip='{{ i18n "loading" }}'></a-spin>
|
<a-spin tip='{{ i18n "loading" }}'></a-spin>
|
||||||
</a-card>
|
</a-card>
|
||||||
</a-row>
|
</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-row :gutter="[isMobile ? 8 : 16, isMobile ? 0 : 12]" v-else>
|
||||||
<a-col>
|
<a-col>
|
||||||
<a-card hoverable>
|
<a-card hoverable>
|
||||||
|
|
@ -253,6 +262,7 @@
|
||||||
},
|
},
|
||||||
oldXraySetting: '',
|
oldXraySetting: '',
|
||||||
xraySetting: '',
|
xraySetting: '',
|
||||||
|
loadFailed: false,
|
||||||
outboundTestUrl: 'https://www.google.com/generate_204',
|
outboundTestUrl: 'https://www.google.com/generate_204',
|
||||||
oldOutboundTestUrl: 'https://www.google.com/generate_204',
|
oldOutboundTestUrl: 'https://www.google.com/generate_204',
|
||||||
inboundTags: [],
|
inboundTags: [],
|
||||||
|
|
@ -394,10 +404,6 @@
|
||||||
const msg = await HttpUtil.post("/panel/xray/");
|
const msg = await HttpUtil.post("/panel/xray/");
|
||||||
|
|
||||||
if (msg.success) {
|
if (msg.success) {
|
||||||
if (!this.loadingStates.fetched) {
|
|
||||||
this.loadingStates.fetched = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const result = JSON.parse(msg.obj);
|
const result = JSON.parse(msg.obj);
|
||||||
const xs = JSON.stringify(result.xraySetting, null, 2);
|
const xs = JSON.stringify(result.xraySetting, null, 2);
|
||||||
this.oldXraySetting = xs;
|
this.oldXraySetting = xs;
|
||||||
|
|
@ -406,7 +412,11 @@
|
||||||
this.outboundTestUrl = result.outboundTestUrl || 'https://www.google.com/generate_204';
|
this.outboundTestUrl = result.outboundTestUrl || 'https://www.google.com/generate_204';
|
||||||
this.oldOutboundTestUrl = this.outboundTestUrl;
|
this.oldOutboundTestUrl = this.outboundTestUrl;
|
||||||
this.saveBtnDisable = true;
|
this.saveBtnDisable = true;
|
||||||
|
this.loadFailed = false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
this.loadFailed = true;
|
||||||
|
return false;
|
||||||
},
|
},
|
||||||
async updateXraySetting() {
|
async updateXraySetting() {
|
||||||
this.loading(true);
|
this.loading(true);
|
||||||
|
|
@ -1064,13 +1074,17 @@
|
||||||
if (window.location.protocol !== "https:") {
|
if (window.location.protocol !== "https:") {
|
||||||
this.showAlert = true;
|
this.showAlert = true;
|
||||||
}
|
}
|
||||||
|
let settingsLoaded = false;
|
||||||
try {
|
try {
|
||||||
await this.getXraySetting();
|
settingsLoaded = await this.getXraySetting();
|
||||||
await this.getXrayResult();
|
await this.getXrayResult();
|
||||||
await this.getOutboundsTraffic();
|
await this.getOutboundsTraffic();
|
||||||
} finally {
|
} finally {
|
||||||
this.loadingStates.fetched = true;
|
this.loadingStates.fetched = true;
|
||||||
}
|
}
|
||||||
|
if (!settingsLoaded) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (window.wsClient) {
|
if (window.wsClient) {
|
||||||
window.wsClient.connect();
|
window.wsClient.connect();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue