From 9cc893a39611a9458af68692fb82f49bd374f1a2 Mon Sep 17 00:00:00 2001 From: Alireza Ahmadi Date: Wed, 6 Dec 2023 14:35:17 +0100 Subject: [PATCH] [bug] fix routing dns strategy #668 --- 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 5e64ae87..31d4feeb 100644 --- a/web/html/xui/xray.html +++ b/web/html/xui/xray.html @@ -925,15 +925,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;