Browse Source

[xray] add dns tag

Co-Authored-By: Alireza Ahmadi <[email protected]>
MHSanaei 1 year ago
parent
commit
e6254e23f2

+ 12 - 1
web/html/xui/xray.html

@@ -546,6 +546,7 @@
                         <a-tab-pane key="tpl-6" tab='DNS' style="padding-top: 20px;" force-render="true">
                             <setting-list-item type="switch" title='{{ i18n "pages.xray.dns.enable" }}' desc='{{ i18n "pages.xray.dns.enableDesc" }}' v-model="enableDNS"></setting-list-item>
                             <template v-if="enableDNS">
+                                <setting-list-item type="text" title='{{ i18n "pages.xray.dns.tag" }}' desc='{{ i18n "pages.xray.dns.tagDesc" }}' v-model="dnsTag"></setting-list-item>
                                 <a-list-item>
                                     <a-row style="padding: 20px">
                                         <a-col :lg="24" :xl="12">
@@ -2027,7 +2028,17 @@
                 },
                 set: function (newValue) {
                     newTemplateSettings = this.templateSettings;
-                    newTemplateSettings.dns =  newValue ? { servers: [], queryStrategy: "UseIP" } : null;
+                    newTemplateSettings.dns =  newValue ? { servers: [], queryStrategy: "UseIP", tag: "dns_inbound" } : null;
+                    this.templateSettings = newTemplateSettings;
+                }
+            },
+            dnsTag: {
+                get: function () {
+                    return this.enableDNS ? this.templateSettings.dns.tag : "";
+                },
+                set: function (newValue) {
+                    newTemplateSettings = this.templateSettings;
+                    newTemplateSettings.dns.tag =  newValue;
                     this.templateSettings = newTemplateSettings;
                 }
             },

+ 1 - 1
web/html/xui/xray_reverse_modal.html

@@ -38,7 +38,6 @@
                     :options="reverseModal.inboundTags"></a-checkbox-group>
             </a-form-item>
         </template>
-    </table>
     </a-form>
 </a-modal>
 <script>
@@ -114,6 +113,7 @@
             this.isEdit = isEdit;
             this.inboundTags = app.templateSettings.inbounds.filter((i) => !ObjectUtil.isEmpty(i.tag)).map(obj => obj.tag);
             this.inboundTags.push(...app.inboundTags);
+            if (app.enableDNS && !ObjectUtil.isEmpty(app.dnsTag)) this.inboundTags.push(app.dnsTag)
             this.outboundTags = app.templateSettings.outbounds.filter((o) => !ObjectUtil.isEmpty(o.tag)).map(obj => obj.tag);
         },
         close() {

+ 1 - 0
web/html/xui/xray_rule_modal.html

@@ -195,6 +195,7 @@
             this.isEdit = isEdit;
             this.inboundTags = app.templateSettings.inbounds.filter((i) => !ObjectUtil.isEmpty(i.tag)).map(obj => obj.tag);
             this.inboundTags.push(...app.inboundTags);
+            if (app.enableDNS && !ObjectUtil.isEmpty(app.dnsTag)) this.inboundTags.push(app.dnsTag)
             this.outboundTags = ["", ...app.templateSettings.outbounds.filter((o) => !ObjectUtil.isEmpty(o.tag)).map(obj => obj.tag)];
             if(app.templateSettings.reverse){
                 if(app.templateSettings.reverse.bridges) {

+ 2 - 0
web/translation/translate.en_US.toml

@@ -467,6 +467,8 @@
 [pages.xray.dns]
 "enable" = "Enable DNS"
 "enableDesc" = "Enable built-in DNS server"
+"tag" = "DNS Inbound Tag"
+"tagDesc" = "This tag will be available as an Inbound tag in routing rules."
 "strategy" = "Query Strategy"
 "strategyDesc" = "Overall strategy to resolve domain names"
 "add" = "Add Server"

+ 2 - 0
web/translation/translate.fa_IR.toml

@@ -467,6 +467,8 @@
 [pages.xray.dns]
 "enable" = "فعال کردن حل دامنه"
 "enableDesc" = "سرور حل دامنه داخلی را فعال کنید"
+"tag" = "برچسب"
+"tagDesc" = "این برچسب در قوانین مسیریابی به عنوان یک برچسب ورودی قابل استفاده خواهد بود"
 "strategy" = "استراتژی پرس‌وجو"
 "strategyDesc" = "استراتژی کلی برای حل نام دامنه"
 "add" = "افزودن سرور"

+ 2 - 0
web/translation/translate.id_ID.toml

@@ -467,6 +467,8 @@
 [pages.xray.dns]
 "enable" = "Aktifkan DNS"
 "enableDesc" = "Aktifkan server DNS bawaan"
+"tag" = "Tanda DNS Masuk"
+"tagDesc" = "Tanda ini akan tersedia sebagai tanda masuk dalam aturan penataan."
 "strategy" = "Strategi Kueri"
 "strategyDesc" = "Strategi keseluruhan untuk menyelesaikan nama domain"
 "add" = "Tambahkan Server"

+ 2 - 0
web/translation/translate.ru_RU.toml

@@ -467,6 +467,8 @@
 [pages.xray.dns]
 "enable" = "Включить DNS"
 "enableDesc" = "Включить встроенный DNS-сервер"
+"tag" = "Входящий тег DNS"
+"tagDesc" = "Этот тег будет доступен как входящий тег в правилах маршрутизации."
 "strategy" = "Стратегия запроса"
 "strategyDesc" = "Общая стратегия разрешения доменных имен"
 "add" = "Добавить сервер"

+ 2 - 0
web/translation/translate.uk_UA.toml

@@ -467,6 +467,8 @@
 [pages.xray.dns]
 "enable" = "Увімкнути DNS"
 "enableDesc" = "Увімкнути вбудований DNS-сервер"
+"tag" = "Мітка вхідного DNS"
+"tagDesc" = "Ця мітка буде доступна як вхідна мітка в правилах маршрутизації."
 "strategy" = "Стратегія запиту"
 "strategyDesc" = "Загальна стратегія вирішення доменних імен"
 "add" = "Додати сервер"

+ 2 - 0
web/translation/translate.vi_VN.toml

@@ -467,6 +467,8 @@
 [pages.xray.dns]
 "enable" = "Kích hoạt DNS"
 "enableDesc" = "Kích hoạt máy chủ DNS tích hợp"
+"tag" = "Thẻ gửi đến DNS"
+"tagDesc" = "Thẻ này sẽ có sẵn dưới dạng thẻ Gửi đến trong quy tắc định tuyến."
 "strategy" = "Chiến lược truy vấn"
 "strategyDesc" = "Chiến lược tổng thể để phân giải tên miền"
 "add" = "Thêm máy chủ"

+ 2 - 0
web/translation/translate.zh_Hans.toml

@@ -467,6 +467,8 @@
 [pages.xray.dns]
 "enable" = "启用 DNS"
 "enableDesc" = "启用内置 DNS 服务器"
+"tag" = "DNS 入站标签"
+"tagDesc" = "此标记将在路由规则中用作入站标记。"
 "strategy" = "查询策略"
 "strategyDesc" = "解析域名的总体策略"
 "add" = "添加服务器"