fix(panel): read outbound protocol ids case-insensitively everywhere (#6523)

Six more readers compared an outbound's protocol id exactly while the core
lowercases it, so an outbound spelled "Blackhole" passed every
excludeBlackhole filter (offered as an mtproto egress, a dialerProxy
target and the geodata download egress, all of which then drop the
traffic) and one spelled "Freedom" was queued by Test All Outbounds. They
now share isOutboundProtocol.
This commit is contained in:
BlindMaster24
2026-09-14 16:02:58 +03:00
committed by GitHub
parent 39ce7cbc22
commit c0c2dd274c
8 changed files with 123 additions and 8 deletions
@@ -0,0 +1,28 @@
import { describe, expect, it } from 'vitest';
import { isOutboundProtocol } from '@/schemas/primitives';
// xray-core lowercases a protocol id in LoadWithID before it resolves the
// handler, so every panel reader has to accept the spellings it accepts.
describe('isOutboundProtocol', () => {
it.each([
['canonical', { protocol: 'freedom' }],
['capitalised', { protocol: 'Freedom' }],
['upper', { protocol: 'FREEDOM' }],
['mixed', { protocol: 'fReEdOm' }],
])('matches a %s id', (_name, outbound) => {
expect(isOutboundProtocol(outbound, 'freedom')).toBe(true);
});
it.each([
['another protocol', { protocol: 'blackhole' }],
['another spelling of another protocol', { protocol: 'Blackhole' }],
['missing', {}],
['empty', { protocol: '' }],
['not a string', { protocol: 42 }],
['null', null],
['undefined', undefined],
])('rejects %s', (_name, outbound) => {
expect(isOutboundProtocol(outbound, 'freedom')).toBe(false);
});
});