|
23 | 23 | <p class="des-label"> |
24 | 24 | {{ $t(`editorPage.subConfig.nodeActions['${type}'].customDns`) }} |
25 | 25 | </p> |
26 | | - <div |
27 | | - v-if="shouldUseCompactCustomDnsTextarea" |
28 | | - class="input-wrapper compact-textarea-wrapper compact-textarea-wrapper--custom-dns" |
29 | | - > |
| 26 | + <div class="input-wrapper compact-textarea-wrapper compact-textarea-wrapper--custom-dns"> |
30 | 27 | <nut-textarea |
31 | 28 | :placeholder="$t(`editorPage.subConfig.nodeActions['${type}'].customDnsPlaceholder`)" |
32 | 29 | :rows="2" |
33 | 30 | :autosize="{ minHeight: 40 }" |
34 | 31 | v-model="rdoUrl" |
35 | 32 | /> |
36 | 33 | </div> |
37 | | - <div |
38 | | - v-else |
39 | | - class="input-wrapper compact-input-wrapper compact-input-wrapper--custom-dns" |
40 | | - > |
41 | | - <nut-input |
42 | | - :placeholder="$t(`editorPage.subConfig.nodeActions['${type}'].customDnsPlaceholder`)" |
43 | | - v-model="rdoUrl" |
44 | | - /> |
45 | | - </div> |
46 | 34 | </div> |
47 | 35 | <div |
48 | 36 | v-if="value === 'Custom'" |
|
66 | 54 | </nut-radio> |
67 | 55 | </nut-radiogroup> |
68 | 56 | </div> |
| 57 | + <div |
| 58 | + v-if="value === 'Custom'" |
| 59 | + class="radio-wrapper options-radio inline-input-option" |
| 60 | + > |
| 61 | + <p class="des-label">{{ $t(`editorPage.subConfig.nodeActions['${type}'].dnsConcurrency`) }}</p> |
| 62 | + <div class="input-wrapper compact-input-wrapper compact-input-wrapper--concurrency"> |
| 63 | + <nut-input |
| 64 | + type="number" |
| 65 | + :placeholder="$t(`editorPage.subConfig.nodeActions['${type}'].dnsConcurrencyPlaceholder`)" |
| 66 | + v-model="rdoDnsConcurrency" |
| 67 | + /> |
| 68 | + </div> |
| 69 | + </div> |
69 | 70 | <div class="radio-wrapper options-radio edns-input-option"> |
70 | 71 | <p class="des-label">EDNS(Google, Ali, Tencent, 自定义 DNS 会携带此参数, 可能会影响解析结果)</p> |
71 | 72 | <div class="input-wrapper compact-input-wrapper compact-input-wrapper--edns"> |
72 | 73 | <nut-input placeholder="请输入纯 IP, 默认为 223.6.6.6" v-model="rdoEdns" /> |
73 | 74 | </div> |
74 | 75 | </div> |
| 76 | + <div class="radio-wrapper options-radio inline-input-option"> |
| 77 | + <p class="des-label">{{ $t(`editorPage.subConfig.nodeActions['${type}'].timeout`) }}</p> |
| 78 | + <div class="input-wrapper compact-input-wrapper compact-input-wrapper--concurrency"> |
| 79 | + <nut-input |
| 80 | + type="number" |
| 81 | + :placeholder="$t(`editorPage.subConfig.nodeActions['${type}'].timeoutPlaceholder`)" |
| 82 | + v-model="rdoTimeout" |
| 83 | + /> |
| 84 | + </div> |
| 85 | + </div> |
75 | 86 | <div class="radio-wrapper options-radio inline-input-option"> |
76 | 87 | <p class="des-label">{{ $t(`editorPage.subConfig.nodeActions['${type}'].concurrency`) }}</p> |
77 | 88 | <div class="input-wrapper compact-input-wrapper compact-input-wrapper--concurrency"> |
|
82 | 93 | /> |
83 | 94 | </div> |
84 | 95 | </div> |
85 | | - <div class="radio-wrapper options-radio"> |
| 96 | + <div class="radio-wrapper options-radio rdo-type-option"> |
86 | 97 | <p class="des-label" style="cursor: pointer" @click="rdoTypeInfo">解析类型(IPv6 兼容 IP4P <font-awesome-icon icon="fa-solid fa-circle-question"/>)</p> |
87 | 98 | <nut-radiogroup direction="horizontal" v-model="rdoType"> |
88 | 99 | <nut-radio v-for="(key, index) in rdoTypeOpt" :label="key" :key="index" |
|
114 | 125 | </nut-radio> |
115 | 126 | </nut-radiogroup> |
116 | 127 | </div> |
| 128 | + <div |
| 129 | + v-if="rdoCache === 'enabled'" |
| 130 | + class="radio-wrapper options-radio inline-input-option" |
| 131 | + > |
| 132 | + <p class="des-label">{{ $t(`editorPage.subConfig.nodeActions['${type}'].cacheTtl`) }}</p> |
| 133 | + <div class="input-wrapper compact-input-wrapper compact-input-wrapper--concurrency"> |
| 134 | + <nut-input |
| 135 | + type="number" |
| 136 | + :placeholder="$t(`editorPage.subConfig.nodeActions['${type}'].cacheTtlPlaceholder`)" |
| 137 | + v-model="rdoCacheTtl" |
| 138 | + /> |
| 139 | + </div> |
| 140 | + </div> |
117 | 141 | </template> |
118 | 142 | <template v-if="type === 'Flag Operator' && foNewVersion && value === 'add'"> |
119 | 143 | <div class="radio-wrapper options-radio"> |
|
140 | 164 | import semverGt from 'semver/functions/gt'; |
141 | 165 | import { useAppNotifyStore } from '@/store/appNotify'; |
142 | 166 | import { storeToRefs } from 'pinia'; |
143 | | - import { useWideScreenNarrowMode } from '@/hooks/useWideScreenNarrowMode'; |
144 | 167 | import { useGlobalStore } from '@/store/global'; |
145 | | - import { computed, inject, onMounted, ref, watch } from 'vue'; |
| 168 | + import { inject, onMounted, ref, watch } from 'vue'; |
146 | 169 | import tw from '@/assets/icons/tw.png'; |
147 | 170 |
|
148 | 171 | const globalStore = useGlobalStore(); |
149 | 172 |
|
150 | 173 | const { showNotify } = useAppNotifyStore(); |
151 | 174 |
|
152 | 175 | const { env } = storeToRefs(globalStore); |
153 | | - const { isWideScreen, isWideScreenNarrowModeActive } = useWideScreenNarrowMode(); |
154 | | - const shouldUseCompactCustomDnsTextarea = computed( |
155 | | - () => !isWideScreen.value || isWideScreenNarrowModeActive.value |
156 | | - ); |
157 | 176 |
|
158 | 177 | const { type, id } = defineProps<{ |
159 | 178 | type: string; |
|
197 | 216 | const rdoTlsSkipCertVerify = ref('disabled'); |
198 | 217 | const rdoUrl = ref(''); |
199 | 218 | const rdoEdns = ref(''); |
| 219 | + const rdoDnsConcurrency = ref(''); |
200 | 220 | const rdoConcurrency = ref(''); |
| 221 | + const rdoTimeout = ref(''); |
| 222 | + const rdoCacheTtl = ref(''); |
201 | 223 |
|
202 | 224 | const normalizeRdoConcurrency = () => { |
203 | 225 | const value = `${rdoConcurrency.value ?? ''}`.trim(); |
|
208 | 230 | return `${value ?? ''}`.trim(); |
209 | 231 | }; |
210 | 232 |
|
| 233 | + const normalizeRdoDnsConcurrency = () => { |
| 234 | + const value = `${rdoDnsConcurrency.value ?? ''}`.trim(); |
| 235 | + return value || undefined; |
| 236 | + }; |
| 237 | +
|
| 238 | + const getInitialRdoDnsConcurrency = (value) => { |
| 239 | + return `${value ?? ''}`.trim(); |
| 240 | + }; |
| 241 | +
|
| 242 | + const normalizeRdoTimeout = () => { |
| 243 | + const value = `${rdoTimeout.value ?? ''}`.trim(); |
| 244 | + return value || undefined; |
| 245 | + }; |
| 246 | +
|
| 247 | + const getInitialRdoTimeout = (value) => { |
| 248 | + return `${value ?? ''}`.trim(); |
| 249 | + }; |
| 250 | +
|
| 251 | + const normalizeRdoCacheTtl = () => { |
| 252 | + const value = `${rdoCacheTtl.value ?? ''}`.trim(); |
| 253 | + return value || undefined; |
| 254 | + }; |
| 255 | +
|
| 256 | + const getInitialRdoCacheTtl = (value) => { |
| 257 | + return `${value ?? ''}`.trim(); |
| 258 | + }; |
| 259 | +
|
211 | 260 | const showTwTips = () => { |
212 | 261 | Toast.text('免责声明: 本操作仅将 Emoji 旗帜进行替换以便于显示, 不包含任何政治意味'); |
213 | 262 | }; |
|
256 | 305 | item.args?.tlsSkipCertVerify ?? 'disabled'; |
257 | 306 | rdoUrl.value = item.args?.url ?? ''; |
258 | 307 | rdoEdns.value = item.args?.edns; |
| 308 | + rdoDnsConcurrency.value = getInitialRdoDnsConcurrency( |
| 309 | + item.args?.dnsConcurrency |
| 310 | + ); |
259 | 311 | rdoConcurrency.value = getInitialRdoConcurrency(item.args?.concurrency); |
| 312 | + rdoTimeout.value = getInitialRdoTimeout(item.args?.timeout); |
| 313 | + rdoCacheTtl.value = getInitialRdoCacheTtl(item.args?.cacheTtl); |
260 | 314 | break; |
261 | 315 | } |
262 | 316 | } |
|
270 | 324 | rdoTlsSkipCertVerify, |
271 | 325 | rdoUrl, |
272 | 326 | rdoEdns, |
| 327 | + rdoDnsConcurrency, |
273 | 328 | rdoConcurrency, |
| 329 | + rdoTimeout, |
| 330 | + rdoCacheTtl, |
274 | 331 | rdoType, |
275 | 332 | foTw, |
276 | 333 | ], () => { |
|
300 | 357 | tlsSkipCertVerify: rdoTlsSkipCertVerify.value, |
301 | 358 | url: rdoUrl.value, |
302 | 359 | edns: rdoEdns.value, |
| 360 | + dnsConcurrency: normalizeRdoDnsConcurrency(), |
303 | 361 | concurrency: normalizeRdoConcurrency(), |
| 362 | + timeout: normalizeRdoTimeout(), |
| 363 | + cacheTtl: |
| 364 | + rdoCache.value === 'enabled' |
| 365 | + ? normalizeRdoCacheTtl() |
| 366 | + : undefined, |
304 | 367 | }; |
305 | 368 | break; |
306 | 369 | } |
|
408 | 471 | flex: 0 1 280px; |
409 | 472 | max-width: 280px; |
410 | 473 | } |
| 474 | + .custom-dns-input-option { |
| 475 | + margin-top: 8px; |
| 476 | + } |
| 477 | + .tls-skip-cert-option { |
| 478 | + margin-top: 10px; |
| 479 | + } |
411 | 480 | .custom-dns-input-option, |
412 | 481 | .tls-skip-cert-option, |
413 | 482 | .edns-input-option { |
|
431 | 500 | min-width: 0; |
432 | 501 | } |
433 | 502 | } |
| 503 | + .rdo-type-option { |
| 504 | + margin-top: 10px; |
| 505 | + } |
434 | 506 | </style> |
0 commit comments