Skip to content

Commit

Permalink
feat: 域名解析支持自定义 DoH(需新版后端)
Browse files Browse the repository at this point in the history
  • Loading branch information
xream committed Jun 20, 2024
1 parent 37b4bf6 commit c122d4d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sub-store-front-end",
"version": "2.14.246",
"version": "2.14.247",
"private": true,
"scripts": {
"dev": "vite --host",
Expand Down
2 changes: 1 addition & 1 deletion src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ export default {
'Resolve Domain Operator': {
label: 'Resolve Domain',
des: 'Providers(can be controlled by the node field "_no-resolve")',
options: ['Google', 'IP-API', 'Cloudflare', 'Ali', 'Tencent'],
options: ['Google', 'IP-API', 'Cloudflare', 'Ali', 'Tencent', 'Custom'],
types: ['IPv4', 'IPv6', 'IP4P'],
filters: ['Disabled', 'Remove Failed', 'IP Only', 'IPv4 Only', 'IPv6 Only'],
cache: ['Enabled', 'Disabled'],
Expand Down
2 changes: 1 addition & 1 deletion src/locales/zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export default {
'Resolve Domain Operator': {
label: '域名解析',
des: '提供商(可由节点字段 "_no-resolve" 控制)',
options: ['Google', 'IP-API', 'Cloudflare', 'Ali', 'Tencent'],
options: ['Google', 'IP-API', 'Cloudflare', 'Ali', 'Tencent', '自定义'],
types: ['IPv4', 'IPv6', 'IP4P'],
filters: ['不过滤', '移除失败', '只保留 IP', '只保留 IPv4', '只保留 IPv6'],
cache: ['启用', '禁用'],
Expand Down
28 changes: 25 additions & 3 deletions src/views/editor/components/ActionRadio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@
<div class="radio-wrapper options-radio">
<nut-radiogroup direction="horizontal" v-model="value">
<nut-radio v-for="(key, index) in opt[type]" :label="key" :key="index"
>{{
>
<div class="input-wrapper" v-if="type === 'Resolve Domain Operator' && value==='Custom' && key==='Custom'">
<nut-input placeholder="目前仅支持 DoH" v-model="rdoUrl" />
</div>
<div v-else>
{{
$t(`editorPage.subConfig.nodeActions['${type}'].options[${index}]`)
}}
</div>
</nut-radio>
</nut-radiogroup>
</div>
Expand All @@ -24,6 +30,7 @@
</nut-radio>
</nut-radiogroup>
</div>

<div class="radio-wrapper options-radio">
<p class="des-label">过滤结果</p>
<nut-radiogroup direction="horizontal" v-model="rdoFilter">
Expand Down Expand Up @@ -92,7 +99,7 @@
const opt = {
'Flag Operator': ['add', 'remove'],
'Sort Operator': ['asc', 'desc', 'random'],
'Resolve Domain Operator': ['Google', 'IP-API', 'Cloudflare', 'Ali', 'Tencent'],
'Resolve Domain Operator': ['Google', 'IP-API', 'Cloudflare', 'Ali', 'Tencent', 'Custom'],
};
const foTwOpt = ['cn', 'ws', 'tw'];
Expand All @@ -118,6 +125,7 @@
const rdoType = ref('IPv4');
const rdoFilter = ref('disabled');
const rdoCache = ref('enabled');
const rdoUrl = ref('');
const showTwTips = () => {
Toast.text('免责声明: 本操作仅将 Emoji 旗帜进行替换以便于显示, 不包含任何政治意味');
Expand Down Expand Up @@ -160,13 +168,14 @@
rdoType.value = item.args?.type ?? 'IPv4';
rdoFilter.value = item.args?.filter ?? 'disabled';
rdoCache.value = item.args?.cache ?? 'enabled';
rdoUrl.value = item.args?.url ?? '';
break;
}
}
});
// 值变化时实时修改 form 的数据
watch([value, rdoFilter, rdoCache, rdoType, foTw], () => {
watch([value, rdoFilter, rdoCache, rdoUrl, rdoType, foTw], () => {
if (['IPv6', 'IP4P'].includes(rdoType.value) && ['IP-API'].includes(value.value)) {
showNotify({
title: `${value.value} 不支持 ${rdoType.value}`,
Expand All @@ -190,6 +199,7 @@
type: rdoType.value,
filter: rdoFilter.value,
cache: rdoCache.value,
url: rdoUrl.value,
};
break;
}
Expand Down Expand Up @@ -221,4 +231,16 @@
display: grid;
grid-template-columns: 1fr 1fr 1fr;
}
.input-wrapper {
display: flex;
align-items: center;
> view.nut-input {
background: transparent;
padding: 8px 12px;
margin-right: 16px;
border-bottom: 1px solid var(--lowest-text-color);
color: var(--second-text-color);
}
}
</style>

0 comments on commit c122d4d

Please sign in to comment.