diff options
Diffstat (limited to 'web/html')
| -rw-r--r-- | web/html/xui/inbounds.html | 67 | ||||
| -rw-r--r-- | web/html/xui/xray.html | 13 |
2 files changed, 53 insertions, 27 deletions
diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 9dce8982..1cd1be1a 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -1195,35 +1195,48 @@ } }, getSubGroupClients(dbInbounds, currentClient) { - const response = { - inbounds: [], - clients: [], - editIds: [] + const response = { + inbounds: [], + clients: [], + editIds: [], + }; + + if (!Array.isArray(dbInbounds) || dbInbounds.length === 0) { + return response; + } + if (!currentClient || !currentClient.subId) { + return response; + } + + dbInbounds.forEach((dbInboundItem) => { + try { + const dbInbound = new DBInbound(dbInboundItem); + if (!dbInbound) { + return; } - if (dbInbounds && dbInbounds.length > 0 && currentClient) { - dbInbounds.forEach((dbInboundItem) => { - const dbInbound = new DBInbound(dbInboundItem); - if (dbInbound) { - const inbound = dbInbound.toInbound(); - if (inbound) { - const clients = inbound.clients; - if (clients.length > 0) { - clients.forEach((client) => { - if (client['subId'] === currentClient['subId']) { - client['inboundId'] = dbInboundItem.id - client['clientId'] = this.getClientId(dbInbound.protocol, client) - response.inbounds.push(dbInboundItem.id) - response.clients.push(client) - response.editIds.push(client['clientId']) - } - }) - } - } - } - }) + + const inbound = dbInbound.toInbound(); + if (!inbound || !Array.isArray(inbound.clients)) { + return; } - return response; - }, + + inbound.clients.forEach((client) => { + if (client.subId === currentClient.subId) { + client.inboundId = dbInboundItem.id; + client.clientId = this.getClientId(dbInbound.protocol, client); + + response.inbounds.push(dbInboundItem.id); + response.clients.push(client); + response.editIds.push(client.clientId); + } + }); + } catch (error) { + console.error("Error processing dbInboundItem:", dbInboundItem, error); + } + }); + + return response; + }, getClientId(protocol, client) { switch (protocol) { case Protocols.TROJAN: return client.password; diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index cc3e1239..3f15c7ba 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -143,6 +143,7 @@ </a-select> </a-col> </a-row> + <setting-list-item type="switch" title='{{ i18n "pages.xray.outBoundTraffic"}}' desc='{{ i18n "pages.xray.outBoundTrafficDesc"}}' v-model="outboundTraffic"></setting-list-item> </a-list-item> </a-collapse-panel> <a-collapse-panel header='{{ i18n "pages.xray.logConfigs" }}'> @@ -1823,6 +1824,18 @@ this.templateSettings = newTemplateSettings; } }, + outboundTraffic: { + get: function () { + if (!this.templateSettings || !this.templateSettings.policy.system || !this.templateSettings.policy.system.statsOutboundDownlink) return false; + return this.templateSettings.policy.system.statsOutboundDownlink; + }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.policy.system.statsOutboundDownlink = newValue; + newTemplateSettings.policy.system.statsOutboundUplink = newValue; + this.templateSettings = newTemplateSettings; + } + }, maskAddressLog: { get: function () { if (!this.templateSettings || !this.templateSettings.log || !this.templateSettings.log.maskAddress) return ""; |
