mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #6381] [Feature]: Add opt-in Happ crypt5 generation to the client QR modal #4328
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#4328
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?
Originally created by @NgaiYeanCoi on GitHub (Sep 1, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6381
Is your feature request related to a problem?
Administrators who need a Happ
happ://crypt5/link do not currently have a safe and explicit workflow for generating it from a client's current subscription in the panel.Doing this manually requires copying a complete subscription URL to an external service. That URL is sensitive because possession of it may grant access to the subscription.
Describe the solution you'd like
Add an optional Happ view to the QR modal for an individual client on the Clients page.
Expected behavior:
happ://crypt5/...link using the existing QR, copy, and image-download flow.Backend and privacy constraints:
https://www.happ.su/main/zh/dev-docs/crypto-link
happ://crypt5/result.no-store.Alternatives you've considered
happ://crypt5/representation.Concrete use case
An administrator opens the QR modal for one client. The existing Standard QR code is displayed and no external request is made.
The administrator selects Happ, The backend receives only the client record ID, reconstructs the client's current subscription URL, performs one bounded provider request, validates the response, and returns a fresh
happ://crypt5/...link.If the provider is unavailable or returns an invalid response, only the Happ view reports a failure. The administrator can immediately return to the unchanged Standard QR code.
Mockups, screenshots, or examples
Client QR
After success:
happ://crypt5/
Which parts of the panel would this affect?
Frontend (UI / panel pages), Backend (API endpoints, login, settings), Subscription (share links / Clash / JSON)
Are you willing to help?
Before submitting
@NgaiYeanCoi commented on GitHub (Sep 1, 2026):
This issue is related to #3902
@github-actions[bot] commented on GitHub (Sep 1, 2026):
Valid feature request — nothing in the panel generates
happ://crypt5/today, and the design you describe maps cleanly onto machinery that already exists in the tree. Below is what is already there, what is missing, and three details in the spec I would change before writing code.I could not open the two screenshots (images are not readable in this analysis), so the UI notes below are based on the current component source; if a mockup detail matters, please describe it as text.
What the panel does today
happ://add/<subUrl>deeplinks atfrontend/src/pages/sub/SubPage.tsx:151, with the Android and iOS menu entries atSubPage.tsx:218andSubPage.tsx:231. That path makes no external request, but the subscription URL is visible in the link — which is exactly the gapcrypt5closes.internal/sub/remote_routing.go. It is the closest precedent to what you are proposing.crypt5support does not exist.git log -S 'crypt5' --allreturns nothing, and there is nocrypt5,crypto.happorhapp.sustring anywhere in the checkout.Prior art you probably did not find because it is titled differently: #3902 ("Feature request add encryption support") asked for
happ://crypt5/with the same vendor doc link. It was closed as completed on 2026-05-29 with no comment, and no commit in history ever introducedcrypt5— so as far as the source shows, that request was closed without being implemented. I am linking it as related rather than closing this one, since your report is the far more specific spec.The pieces your design would plug into
ClientRecord.id(frontend/src/generated/types.ts:313)SettingService.BuildSubURIBase—internal/web/service/setting.go:1410, documented as the shared source of truthnewRemoteRoutingHTTPClient—internal/sub/remote_routing.go:464:DialContext: netsafe.SSRFGuardedDialContext,TLSClientConfig: &tls.Config{MinVersion: tls.VersionTLS12},Timeout: remoteRoutingHTTPTimeout(6s), plusio.LimitReaderatremote_routing.go:307internal/pia/endpoints.go:9no-storeinternal/web/controller/base.go:24,internal/web/controller/index.go:148/panel/api/*:BaseController.checkLogin(internal/web/controller/base.go:19) andCSRFMiddleware(internal/web/middleware/security.go:41)QrPanel, already imported by the modal (frontend/src/pages/clients/ClientQrModal.tsx:7)Three things I would change in the spec
1. "Do not follow redirects" is probably too strict. The panel's existing Happ integration discovered that these services return the deeplink as the
Locationof a 3xx, and handles it without issuing a second request:with the 3xx consumed at
remote_routing.go:284-297. A client that rejects all redirects would throw away a valid response ifcrypt5behaves the same way. The rule that gives you the same safety is "never issue a follow-up request, but accept ahapp://Location". I have not verified the crypt5 endpoint's actual response shape — that is the one thing worth confirming against the vendor doc before coding.2. The Standard link and the generated one can disagree. The modal builds the Standard link entirely client-side today:
Server-side, the
subURIsetting wins when it is non-empty andBuildSubURIBase(host) + subPathis only the fallback (internal/web/service/setting.go:1478-1494). A backend that re-derives the URL fromresolveHost(c)without reusing that same resolution order will encode a different URL than the QR sitting next to it — behind a reverse proxy or withsubDomainset, silently. Reuse the resolution, do not re-implement it.3. Consider a setting that turns the whole thing off. Some operators forbid any outbound call from the panel host. A single boolean next to the existing Happ settings (
internal/web/service/setting.go:1345maps"Happ routing source"→SubRoutingRules) is cheaper than an admin discovering the capability exists at all.Minor UI note: the modal is an Ant Design
Collapseof sections (ClientQrModal.tsx:240-248), not the Standard/Happ switcher in your mockup — worth deciding whether Happ becomes another collapse panel or the modal grows a real segmented control.If you open the PR
This is backend-plus-frontend, so the route contract chain applies in full:
g.POSTneeds a matching entry infrontend/src/pages/api-docs/endpoints.ts, thenmake gen— pinned both ways byTestRouteRegistryContractininternal/web/routes_contract_test.go;StructAllowallowlist intools/openapigen/main.go, or it is silently dropped from the schemas and the OpenAPI build then fails;frontend/public/openapi.json→docs/public/openapi.json, thencd docs && pnpm gen:api;internal/web/translation/and must be referenced in the same commit.Two rules you do not need to satisfy, given the stateless design: no
runtime.Runtimedispatch (nothing changes inbound or client state) and no migration ininternal/database/db.go(nothing is persisted). Keeping it that way is what keeps the change small.Verdict: Feature request
This reply was generated automatically; a maintainer may follow up.