From 96786c94189f3d2f3f04c1915529c786228bdf42 Mon Sep 17 00:00:00 2001 From: MHSanaei Date: Fri, 17 Mar 2023 19:37:49 +0330 Subject: alireza --- web/html/xui/setting.html | 120 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 118 insertions(+), 2 deletions(-) (limited to 'web/html/xui/setting.html') diff --git a/web/html/xui/setting.html b/web/html/xui/setting.html index cbbdce1f..17f76cb0 100644 --- a/web/html/xui/setting.html +++ b/web/html/xui/setting.html @@ -20,7 +20,7 @@ display: block; } - :not(.ant-card-dark)>.ant-tabs-top-bar { + :not(.ant-card-dark)>.ant-tabs-top-bar { background: white; } @@ -56,6 +56,7 @@ ref="selectLang" v-model="lang" @change="setLang(lang)" + :dropdown-class-name="siderDrawer.isDarkTheme ? 'ant-card-dark' : ''" style="width: 100%" > @@ -87,13 +88,28 @@ style="max-width: 300px"> - + {{ i18n "confirm" }} + + + {{ i18n "pages.setting.advancedTemplate"}} + + + + + + + + + + + + {{ i18n "pages.setting.completeTemplate"}} @@ -103,6 +119,10 @@ + + + + @@ -189,6 +209,102 @@ this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting); } }, + computed: { + templateSettings: { + get: function () { return this.allSetting.xrayTemplateConfig ? JSON.parse(this.allSetting.xrayTemplateConfig) : null ; }, + set: function (newValue) { this.allSetting.xrayTemplateConfig = JSON.stringify(newValue, null, 2) }, + }, + inboundSettings: { + get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.inbounds, null, 2) : null; }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.inbounds = JSON.parse(newValue) + this.templateSettings = newTemplateSettings + }, + }, + outboundSettings: { + get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.outbounds, null, 2) : null; }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.outbounds = JSON.parse(newValue) + this.templateSettings = newTemplateSettings + }, + }, + routingRuleSettings: { + get: function () { return this.templateSettings ? JSON.stringify(this.templateSettings.routing.rules, null, 2) : null; }, + set: function (newValue) { + newTemplateSettings = this.templateSettings; + newTemplateSettings.routing.rules = JSON.parse(newValue) + this.templateSettings = newTemplateSettings + }, + }, + torrentSettings: { + get: function () { + torrentFilter = false + if(this.templateSettings != null){ + this.templateSettings.routing.rules.forEach(routingRule => { + if(routingRule.hasOwnProperty("protocol")){ + if (routingRule.protocol[0] === "bittorrent" && routingRule.outboundTag == "blocked"){ + torrentFilter = true + } + } + }); + } + return torrentFilter + }, + set: function (newValue) { + newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig); + if (newValue){ + newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"protocol\": [\"bittorrent\"],\"type\": \"field\"}")) + } + else { + newTemplateSettings.routing.rules = []; + this.templateSettings.routing.rules.forEach(routingRule => { + if (routingRule.hasOwnProperty('protocol')){ + if (routingRule.protocol[0] === "bittorrent" && routingRule.outboundTag == "blocked"){ + return; + } + } + newTemplateSettings.routing.rules.push(routingRule); + }); + } + this.templateSettings = newTemplateSettings + }, + }, + privateIpSettings: { + get: function () { + localIpFilter = false + if(this.templateSettings != null){ + this.templateSettings.routing.rules.forEach(routingRule => { + if(routingRule.hasOwnProperty("ip")){ + if (routingRule.ip[0] === "geoip:private" && routingRule.outboundTag == "blocked"){ + localIpFilter = true + } + } + }); + } + return localIpFilter + }, + set: function (newValue) { + newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig); + if (newValue){ + newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"ip\": [\"geoip:private\"],\"type\": \"field\"}")) + } + else { + newTemplateSettings.routing.rules = []; + this.templateSettings.routing.rules.forEach(routingRule => { + if (routingRule.hasOwnProperty('ip')){ + if (routingRule.ip[0] === "geoip:private" && routingRule.outboundTag == "blocked"){ + return; + } + } + newTemplateSettings.routing.rules.push(routingRule); + }); + } + this.templateSettings = newTemplateSettings + }, + }, + } }); -- cgit v1.2.3