From 35feef650f793ffbec2af51a18fd25d8b0beefb1 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Fri, 8 Dec 2023 20:08:44 +0100 Subject: import-export inbound #1300 --- web/html/xui/inbounds.html | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'web/html/xui/inbounds.html') diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 13808ac9..31595f00 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -121,6 +121,10 @@ + + + {{ i18n "pages.inbounds.importInbound" }} + {{ i18n "pages.inbounds.export" }} @@ -221,6 +225,10 @@ {{ i18n "info"}} + + + {{ i18n "pages.inbounds.copyToClipboard" }} + {{ i18n "pages.inbounds.resetTraffic" }} @@ -708,6 +716,9 @@ }, generalActions(action) { switch (action.key) { + case "import": + this.importInbound(); + break; case "export": this.exportAllLinks(); break; @@ -742,6 +753,9 @@ case "export": this.inboundLinks(dbInbound.id); break; + case "clipboard": + this.copyToClipboard(dbInbound.id); + break; case "resetTraffic": this.resetTraffic(dbInbound.id); break; @@ -1162,6 +1176,18 @@ newDbInbound = this.checkFallback(dbInbound); txtModal.show('{{ i18n "pages.inbounds.export"}}', newDbInbound.genInboundLinks, newDbInbound.remark); }, + importInbound() { + promptModal.open({ + title: '{{ i18n "pages.inbounds.importInbound" }}', + type: 'textarea', + value: '', + okText: '{{ i18n "pages.inbounds.import" }}', + confirm: async (dbInboundText) => { + await this.submit('/panel/inbound/import', {data: dbInboundText}, promptModal); + promptModal.close(); + }, + }); + }, exportAllLinks() { let copyText = []; for (const dbInbound of this.dbInbounds) { @@ -1169,6 +1195,10 @@ } txtModal.show('{{ i18n "pages.inbounds.export"}}', copyText.join('\r\n'), 'All-Inbounds'); }, + copyToClipboard(dbInboundId) { + dbInbound = this.dbInbounds.find(row => row.id === dbInboundId); + txtModal.show('{{ i18n "pages.inbounds.inboundData" }}', JSON.stringify(dbInbound, null, 2)); + }, async startDataRefreshLoop() { while (this.isRefreshEnabled) { try { -- cgit v1.2.3