Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/MHSanaei/3x-ui.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHamidreza Ghavami <hamid.r.gh.1998@gmail.com>2023-04-18 09:53:43 +0300
committerHamidreza Ghavami <hamid.r.gh.1998@gmail.com>2023-04-18 09:53:43 +0300
commitf3fe866af283d2efd45e4bb8886f752dcfc8d393 (patch)
tree59a5489696a6a693304dbb0bdfba88ef0a2027ec /web/html/xui/setting.html
parent25e50aa6f1b31218b0b70d1fb796f93ef770e152 (diff)
change settings to use refactored function in setting.html
Diffstat (limited to 'web/html/xui/setting.html')
-rw-r--r--web/html/xui/setting.html429
1 files changed, 276 insertions, 153 deletions
diff --git a/web/html/xui/setting.html b/web/html/xui/setting.html
index 72a53251..54d54d72 100644
--- a/web/html/xui/setting.html
+++ b/web/html/xui/setting.html
@@ -355,178 +355,301 @@ const app = new Vue({
this.checkRequiredOutbounds();
}
},
- async mounted() {
- await this.getAllSetting();
- while (true) {
- await PromiseUtil.sleep(1000);
- 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) },
+ async mounted() {
+ await this.getAllSetting();
+ while (true) {
+ await PromiseUtil.sleep(1000);
+ this.saveBtnDisable = this.oldAllSetting.equals(this.allSetting);
+ }
},
- 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
+ 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) },
},
- },
- 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
+ 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
+ },
},
- },
- 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
+ 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
+ },
},
- },
- 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
- }
- }
+ 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 () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "protocol",
+ data: this.settingsData.protocols.bittorrent
});
- }
- return torrentFilter
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "protocol",
+ data: this.settingsData.protocols.bittorrent
+ });
+ },
},
- 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);
+ privateIpSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "ip",
+ data: this.settingsData.ips.local
});
- }
- this.templateSettings = newTemplateSettings
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "ip",
+ data: this.settingsData.ips.local
+ });
+ },
},
- },
- 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
- }
- }
+ AdsSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.ads
});
- }
- return localIpFilter
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.ads
+ });
+ },
},
- 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);
+ PornSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.porn
});
- }
- this.templateSettings = newTemplateSettings
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.porn
+ });
+ },
},
- },
- IRIpSettings: {
- get: function () {
- localIpFilter = false
- if(this.templateSettings != null){
- this.templateSettings.routing.rules.forEach(routingRule => {
- if(routingRule.hasOwnProperty("ip")){
- if (routingRule.ip[0] === "geoip:ir" && routingRule.outboundTag == "blocked"){
- localIpFilter = true
- }
- }
+ GoogleIPv4Settings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "IPv4",
+ property: "domain",
+ data: this.settingsData.domains.google
});
- }
- return localIpFilter
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "IPv4",
+ property: "domain",
+ data: this.settingsData.domains.google
+ });
+ },
},
- set: function (newValue) {
- newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig);
- if (newValue){
- newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"ip\": [\"geoip:ir\"],\"type\": \"field\"}"))
- }
- else {
- newTemplateSettings.routing.rules = [];
- this.templateSettings.routing.rules.forEach(routingRule => {
- if (routingRule.hasOwnProperty('ip')){
- if (routingRule.ip[0] === "geoip:ir" && routingRule.outboundTag == "blocked"){
- return;
- }
- }
- newTemplateSettings.routing.rules.push(routingRule);
+ NetflixIPv4Settings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "IPv4",
+ property: "domain",
+ data: this.settingsData.domains.netflix
});
- }
- this.templateSettings = newTemplateSettings
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "IPv4",
+ property: "domain",
+ data: this.settingsData.domains.netflix
+ });
+ },
},
- },
- IRdomainSettings: {
- get: function () {
- localdomainFilter = false
- if(this.templateSettings != null){
- this.templateSettings.routing.rules.forEach(routingRule => {
- if(routingRule.hasOwnProperty("domain")){
- if ((routingRule.domain[0] === "regexp:.+.ir$" || routingRule.domain[0] === "ext:iran.dat:ir" || routingRule.domain[0] === "ext:iran.dat:other") && routingRule.outboundTag == "blocked") {
- localdomainFilter = true
- }
- }
+ IRIpSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "ip",
+ data: this.settingsData.ips.ir
});
- }
- return localdomainFilter
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "ip",
+ data: this.settingsData.ips.ir
+ });
+ },
},
- set: function (newValue) {
- newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig);
- if (newValue){
- newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"domain\": [\"regexp:.+.ir$\", \"ext:iran.dat:ir\", \"ext:iran.dat:other\"],\"type\": \"field\"}"))
- }
- else {
- newTemplateSettings.routing.rules = [];
- this.templateSettings.routing.rules.forEach(routingRule => {
- if (routingRule.hasOwnProperty('domain')){
- if ((routingRule.domain[0] === "regexp:.+.ir$" || routingRule.domain[0] === "ext:iran.dat:ir" || routingRule.domain[0] === "ext:iran.dat:other") && routingRule.outboundTag == "blocked"){
- return;
- }
- }
- newTemplateSettings.routing.rules.push(routingRule);
+ IRDomainSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.ir
});
- }
- this.templateSettings = newTemplateSettings
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.ir
+ });
+ },
},
- },
-
- }
- });
+ ChinaIpSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "ip",
+ data: this.settingsData.ips.cn
+ });
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "ip",
+ data: this.settingsData.ips.cn
+ });
+ },
+ },
+ ChinaDomainSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.cn
+ });
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "blocked",
+ property: "domain",
+ data: this.settingsData.domains.cn
+ });
+ },
+ },
+ GoogleWARPSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.google
+ });
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.google
+ });
+ },
+ },
+ OpenAIWARPSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.openai
+ });
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.openai
+ });
+ },
+ },
+ NetflixWARPSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.netflix
+ });
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.netflix
+ });
+ },
+ },
+ SpotifyWARPSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.spotify
+ });
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.spotify
+ });
+ },
+ },
+ IRWARPSettings: {
+ get: function () {
+ return this.templateRuleGetter({
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.ir
+ });
+ },
+ set: function (newValue) {
+ this.templateRuleSetter({
+ newValue,
+ outboundTag: "WARP",
+ property: "domain",
+ data: this.settingsData.domains.ir
+ });
+ },
+ },
+ }
+ });
-</script>
+ </script>
</body>
-</html> \ No newline at end of file
+
+</html>