diff options
| author | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-06 01:03:38 +0300 |
|---|---|---|
| committer | Alireza Ahmadi <alireza7@gmail.com> | 2023-12-06 01:03:38 +0300 |
| commit | aa196372887dcfd1048522d13c573f8c0296548c (patch) | |
| tree | 4ef54d5955e06c4681c902da12be404809974975 /web/html/xui | |
| parent | 1bbef6d612e4db7749497fef6b76611831d75494 (diff) | |
outbound tag validation #1286
Diffstat (limited to 'web/html/xui')
| -rw-r--r-- | web/html/xui/xray.html | 6 | ||||
| -rw-r--r-- | web/html/xui/xray_outbound_modal.html | 6 | ||||
| -rw-r--r-- | web/html/xui/xray_reverse_modal.html | 4 | ||||
| -rw-r--r-- | web/html/xui/xray_rule_modal.html | 4 |
4 files changed, 12 insertions, 8 deletions
diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index 9bcacebd..b8bbe094 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -747,7 +747,8 @@ } outModal.close(); }, - isEdit: false + isEdit: false, + tags: this.templateSettings.outbounds.map(obj => obj.tag) }); }, editOutbound(index){ @@ -760,7 +761,8 @@ this.outboundSettings = JSON.stringify(this.templateSettings.outbounds); outModal.close(); }, - isEdit: true + isEdit: true, + tags: this.outboundData.filter((o) => o.key != index ).map(obj => obj.tag) }); }, deleteOutbound(index){ diff --git a/web/html/xui/xray_outbound_modal.html b/web/html/xui/xray_outbound_modal.html index c8be04c4..2941e096 100644 --- a/web/html/xui/xray_outbound_modal.html +++ b/web/html/xui/xray_outbound_modal.html @@ -21,10 +21,11 @@ duplicateTag: false, isValid: true, activeKey: '1', + tags: [], ok() { ObjectUtil.execute(outModal.confirm, outModal.outbound.toJson()); }, - show({ title='', okText='{{ i18n "sure" }}', outbound, confirm=(outbound)=>{}, isEdit=false }) { + show({ title='', okText='{{ i18n "sure" }}', outbound, confirm=(outbound)=>{}, isEdit=false, tags=[] }) { this.title = title; this.okText = okText; this.confirm = confirm; @@ -34,6 +35,7 @@ this.visible = true; this.outbound = isEdit ? Outbound.fromJson(outbound) : new Outbound(); this.isEdit = isEdit; + this.tags = tags; this.check() }, close() { @@ -44,7 +46,7 @@ outModal.confirmLoading = loading; }, check(){ - if(outModal.outbound.tag == ''){ + if(outModal.outbound.tag == '' || outModal.tags.includes(outModal.outbound.tag)){ this.duplicateTag = true; this.isValid = false; } else { diff --git a/web/html/xui/xray_reverse_modal.html b/web/html/xui/xray_reverse_modal.html index bd0152bb..71a21517 100644 --- a/web/html/xui/xray_reverse_modal.html +++ b/web/html/xui/xray_reverse_modal.html @@ -111,9 +111,9 @@ ] } this.isEdit = isEdit; - this.inboundTags = app.templateSettings.inbounds.map(obj => obj.tag); + this.inboundTags = app.templateSettings.inbounds.filter((i) => !ObjectUtil.isEmpty(i.tag)).map(obj => obj.tag); this.inboundTags.push(...app.inboundTags); - this.outboundTags = app.templateSettings.outbounds.map(obj => obj.tag); + this.outboundTags = app.templateSettings.outbounds.filter((o) => !ObjectUtil.isEmpty(o.tag)).map(obj => obj.tag); }, close() { reverseModal.visible = false; diff --git a/web/html/xui/xray_rule_modal.html b/web/html/xui/xray_rule_modal.html index d786ebb7..6c5b3c08 100644 --- a/web/html/xui/xray_rule_modal.html +++ b/web/html/xui/xray_rule_modal.html @@ -152,9 +152,9 @@ } } this.isEdit = isEdit; - this.inboundTags = app.templateSettings.inbounds.map(obj => obj.tag); + this.inboundTags = app.templateSettings.inbounds.filter((i) => !ObjectUtil.isEmpty(i.tag)).map(obj => obj.tag); this.inboundTags.push(...app.inboundTags); - this.outboundTags = app.templateSettings.outbounds.map(obj => obj.tag); + this.outboundTags = app.templateSettings.outbounds.filter((o) => !ObjectUtil.isEmpty(o.tag)).map(obj => obj.tag); if(app.templateSettings.reverse){ if(app.templateSettings.reverse.bridges) { this.inboundTags.push(...app.templateSettings.reverse.bridges.map(b => b.tag)); |
