mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6523] [MERGED] fix(panel): read outbound protocol ids case-insensitively everywhere #6330
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#6330
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/6523
Author: @BlindMaster24
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/outbound-protocol-case-filters📝 Commits (1)
3dfb208fix(panel): read outbound protocol ids case-insensitively everywhere📊 Changes
8 files changed (+123 additions, -8 deletions)
View changed files
📝
frontend/src/api/queries/useOutboundTags.ts(+3 -2)📝
frontend/src/hooks/useXraySetting.ts(+9 -3)📝
frontend/src/pages/index/GeodataSection.tsx(+2 -1)📝
frontend/src/pages/settings/GeneralTab.tsx(+2 -1)📝
frontend/src/pages/xray/outbounds/OutboundsTab.tsx(+2 -1)📝
frontend/src/schemas/primitives/outbound-protocol.ts(+10 -0)➕
frontend/src/test/outbound-protocol-case.test.ts(+28 -0)➕
frontend/src/test/use-outbound-tags.test.tsx(+67 -0)📄 Description
Summary
Six more places read an outbound's protocol id by exact string match, while xray-core lowercases that id before it resolves the handler. An outbound spelled
Blackholetherefore passed everyexcludeBlackholefilter, and one spelledFreedomwas queued by Test All Outbounds. They all now share oneisOutboundProtocolhelper.Why
infra/conf/loader.goin the pinned core lowercases the id inLoadWithID, andinfra/conf/xray.go:329hands itc.Protocolfor every outbound, so the spelling never decides which handler runs. The panel's readers still disagreed with that:api/queries/useOutboundTags.ts(useOutboundTags,useOutboundTagGroups) — the tag lists that offer an egress for an mtproto inbound and for adialerProxy, both requested withexcludeBlackhole.pages/xray/outbounds/OutboundsTab.tsx— thedialerProxypicker in the outbound editor.pages/index/GeodataSection.tsxandpages/settings/GeneralTab.tsx— the geodata download egress pickers.hooks/useXraySetting.ts— the skip list for Test All Outbounds, which exists so direct/DNS/block outbounds are not probed.User story: a config pasted into Xray Settings → JSON with
"protocol": "Blackhole"for the block outbound runs exactly likeblackhole— the core accepts it silently. The block outbound then appears in the mtproto egress dropdown, in thedialerProxylist and in the geodata download picker; choosing it looks like a working selection and discards the traffic, with nothing in the UI or the logs to say why. The mirror image on the same template: a direct outbound spelledFreedomis queued by Test All Outbounds, which probes it as if it were a proxy.Type of change
Areas affected
How was this tested?
frontend/src/test/use-outbound-tags.test.tsxdrives the real hook over a mocked panel response whose outbounds aredirect/freedom,blocked/Blackhole,warp/wireguard: withexcludeBlackholeboth pickers must return['direct', 'warp'], and without it all three tags are offered. Reverting the two call sites to the exact match reddens the first two tests (expected [ 'direct', 'blocked', 'warp' ] to deeply equal [ 'direct', 'warp' ]).frontend/src/test/outbound-protocol-case.test.tspins the shared rule itself —freedom/Freedom/FREEDOM/fReEdOmmatch, another protocol or its spelling does not, and a missing, empty, non-string,nullorundefinedprotocol never matches.npm run typecheck,npm run lint,oxfmt --checkpass on the touched files, and the existinggeodata-section,general-tabanduse-xray-settingsuites still pass.Honest note on coverage: the two picker components (
GeodataSection,GeneralTab) andOutboundsTabare one-line conversions to the same helper and I did not add per-component cases for them, so their exclusion behaviour is pinned by the helper test rather than by a test that renders those pages.Screenshots / recordings
N/A — the difference needs a template that spells a protocol id differently.
Breaking changes
None. Nothing is rewritten on save; the readers simply accept the spellings the core accepts.
Checklist
go build ./...and the test suite pass locally. (no Go change in this PR)npm run lintandnpm run typecheckpass, and the Vite build succeeds.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.