fix direct on json sub for ru

vn has been removed
This commit is contained in:
mhsanaei 2024-04-02 23:43:16 +03:30
parent c147636133
commit 6d364638ca

View file

@ -389,9 +389,9 @@
saveBtnDisable: true, saveBtnDisable: true,
user: {}, user: {},
lang: getLang(), lang: getLang(),
remarkModels: {i:'Inbound',e:'Email',o:'Other'}, remarkModels: { i: 'Inbound', e: 'Email', o: 'Other' },
remarkSeparators: [' ','-','_','@',':','~','|',',','.','/'], remarkSeparators: [' ', '-', '_', '@', ':', '~', '|', ',', '.', '/'],
datepickerList: [{name:'Gregorian (Standard)', value: 'gregorian'}, {name:'Jalalian (شمسی)', value: 'jalalian'}], datepickerList: [{ name: 'Gregorian (Standard)', value: 'gregorian' }, { name: 'Jalalian (شمسی)', value: 'jalalian' }],
remarkSample: '', remarkSample: '',
defaultFragment: { defaultFragment: {
tag: "fragment", tag: "fragment",
@ -443,11 +443,10 @@
{ label: '🇮🇷 Iran', value: 'ir' }, { label: '🇮🇷 Iran', value: 'ir' },
{ label: '🇨🇳 China', value: 'cn' }, { label: '🇨🇳 China', value: 'cn' },
{ label: '🇷🇺 Russia', value: 'ru' }, { label: '🇷🇺 Russia', value: 'ru' },
{ label: '🇻🇳 Vietnam', value: 'vn' },
], ],
get remarkModel() { get remarkModel() {
rm = this.allSetting.remarkModel; rm = this.allSetting.remarkModel;
return rm.length>1 ? rm.substring(1).split('') : []; return rm.length > 1 ? rm.substring(1).split('') : [];
}, },
set remarkModel(value) { set remarkModel(value) {
rs = this.allSetting.remarkModel[0]; rs = this.allSetting.remarkModel[0];
@ -467,7 +466,7 @@
set datepicker(value) { set datepicker(value) {
this.allSetting.datepicker = value; this.allSetting.datepicker = value;
}, },
changeRemarkSample(){ changeRemarkSample() {
sample = [] sample = []
this.remarkModel.forEach(r => sample.push(this.remarkModels[r])); this.remarkModel.forEach(r => sample.push(this.remarkModels[r]));
this.remarkSample = sample.length == 0 ? '' : sample.join(this.remarkSeparator); this.remarkSample = sample.length == 0 ? '' : sample.join(this.remarkSeparator);
@ -573,15 +572,15 @@
}, },
computed: { computed: {
fragment: { fragment: {
get: function() { return this.allSetting?.subJsonFragment != ""; }, get: function () { return this.allSetting?.subJsonFragment != ""; },
set: function (v) { set: function (v) {
this.allSetting.subJsonFragment = v ? JSON.stringify(this.defaultFragment) : ""; this.allSetting.subJsonFragment = v ? JSON.stringify(this.defaultFragment) : "";
} }
}, },
fragmentPackets: { fragmentPackets: {
get: function() { return this.fragment ? JSON.parse(this.allSetting.subJsonFragment).settings.fragment.packets : ""; }, get: function () { return this.fragment ? JSON.parse(this.allSetting.subJsonFragment).settings.fragment.packets : ""; },
set: function(v) { set: function (v) {
if (v != ""){ if (v != "") {
newFragment = JSON.parse(this.allSetting.subJsonFragment); newFragment = JSON.parse(this.allSetting.subJsonFragment);
newFragment.settings.fragment.packets = v; newFragment.settings.fragment.packets = v;
this.allSetting.subJsonFragment = JSON.stringify(newFragment); this.allSetting.subJsonFragment = JSON.stringify(newFragment);
@ -589,9 +588,9 @@
} }
}, },
fragmentLength: { fragmentLength: {
get: function() { return this.fragment ? JSON.parse(this.allSetting.subJsonFragment).settings.fragment.length : ""; }, get: function () { return this.fragment ? JSON.parse(this.allSetting.subJsonFragment).settings.fragment.length : ""; },
set: function(v) { set: function (v) {
if (v != ""){ if (v != "") {
newFragment = JSON.parse(this.allSetting.subJsonFragment); newFragment = JSON.parse(this.allSetting.subJsonFragment);
newFragment.settings.fragment.length = v; newFragment.settings.fragment.length = v;
this.allSetting.subJsonFragment = JSON.stringify(newFragment); this.allSetting.subJsonFragment = JSON.stringify(newFragment);
@ -599,9 +598,9 @@
} }
}, },
fragmentInterval: { fragmentInterval: {
get: function() { return this.fragment ? JSON.parse(this.allSetting.subJsonFragment).settings.fragment.interval : ""; }, get: function () { return this.fragment ? JSON.parse(this.allSetting.subJsonFragment).settings.fragment.interval : ""; },
set: function(v) { set: function (v) {
if (v != ""){ if (v != "") {
newFragment = JSON.parse(this.allSetting.subJsonFragment); newFragment = JSON.parse(this.allSetting.subJsonFragment);
newFragment.settings.fragment.interval = v; newFragment.settings.fragment.interval = v;
this.allSetting.subJsonFragment = JSON.stringify(newFragment); this.allSetting.subJsonFragment = JSON.stringify(newFragment);
@ -609,46 +608,46 @@
} }
}, },
enableMux: { enableMux: {
get: function() { return this.allSetting?.subJsonMux != ""; }, get: function () { return this.allSetting?.subJsonMux != ""; },
set: function (v) { set: function (v) {
this.allSetting.subJsonMux = v ? JSON.stringify(this.defaultMux) : ""; this.allSetting.subJsonMux = v ? JSON.stringify(this.defaultMux) : "";
} }
}, },
muxConcurrency: { muxConcurrency: {
get: function() { return this.enableMux ? JSON.parse(this.allSetting.subJsonMux).concurrency : -1; }, get: function () { return this.enableMux ? JSON.parse(this.allSetting.subJsonMux).concurrency : -1; },
set: function(v) { set: function (v) {
newMux = JSON.parse(this.allSetting.subJsonMux); newMux = JSON.parse(this.allSetting.subJsonMux);
newMux.concurrency = v; newMux.concurrency = v;
this.allSetting.subJsonMux = JSON.stringify(newMux); this.allSetting.subJsonMux = JSON.stringify(newMux);
} }
}, },
muxXudpConcurrency: { muxXudpConcurrency: {
get: function() { return this.enableMux ? JSON.parse(this.allSetting.subJsonMux).xudpConcurrency : -1; }, get: function () { return this.enableMux ? JSON.parse(this.allSetting.subJsonMux).xudpConcurrency : -1; },
set: function(v) { set: function (v) {
newMux = JSON.parse(this.allSetting.subJsonMux); newMux = JSON.parse(this.allSetting.subJsonMux);
newMux.xudpConcurrency = v; newMux.xudpConcurrency = v;
this.allSetting.subJsonMux = JSON.stringify(newMux); this.allSetting.subJsonMux = JSON.stringify(newMux);
} }
}, },
muxXudpProxyUDP443: { muxXudpProxyUDP443: {
get: function() { return this.enableMux ? JSON.parse(this.allSetting.subJsonMux).xudpProxyUDP443 : "reject"; }, get: function () { return this.enableMux ? JSON.parse(this.allSetting.subJsonMux).xudpProxyUDP443 : "reject"; },
set: function(v) { set: function (v) {
newMux = JSON.parse(this.allSetting.subJsonMux); newMux = JSON.parse(this.allSetting.subJsonMux);
newMux.xudpProxyUDP443 = v; newMux.xudpProxyUDP443 = v;
this.allSetting.subJsonMux = JSON.stringify(newMux); this.allSetting.subJsonMux = JSON.stringify(newMux);
} }
}, },
enableDirect: { enableDirect: {
get: function() { return this.allSetting?.subJsonRules != ""; }, get: function () { return this.allSetting?.subJsonRules != ""; },
set: function (v) { set: function (v) {
this.allSetting.subJsonRules = v ? JSON.stringify(this.defaultRules) : ""; this.allSetting.subJsonRules = v ? JSON.stringify(this.defaultRules) : "";
} }
}, },
directCountries: { directCountries: {
get: function() { get: function () {
if (!this.enableDirect) return []; if (!this.enableDirect) return [];
rules = JSON.parse(this.allSetting.subJsonRules); rules = JSON.parse(this.allSetting.subJsonRules);
return Array.isArray(rules) ? rules[1].ip.map(d => d.replace("geoip:","")) : []; return Array.isArray(rules) ? rules[1].ip.map(d => d.replace("geoip:", "")) : [];
}, },
set: function (v) { set: function (v) {
rules = JSON.parse(this.allSetting.subJsonRules); rules = JSON.parse(this.allSetting.subJsonRules);
@ -656,25 +655,32 @@
rules[0].domain = []; rules[0].domain = [];
rules[1].ip = []; rules[1].ip = [];
v.forEach(d => { v.forEach(d => {
category = ["cn","private"].includes(d) ? "" : "category-"; let category = '';
rules[0].domain.push("geosite:"+category+d); if (["cn", "private"].includes(d)) {
rules[1].ip.push("geoip:"+d); category = "";
} else if (d === 'ru') {
category = "category-gov-";
} else {
category = "category-";
}
rules[0].domain.push("geosite:" + category + d);
rules[1].ip.push("geoip:" + d);
}); });
this.allSetting.subJsonRules = JSON.stringify(rules); this.allSetting.subJsonRules = JSON.stringify(rules);
} }
}, },
confAlerts: { confAlerts: {
get: function() { get: function () {
if (!this.allSetting) return []; if (!this.allSetting) return [];
var alerts = [] var alerts = []
if (window.location.protocol !== "https:") alerts.push('{{ i18n "secAlertSSL" }}'); if (window.location.protocol !== "https:") alerts.push('{{ i18n "secAlertSSL" }}');
if (this.allSetting.webPort == 54321) alerts.push('{{ i18n "secAlertPanelPort" }}'); if (this.allSetting.webPort == 54321) alerts.push('{{ i18n "secAlertPanelPort" }}');
panelPath = window.location.pathname.split('/').length<4 panelPath = window.location.pathname.split('/').length < 4
if (panelPath && this.allSetting.webBasePath == '/') alerts.push('{{ i18n "secAlertPanelURI" }}'); if (panelPath && this.allSetting.webBasePath == '/') alerts.push('{{ i18n "secAlertPanelURI" }}');
if (this.allSetting.subEnable) { if (this.allSetting.subEnable) {
subPath = this.allSetting.subURI.length >0 ? new URL(this.allSetting.subURI).pathname : this.allSetting.subPath; subPath = this.allSetting.subURI.length > 0 ? new URL(this.allSetting.subURI).pathname : this.allSetting.subPath;
if (subPath == '/sub/') alerts.push('{{ i18n "secAlertSubURI" }}'); if (subPath == '/sub/') alerts.push('{{ i18n "secAlertSubURI" }}');
subJsonPath = this.allSetting.subJsonURI.length >0 ? new URL(this.allSetting.subJsonURI).pathname : this.allSetting.subJsonPath; subJsonPath = this.allSetting.subJsonURI.length > 0 ? new URL(this.allSetting.subJsonURI).pathname : this.allSetting.subJsonPath;
if (subJsonPath == '/json/') alerts.push('{{ i18n "secAlertSubJsonURI" }}'); if (subJsonPath == '/json/') alerts.push('{{ i18n "secAlertSubJsonURI" }}');
} }
return alerts return alerts