mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5348] [Feature]: JSON subscription page #3745
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#3745
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 @forwork10 on GitHub (Jun 15, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5348
Is your feature request related to a problem?
Currently, when opening a standard subscription link in a web browser, i see normal UI. However, if a user opens a JSON subscription link (/json) directly in a browser, it only displays the raw JSON code.
Describe the solution you'd like
I would like the JSON subscription endpoint to detect if the request comes from a standard web browser (via User-Agent headers).
Alternatives you've considered
I made my own custom subserver (running 3xui subserver on a local port), but it's not very convenient.
Concrete use case
Regular subscription links can be used in VPN services, where you can view statistics and import a subscription into the client. This is convenient because you don't need to implement the subscription import logic yourself, etc. I would like to see the same functionality for JSON/Clash subscriptions.
Mockups, screenshots, or examples
No response
Which parts of the panel would this affect?
Subscription (share links / Clash / JSON)
Are you willing to help?
Before submitting
@github-actions[bot] commented on GitHub (Jun 15, 2026):
The standard subscription endpoint already has exactly the browser-detection behaviour you are describing; the JSON endpoint does not. Here is what the code shows:
Standard endpoint (
subshandler,internal/sub/controller.go:137-183) — already implemented. When the request carriesAccept: text/html, or the query string contains?html=1/?view=html, the handler callsserveSubPage, which injectswindow.__SUB_PAGE_DATA__into the embedded React SPA (internal/web/dist/subpage.html). That page renders traffic stats, QR codes, and copy buttons. VPN clients that do not send an HTML Accept header receive the base64-encoded proxy list as before.JSON endpoint (
subJsonshandler,internal/sub/controller.go:342-358) — no browser detection. It unconditionally callssubJsonService.GetJson(subId, host)and returns the raw JSON string, regardless of the requester'sAcceptheader or User-Agent.What an implementation would need to do:
subJsons, add the same Accept/query-param check that already exists insubs(lines 150-167 ofcontroller.go).subService.GetSubs(subId, host)to retrieve the traffic, emails, last-online, and proxy links needed to populatePageData.a.serveSubPage(c, basePathStr, page)call — no new HTML or frontend work required, sinceserveSubPageand the SPA are already generic.The same approach could be applied to the Clash endpoint (
subClashs, lines 360-378) if that is also desired.A PR for this change would be straightforward and can reuse the existing infrastructure without touching the frontend or the
SubJsonServicelogic.This reply was generated automatically; a maintainer may follow up.