From c980a06969c9595f0b0b7d5db301f2413506eb6f Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Fri, 8 Dec 2023 20:31:17 +0100 Subject: customizable remark #1300 --- web/html/common/qrcode_modal.html | 2 +- web/html/xui/inbound_info_modal.html | 2 +- web/html/xui/inbounds.html | 4 ++- web/html/xui/settings.html | 48 ++++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 3 deletions(-) (limited to 'web/html') diff --git a/web/html/common/qrcode_modal.html b/web/html/common/qrcode_modal.html index 0df369ff..4be7997d 100644 --- a/web/html/common/qrcode_modal.html +++ b/web/html/common/qrcode_modal.html @@ -35,7 +35,7 @@ this.client = client; this.subId = ''; this.qrcodes = []; - this.inbound.genAllLinks(this.dbInbound.remark, client).forEach(l => { + this.inbound.genAllLinks(this.dbInbound.remark, app.remarkModel, client).forEach(l => { this.qrcodes.push({ remark: l.remark, link: l.link diff --git a/web/html/xui/inbound_info_modal.html b/web/html/xui/inbound_info_modal.html index e92fc874..bd1fea72 100644 --- a/web/html/xui/inbound_info_modal.html +++ b/web/html/xui/inbound_info_modal.html @@ -264,7 +264,7 @@ this.clientSettings = this.inbound.clients ? this.inbound.clients[index] : null; this.isExpired = this.inbound.clients ? this.inbound.isExpiry(index): this.dbInbound.isExpiry; this.clientStats = this.inbound.clients ? this.dbInbound.clientStats.find(row => row.email === this.clientSettings.email) : []; - this.links = this.inbound.genAllLinks(this.dbInbound.remark, this.clientSettings); + this.links = this.inbound.genAllLinks(this.dbInbound.remark, app.remarkModel, this.clientSettings); if (this.clientSettings) { if (this.clientSettings.subId) { this.subLink = this.genSubLink(this.clientSettings.subId); diff --git a/web/html/xui/inbounds.html b/web/html/xui/inbounds.html index 31595f00..14371631 100644 --- a/web/html/xui/inbounds.html +++ b/web/html/xui/inbounds.html @@ -556,6 +556,7 @@ enable : false, subURI : '' }, + remarkModel: '-ieo', tgBotEnable: false, pageSize: 0, isMobile: window.innerWidth <= 768, @@ -600,6 +601,7 @@ subURI: subURI }; this.pageSize = pageSize; + this.remarkModel = remarkModel; } }, setInbounds(dbInbounds) { @@ -1191,7 +1193,7 @@ exportAllLinks() { let copyText = []; for (const dbInbound of this.dbInbounds) { - copyText.push(dbInbound.genInboundLinks); + copyText.push(dbInbound.genInboundLinks(this.remarkModel)); } txtModal.show('{{ i18n "pages.inbounds.export"}}', copyText.join('\r\n'), 'All-Inbounds'); }, diff --git a/web/html/xui/settings.html b/web/html/xui/settings.html index 24cef2af..f40b20a5 100644 --- a/web/html/xui/settings.html +++ b/web/html/xui/settings.html @@ -105,6 +105,28 @@ + + + + + + + + + + + [[ value ]] + + + [[ key ]] + + + + + @@ -272,6 +294,31 @@ saveBtnDisable: true, user: {}, lang: getLang(), + showAlert: false, + remarkModels: {i:'Inbound',e:'Email',o:'Other'}, + remarkSeparators: [' ','-','_','@',':','~','|',',','.','/'], + remarkSample: '', + get remarkModel() { + rm = this.allSetting.remarkModel; + return rm.length>1 ? rm.substring(1).split('') : []; + }, + set remarkModel(value) { + rs = this.allSetting.remarkModel[0]; + this.allSetting.remarkModel = rs + value.join(''); + this.changeRemarkSample(); + }, + get remarkSeparator() { + return this.allSetting.remarkModel.length > 1 ? this.allSetting.remarkModel.charAt(0) : '-'; + }, + set remarkSeparator(value) { + this.allSetting.remarkModel = value + this.allSetting.remarkModel.substring(1); + this.changeRemarkSample(); + }, + changeRemarkSample(){ + sample = [] + this.remarkModel.forEach(r => sample.push(this.remarkModels[r])); + this.remarkSample = sample.length == 0 ? '' : sample.join(this.remarkSeparator); + } }, methods: { loading(spinning = true) { @@ -284,6 +331,7 @@ if (msg.success) { this.oldAllSetting = new AllSetting(msg.obj); this.allSetting = new AllSetting(msg.obj); + app.changeRemarkSample(); this.saveBtnDisable = true; } await this.fetchUserSecret(); -- cgit v1.2.3