[GH-ISSUE #5533] [Feature]: Centralized Links Management and Bulk Assignment to Clients #3862

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

Originally created by @saeedhasani on GitHub (Jun 24, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5533

The new External Links / External Subscriptions feature introduced in v3.4.0 is very useful, but currently links can only be added individually inside each client.

For small deployments this is acceptable, but for larger panels with hundreds or thousands of users it becomes extremely difficult to manage.

A common use case is adding:

  • Backup subscriptions
  • Emergency nodes
  • Third-party configurations
  • Shared VPN endpoints
  • Cloudflare-related subscriptions

Currently administrators must manually open every client and add the same link repeatedly.

This does not scale and makes maintenance difficult.

Describe the solution you'd like

Introduce a dedicated Links section in the sidebar, similar to how Inbounds are managed.

Example:

Sidebar

  • Inbounds
  • Clients
  • Groups
  • Nodes
  • Links

Inside the Links section, administrators can:

  • Create External Links
  • Create External Subscriptions
  • Edit existing links
  • Enable/disable links
  • Delete links

After creating a link, it should be possible to assign it to multiple clients at once, similar to the current inbound assignment workflow.


Example Workflow

  1. Create a link in the Links section.
  2. Select one or more clients.
  3. Assign the link to the selected clients.
  4. The assigned link automatically appears in their generated subscription.

If the administrator later updates the link, all assigned clients automatically receive the updated version.


Benefits

  • Centralized management
  • Much easier maintenance
  • No need to edit clients one by one
  • Consistent configuration across users
  • Better scalability for large deployments
  • Similar UX to existing inbound management

Additional Suggestion

It would be useful if Links could support:

  • Tags
  • Categories
  • Enable/disable status
  • Usage count (how many clients are using the link)

This would make link management much easier for large-scale installations.

Thank you for your great work on 3x-ui.

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 @saeedhasani on GitHub (Jun 24, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5533 ### Is your feature request related to a problem? The new External Links / External Subscriptions feature introduced in v3.4.0 is very useful, but currently links can only be added individually inside each client. For small deployments this is acceptable, but for larger panels with hundreds or thousands of users it becomes extremely difficult to manage. A common use case is adding: - Backup subscriptions - Emergency nodes - Third-party configurations - Shared VPN endpoints - Cloudflare-related subscriptions Currently administrators must manually open every client and add the same link repeatedly. This does not scale and makes maintenance difficult. ### Describe the solution you'd like Introduce a dedicated **Links** section in the sidebar, similar to how **Inbounds** are managed. Example: Sidebar - Inbounds - Clients - Groups - Nodes - Links Inside the Links section, administrators can: - Create External Links - Create External Subscriptions - Edit existing links - Enable/disable links - Delete links After creating a link, it should be possible to assign it to multiple clients at once, similar to the current inbound assignment workflow. --- ### Example Workflow 1. Create a link in the Links section. 2. Select one or more clients. 3. Assign the link to the selected clients. 4. The assigned link automatically appears in their generated subscription. If the administrator later updates the link, all assigned clients automatically receive the updated version. --- ### Benefits - Centralized management - Much easier maintenance - No need to edit clients one by one - Consistent configuration across users - Better scalability for large deployments - Similar UX to existing inbound management --- ### Additional Suggestion It would be useful if Links could support: - Tags - Categories - Enable/disable status - Usage count (how many clients are using the link) This would make link management much easier for large-scale installations. Thank you for your great work on 3x-ui. ### 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? - [x] I'd like to implement this feature myself and open a PR. - [x] 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 (Jun 24, 2026):

The feature request is well-understood and technically sound. Here is a precise summary of what currently exists and what an implementation would need to add, to help you scope the PR.

Current architecture (confirmed in source)

External links are modeled in internal/database/model/model.go as ClientExternalLink, a table with a direct ClientId foreign key:

client_external_links
  id          int PK
  client_id   int  → clients.id   (per-client, one row per link per client)
  kind        string ("link" | "subscription")
  value       string
  remark      string
  sort_index  int
  created_at  int64

There is no global link entity and no many-to-many relationship. The service layer (internal/web/service/client_external_link.go) operates exclusively on a single client at a time via SetExternalLinksByEmail / GetExternalLinksForRecord. The subscription generator (internal/sub/external_config.go) queries by client_id as well.

What a centralized links implementation would need to touch

  1. Database (internal/database/model/model.go, internal/database/db.go): A new global ExternalLink table (id, kind, value, remark, enabled, …) and a join table (e.g. client_link_assignments) linking it to one or more clients. The existing per-client client_external_links table could remain for backwards compatibility, or be migrated.

  2. Service layer (internal/web/service/): New service file for CRUD on global links and for bulk assignment. The bulk-assign operation would need to be transactional, inserting or upserting rows into the join table for each selected client.

  3. Controller / API (internal/web/controller/): New REST endpoints for global link CRUD and bulk assignment. The existing POST /panel/api/clients/:email/externalLinks endpoint is per-client and would be unaffected.

  4. Subscription generator (internal/sub/external_config.go): getClientExternalLinksBySubId queries client_external_links by client_id. It would need to also join against client_link_assignments → external_links to include globally-assigned links.

  5. Frontend (frontend/src/): A new sidebar entry, page, and form components for global link management, plus multi-select client assignment UI (similar in shape to how inbound assignment works). The existing Links tab inside ClientFormModal.tsx (lines 743–792) would be unaffected for per-client overrides.

  6. OpenAPI spec: The generator in tools/openapigen/ would pick up new endpoints automatically once the controller routes are registered; re-running the generator and committing the updated internal/web/dist/openapi.json is part of the build.

Scope note

The additional metadata you suggested (tags, categories, enable/disable, usage count) is straightforward to add to the global ExternalLink model, and the enabled flag in particular is worth including from the start because the subscription generator would need to respect it.

If you open a PR, it would be worth proposing the schema in the PR description first so the data model can be reviewed before the full implementation is built on top of it.

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

<!-- gh-comment-id:4788338219 --> @github-actions[bot] commented on GitHub (Jun 24, 2026): The feature request is well-understood and technically sound. Here is a precise summary of what currently exists and what an implementation would need to add, to help you scope the PR. **Current architecture (confirmed in source)** External links are modeled in `internal/database/model/model.go` as `ClientExternalLink`, a table with a direct `ClientId` foreign key: ``` client_external_links id int PK client_id int → clients.id (per-client, one row per link per client) kind string ("link" | "subscription") value string remark string sort_index int created_at int64 ``` There is no global link entity and no many-to-many relationship. The service layer (`internal/web/service/client_external_link.go`) operates exclusively on a single client at a time via `SetExternalLinksByEmail` / `GetExternalLinksForRecord`. The subscription generator (`internal/sub/external_config.go`) queries by `client_id` as well. **What a centralized links implementation would need to touch** 1. **Database** (`internal/database/model/model.go`, `internal/database/db.go`): A new global `ExternalLink` table (id, kind, value, remark, enabled, …) and a join table (e.g. `client_link_assignments`) linking it to one or more clients. The existing per-client `client_external_links` table could remain for backwards compatibility, or be migrated. 2. **Service layer** (`internal/web/service/`): New service file for CRUD on global links and for bulk assignment. The bulk-assign operation would need to be transactional, inserting or upserting rows into the join table for each selected client. 3. **Controller / API** (`internal/web/controller/`): New REST endpoints for global link CRUD and bulk assignment. The existing `POST /panel/api/clients/:email/externalLinks` endpoint is per-client and would be unaffected. 4. **Subscription generator** (`internal/sub/external_config.go`): `getClientExternalLinksBySubId` queries `client_external_links` by `client_id`. It would need to also join against `client_link_assignments` → `external_links` to include globally-assigned links. 5. **Frontend** (`frontend/src/`): A new sidebar entry, page, and form components for global link management, plus multi-select client assignment UI (similar in shape to how inbound assignment works). The existing Links tab inside `ClientFormModal.tsx` (lines 743–792) would be unaffected for per-client overrides. 6. **OpenAPI spec**: The generator in `tools/openapigen/` would pick up new endpoints automatically once the controller routes are registered; re-running the generator and committing the updated `internal/web/dist/openapi.json` is part of the build. **Scope note** The additional metadata you suggested (tags, categories, enable/disable, usage count) is straightforward to add to the global `ExternalLink` model, and the enabled flag in particular is worth including from the start because the subscription generator would need to respect it. If you open a PR, it would be worth proposing the schema in the PR description first so the data model can be reviewed before the full implementation is built on top of it. *This comment was generated automatically; a maintainer may follow up.*
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#3862
No description provided.