mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-10-25 07:15:01 +03:00
feat(hosts): add drag-and-drop and global subscription ordering (#6895)
Hosts already had one saved order on the Hosts page, but subscriptions honoured it only inside each inbound, so a host of a later inbound could never come before one of an earlier inbound (#6894). A new opt-in setting makes raw/base64, Clash/Mihomo and JSON subscriptions follow the Hosts page order across inbounds; the default keeps today's inbound-first output unchanged. The Hosts table gains drag-and-drop reordering next to the Up/Down buttons, on a pointer-reorder hook the Routing Rules table now shares.
This commit is contained in:
@@ -51,7 +51,7 @@ The **format is chosen by path**, each with its own enable toggle:
|
||||
| **Clash for Windows (legacy)** | `/clash-legacy/` | `subClashEnable` | YAML limited to proxy types, transports, and ciphers supported by the legacy Clash core. |
|
||||
|
||||
Only enabled inbounds using **VLESS, VMess, Trojan, Shadowsocks, WireGuard, AmneziaWG, MTProto, TUIC, or Hysteria2**
|
||||
appear in a subscription, ordered by their sub-sort index (TUIC and AmneziaWG are included in raw links and Clash/Mihomo profiles, but omitted from JSON endpoints; MTProto is included in raw links). Requesting `subPath`
|
||||
appear in a subscription, ordered by their sub-sort index by default (TUIC and AmneziaWG are included in raw links and Clash/Mihomo profiles, but omitted from JSON endpoints; MTProto is included in raw links). Requesting `subPath`
|
||||
with an `Accept: text/html` header (or `?html=1`) returns a human-readable info
|
||||
page instead of the raw body.
|
||||
|
||||
@@ -74,6 +74,42 @@ default matcher so existing subscription URLs continue returning YAML.
|
||||
It does not distinguish legacy clients from Mihomo-based clients; Clash for
|
||||
Windows users must use `/clash-legacy/<sub-id>` for a compatible profile.
|
||||
|
||||
### Subscription node ordering
|
||||
|
||||
In **Settings → Subscription → Panel settings**, select **Subscription Node Ordering**
|
||||
(`subHostSortMode`). **Inbound order (default)** preserves the existing subscription
|
||||
sort index, then inbound ID, with each inbound's Hosts ordered inside that block.
|
||||
|
||||
**Hosts order** (`hosts-first`) uses the global order on **Hosts**, including Host
|
||||
groups attached to different inbounds. Drag a group's grip above or below another
|
||||
row to save its position, or use the existing Up/Down buttons. A failed save restores
|
||||
the previous displayed order. The next subscription fetch uses the saved order;
|
||||
no inbound edit or Xray restart is needed.
|
||||
|
||||
For example, these rows start with Host A (Inbound #5) above Host B (Inbound #20):
|
||||
|
||||

|
||||
|
||||
Dragging Host B above Host A saves the order across both inbounds:
|
||||
|
||||

|
||||
|
||||
These screenshots use example Hosts and synthetic API responses.
|
||||
|
||||
Host groups sort by their persisted sort order. Ties use the group remark and group
|
||||
ID, matching the Hosts table. Within a group, inbound subscription sort index,
|
||||
inbound ID and Host row ID provide deterministic ordering for attachments and
|
||||
addresses. Inbounds without applicable Hosts and legacy externalProxy entries
|
||||
follow all Host entries in their previous relative order. External client links
|
||||
remain appended, and the subscription info node remains first.
|
||||
|
||||
This applies to Raw/Base64, Clash/Mihomo and JSON subscriptions. JSON balancer
|
||||
documents keep their slots from the existing numeric balancer/inbound sort; only
|
||||
the endpoint slots are rearranged, preserving the relative order of Host entries.
|
||||
Eligibility, exclusions, credentials and protocol settings are unchanged.
|
||||
Standalone share-link and QR previews retain their existing behavior. Client apps
|
||||
may apply their own sorting after importing a subscription.
|
||||
|
||||
### Base64 vs JSON
|
||||
|
||||
The **Base64** body is just the newline-joined share links, standard-base64
|
||||
|
||||
@@ -35,7 +35,9 @@ _openapi:
|
||||
url: '#enable-or-disable-a-host-group'
|
||||
- depth: 2
|
||||
title: Set host group sort order by the position of each groupId in the array.
|
||||
url: '#set-host-group-sort-order-by-the-position-of-each-groupid-in-the-array'
|
||||
IDs must be unique and refer to existing groups; omitted groups follow
|
||||
in their previous order.
|
||||
url: '#set-host-group-sort-order-by-the-position-of-each-groupid-in-the-array-ids-must-be-unique-and-refer-to-existing-groups-omitted-groups-follow-in-their-previous-order'
|
||||
- depth: 2
|
||||
title: Add a host group to inbounds (same as /add).
|
||||
url: '#add-a-host-group-to-inbounds-same-as-add'
|
||||
@@ -65,7 +67,9 @@ _openapi:
|
||||
- content: Enable or disable a host group.
|
||||
id: enable-or-disable-a-host-group
|
||||
- content: Set host group sort order by the position of each groupId in the array.
|
||||
id: set-host-group-sort-order-by-the-position-of-each-groupid-in-the-array
|
||||
IDs must be unique and refer to existing groups; omitted groups follow
|
||||
in their previous order.
|
||||
id: set-host-group-sort-order-by-the-position-of-each-groupid-in-the-array-ids-must-be-unique-and-refer-to-existing-groups-omitted-groups-follow-in-their-previous-order
|
||||
- content: Add a host group to inbounds (same as /add).
|
||||
id: add-a-host-group-to-inbounds-same-as-add
|
||||
- content: Enable or disable many host groups in one call.
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 33 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 32 KiB |
@@ -350,6 +350,10 @@
|
||||
"subHideSettings": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subHostSortMode": {
|
||||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -705,6 +709,7 @@
|
||||
"subHappTunMode",
|
||||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
@@ -1136,6 +1141,10 @@
|
||||
"subHideSettings": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"subHostSortMode": {
|
||||
"example": "inbound-first",
|
||||
"type": "string"
|
||||
},
|
||||
"subIncyAnnounceUrl": {
|
||||
"type": "string"
|
||||
},
|
||||
@@ -1499,6 +1508,7 @@
|
||||
"subHappTunMode",
|
||||
"subHappTunType",
|
||||
"subHideSettings",
|
||||
"subHostSortMode",
|
||||
"subIncyAnnounceUrl",
|
||||
"subIncyAppAutoDetect",
|
||||
"subIncyBannerBgColor",
|
||||
@@ -12619,7 +12629,7 @@
|
||||
"tags": [
|
||||
"Hosts"
|
||||
],
|
||||
"summary": "Set host group sort order by the position of each groupId in the array.",
|
||||
"summary": "Set host group sort order by the position of each groupId in the array. IDs must be unique and refer to existing groups; omitted groups follow in their previous order.",
|
||||
"operationId": "post_panel_api_hosts_reorder",
|
||||
"requestBody": {
|
||||
"required": true,
|
||||
|
||||
Reference in New Issue
Block a user