From f521c0b53a7c82ab220efe2c39f34a102c4e4724 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Fri, 8 Dec 2023 19:12:17 +0100 Subject: [PATCH] [bug] fix routing dns strategy #1300 --- web/html/xui/xray.html | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html index b8bbe094..d2df65b6 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -969,15 +969,17 @@ freedomStrategy: { get: function () { if (!this.templateSettings) return "AsIs"; - freedomOutbound = this.templateSettings.outbounds.find((o) => o.protocol === "freedom" && !o.tag); + freedomOutbound = this.templateSettings.outbounds.find((o) => o.protocol === "freedom" && o.tag == "direct"); if (!freedomOutbound) return "AsIs"; if (!freedomOutbound.settings || !freedomOutbound.settings.domainStrategy) return "AsIs"; return freedomOutbound.settings.domainStrategy; }, set: function (newValue) { newTemplateSettings = this.templateSettings; - freedomOutboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.protocol === "freedom" && !o.tag); - if (!newTemplateSettings.outbounds[freedomOutboundIndex].settings) { + freedomOutboundIndex = newTemplateSettings.outbounds.findIndex((o) => o.protocol === "freedom" && o.tag == "direct"); + if(freedomOutboundIndex == -1){ + newTemplateSettings.outbounds.push({protocol: "freedom", tag: "direct", settings: { "domainStrategy": newValue }}); + } else if (!newTemplateSettings.outbounds[freedomOutboundIndex].settings) { newTemplateSettings.outbounds[freedomOutboundIndex].settings = {"domainStrategy": newValue}; } else { newTemplateSettings.outbounds[freedomOutboundIndex].settings.domainStrategy = newValue;