Skip to content

Commit

Permalink
outbound tag validation #1286
Browse files Browse the repository at this point in the history
  • Loading branch information
alireza0 committed Dec 5, 2023
1 parent 1bbef6d commit aa19637
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 8 deletions.
6 changes: 4 additions & 2 deletions web/html/xui/xray.html
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@ <h2 class="collapse-title">
}
outModal.close();
},
isEdit: false
isEdit: false,
tags: this.templateSettings.outbounds.map(obj => obj.tag)
});
},
editOutbound(index){
Expand All @@ -760,7 +761,8 @@ <h2 class="collapse-title">
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){
Expand Down
6 changes: 4 additions & 2 deletions web/html/xui/xray_outbound_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -34,6 +35,7 @@
this.visible = true;
this.outbound = isEdit ? Outbound.fromJson(outbound) : new Outbound();
this.isEdit = isEdit;
this.tags = tags;
this.check()
},
close() {
Expand All @@ -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 {
Expand Down
4 changes: 2 additions & 2 deletions web/html/xui/xray_reverse_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions web/html/xui/xray_rule_modal.html
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
1 change: 1 addition & 0 deletions web/translation/translate.en_US.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
"editOutbound" = "Edit outbound"
"editReverse" = "Edit reverse"
"tag" = "Tag"
"tagDesc" = "Unique tag"
"address" = "Address"
"reverse" = "Reverse"
"domain" = "Domain"
Expand Down
1 change: 1 addition & 0 deletions web/translation/translate.es_ES.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
"editOutbound" = "Editar salida"
"editReverse" = "Editar reverso"
"tag" = "Etiqueta"
"tagDesc" = "etiqueta única"
"address" = "Dirección"
"reverse" = "Reverso"
"domain" = "Dominio"
Expand Down
1 change: 1 addition & 0 deletions web/translation/translate.fa_IR.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
"editOutbound" = "ویرایش خروجی"
"editReverse" = "ویرایش معکوس"
"tag" = "برچسب"
"tagDesc" = "برچسب یگانه"
"address" = "آدرس"
"reverse" = "معکوس"
"domain" = "دامنه"
Expand Down
1 change: 1 addition & 0 deletions web/translation/translate.ru_RU.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
"editOutbound" = "Изменить исходящий"
"editReverse" = "Редактировать реверс"
"tag" = "Тег"
"tagDesc" = "уникальный тег"
"address" = "Адрес"
"reverse" = "Обратный"
"domain" = "Домен"
Expand Down
1 change: 1 addition & 0 deletions web/translation/translate.vi_VN.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
"editOutbound" = "Chỉnh sửa gửi đi"
"editReverse" = "Chỉnh sửa ngược lại"
"tag" = "Thẻ"
"tagDesc" = "thẻ duy nhất"
"address" = "Địa chỉ"
"reverse" = "Đảo ngược"
"domain" = "Miền"
Expand Down
1 change: 1 addition & 0 deletions web/translation/translate.zh_Hans.toml
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@
"editOutbound" = "编辑出站"
"editReverse" = "编辑反向"
"tag" = "标签"
"tagDesc" = "独特的标签"
"address" = "地址"
"rreverse" = "反转"
"domain" = "域名"
Expand Down

0 comments on commit aa19637

Please sign in to comment.