mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-07-01 20:42:07 +00:00
change settings to use refactored function in setting.html
This commit is contained in:
parent
25e50aa6f1
commit
f3fe866af2
1 changed files with 295 additions and 172 deletions
|
@ -393,140 +393,263 @@ const app = new Vue({
|
||||||
},
|
},
|
||||||
torrentSettings: {
|
torrentSettings: {
|
||||||
get: function () {
|
get: function () {
|
||||||
torrentFilter = false
|
return this.templateRuleGetter({
|
||||||
if(this.templateSettings != null){
|
outboundTag: "blocked",
|
||||||
this.templateSettings.routing.rules.forEach(routingRule => {
|
property: "protocol",
|
||||||
if(routingRule.hasOwnProperty("protocol")){
|
data: this.settingsData.protocols.bittorrent
|
||||||
if (routingRule.protocol[0] === "bittorrent" && routingRule.outboundTag == "blocked"){
|
|
||||||
torrentFilter = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return torrentFilter
|
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig);
|
this.templateRuleSetter({
|
||||||
if (newValue){
|
newValue,
|
||||||
newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"protocol\": [\"bittorrent\"],\"type\": \"field\"}"))
|
outboundTag: "blocked",
|
||||||
}
|
property: "protocol",
|
||||||
else {
|
data: this.settingsData.protocols.bittorrent
|
||||||
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: {
|
privateIpSettings: {
|
||||||
get: function () {
|
get: function () {
|
||||||
localIpFilter = false
|
return this.templateRuleGetter({
|
||||||
if(this.templateSettings != null){
|
outboundTag: "blocked",
|
||||||
this.templateSettings.routing.rules.forEach(routingRule => {
|
property: "ip",
|
||||||
if(routingRule.hasOwnProperty("ip")){
|
data: this.settingsData.ips.local
|
||||||
if (routingRule.ip[0] === "geoip:private" && routingRule.outboundTag == "blocked"){
|
|
||||||
localIpFilter = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return localIpFilter
|
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig);
|
this.templateRuleSetter({
|
||||||
if (newValue){
|
newValue,
|
||||||
newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"ip\": [\"geoip:private\"],\"type\": \"field\"}"))
|
outboundTag: "blocked",
|
||||||
}
|
property: "ip",
|
||||||
else {
|
data: this.settingsData.ips.local
|
||||||
newTemplateSettings.routing.rules = [];
|
});
|
||||||
this.templateSettings.routing.rules.forEach(routingRule => {
|
},
|
||||||
if (routingRule.hasOwnProperty('ip')){
|
},
|
||||||
if (routingRule.ip[0] === "geoip:private" && routingRule.outboundTag == "blocked"){
|
AdsSettings: {
|
||||||
return;
|
get: function () {
|
||||||
}
|
return this.templateRuleGetter({
|
||||||
}
|
outboundTag: "blocked",
|
||||||
newTemplateSettings.routing.rules.push(routingRule);
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.ads
|
||||||
|
});
|
||||||
|
},
|
||||||
|
set: function (newValue) {
|
||||||
|
this.templateRuleSetter({
|
||||||
|
newValue,
|
||||||
|
outboundTag: "blocked",
|
||||||
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.ads
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
PornSettings: {
|
||||||
|
get: function () {
|
||||||
|
return this.templateRuleGetter({
|
||||||
|
outboundTag: "blocked",
|
||||||
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.porn
|
||||||
|
});
|
||||||
|
},
|
||||||
|
set: function (newValue) {
|
||||||
|
this.templateRuleSetter({
|
||||||
|
newValue,
|
||||||
|
outboundTag: "blocked",
|
||||||
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.porn
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
GoogleIPv4Settings: {
|
||||||
|
get: function () {
|
||||||
|
return this.templateRuleGetter({
|
||||||
|
outboundTag: "IPv4",
|
||||||
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.google
|
||||||
|
});
|
||||||
|
},
|
||||||
|
set: function (newValue) {
|
||||||
|
this.templateRuleSetter({
|
||||||
|
newValue,
|
||||||
|
outboundTag: "IPv4",
|
||||||
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.google
|
||||||
|
});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
NetflixIPv4Settings: {
|
||||||
|
get: function () {
|
||||||
|
return this.templateRuleGetter({
|
||||||
|
outboundTag: "IPv4",
|
||||||
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.netflix
|
||||||
|
});
|
||||||
|
},
|
||||||
|
set: function (newValue) {
|
||||||
|
this.templateRuleSetter({
|
||||||
|
newValue,
|
||||||
|
outboundTag: "IPv4",
|
||||||
|
property: "domain",
|
||||||
|
data: this.settingsData.domains.netflix
|
||||||
});
|
});
|
||||||
}
|
|
||||||
this.templateSettings = newTemplateSettings
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
IRIpSettings: {
|
IRIpSettings: {
|
||||||
get: function () {
|
get: function () {
|
||||||
localIpFilter = false
|
return this.templateRuleGetter({
|
||||||
if(this.templateSettings != null){
|
outboundTag: "blocked",
|
||||||
this.templateSettings.routing.rules.forEach(routingRule => {
|
property: "ip",
|
||||||
if(routingRule.hasOwnProperty("ip")){
|
data: this.settingsData.ips.ir
|
||||||
if (routingRule.ip[0] === "geoip:ir" && routingRule.outboundTag == "blocked"){
|
|
||||||
localIpFilter = true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return localIpFilter
|
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig);
|
this.templateRuleSetter({
|
||||||
if (newValue){
|
newValue,
|
||||||
newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"ip\": [\"geoip:ir\"],\"type\": \"field\"}"))
|
outboundTag: "blocked",
|
||||||
}
|
property: "ip",
|
||||||
else {
|
data: this.settingsData.ips.ir
|
||||||
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);
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
this.templateSettings = newTemplateSettings
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
IRdomainSettings: {
|
IRDomainSettings: {
|
||||||
get: function () {
|
get: function () {
|
||||||
localdomainFilter = false
|
return this.templateRuleGetter({
|
||||||
if(this.templateSettings != null){
|
outboundTag: "blocked",
|
||||||
this.templateSettings.routing.rules.forEach(routingRule => {
|
property: "domain",
|
||||||
if(routingRule.hasOwnProperty("domain")){
|
data: this.settingsData.domains.ir
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
return localdomainFilter
|
|
||||||
},
|
},
|
||||||
set: function (newValue) {
|
set: function (newValue) {
|
||||||
newTemplateSettings = JSON.parse(this.allSetting.xrayTemplateConfig);
|
this.templateRuleSetter({
|
||||||
if (newValue){
|
newValue,
|
||||||
newTemplateSettings.routing.rules.push(JSON.parse("{\"outboundTag\": \"blocked\",\"domain\": [\"regexp:.+.ir$\", \"ext:iran.dat:ir\", \"ext:iran.dat:other\"],\"type\": \"field\"}"))
|
outboundTag: "blocked",
|
||||||
}
|
property: "domain",
|
||||||
else {
|
data: this.settingsData.domains.ir
|
||||||
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"){
|
ChinaIpSettings: {
|
||||||
return;
|
get: function () {
|
||||||
}
|
return this.templateRuleGetter({
|
||||||
}
|
outboundTag: "blocked",
|
||||||
newTemplateSettings.routing.rules.push(routingRule);
|
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
|
||||||
});
|
});
|
||||||
}
|
|
||||||
this.templateSettings = newTemplateSettings
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
Loading…
Reference in a new issue