Skip to content

Commit a6cbc2c

Browse files
kunishclaude
andcommitted
feat: make proxy preview auto-switch threshold configurable (#1817)
Add a configurable threshold for switching between list and dot preview modes in auto mode, replacing the hardcoded value of 10. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent f67ceb1 commit a6cbc2c

File tree

6 files changed

+25
-1
lines changed

6 files changed

+25
-1
lines changed

components/ProxyNodePreview.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ const isOff = computed(
1616
() => configStore.proxiesPreviewType === PROXIES_PREVIEW_TYPE.OFF,
1717
)
1818
19-
const isSmallGroup = computed(() => props.proxyNameList.length <= 10)
19+
const isSmallGroup = computed(
20+
() => props.proxyNameList.length <= configStore.proxiesPreviewAutoThreshold,
21+
)
2022
2123
const isShowBar = computed(() => {
2224
const type = configStore.proxiesPreviewType

i18n/locales/en.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"auto": "Auto",
5757
"off": "Off",
5858
"proxiesPreviewType": "Proxies Preview Type",
59+
"proxiesPreviewAutoThreshold": "Auto Switch Threshold",
5960
"proxiesDisplayMode": "Display Mode",
6061
"cardMode": "Card",
6162
"listMode": "List",

i18n/locales/ru.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"auto": "Авто",
5757
"off": "Выкл",
5858
"proxiesPreviewType": "Тип предпросмотра прокси",
59+
"proxiesPreviewAutoThreshold": "Порог автопереключения",
5960
"proxiesDisplayMode": "Режим отображения",
6061
"cardMode": "Карточки",
6162
"listMode": "Список",

i18n/locales/zh.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
"auto": "自适应",
5757
"off": "关闭",
5858
"proxiesPreviewType": "节点组预览样式",
59+
"proxiesPreviewAutoThreshold": "自适应切换阈值",
5960
"proxiesDisplayMode": "节点显示模式",
6061
"cardMode": "卡片",
6162
"listMode": "列表",

pages/proxies.vue

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -866,6 +866,20 @@ const ProviderProxyNodes = defineComponent({
866866
{{ t('off') }}
867867
</option>
868868
</select>
869+
870+
<template
871+
v-if="configStore.proxiesPreviewType === PROXIES_PREVIEW_TYPE.Auto"
872+
>
873+
<ConfigTitle with-divider>
874+
{{ t('proxiesPreviewAutoThreshold') }}
875+
</ConfigTitle>
876+
<input
877+
v-model.number="configStore.proxiesPreviewAutoThreshold"
878+
class="input-bordered input w-full"
879+
type="number"
880+
min="1"
881+
/>
882+
</template>
869883
</div>
870884

871885
<div>

stores/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ export const useConfigStore = defineStore('config', () => {
3535
'proxiesPreviewType',
3636
PROXIES_PREVIEW_TYPE.Auto,
3737
)
38+
const proxiesPreviewAutoThreshold = useLocalStorage<number>(
39+
'proxiesPreviewAutoThreshold',
40+
10,
41+
)
3842
const proxiesOrderingType = useLocalStorage<PROXIES_ORDERING_TYPE>(
3943
'proxiesOrderingType',
4044
PROXIES_ORDERING_TYPE.NATURAL,
@@ -166,6 +170,7 @@ export const useConfigStore = defineStore('config', () => {
166170
favNightTheme,
167171
// Proxies
168172
proxiesPreviewType,
173+
proxiesPreviewAutoThreshold,
169174
proxiesOrderingType,
170175
proxiesDisplayMode,
171176
renderProxiesInTwoColumns,

0 commit comments

Comments
 (0)