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:
authorMHSanaei <ho3ein.sanaei@gmail.com>2024-02-19 23:04:25 +0300
committerMHSanaei <ho3ein.sanaei@gmail.com>2024-02-19 23:04:25 +0300
commit02239c8f2d727d4149e45c4b31b92ea1ea3bb424 (patch)
tree99dbe50d2d58b173af9b4092d0601773c7ac7c37
parent70b3db074aa6c82182219aa13f048d41632d8ed0 (diff)
[xray] dns - new
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
-rw-r--r--web/html/xui/dns_modal.html86
-rw-r--r--web/html/xui/xray.html125
-rw-r--r--web/html/xui/xray_reverse_modal.html2
-rw-r--r--web/translation/translate.en_US.toml9
-rw-r--r--web/translation/translate.es_ES.toml9
-rw-r--r--web/translation/translate.fa_IR.toml9
-rw-r--r--web/translation/translate.id_ID.toml9
-rw-r--r--web/translation/translate.ru_RU.toml9
-rw-r--r--web/translation/translate.vi_VN.toml9
-rw-r--r--web/translation/translate.zh_Hans.toml9
10 files changed, 270 insertions, 6 deletions
diff --git a/web/html/xui/dns_modal.html b/web/html/xui/dns_modal.html
new file mode 100644
index 00000000..8b687ab2
--- /dev/null
+++ b/web/html/xui/dns_modal.html
@@ -0,0 +1,86 @@
+{{define "dnsModal"}}
+<a-modal id="dns-modal" v-model="dnsModal.visible" :title="dnsModal.title" @ok="dnsModal.ok"
+ :closable="true" :mask-closable="false"
+ :ok-text="dnsModal.okText" cancel-text='{{ i18n "close" }}' :class="themeSwitcher.currentTheme">
+ <a-form :colon="false" :label-col="{ md: {span:6} }" :wrapper-col="{ md: {span:14} }">
+ <a-form-item label='{{ i18n "pages.xray.outbound.address" }}'>
+ <a-input v-model.trim="dnsModal.dnsServer.address"></a-input>
+ </a-form-item>
+ <a-form-item label='{{ i18n "pages.xray.dns.domains" }}'>
+ <a-button size="small" type="primary" @click="dnsModal.dnsServer.domains.push('')">+</a-button>
+ <template v-for="(domain, index) in dnsModal.dnsServer.domains">
+ <a-input v-model.trim="dnsModal.dnsServer.domains[index]">
+ <a-button size="small" slot="addonAfter" @click="dnsModal.dnsServer.domains.splice(index,1)">-</a-button>
+ </a-input>
+ </template>
+ </a-form-item>
+ <a-form-item label='{{ i18n "pages.xray.dns.strategy" }}' v-if="isAdvanced">
+ <a-select
+ v-model="dnsModal.dnsServer.queryStrategy"
+ style="width: 100%"
+ :dropdown-class-name="themeSwitcher.currentTheme">
+ <a-select-option :value="l" :label="l" v-for="l in ['UseIP', 'UseIPv4', 'UseIPv6']">
+ [[ l ]]
+ </a-select-option>
+ </a-select>
+ </a-form-item>
+ </a-form>
+</a-modal>
+<script>
+ const dnsModal = {
+ title: '',
+ visible: false,
+ okText: '{{ i18n "confirm" }}',
+ isEdit: false,
+ confirm: null,
+ dnsServer: {
+ address: "localhost",
+ domains: [],
+ queryStrategy: 'UseIP',
+ },
+ ok() {
+ domains = dnsModal.dnsServer.domains.filter(d => d.length>0);
+ dnsModal.dnsServer.domains = domains;
+ newDnsServer = domains.length > 0 ? dnsModal.dnsServer : dnsModal.dnsServer.address;
+ ObjectUtil.execute(dnsModal.confirm, newDnsServer);
+ },
+ show({ title='', okText='{{ i18n "confirm" }}', dnsServer, confirm=(dnsServer)=>{}, isEdit=false }) {
+ this.title = title;
+ this.okText = okText;
+ this.confirm = confirm;
+ this.visible = true;
+ if(isEdit) {
+ if (typeof dnsServer == 'object'){
+ this.dnsServer = dnsServer;
+ } else {
+ this.dnsServer.address = dnsServer?? '';
+ }
+ } else {
+ this.dnsServer = {
+ address: "localhost",
+ domains: [],
+ queryStrategy: 'UseIP',
+ }
+ }
+ this.isEdit = isEdit;
+ },
+ close() {
+ dnsModal.visible = false;
+ },
+ };
+
+ new Vue({
+ delimiters: ['[[', ']]'],
+ el: '#dns-modal',
+ data: {
+ dnsModal: dnsModal,
+ },
+ computed: {
+ isAdvanced: {
+ get: function () { return dnsModal.dnsServer.domains.length>0 }
+ }
+ }
+ });
+
+</script>
+{{end}}
diff --git a/web/html/xui/xray.html b/web/html/xui/xray.html
index 3e6cf851..0ceafeab 100644
--- a/web/html/xui/xray.html
+++ b/web/html/xui/xray.html
@@ -133,12 +133,10 @@
description='{{ i18n "pages.xray.RoutingStrategyDesc" }}' />
</a-col>
<a-col :lg="24" :xl="12">
- <template>
<a-select v-model="routingStrategy" :dropdown-class-name="themeSwitcher.currentTheme"
style="width: 100%">
<a-select-option v-for="s in routingDomainStrategies" :value="s">[[ s ]]</a-select-option>
</a-select>
- </template>
</a-col>
</a-row>
</a-list-item>
@@ -516,6 +514,61 @@
</template>
</a-table>
</a-tab-pane>
+ <a-tab-pane key="tpl-5" tab='DNS' style="padding-top: 20px;" force-render="true">
+ <setting-list-item type="switch" title='{{ i18n "pages.xray.dns.enable" }}' desc='{{ i18n "pages.xray.dns.enableDesc" }}' v-model="enableDNS"></setting-list-item>
+ <template v-if="enableDNS">
+ <a-list-item>
+ <a-row style="padding: 20px">
+ <a-col :lg="24" :xl="12">
+ <a-list-item-meta title='{{ i18n "pages.xray.dns.strategy" }}' description='{{ i18n "pages.xray.dns.strategyDesc" }}' />
+ </a-col>
+ <a-col :lg="24" :xl="12">
+ <a-select
+ v-model="dnsStrategy"
+ style="width: 100%"
+ :dropdown-class-name="themeSwitcher.currentTheme">
+ <a-select-option :value="l" :label="l" v-for="l in ['UseIP', 'UseIPv4', 'UseIPv6']">
+ [[ l ]]
+ </a-select-option>
+ </a-select>
+ </a-col>
+ </a-row>
+ </a-list-item>
+ <a-button type="primary" icon="plus" @click="addDNSServer()" style="margin-bottom: 10px;">{{ i18n "pages.xray.dns.add" }}</a-button>
+ <a-table :columns="dnsColumns" bordered v-if="dnsServers.length>0"
+ :row-key="r => r.key"
+ :data-source="dnsServers"
+ :scroll="isMobile ? {} : { x: 200 }"
+ :pagination="false"
+ :indent-size="0"
+ :style="isMobile ? 'padding: 5px 0' : 'margin-left: 1px;'">
+ <template slot="action" slot-scope="text,dns,index">
+ [[ index+1 ]]
+ <a-dropdown :trigger="['click']">
+ <a-icon @click="e => e.preventDefault()" type="more" style="font-size: 16px; text-decoration: bold;"></a-icon>
+ <a-menu slot="overlay" :theme="themeSwitcher.currentTheme">
+ <a-menu-item @click="editDNSServer(index)">
+ <a-icon type="edit"></a-icon>
+ {{ i18n "edit" }}
+ </a-menu-item>
+ <a-menu-item @click="deleteDNSServer(index)">
+ <span style="color: #FF4D4F">
+ <a-icon type="delete"></a-icon> {{ i18n "delete"}}
+ </span>
+ </a-menu-item>
+ </a-menu>
+ </a-dropdown>
+ </template>
+ <template slot="address" slot-scope="dns,index">
+ <span v-if="typeof dns == 'object'">[[ dns.address ]]</span>
+ <span v-else>[[ dns ]]</span>
+ </template>
+ <template slot="domain" slot-scope="dns,index">
+ <span v-if="typeof dns == 'object'">[[ dns.domains.join(",") ]]</span>
+ </template>
+ </a-table>
+ </template>
+ </a-tab-pane>
<a-tab-pane key="tpl-advanced" tab='{{ i18n "pages.xray.advancedTemplate"}}' style="padding-top: 20px;" force-render="true">
<a-list-item-meta title='{{ i18n "pages.xray.Template"}}' description='{{ i18n "pages.xray.TemplateDesc"}}'></a-list-item-meta>
<a-radio-group v-model="advSettings" @change="changeCode" button-style="solid" style="margin: 10px 0;" :size="isMobile ? 'small' : ''">
@@ -583,6 +636,12 @@
{ title: '{{ i18n "pages.xray.outbound.domain"}}', dataIndex: 'domain', align: 'center', width: 50 },
];
+ const dnsColumns = [
+ { title: "#", align: 'center', width: 20, scopedSlots: { customRender: 'action' } },
+ { title: '{{ i18n "pages.xray.outbound.address"}}', align: 'center', width: 50, scopedSlots: { customRender: 'address' } },
+ { title: '{{ i18n "pages.xray.dns.domains"}}', align: 'center', width: 50, scopedSlots: { customRender: 'domain' } },
+ ];
+
const balancerColumns = [
{ title: "#", align: 'center', width: 20, scopedSlots: { customRender: 'action' } },
{ title: '{{ i18n "pages.xray.balancer.tag"}}', dataIndex: 'tag', align: 'center', width: 50 },
@@ -1158,6 +1217,36 @@
this.templateSettings = newTemplateSettings;
},
+ addDNSServer(){
+ dnsModal.show({
+ title: '{{ i18n "pages.xray.dns.add" }}',
+ confirm: (dnsServer) => {
+ dnsServers = this.dnsServers;
+ dnsServers.push(dnsServer);
+ this.dnsServers = dnsServers;
+ dnsModal.close();
+ },
+ isEdit: false
+ });
+ },
+ editDNSServer(index){
+ dnsModal.show({
+ title: '{{ i18n "pages.xray.dns.edit" }} #' + (index+1),
+ dnsServer: this.dnsServers[index],
+ confirm: (dnsServer) => {
+ dnsServers = this.dnsServers;
+ dnsServers[index] = dnsServer;
+ this.dnsServers = dnsServers;
+ dnsModal.close();
+ },
+ isEdit: true
+ });
+ },
+ deleteDNSServer(index){
+ newDnsServers = this.dnsServers;
+ newDnsServers.splice(index,1);
+ this.dnsServers = newDnsServers;
+ },
addRule(){
ruleModal.show({
title: '{{ i18n "pages.xray.rules.add"}}',
@@ -1499,14 +1588,14 @@
familyProtectSettings: {
get: function () {
if (!this.templateSettings || !this.templateSettings.dns || !this.templateSettings.dns.servers) return false;
- return doAllItemsExist(this.templateSettings.dns.servers, this.settingsData.familyProtectDNS.servers);
+ return doAllItemsExist(this.settingsData.familyProtectDNS.servers, this.templateSettings.dns.servers);
},
set: function (newValue) {
newTemplateSettings = this.templateSettings;
if (newValue) {
newTemplateSettings.dns = this.settingsData.familyProtectDNS;
} else {
- delete newTemplateSettings.dns;
+ newTemplateSettings.dns.servers = newTemplateSettings.dns?.servers?.filter(data => !this.settingsData.familyProtectDNS.servers.includes(data))
}
this.templateSettings = newTemplateSettings;
},
@@ -1780,6 +1869,34 @@
}
},
},
+ enableDNS: {
+ get: function () {
+ return this.templateSettings ? this.templateSettings.dns != null : false;
+ },
+ set: function (newValue) {
+ newTemplateSettings = this.templateSettings;
+ newTemplateSettings.dns = newValue ? { servers: [], queryStrategy: "UseIP" } : null;
+ this.templateSettings = newTemplateSettings;
+ }
+ },
+ dnsStrategy: {
+ get: function () {
+ return this.enableDNS ? this.templateSettings.dns.queryStrategy : null;
+ },
+ set: function (newValue) {
+ newTemplateSettings = this.templateSettings;
+ newTemplateSettings.dns.queryStrategy = newValue;
+ this.templateSettings = newTemplateSettings;
+ }
+ },
+ dnsServers: {
+ get: function () { return this.enableDNS ? this.templateSettings.dns.servers : []; },
+ set: function (newValue) {
+ newTemplateSettings = this.templateSettings;
+ newTemplateSettings.dns.servers = newValue;
+ this.templateSettings = newTemplateSettings;
+ }
+ }
},
});
</script>
diff --git a/web/html/xui/xray_reverse_modal.html b/web/html/xui/xray_reverse_modal.html
index cb4e7037..724c9825 100644
--- a/web/html/xui/xray_reverse_modal.html
+++ b/web/html/xui/xray_reverse_modal.html
@@ -132,8 +132,6 @@
reverseModal: reverseModal,
reverseTypes: { bridge: '{{ i18n "pages.xray.outbound.bridge" }}', portal:'{{ i18n "pages.xray.outbound.portal" }}'},
},
- methods: {
- }
});
</script>
diff --git a/web/translation/translate.en_US.toml b/web/translation/translate.en_US.toml
index 5e1afa9b..354cda48 100644
--- a/web/translation/translate.en_US.toml
+++ b/web/translation/translate.en_US.toml
@@ -449,6 +449,15 @@
"psk" = "PreShared Key"
"domainStrategy" = "Domain Strategy"
+[pages.xray.dns]
+"enable" = "Enable DNS"
+"enableDesc" = "Enable built-in DNS server"
+"strategy" = "Query Strategy"
+"strategyDesc" = "Overall strategy to resolve domain names"
+"add" = "Add Server"
+"edit" = "Edit Server"
+"domains" = "Domains"
+
[pages.settings.security]
"admin" = "Admin"
"secret" = "Secret Token"
diff --git a/web/translation/translate.es_ES.toml b/web/translation/translate.es_ES.toml
index 80d162eb..5fb3eb71 100644
--- a/web/translation/translate.es_ES.toml
+++ b/web/translation/translate.es_ES.toml
@@ -449,6 +449,15 @@
"psk" = "Clave precompartida"
"domainStrategy" = "Estrategia de dominio"
+[pages.xray.dns]
+"enable" = "Habilitar DNS"
+"enableDesc" = "Habilitar servidor DNS integrado"
+"strategy" = "Estrategia de consulta"
+"strategyDesc" = "Estrategia general para resolver nombres de dominio"
+"add" = "Agregar servidor"
+"edit" = "Editar servidor"
+"domains" = "Dominios"
+
[pages.settings.security]
"admin" = "Administrador"
"secret" = "Token Secreto"
diff --git a/web/translation/translate.fa_IR.toml b/web/translation/translate.fa_IR.toml
index 546712fd..ca9241e0 100644
--- a/web/translation/translate.fa_IR.toml
+++ b/web/translation/translate.fa_IR.toml
@@ -449,6 +449,15 @@
"psk" = "کلید مشترک"
"domainStrategy" = "استراتژی حل دامنه"
+[pages.xray.dns]
+"enable" = "فعال کردن حل دامنه"
+"enableDesc" = "سرور حل دامنه داخلی را فعال کنید"
+"strategy" = "استراتژی پرس‌وجو"
+"strategyDesc" = "استراتژی کلی برای حل نام دامنه"
+"add" = "افزودن سرور"
+"edit" = "ویرایش سرور"
+"domains" = "دامنه‌ها"
+
[pages.settings.security]
"admin" = "مدیر"
"secret" = "توکن مخفی"
diff --git a/web/translation/translate.id_ID.toml b/web/translation/translate.id_ID.toml
index cfa0210d..0ee07462 100644
--- a/web/translation/translate.id_ID.toml
+++ b/web/translation/translate.id_ID.toml
@@ -449,6 +449,15 @@
"psk" = "Kunci Pra-Bagi"
"domainStrategy" = "Strategi Domain"
+[pages.xray.dns]
+"enable" = "Aktifkan DNS"
+"enableDesc" = "Aktifkan server DNS bawaan"
+"strategy" = "Strategi Kueri"
+"strategyDesc" = "Strategi keseluruhan untuk menyelesaikan nama domain"
+"add" = "Tambahkan Server"
+"edit" = "Sunting Server"
+"domains" = "Domains"
+
[pages.settings.security]
"admin" = "Admin"
"secret" = "Token Rahasia"
diff --git a/web/translation/translate.ru_RU.toml b/web/translation/translate.ru_RU.toml
index dfb75d4a..ea14a6a5 100644
--- a/web/translation/translate.ru_RU.toml
+++ b/web/translation/translate.ru_RU.toml
@@ -449,6 +449,15 @@
"psk" = "Общий ключ"
"domainStrategy" = "Стратегия домена"
+[pages.xray.dns]
+"enable" = "Включить DNS"
+"enableDesc" = "Включить встроенный DNS-сервер"
+"strategy" = "Стратегия запроса"
+"strategyDesc" = "Общая стратегия разрешения доменных имен"
+"add" = "Добавить сервер"
+"edit" = "Редактировать сервер"
+"domains" = "Домены"
+
[pages.settings.security]
"admin" = "Админ"
"secret" = "Секретный токен"
diff --git a/web/translation/translate.vi_VN.toml b/web/translation/translate.vi_VN.toml
index b6e7fd46..52b655e9 100644
--- a/web/translation/translate.vi_VN.toml
+++ b/web/translation/translate.vi_VN.toml
@@ -449,6 +449,15 @@
"psk" = "Khóa chia sẻ"
"domainStrategy" = "Chiến lược tên miền"
+[pages.xray.dns]
+"enable" = "Kích hoạt DNS"
+"enableDesc" = "Kích hoạt máy chủ DNS tích hợp"
+"strategy" = "Chiến lược truy vấn"
+"strategyDesc" = "Chiến lược tổng thể để phân giải tên miền"
+"add" = "Thêm máy chủ"
+"edit" = "Chỉnh sửa máy chủ"
+"domains" = "Tên miền"
+
[pages.settings.security]
"admin" = "Quản trị viên"
"secret" = "Mã thông báo bí mật"
diff --git a/web/translation/translate.zh_Hans.toml b/web/translation/translate.zh_Hans.toml
index ba37ae92..0f0afc19 100644
--- a/web/translation/translate.zh_Hans.toml
+++ b/web/translation/translate.zh_Hans.toml
@@ -449,6 +449,15 @@
"psk" = "共享密钥"
"domainStrategy" = "域策略"
+[pages.xray.dns]
+"enable" = "启用 DNS"
+"enableDesc" = "启用内置 DNS 服务器"
+"strategy" = "查询策略"
+"strategyDesc" = "解析域名的总体策略"
+"add" = "添加服务器"
+"edit" = "编辑服务器"
+"domains" = "域"
+
[pages.settings.security]
"admin" = "管理员"
"secret" = "密钥"