去掉解释性提示和链条上的类型标注
链条回到纯名字。类型标注和「某某组自己决定选中哪一条」那句解释是我上一版加的, 用来说明为什么那一层点不了——但不能点的东西本来就没画出来,解释一个看不见的东西 只是噪音。 默认入站那条压成一句,内核未连接那条压成四个字,没有附加规则时整行不显示而不是 显示一个破折号。shared 里跟着没人用的 autoDecidedHops 一并删掉。
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { describe, expect, it } from 'bun:test'
|
||||
import { acceptsManualChoice, autoDecidedHops, lastSwitchableGroup, resolveChain } from './outbound-chain.ts'
|
||||
import { acceptsManualChoice, lastSwitchableGroup, resolveChain } from './outbound-chain.ts'
|
||||
import type { RuntimeNode } from './outbound-chain.ts'
|
||||
|
||||
/**
|
||||
@@ -97,13 +97,3 @@ describe('找出用户能换选中的那一层', () => {
|
||||
})
|
||||
})
|
||||
|
||||
describe('哪几层是自动决定的', () => {
|
||||
it('列出来,界面用它解释为什么这一层点不了', () => {
|
||||
const chain = resolveChain(runtime, 'PROXY')
|
||||
expect(autoDecidedHops(runtime, chain)).toEqual([{ name: 'AUTO', type: 'URLTest' }])
|
||||
})
|
||||
|
||||
it('线路本身不算——它不是组,本来就没得选', () => {
|
||||
expect(autoDecidedHops(runtime, ['[vless]Gomami'])).toEqual([])
|
||||
})
|
||||
})
|
||||
|
||||
@@ -79,17 +79,3 @@ export function lastSwitchableGroup(
|
||||
return null
|
||||
}
|
||||
|
||||
/**
|
||||
* 链条上那些自动决定选中结果的组。
|
||||
*
|
||||
* 界面用它来解释「为什么这一层点不了」——不说清楚的话,用户看到链条里有个组却没法
|
||||
* 操作,只会以为是坏了。
|
||||
*/
|
||||
export function autoDecidedHops(
|
||||
runtime: Record<string, RuntimeNode>,
|
||||
chain: string[],
|
||||
): Array<{ name: string; type: string }> {
|
||||
return chain
|
||||
.map((name) => ({ name, type: runtime[name]?.type ?? '' }))
|
||||
.filter((hop) => hop.type !== '' && !acceptsManualChoice(hop.type) && runtime[hop.name]?.all)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user