mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6810] [MERGED] fix(sub): isolate Incy subscription routing from Happ headers #6461
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#6461
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/6810
Author: @mvanhorn
Created: 10/13/2026
Status: ✅ Merged
Merged: 10/13/2026
Merged by: @MHSanaei
Base:
main← Head:fix/6062-incy-client-routing-isolation📝 Commits (2)
1f6155csub: isolate Incy subscription routing from Happ headersc9d3b67fix(sub): keep the shared JSON routing profile for INCY clients📊 Changes
2 files changed (+67 additions, -2 deletions)
View changed files
📝
internal/sub/controller.go(+12 -2)📝
internal/sub/controller_test.go(+55 -0)📄 Description
Summary
The resolved Incy line is written to the body only when IsIncyClient matches the subscription User-Agent, Incy routing is enabled, and the resolved text is non-blank. ApplyCommonHeaders computes that same Incy check once and, for a matching client, skips the Happ routing-header block, leaving Routing-Enable, the Happ Routing value, and the JSON routing header unset. ApplyIncyHeaders is called with that incyClient flag. The new test requests the subscription as INCY/1.0.0/ios and as Happ/1.2.0 and expects the Incy response to end with the incy:// line and to have empty Routing headers, and the Happ response to keep the happ:// Routing header with Routing-Enable true and no incy:// line in the body.
Closes #6062
Why
With both routing features enabled, every subscription response carries Happ's Routing and Routing-Enable headers, and the Incy rules are appended to that same body for every caller. An Incy client therefore loads the Happ profile from the header. A Happ client receives the incy:// line in the body alongside its own Routing header. ApplyCommonHeaders resolved the Happ routing source on every response and set Routing-Enable and Routing from it, and when the Happ rule string was empty it substituted the JSON routing header. The subs handler appended subIncyRoutingRules whenever Incy routing was enabled and the stored rules were non-empty. Neither write consulted the request User-Agent, so the Happ headers and the Incy body line were emitted together.
Type of change
Areas affected
How was this tested?
gofmt -l printed no filenames for the subscription controller, its test, and the remote routing test.
go vet ./internal/sub/... printed no diagnostics.
go test ./internal/sub/... passed.
The tests in
internal/sub/controller_test.gofail without the fix (checked by reverting the source changes).Screenshots / recordings
No user-visible surface changes in this PR, so there is nothing to show.
Breaking changes
Covered in the summary above.
Checklist
go build ./...and the test suite pass locally.Not claimed:
go build ./...is a different command from the local runs that passed,gofmt,go vetandgo test.npm run lint,npm run typecheck, andnpm run buildpass.Not claimed:
npm run lintis a different command from the local runs that passed,gofmt,go vetandgo test.AI disclosure
AI was used for assistance.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.