mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #6488] [MERGED] feat(sub): refine Happ routing presets, serverDescription escaping, and auto-detect placement #6302
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#6302
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/6488
Author: @Pejman-Yousefi-Official
Created: 9/12/2026
Status: ✅ Merged
Merged: 9/13/2026
Merged by: @MHSanaei
Base:
main← Head:fix/happ-refinements📝 Commits (2)
176d542feat(sub): refine Happ routing presets, serverDescription escaping, and auto-detect placement888c9e8fix(sub): address PR review findings on routing parity, agent regex, and i18n📊 Changes
10 files changed (+307 additions, -167 deletions)
View changed files
📝
frontend/src/pages/settings/HappSettingsContent.tsx(+61 -65)📝
frontend/src/pages/settings/happPresets.ts(+36 -60)📝
frontend/src/test/happ-presets.test.ts(+12 -22)📝
frontend/src/test/happ-settings-tun-mode.test.tsx(+21 -0)📝
internal/sub/endpoint.go(+23 -5)📝
internal/sub/endpoint_test.go(+4 -4)📝
internal/sub/happ.go(+11 -8)📝
internal/sub/happ_test.go(+124 -1)📝
internal/sub/host_sub.go(+3 -0)📝
internal/sub/service.go(+12 -2)📄 Description
Summary
Follow-up refinements to the Happ client integration (#6434) ensuring strict conformance with official Happ developer specifications, robust fragment parameter escaping, synchronized routing off-state headers, and enhanced UI discoverability.
Why
happ://routing/onadd/<base64>deeplink requires a vendor profile JSON object (Name,GlobalProxy,DirectSites,DirectIp,BlockSites,BlockIp, etc.) rather than Xray core field rules. Both the visual rule generator and curated presets (Iran Bypass, China Direct, AdBlock, Global) now generate standard Happ profile payloads.strings.Cut:appendQueryAndFragmentnow explicitly targets?serverDescription=viastrings.Cut. This prevents unescaping literal?characters in node remarks (e.g.Server? 01) while cleanly preserving the base64-encoded Happ subtitle query.happ://routing/offis configured,Routing-Enable: 0andRouting: happ://routing/offare guaranteed to emit in lockstep even if general routing was previously toggled on, allowing Happ clients to clear cached rules reliably.subHappAutoDetectto the top of the Happ settings tab as a prominent master switch, preventing operator confusion where Happ headers were gated off.resetcolors, Dark Violet, Turquoise) in the Themes tab with standardt('reset')localization.t('apply').Type of change
Areas affected
How was this tested?
go test -v ./internal/sub/...(all tests pass).TestApplyCommonHeaders_HappRoutingOffDeeplinkenforcesRouting-Enable: 0on off deeplinks.TestAppendQueryAndFragment_PreservesServerDescriptioncovers literal?remarks and encoded subtitle parameters.npx vitest run src/test/happ-presets.test.ts src/test/happ-settings-tun-mode.test.tsx(10/10 tests pass).npm run lint(oxlint): 0 errors, 0 warnings across 540 files.npm run typecheck(tsc --noEmit): clean, 0 errors.go build ./...andgo vet ./...: clean exit 0.Breaking changes
None. All changes are strictly additive and backward compatible.
Checklist
go build ./...and the test suite pass locally.npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.