mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-04-19 13:32:24 +00:00
Direct Sub Json - geoIP, geoSite
This commit is contained in:
parent
7c892ac051
commit
c30c6f08f3
11 changed files with 63 additions and 23 deletions
|
@ -380,9 +380,14 @@
|
|||
</a-col>
|
||||
</a-row>
|
||||
<a-collapse v-if="enableDirect" style="margin-top: 14px;">
|
||||
<a-collapse-panel header='{{ i18n "pages.settings.directSett"}}'>
|
||||
<a-collapse-panel header='Geo IP'>
|
||||
<a-list-item style="padding: 10px 20px">
|
||||
<a-checkbox-group v-model="directCountries" name="Countries" :options="countryOptions"></a-checkbox-group>
|
||||
<a-checkbox-group v-model="geoIP" name="Geo IP" :options="geoIPOptions"></a-checkbox-group>
|
||||
</a-list-item>
|
||||
</a-collapse-panel>
|
||||
<a-collapse-panel header='Geo Site'>
|
||||
<a-list-item style="padding: 10px 20px">
|
||||
<a-checkbox-group v-model="geoSite" name="Geo Site" :options="geoSiteOptions"></a-checkbox-group>
|
||||
</a-list-item>
|
||||
</a-collapse-panel>
|
||||
</a-collapse>
|
||||
|
@ -458,8 +463,7 @@
|
|||
type: "field",
|
||||
outboundTag: "direct",
|
||||
domain: [
|
||||
"geosite:category-ir",
|
||||
"geosite:cn"
|
||||
"geosite:category-ir"
|
||||
],
|
||||
"enabled": true
|
||||
},
|
||||
|
@ -468,17 +472,30 @@
|
|||
outboundTag: "direct",
|
||||
ip: [
|
||||
"geoip:private",
|
||||
"geoip:ir",
|
||||
"geoip:cn"
|
||||
"geoip:ir"
|
||||
],
|
||||
enabled: true
|
||||
},
|
||||
],
|
||||
countryOptions: [
|
||||
geoIPOptions: [
|
||||
{ label: 'Private IP/Domain', value: 'private' },
|
||||
{ label: '🇮🇷 Iran', value: 'ir' },
|
||||
{ label: '🇨🇳 China', value: 'cn' },
|
||||
{ label: '🇷🇺 Russia', value: 'ru' },
|
||||
{ label: '🇻🇳 Vietnam', value: 'vn' },
|
||||
{ label: '🇪🇸 Spain', value: 'es' },
|
||||
{ label: '🇮🇩 Indonesia', value: 'id' },
|
||||
{ label: '🇺🇦 Ukraine', value: 'ua' },
|
||||
{ label: '🇹🇷 Türkiye', value: 'tr' },
|
||||
{ label: '🇧🇷 Brazil', value: 'br' },
|
||||
],
|
||||
geoSiteOptions: [
|
||||
{ label: '🇮🇷 Iran', value: 'ir' },
|
||||
{ label: '🇨🇳 China', value: 'cn' },
|
||||
{ label: '🇷🇺 Russia', value: 'ru' },
|
||||
{ label: 'Apple', value: 'apple' },
|
||||
{ label: 'Meta', value: 'meta' },
|
||||
{ label: 'Google', value: 'google' },
|
||||
],
|
||||
get remarkModel() {
|
||||
rm = this.allSetting.remarkModel;
|
||||
|
@ -730,26 +747,49 @@
|
|||
this.allSetting.subJsonRules = v ? JSON.stringify(this.defaultRules) : "";
|
||||
}
|
||||
},
|
||||
directCountries: {
|
||||
geoIP: {
|
||||
get: function () {
|
||||
if (!this.enableDirect) return [];
|
||||
rules = JSON.parse(this.allSetting.subJsonRules);
|
||||
const rules = JSON.parse(this.allSetting.subJsonRules);
|
||||
return Array.isArray(rules) ? rules[1].ip.map(d => d.replace("geoip:", "")) : [];
|
||||
},
|
||||
set: function (v) {
|
||||
rules = JSON.parse(this.allSetting.subJsonRules);
|
||||
const rules = JSON.parse(this.allSetting.subJsonRules);
|
||||
if (!Array.isArray(rules)) return;
|
||||
rules[0].domain = [];
|
||||
|
||||
rules[1].ip = [];
|
||||
v.forEach(d => {
|
||||
rules[1].ip.push("geoip:" + d);
|
||||
});
|
||||
this.allSetting.subJsonRules = JSON.stringify(rules);
|
||||
}
|
||||
},
|
||||
geoSite: {
|
||||
get: function () {
|
||||
if (!this.enableDirect) return [];
|
||||
const rules = JSON.parse(this.allSetting.subJsonRules);
|
||||
return Array.isArray(rules) ?
|
||||
rules[0].domain.map(d => {
|
||||
if (d.startsWith("geosite:category-")) {
|
||||
return d.replace("geosite:category-", "");
|
||||
}
|
||||
return d.replace("geosite:", "");
|
||||
})
|
||||
: [];
|
||||
},
|
||||
set: function (v) {
|
||||
const rules = JSON.parse(this.allSetting.subJsonRules);
|
||||
if (!Array.isArray(rules)) return;
|
||||
|
||||
rules[0].domain = [];
|
||||
v.forEach(d => {
|
||||
let category = '';
|
||||
if (["cn", "private"].includes(d)) {
|
||||
if (["cn", "apple", "meta", "google"].includes(d)) {
|
||||
category = "";
|
||||
} else if (["ru", "ir"].includes(d)) {
|
||||
category = "category-";
|
||||
}
|
||||
rules[0].domain.push("geosite:" + category + d);
|
||||
rules[1].ip.push("geoip:" + d);
|
||||
});
|
||||
this.allSetting.subJsonRules = JSON.stringify(rules);
|
||||
}
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Mux Settings"
|
||||
"direct" = "Direct Connection"
|
||||
"directDesc" = "Directly establishes connections with domains or IP ranges of a specific country."
|
||||
"directSett" = "Direct Connection Options"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Xray Configs"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Configuración Mux"
|
||||
"direct" = "Conexión Directa"
|
||||
"directDesc" = "Establece conexiones directas con dominios o rangos de IP de un país específico."
|
||||
"directSett" = "Opciones de Conexión Directa"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Xray Configuración"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "تنظیمات ماکس"
|
||||
"direct" = "اتصال مستقیم"
|
||||
"directDesc" = "به طور مستقیم با دامنه ها یا محدوده آیپی یک کشور خاص ارتباط برقرار می کند"
|
||||
"directSett" = "گزینه های اتصال مستقیم"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "پیکربندی ایکسری"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Pengaturan Mux"
|
||||
"direct" = "Koneksi langsung"
|
||||
"directDesc" = "Secara langsung membuat koneksi dengan domain atau rentang IP negara tertentu."
|
||||
"directSett" = "Opsi Koneksi Langsung"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Konfigurasi Xray"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Configurações de Mux"
|
||||
"direct" = "Conexão Direta"
|
||||
"directDesc" = "Estabelece conexões diretamente com domínios ou intervalos de IP de um país específico."
|
||||
"directSett" = "Opções de Conexão Direta"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Configurações Xray"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Mux Настройки"
|
||||
"direct" = "Прямая связь"
|
||||
"directDesc" = "Напрямую устанавливает соединения с доменами или диапазонами IP конкретной страны."
|
||||
"directSett" = "Варианты прямого подключения"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Настройки Xray"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Mux Ayarları"
|
||||
"direct" = "Doğrudan Bağlantı"
|
||||
"directDesc" = "Belirli bir ülkenin alan adları veya IP aralıkları ile doğrudan bağlantı kurar."
|
||||
"directSett" = "Doğrudan Bağlantı Seçenekleri"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Xray Yapılandırmaları"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Налаштування Mux"
|
||||
"direct" = "Пряме підключення"
|
||||
"directDesc" = "Безпосередньо встановлює з’єднання з доменами або діапазонами IP певної країни."
|
||||
"directSett" = "Параметри прямого підключення"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Xray конфігурації"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "Mux Cài đặt"
|
||||
"direct" = "Kết nối trực tiếp"
|
||||
"directDesc" = "Trực tiếp thiết lập kết nối với tên miền hoặc dải IP của một quốc gia cụ thể."
|
||||
"directSett" = "Tùy chọn kết nối trực tiếp"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Cài đặt Xray"
|
||||
|
|
|
@ -316,7 +316,7 @@
|
|||
"muxSett" = "复用器设置"
|
||||
"direct" = "直接连接"
|
||||
"directDesc" = "直接与特定国家的域或IP范围建立连接"
|
||||
"directSett" = "直接连接选项"
|
||||
|
||||
|
||||
[pages.xray]
|
||||
"title" = "Xray 配置"
|
||||
|
|
Loading…
Reference in a new issue