2024-02-19 23:04:25 +03:00
|
|
|
{{define "dnsModal"}}
|
2024-04-20 21:45:36 +03:00
|
|
|
<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:8} }" :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 icon="plus" 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 icon="minus" 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>
|
2024-02-19 23:04:25 +03:00
|
|
|
</a-modal>
|
|
|
|
<script>
|
2024-04-20 21:45:36 +03:00
|
|
|
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 ?? "",
|
|
|
|
domains: [],
|
|
|
|
queryStrategy: 'UseIP',
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
this.dnsServer = {
|
2024-02-19 23:04:25 +03:00
|
|
|
address: "localhost",
|
|
|
|
domains: [],
|
|
|
|
queryStrategy: 'UseIP',
|
|
|
|
}
|
2024-04-20 21:45:36 +03:00
|
|
|
}
|
|
|
|
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
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
2024-02-19 23:04:25 +03:00
|
|
|
</script>
|
2024-04-20 21:45:36 +03:00
|
|
|
{{end}}
|