diff options
| author | Ho3ein <ho3ein.sanaei@gmail.com> | 2023-03-28 01:49:13 +0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-03-28 01:49:13 +0300 |
| commit | 43aea386413d0c19c208a1292950f106b10a536c (patch) | |
| tree | 1d587245fba54c7ed87f4b4ea5d678cc378ffb8e /web/html/xui/inbounds.html | |
| parent | 3da6c4d7d91c31ac341bfdc0e3513f5bf2501a91 (diff) | |
| parent | 88744d92b3677b33f0b6265bacb7805aeab856e6 (diff) | |
Merge pull request #114 from MHSanaei/dev
clone inbound + reset traffic all inbound
Diffstat (limited to 'web/html/xui/inbounds.html')
| -rw-r--r-- | web/html/xui/inbounds.html | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index f7b9e2ed..90250869 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -52,6 +52,7 @@ <div slot="title"> <a-button type="primary" icon="plus" @click="openAddInbound">{{ i18n "pages.inbounds.addInbound" }}</a-button> <a-button type="primary" icon="export" @click="exportAllLinks">{{ i18n "pages.inbounds.export" }}</a-button> + <a-button type="primary" icon="reload" @click="resetAllTraffic">{{ i18n "pages.inbounds.resetAllTraffic" }}</a-button> </div> <a-input v-model.lazy="searchKey" placeholder="{{ i18n "search" }}" autofocus style="max-width: 300px"></a-input> <a-table :columns="columns" :row-key="dbInbound => dbInbound.id" @@ -96,6 +97,9 @@ <a-menu-item key="resetTraffic"> <a-icon type="retweet"></a-icon> {{ i18n "pages.inbounds.resetTraffic" }} </a-menu-item> + <a-menu-item key="clone"> + <a-icon type="block"></a-icon> {{ i18n "pages.inbounds.Clone"}} + </a-menu-item> <a-menu-item key="delete"> <span style="color: #FF4D4F"> <a-icon type="delete"></a-icon> {{ i18n "delete"}} @@ -311,11 +315,47 @@ case "resetTraffic": this.resetTraffic(dbInbound.id); break; + case "clone": + this.openCloneInbound(dbInbound); + break; case "delete": this.delInbound(dbInbound.id); break; } }, + openCloneInbound(dbInbound) { + this.$confirm({ + title: '{{ i18n "pages.inbounds.cloneInbound"}} ' + dbInbound.remark, + content: '{{ i18n "pages.inbounds.cloneInboundContent"}}', + okText: '{{ i18n "pages.inbounds.cloneInboundOk"}}', + cancelText: '{{ i18n "cancel" }}', + onOk: () => { + const baseInbound = dbInbound.toInbound(); + dbInbound.up = 0; + dbInbound.down = 0; + this.cloneInbound(baseInbound, dbInbound); + }, + }); + }, + async cloneInbound(baseInbound, dbInbound) { + const inbound = new Inbound(); + const data = { + up: dbInbound.up, + down: dbInbound.down, + total: dbInbound.total, + remark: dbInbound.remark + " - Cloned", + enable: dbInbound.enable, + expiryTime: dbInbound.expiryTime, + + listen: inbound.listen, + port: inbound.port, + protocol: baseInbound.protocol, + settings: inbound.settings.toString(), + streamSettings: baseInbound.stream.toString(), + sniffing: baseInbound.canSniffing() ? baseInbound.sniffing.toString() : '{}', + }; + await this.submit('/xui/inbound/add', data, inModal); + }, openAddInbound() { inModal.show({ title: '{{ i18n "pages.inbounds.addInbound"}}', @@ -462,6 +502,22 @@ }, }); }, + resetAllTraffic() { + this.$confirm({ + title: '{{ i18n "pages.inbounds.resetAllTrafficTitle"}}', + content: '{{ i18n "pages.inbounds.resetAllTrafficContent"}}', + okText: '{{ i18n "pages.inbounds.resetAllTrafficOkText"}}', + cancelText: '{{ i18n "pages.inbounds.resetAllTrafficCancelText"}}', + onOk: async () => { + for (const dbInbound of this.dbInbounds) { + const inbound = dbInbound.toInbound(); + dbInbound.up = 0; + dbInbound.down = 0; + this.updateInbound(inbound, dbInbound); + } + }, + }); + }, delInbound(dbInboundId) { this.$confirm({ title: '{{ i18n "pages.inbounds.deleteInbound"}}', |
