删掉出站模式的写方向

界面上做「出站模式三选一」的计划经讨论废弃:全局档等价于既有的专属组,
直连留在卡片里是即时动作,规则档的真实需求(内网豁免、按站点分流)属于
之后的附加规则功能。outboundToProxyField 自此确定没有调用方。读方向保留,
手写配置里的 DIRECT/GLOBAL 仍要认得和显示。
This commit is contained in:
2026-08-11 16:03:08 +08:00
parent 4da501ded6
commit a44f410074
2 changed files with 4 additions and 26 deletions
+1 -16
View File
@@ -8,7 +8,6 @@ import {
fallbackTarget,
isUnsetOutbound,
outboundLabel,
outboundToProxyField,
OUTBOUND_PRESETS,
resolveDestination,
} from './inbounds.ts'
@@ -92,12 +91,6 @@ describe('出站去向的四种形态', () => {
expect(of('AUTO')).toEqual({ kind: 'named', name: 'AUTO' })
})
it('写回时能还原成原来的字段值', () => {
expect(outboundToProxyField({ kind: 'rules' })).toBeUndefined()
expect(outboundToProxyField({ kind: 'direct' })).toBe('DIRECT')
expect(outboundToProxyField({ kind: 'global' })).toBe('GLOBAL')
expect(outboundToProxyField({ kind: 'named', name: 'AUTO' })).toBe('AUTO')
})
})
describe('能被入站引用的出站名字', () => {
@@ -149,7 +142,7 @@ describe('流量最终去哪', () => {
})
})
describe('出站预设表是读写显示三者的唯一约定', () => {
describe('出站预设表是读取和显示的唯一约定', () => {
it('每种预设的字段值和标签一一对应', () => {
expect(OUTBOUND_PRESETS.map((p) => [p.mode.kind, p.field, p.label])).toEqual([
['rules', undefined, 'RULE'],
@@ -158,14 +151,6 @@ describe('出站预设表是读写显示三者的唯一约定', () => {
])
})
it('从配置读出来再写回去,值不变', () => {
// 这条是防止「显示的」和「写进文件的」跑偏:任何一种模式转一圈都要回到原值
for (const preset of OUTBOUND_PRESETS) {
expect(outboundToProxyField(preset.mode)).toBe(preset.field)
}
expect(outboundToProxyField({ kind: 'named', name: 'AUTO' })).toBe('AUTO')
})
it('界面上的名字用配置里的原词', () => {
expect(outboundLabel({ kind: 'rules' })).toBe('RULE')
expect(outboundLabel({ kind: 'direct' })).toBe('DIRECT')