From ccb92c70bfccc2132c8b2270db11212d8d9155e8 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Sat, 10 Oct 2026 23:00:18 +0200 Subject: [PATCH] Xray settings: Lua script for DNS and routing, DNS server id --- web/html/xui/dns_modal.html | 20 ++++++++++++++++++-- web/html/xui/xray.html | 25 +++++++++++++++++++++++++ web/translation/translate.en_US.toml | 4 ++++ web/translation/translate.fa_IR.toml | 4 ++++ web/translation/translate.ru_RU.toml | 4 ++++ web/translation/translate.vi_VN.toml | 4 ++++ web/translation/translate.zh_Hans.toml | 4 ++++ 7 files changed, 63 insertions(+), 2 deletions(-) diff --git a/web/html/xui/dns_modal.html b/web/html/xui/dns_modal.html index 2c0a6beb..02ea7925 100644 --- a/web/html/xui/dns_modal.html +++ b/web/html/xui/dns_modal.html @@ -3,6 +3,17 @@ :mask-closable="false" :ok-text="dnsModal.okText" cancel-text='{{ i18n "close" }}' :class="themeSwitcher.currentTheme"> + + + + @@ -43,6 +54,7 @@ isEdit: false, confirm: null, dnsServer: { + id: '', address: "localhost", domains: [], expectIPs: [], @@ -54,7 +66,9 @@ expectIPs = dnsModal.dnsServer.expectIPs.filter(ip => ip.length > 0); dnsModal.dnsServer.domains = domains; dnsModal.dnsServer.expectIPs = expectIPs; - newDnsServer = (domains.length > 0 || expectIPs.length > 0) ? dnsModal.dnsServer : dnsModal.dnsServer.address; + if (!dnsModal.dnsServer.id) delete dnsModal.dnsServer.id; + // a bare address string cannot carry the id a DNS script looks servers up by + newDnsServer = (domains.length > 0 || expectIPs.length > 0 || dnsModal.dnsServer.id) ? dnsModal.dnsServer : dnsModal.dnsServer.address; ObjectUtil.execute(dnsModal.confirm, newDnsServer); }, @@ -71,9 +85,10 @@ this.visible = true; if (isEdit) { if (typeof dnsServer == 'object') { - this.dnsServer = dnsServer; + this.dnsServer = { id: '', domains: [], expectIPs: [], ...dnsServer }; } else { this.dnsServer = { + id: '', address: dnsServer ?? "", domains: [], expectIPs: [], @@ -83,6 +98,7 @@ } } else { this.dnsServer = { + id: '', address: "localhost", domains: [], expectIPs: [], diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index e03ca927..f98b0a1c 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -150,6 +150,7 @@ + @@ -327,6 +328,7 @@ + DNS {{ i18n "pages.xray.dns.add" }}