Revert to doAllItemsExist

This commit is contained in:
Hamidreza Ghavami
2023-05-16 14:16:23 +04:30
parent 57e297d6cf
commit a99035bd3d

View File

@@ -403,14 +403,6 @@
this.saveBtnDisable = true;
}
},
doAllItemsExist(array1, array2) {
for (let i = 0; i < array1.length; i++) {
if (!array2.includes(array1[i])) {
return false;
}
}
return true;
},
syncRulesWithOutbound(tag, setting) {
const newTemplateSettings = this.templateSettings;
const haveRules = newTemplateSettings.routing.rules.some((r) => r?.outboundTag === tag);
@@ -606,7 +598,7 @@
},
torrentSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.protocols.bittorrent, this.blockedProtocols);
return doAllItemsExist(this.settingsData.protocols.bittorrent, this.blockedProtocols);
},
set: function (newValue) {
if (newValue) {
@@ -618,7 +610,7 @@
},
privateIpSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.ips.local, this.blockedIPs);
return doAllItemsExist(this.settingsData.ips.local, this.blockedIPs);
},
set: function (newValue) {
if (newValue) {
@@ -630,7 +622,7 @@
},
AdsSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.ads, this.blockedDomains);
return doAllItemsExist(this.settingsData.domains.ads, this.blockedDomains);
},
set: function (newValue) {
if (newValue) {
@@ -643,7 +635,7 @@
familyProtectSettings: {
get: function () {
if (!this.templateSettings || !this.templateSettings.dns || !this.templateSettings.dns.servers) return false;
return this.doAllItemsExist(this.templateSettings.dns.servers, this.settingsData.familyProtectDNS.servers);
return doAllItemsExist(this.templateSettings.dns.servers, this.settingsData.familyProtectDNS.servers);
},
set: function (newValue) {
newTemplateSettings = this.templateSettings;
@@ -657,7 +649,7 @@
},
GoogleIPv4Settings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.google, this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" }));
return doAllItemsExist(this.settingsData.domains.google, this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" }));
},
set: function (newValue) {
oldData = this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" });
@@ -676,7 +668,7 @@
},
NetflixIPv4Settings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.netflix, this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" }));
return doAllItemsExist(this.settingsData.domains.netflix, this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" }));
},
set: function (newValue) {
oldData = this.templateRuleGetter({ outboundTag: "IPv4", property: "domain" });
@@ -695,7 +687,7 @@
},
IRIpSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.ips.ir, this.blockedIPs);
return doAllItemsExist(this.settingsData.ips.ir, this.blockedIPs);
},
set: function (newValue) {
if (newValue) {
@@ -707,7 +699,7 @@
},
IRDomainSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.ir, this.blockedDomains);
return doAllItemsExist(this.settingsData.domains.ir, this.blockedDomains);
},
set: function (newValue) {
if (newValue) {
@@ -719,7 +711,7 @@
},
ChinaIpSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.ips.cn, this.blockedIPs);
return doAllItemsExist(this.settingsData.ips.cn, this.blockedIPs);
},
set: function (newValue) {
if (newValue) {
@@ -731,7 +723,7 @@
},
ChinaDomainSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.cn, this.blockedDomains);
return doAllItemsExist(this.settingsData.domains.cn, this.blockedDomains);
},
set: function (newValue) {
if (newValue) {
@@ -743,7 +735,7 @@
},
RussiaIpSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.ips.ru, this.blockedIPs);
return doAllItemsExist(this.settingsData.ips.ru, this.blockedIPs);
},
set: function (newValue) {
if (newValue) {
@@ -755,7 +747,7 @@
},
RussiaDomainSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.ru, this.blockedDomains);
return doAllItemsExist(this.settingsData.domains.ru, this.blockedDomains);
},
set: function (newValue) {
if (newValue) {
@@ -767,7 +759,7 @@
},
IRIpDirectSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.ips.ir, this.directIPs);
return doAllItemsExist(this.settingsData.ips.ir, this.directIPs);
},
set: function (newValue) {
if (newValue) {
@@ -779,7 +771,7 @@
},
IRDomainDirectSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.ir, this.directDomains);
return doAllItemsExist(this.settingsData.domains.ir, this.directDomains);
},
set: function (newValue) {
if (newValue) {
@@ -791,7 +783,7 @@
},
ChinaIpDirectSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.ips.cn, this.directIPs);
return doAllItemsExist(this.settingsData.ips.cn, this.directIPs);
},
set: function (newValue) {
if (newValue) {
@@ -803,7 +795,7 @@
},
ChinaDomainDirectSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.cn, this.directDomains);
return doAllItemsExist(this.settingsData.domains.cn, this.directDomains);
},
set: function (newValue) {
if (newValue) {
@@ -815,7 +807,7 @@
},
RussiaIpDirectSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.ips.ru, this.directIPs);
return doAllItemsExist(this.settingsData.ips.ru, this.directIPs);
},
set: function (newValue) {
if (newValue) {
@@ -827,7 +819,7 @@
},
RussiaDomainDirectSettings: {
get: function () {
return this.doAllItemsExist(this.settingsData.domains.ru, this.directDomains);
return doAllItemsExist(this.settingsData.domains.ru, this.directDomains);
},
set: function (newValue) {
if (newValue) {