[GH-ISSUE #6445] [Feature]: Remove liinks from subscription page #4364

Open
opened 2026-10-31 20:39:08 +07:00 by bsakaguchi · 1 comment
Owner

Originally created by @indx0 on GitHub (Sep 10, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6445

Currently, you can limit your sub by HWID, but links still can be copied, which bypasses the limit.

Image

Describe the solution you'd like

Add a toggle to remove an inbound from subpage or remove all when HWID is enabled automatically.

Alternatives you've considered

No response

Concrete use case

No response

Mockups, screenshots, or examples

No response

Which parts of the panel would this affect?

No response

Are you willing to help?

  • I'd like to implement this feature myself and open a PR.
  • I can help test once a PR is open.

Before submitting

  • I searched existing issues and this feature has not been requested.
  • This feature request is written in English.
Originally created by @indx0 on GitHub (Sep 10, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/6445 ### Is your feature request related to a problem? Currently, you can limit your sub by HWID, but links still can be copied, which bypasses the limit. <img width="3218" height="2754" alt="Image" src="https://github.com/user-attachments/assets/9bff51a6-1441-44b3-8c5f-7fb3c0ef7b4b" /> ### Describe the solution you'd like Add a toggle to remove an inbound from subpage or remove all when HWID is enabled automatically. ### Alternatives you've considered _No response_ ### Concrete use case _No response_ ### Mockups, screenshots, or examples _No response_ ### Which parts of the panel would this affect? _No response_ ### Are you willing to help? - [ ] I'd like to implement this feature myself and open a PR. - [ ] I can help test once a PR is open. ### Before submitting - [x] I searched [existing issues](../issues?q=is%3Aissue) and this feature has not been requested. - [x] This feature request is written in English.
Author
Owner

@github-actions[bot] commented on GitHub (Sep 10, 2026):

Your reading of the panel is correct: the HTML subscription page is served before the device-limit check, so the config links (with copy and QR buttons) are shown regardless of how many HWIDs are already registered. That ordering is deliberate today, not an oversight, and there is no built-in toggle for it — but a custom subscription theme removes the link list right now, and there is one scope caveat below about how far that gets you.

(I could not open the attached image; nothing here depends on it — the link list is confirmed in the source.)

Where the behaviour lives

internal/sub/controller.go:401-413 — the HTML branch returns before the gate:

if a.maybeServeSubPage(c) {
    logSubscriptionRoute(userAgent, "html")
    return
}
if !a.enforceHwid(c) {
    return
}

The page view-model carries the configs — "links": page.Result, (internal/sub/controller.go:629) — and frontend/src/pages/sub/SubPage.tsx:518-560 renders one copy/QR row per config plus a "copy all configs" button.

The ordering is pinned by a test: TestSubscriptionHwidGateSkipsHtmlInfoPage (internal/sub/hwid_controller_test.go:136) fails if the page ever becomes gated — t.Fatalf("HTML sub page should not be HWID-gated: %#v", rec.Header()). It was reaffirmed in commit f17e4684 ("fix(sub): apply the device limit to ?view=raw"), whose message reads: "Gate the raw branch and leave the other gate where it was, below maybeServeSubPage, so the HTML info page stays ungated as before."

One scope point worth knowing

The HWID limit only counts subscription fetches. EnforceHwidForSubID (internal/web/service/client_hwid.go:79) records one ClientHwid row per X-HWID header per sub_id, and nothing in the Xray connection path consults it. So hiding the links raises the bar but does not cap devices: any device that is already registered can still export the same config out of its client app. If you want a limit that bites at connection time, the existing lever is the per-client limitIp field plus the IP-limit job (internal/web/job/check_client_ip_job.go) — under Docker it needs NET_ADMIN and NET_RAW.

Workaround available today

A custom subscription theme that simply never renders the links:

  1. Create a folder on the server, e.g. /etc/3x-ui/sub_templates/no-links/.
  2. Put an index.html (or sub.html) in it — a Go html/template using any of the documented fields (.used, .remained, .expire, .subUrl, .subTitle, …) but never ranging over {{ .links }}.
  3. Panel → Settings → Subscription → Information → Sub Theme Directory = that absolute path, then save.

The template is re-parsed whenever its modification time changes (loadSubTemplate, internal/sub/controller.go:687), so no restart is needed. Full field list: docs/custom-subscription-templates.md and Config → Subscription.

Caveat: it applies to every subscription on the panel, not per-inbound and not only when a HWID limit is set — which is exactly the toggle you are asking for, so the request stands.

For the maintainer

The "page data without links" shape already exists: maybeServeSubInfo builds the same map and does delete(info, "links") (internal/sub/controller.go:349), so a subHideLinks setting — or a rule keyed on limit_hwid > 0 — would reuse an existing path in subPageContext rather than need new plumbing.

Related, but different asks and not duplicates: #6331 (placeholder configs instead of 404 once the limit is reached) and #6357 (read-only device-slot status on the subscription API).

Verdict: Feature request

This reply was generated automatically; a maintainer may follow up.

<!-- gh-comment-id:5623269496 --> @github-actions[bot] commented on GitHub (Sep 10, 2026): **Your reading of the panel is correct**: the HTML subscription page is served *before* the device-limit check, so the config links (with copy and QR buttons) are shown regardless of how many HWIDs are already registered. That ordering is deliberate today, not an oversight, and there is no built-in toggle for it — but a custom subscription theme removes the link list right now, and there is one scope caveat below about how far that gets you. (I could not open the attached image; nothing here depends on it — the link list is confirmed in the source.) ### Where the behaviour lives `internal/sub/controller.go:401-413` — the HTML branch returns before the gate: ```go if a.maybeServeSubPage(c) { logSubscriptionRoute(userAgent, "html") return } if !a.enforceHwid(c) { return } ``` The page view-model carries the configs — `"links": page.Result,` (`internal/sub/controller.go:629`) — and `frontend/src/pages/sub/SubPage.tsx:518-560` renders one copy/QR row per config plus a "copy all configs" button. The ordering is pinned by a test: `TestSubscriptionHwidGateSkipsHtmlInfoPage` (`internal/sub/hwid_controller_test.go:136`) fails if the page ever becomes gated — `t.Fatalf("HTML sub page should not be HWID-gated: %#v", rec.Header())`. It was reaffirmed in commit `f17e4684` ("fix(sub): apply the device limit to `?view=raw`"), whose message reads: *"Gate the raw branch and leave the other gate where it was, below maybeServeSubPage, so the HTML info page stays ungated as before."* ### One scope point worth knowing The HWID limit only counts subscription **fetches**. `EnforceHwidForSubID` (`internal/web/service/client_hwid.go:79`) records one `ClientHwid` row per `X-HWID` header per `sub_id`, and nothing in the Xray connection path consults it. So hiding the links raises the bar but does not cap devices: any device that is already registered can still export the same config out of its client app. If you want a limit that bites at connection time, the existing lever is the per-client `limitIp` field plus the IP-limit job (`internal/web/job/check_client_ip_job.go`) — under Docker it needs `NET_ADMIN` and `NET_RAW`. ### Workaround available today A custom subscription theme that simply never renders the links: 1. Create a folder on the server, e.g. `/etc/3x-ui/sub_templates/no-links/`. 2. Put an `index.html` (or `sub.html`) in it — a Go `html/template` using any of the documented fields (`.used`, `.remained`, `.expire`, `.subUrl`, `.subTitle`, …) but never ranging over `{{ .links }}`. 3. Panel → **Settings → Subscription → Information → Sub Theme Directory** = that absolute path, then save. The template is re-parsed whenever its modification time changes (`loadSubTemplate`, `internal/sub/controller.go:687`), so no restart is needed. Full field list: [`docs/custom-subscription-templates.md`](https://github.com/MHSanaei/3x-ui/blob/main/docs/custom-subscription-templates.md) and [Config → Subscription](https://www.3x-ui.com/docs/config/subscription). Caveat: it applies to every subscription on the panel, not per-inbound and not only when a HWID limit is set — which is exactly the toggle you are asking for, so the request stands. ### For the maintainer The "page data without links" shape already exists: `maybeServeSubInfo` builds the same map and does `delete(info, "links")` (`internal/sub/controller.go:349`), so a `subHideLinks` setting — or a rule keyed on `limit_hwid > 0` — would reuse an existing path in `subPageContext` rather than need new plumbing. Related, but different asks and not duplicates: #6331 (placeholder configs instead of 404 once the limit is reached) and #6357 (read-only device-slot status on the subscription API). Verdict: Feature request *This reply was generated automatically; a maintainer may follow up.* <!-- claude-issue:analyst -->
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#4364
No description provided.