From 96786c94189f3d2f3f04c1915529c786228bdf42 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 17 Mar 2023 19:37:49 +0330 Subject: alireza --- web/html/xui/inbound_info_modal.html | 119 +++++++++++++++++++++++++---------- 1 file changed, 87 insertions(+), 32 deletions(-) (limited to 'web/html/xui/inbound_info_modal.html') diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index 737665d5..0e1b1415 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -3,7 +3,7 @@ v-model="infoModal.visible" title='{{ i18n "pages.inbounds.details"}}' :closable="true" :mask-closable="true" - :class="siderDrawer.isDarkTheme ? darkClass : ''" + :class="siderDrawer.isDarkTheme ? darkClass : ''" :footer="null" width="600px" > @@ -44,7 +44,7 @@ - + tls: {{ i18n "enabled" }}
tls {{ i18n "domainName" }}: [[ inbound.serverName ? inbound.serverName : '' ]] @@ -57,20 +57,20 @@ + +
URL

[[ infoModal.link ]]

@@ -106,39 +167,31 @@ visible: false, inbound: new Inbound(), dbInbound: new DBInbound(), + settings: null, clientSettings: new Inbound.Settings(), clientStats: [], upStats: 0, downStats: 0, clipboard: null, link: null, - index: 0, + index: null, isExpired: false, - show(dbInbound, index=0) { + show(dbInbound, index) { this.index = index; this.inbound = dbInbound.toInbound(); this.dbInbound = new DBInbound(dbInbound); this.link = dbInbound.genLink(index); - this.clientSettings = Object.values(JSON.parse(this.inbound.settings).clients)[index]; - this.clientStats = dbInbound.clientStats; + this.settings = JSON.parse(this.inbound.settings); + this.clientSettings = this.settings.clients ? Object.values(this.settings.clients)[index] : null; this.isExpired = this.inbound.isExpiry(index); - if(dbInbound.clientStats.length > 0) - { - for (const key in dbInbound.clientStats) { - if (Object.hasOwnProperty.call(dbInbound.clientStats, key)) { - if(dbInbound.clientStats[key]['email'] == this.clientSettings.email) - this.clientStats = dbInbound.clientStats[key]; - - } - } - } + this.clientStats = this.settings.clients ? this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) : []; this.visible = true; infoModalApp.$nextTick(() => { if (this.clipboard === null) { this.clipboard = new ClipboardJS('#copy-url-link', { text: () => this.link, }); - this.clipboard.on('success', () => app.$message.success('{{ i18n "copySuccess" }}')); + this.clipboard.on('success', () => app.$message.success('{{ i18n "copied" }}')); } }); }, @@ -146,6 +199,7 @@ infoModal.visible = false; }, }; + const infoModalApp = new Vue({ delimiters: ['[[', ']]'], el: '#inbound-info-modal', @@ -156,32 +210,33 @@ }, get inbound() { return this.infoModal.inbound; + }, + get isEnable() { + if(infoModal.clientStats){ + return infoModal.clientStats.enable; + } + return infoModal.dbInbound.isEnable; } }, methods: { - setQrCode(elmentId,index) { - content = infoModal.inbound.genLink(infoModal.dbInbound.address,infoModal.dbInbound.remark,index) - new QRious({ - element: document.querySelector('#'+elmentId), - size: 260, - value: content, - }); - }, copyTextToClipboard(elmentId,content) { this.infoModal.clipboard = new ClipboardJS('#' + elmentId, { text: () => content, }); this.infoModal.clipboard.on('success', () => { - app.$message.success('{{ i18n "copySuccess" }}') + app.$message.success('{{ i18n "copied" }}') this.infoModal.clipboard.destroy(); }); }, statsColor(stats) { + if(!stats) return 'blue' if(stats['total'] === 0) return 'blue' else if(stats['total'] > 0 && (stats['down']+stats['up']) < stats['total']) return 'cyan' else return 'red' } }, + }); + {{end}} \ No newline at end of file -- cgit v1.2.3