diff options
| author | MHSanaei <ho3ein.sanaei@gmail.com> | 2024-02-19 23:04:25 +0300 |
|---|---|---|
| committer | MHSanaei <ho3ein.sanaei@gmail.com> | 2024-02-19 23:04:25 +0300 |
| commit | 02239c8f2d727d4149e45c4b31b92ea1ea3bb424 (patch) | |
| tree | 99dbe50d2d58b173af9b4092d0601773c7ac7c37 /web/html/xui/xray.html | |
| parent | 70b3db074aa6c82182219aa13f048d41632d8ed0 (diff) | |
[xray] dns - new
Co-Authored-By: Alireza Ahmadi <alireza7@gmail.com>
Diffstat (limited to 'web/html/xui/xray.html')
| -rw-r--r-- | web/html/xui/xray.html | 125 |
1 files changed, 121 insertions, 4 deletions
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> |
