[PR #5409] [MERGED] feat(hosts): managed Hosts for per-host subscription link overrides #5873

Closed
opened 2026-11-02 04:04:41 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5409
Author: @MHSanaei
Created: 6/17/2026
Status: ✅ Merged
Merged: 6/17/2026
Merged by: @MHSanaei

Base: main ← Head: feat/hosts


📝 Commits (10+)

  • 2d1e6f6 test(sub): characterize current link output (externalProxy + single-link baselines)
  • 4c243ef refactor(sub): unify external-proxy link building behind ShareEndpoint (TDD, snapshot-locked)
  • fcb4836 feat(model): Host entity + automigrate + openapi codegen (TDD)
  • d38ca25 feat(api): Host CRUD service + controller + routes (TDD)
  • 420a3f1 feat(sub): render subscription links from hosts; legacy fallback when none (TDD, mutation-checked)
  • 7e1db8e feat(migration): seed hosts from inbound externalProxy (TDD, idempotent, dual-driver)
  • efc322c feat(ui): Hosts page + schema + query hooks + link preview helper (TDD on schema/helpers)
  • 821d547 refactor(ui): remove the External Proxy form from the inbound stream settings
  • 6f1046a fix(ui): use Alert title instead of deprecated message (antd 6)
  • 5d6ba4d style(ui): align Hosts page with Clients/Inbounds cards + reorder columns

📊 Changes

115 files changed (+6482 additions, -1045 deletions)

View changed files

📝 frontend/public/openapi.json (+945 -26)
➕ frontend/src/api/queries/useHostMutations.ts (+60 -0)
➕ frontend/src/api/queries/useHostsQuery.ts (+33 -0)
📝 frontend/src/api/queryKeys.ts (+6 -0)
➕ frontend/src/components/form/RemarkTemplateField.tsx (+71 -0)
➕ frontend/src/components/form/RemarkVarPicker.tsx (+43 -0)
📝 frontend/src/components/form/index.ts (+3 -0)
📝 frontend/src/generated/examples.ts (+47 -6)
📝 frontend/src/generated/schemas.ts (+181 -26)
📝 frontend/src/generated/types.ts (+38 -6)
📝 frontend/src/generated/zod.ts (+39 -6)
📝 frontend/src/layouts/AppSidebar.tsx (+6 -3)
➕ frontend/src/lib/hosts/host-link.ts (+50 -0)
➕ frontend/src/lib/remark/remarkVariables.ts (+70 -0)
➕ frontend/src/lib/xray/forms/transport/CustomSockoptList.tsx (+76 -0)
📝 frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx (+1 -1)
📝 frontend/src/lib/xray/inbound-link.ts (+13 -28)
📝 frontend/src/lib/xray/link-label.tsx (+10 -23)
📝 frontend/src/models/setting.ts (+1 -3)
📝 frontend/src/pages/api-docs/endpoints.ts (+93 -0)

...and 80 more files

📄 Description

Summary

Introduces a first-class Hosts feature: a dedicated way to define per-host subscription link overrides, replacing the old inline "External Proxy" form on the inbound stream settings.

A Host is a managed entity (model + automigrate + API + UI) that the subscription server uses to render share links. When no hosts exist for an inbound, the legacy externalProxy behavior is preserved as a fallback, and existing externalProxy entries are seeded into hosts on migration (idempotent, dual-driver).

What's included

  • Backend

    • Host entity + automigrate + OpenAPI codegen
    • Host CRUD service, controller and routes
    • Subscription rendering from hosts (raw / JSON / Clash), with legacy fallback when none
    • Migration that seeds hosts from inbound externalProxy (idempotent, SQLite + Postgres)
    • Unified external-proxy link building behind a shared ShareEndpoint
    • Per-host overrides: SNI + fingerprint for Reality, allowInsecure, mux params, sockopt + xhttp-extra params, serverDescription, mihomoX25519, vlessRouteId
    • Sockopt scoping fixes: inbound Sockopt is server-only, outbound/host Sockopt is client-only
    • Per-client remark template variables (drops the legacy remark model + "Show Usage Info")
  • Frontend

    • New Hosts page + schema + query hooks + link-preview helper
    • Inbound-style responsive, tabbed form (Basic / Security / Advanced) with icons
    • Structured editors for Mux / Sockopt / XHTTP, reusing the outbound MuxForm
    • Removed the External Proxy form from the inbound stream settings
    • Various empty-state, card-hover, and layout polish across Hosts/Outbounds

Testing

TDD throughout the backend (schema, helpers, migration, sub rendering, CRUD); subscription output locked with characterization snapshots and mutation checks.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/MHSanaei/3x-ui/pull/5409 **Author:** [@MHSanaei](https://github.com/MHSanaei) **Created:** 6/17/2026 **Status:** ✅ Merged **Merged:** 6/17/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `feat/hosts` --- ### 📝 Commits (10+) - [`2d1e6f6`](https://github.com/MHSanaei/3x-ui/commit/2d1e6f6879cb1d45d69813120bdf056273080e46) test(sub): characterize current link output (externalProxy + single-link baselines) - [`4c243ef`](https://github.com/MHSanaei/3x-ui/commit/4c243efaafb5f578b7da7b728e2248958494dd44) refactor(sub): unify external-proxy link building behind ShareEndpoint (TDD, snapshot-locked) - [`fcb4836`](https://github.com/MHSanaei/3x-ui/commit/fcb4836b25f56b70343c5e53ac2d8bc40cefcf81) feat(model): Host entity + automigrate + openapi codegen (TDD) - [`d38ca25`](https://github.com/MHSanaei/3x-ui/commit/d38ca25d3ae244706b1107bcbde5db67f5e5ab76) feat(api): Host CRUD service + controller + routes (TDD) - [`420a3f1`](https://github.com/MHSanaei/3x-ui/commit/420a3f169de3ed87aeebef265d79d70ea53d3ce8) feat(sub): render subscription links from hosts; legacy fallback when none (TDD, mutation-checked) - [`7e1db8e`](https://github.com/MHSanaei/3x-ui/commit/7e1db8eb1352b9d61adc4ae6800e896d1ff10430) feat(migration): seed hosts from inbound externalProxy (TDD, idempotent, dual-driver) - [`efc322c`](https://github.com/MHSanaei/3x-ui/commit/efc322c4207406688effe237a741127171e20715) feat(ui): Hosts page + schema + query hooks + link preview helper (TDD on schema/helpers) - [`821d547`](https://github.com/MHSanaei/3x-ui/commit/821d547d9ab06640a09669267eed4d49c35daff8) refactor(ui): remove the External Proxy form from the inbound stream settings - [`6f1046a`](https://github.com/MHSanaei/3x-ui/commit/6f1046a4ee64c700acf0bd00f11224bd86e50923) fix(ui): use Alert `title` instead of deprecated `message` (antd 6) - [`5d6ba4d`](https://github.com/MHSanaei/3x-ui/commit/5d6ba4d63eea164b019b9410a08924445d47f0ad) style(ui): align Hosts page with Clients/Inbounds cards + reorder columns ### 📊 Changes **115 files changed** (+6482 additions, -1045 deletions) <details> <summary>View changed files</summary> 📝 `frontend/public/openapi.json` (+945 -26) ➕ `frontend/src/api/queries/useHostMutations.ts` (+60 -0) ➕ `frontend/src/api/queries/useHostsQuery.ts` (+33 -0) 📝 `frontend/src/api/queryKeys.ts` (+6 -0) ➕ `frontend/src/components/form/RemarkTemplateField.tsx` (+71 -0) ➕ `frontend/src/components/form/RemarkVarPicker.tsx` (+43 -0) 📝 `frontend/src/components/form/index.ts` (+3 -0) 📝 `frontend/src/generated/examples.ts` (+47 -6) 📝 `frontend/src/generated/schemas.ts` (+181 -26) 📝 `frontend/src/generated/types.ts` (+38 -6) 📝 `frontend/src/generated/zod.ts` (+39 -6) 📝 `frontend/src/layouts/AppSidebar.tsx` (+6 -3) ➕ `frontend/src/lib/hosts/host-link.ts` (+50 -0) ➕ `frontend/src/lib/remark/remarkVariables.ts` (+70 -0) ➕ `frontend/src/lib/xray/forms/transport/CustomSockoptList.tsx` (+76 -0) 📝 `frontend/src/lib/xray/forms/transport/FinalMaskForm.tsx` (+1 -1) 📝 `frontend/src/lib/xray/inbound-link.ts` (+13 -28) 📝 `frontend/src/lib/xray/link-label.tsx` (+10 -23) 📝 `frontend/src/models/setting.ts` (+1 -3) 📝 `frontend/src/pages/api-docs/endpoints.ts` (+93 -0) _...and 80 more files_ </details> ### 📄 Description ## Summary Introduces a first-class **Hosts** feature: a dedicated way to define per-host subscription link overrides, replacing the old inline "External Proxy" form on the inbound stream settings. A Host is a managed entity (model + automigrate + API + UI) that the subscription server uses to render share links. When no hosts exist for an inbound, the legacy externalProxy behavior is preserved as a fallback, and existing externalProxy entries are seeded into hosts on migration (idempotent, dual-driver). ## What's included - **Backend** - `Host` entity + automigrate + OpenAPI codegen - Host CRUD service, controller and routes - Subscription rendering from hosts (raw / JSON / Clash), with legacy fallback when none - Migration that seeds hosts from inbound `externalProxy` (idempotent, SQLite + Postgres) - Unified external-proxy link building behind a shared `ShareEndpoint` - Per-host overrides: SNI + fingerprint for Reality, `allowInsecure`, mux params, sockopt + xhttp-extra params, `serverDescription`, `mihomoX25519`, `vlessRouteId` - Sockopt scoping fixes: inbound Sockopt is server-only, outbound/host Sockopt is client-only - Per-client remark template variables (drops the legacy remark model + "Show Usage Info") - **Frontend** - New **Hosts** page + schema + query hooks + link-preview helper - Inbound-style responsive, tabbed form (Basic / Security / Advanced) with icons - Structured editors for Mux / Sockopt / XHTTP, reusing the outbound MuxForm - Removed the External Proxy form from the inbound stream settings - Various empty-state, card-hover, and layout polish across Hosts/Outbounds ## Testing TDD throughout the backend (schema, helpers, migration, sub rendering, CRUD); subscription output locked with characterization snapshots and mutation checks. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:04:41 +07:00
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#5873
No description provided.