[PR #7096] fix(sub): render nothing when every host of an inbound is excluded from a format #6648

Open
opened 2026-11-07 21:42:13 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/7096
Author: @mjbe71
Created: 11/7/2026
Status: 🔄 Open

Base: main ← Head: fix/sub-all-hosts-excluded


📝 Commits (4)

  • 911179b fix(sub): render nothing when every host of an inbound is excluded from a format
  • 498a646 fix(frontend): mirror the all-hosts-excluded rule in the panel's host links
  • 2e0cc9d docs(sub): shorten the hostEndpoints doc comment to two lines
  • 35e87f3 test(frontend): stop pinning the bare-inbound fallback for excluded Hosts

📊 Changes

14 files changed (+333 additions, -30 deletions)

View changed files

📝 frontend/src/lib/hosts/host-link.ts (+19 -0)
📝 frontend/src/pages/clients/tunnelEndpoints.ts (+4 -3)
📝 frontend/src/pages/inbounds/InboundsPage.tsx (+11 -2)
📝 frontend/src/pages/inbounds/info/InboundInfoModal.tsx (+10 -3)
➕ frontend/src/test/host-all-excluded.test.ts (+95 -0)
📝 frontend/src/test/host-link.test.ts (+17 -0)
📝 frontend/src/test/tunnel-host-endpoints.test.ts (+6 -1)
📝 internal/sub/clash_service.go (+6 -1)
➕ internal/sub/host_all_excluded_test.go (+126 -0)
📝 internal/sub/host_order.go (+9 -2)
📝 internal/sub/host_sub.go (+13 -13)
📝 internal/sub/json_service.go (+6 -1)
📝 internal/sub/links.go (+4 -1)
📝 internal/sub/service.go (+7 -3)

📄 Description

Problem

hostEndpoints and subscriptionHostVariants returned the same empty result for "inbound has no enabled hosts" and "all enabled hosts are excluded from this format". An inbound whose hosts were all hidden from raw, json or clash therefore fell back to its bare address and appeared in that subscription anyway.

Fix

The all-excluded case is now reported separately and renders nothing, in raw, json and clash, in both the legacy and hosts-first sort modes, and in inboundLinks / LinkProvider. Traffic accounting and the usage header are kept, the same as for a client bound to a format-excluded host (TestSub_ClientHostRule_FormatExcludedFailsClosed).

Behaviour change

An inbound that has enabled hosts, all of them excluded from a format, no longer appears in that format. Inbounds with no hosts, or only disabled hosts, render as before (covered by a test).

  • The panel's own tunnel configs and link export (MTProto, WireGuard, AmneziaWG, TUIC) follow the same rule via allHostsExcluded in host-link.ts.
  • An existing TUIC Clash test that expected the inbound's own address for a sole excluded Host now covers a second, non-excluded Host instead.

Tests

  • TestSub_AllHostsFormatExcluded_RendersNothing: 2 sort modes x 3 formats, checks nothing is rendered, usage is kept, and the other formats still render.
  • TestSub_OnlyDisabledHosts_StillRendersInbound: disabled hosts are not "excluded".
  • TestLinkProvider_AllHostsRawExcluded_NoLinks: LinksForClient / LinksForInbounds.

Written test-first; they fail on main for the reported reason.


🔄 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/7096 **Author:** [@mjbe71](https://github.com/mjbe71) **Created:** 11/7/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `fix/sub-all-hosts-excluded` --- ### 📝 Commits (4) - [`911179b`](https://github.com/MHSanaei/3x-ui/commit/911179ba761205672a6c6c60d6391260abba9e38) fix(sub): render nothing when every host of an inbound is excluded from a format - [`498a646`](https://github.com/MHSanaei/3x-ui/commit/498a6469690daa5ad7c21d5d893da45c2884f127) fix(frontend): mirror the all-hosts-excluded rule in the panel's host links - [`2e0cc9d`](https://github.com/MHSanaei/3x-ui/commit/2e0cc9d8b04fbca37e724f8635290c06044ddcbe) docs(sub): shorten the hostEndpoints doc comment to two lines - [`35e87f3`](https://github.com/MHSanaei/3x-ui/commit/35e87f33f09c11f3088cbac7c93eac86d774a6c8) test(frontend): stop pinning the bare-inbound fallback for excluded Hosts ### 📊 Changes **14 files changed** (+333 additions, -30 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/hosts/host-link.ts` (+19 -0) 📝 `frontend/src/pages/clients/tunnelEndpoints.ts` (+4 -3) 📝 `frontend/src/pages/inbounds/InboundsPage.tsx` (+11 -2) 📝 `frontend/src/pages/inbounds/info/InboundInfoModal.tsx` (+10 -3) ➕ `frontend/src/test/host-all-excluded.test.ts` (+95 -0) 📝 `frontend/src/test/host-link.test.ts` (+17 -0) 📝 `frontend/src/test/tunnel-host-endpoints.test.ts` (+6 -1) 📝 `internal/sub/clash_service.go` (+6 -1) ➕ `internal/sub/host_all_excluded_test.go` (+126 -0) 📝 `internal/sub/host_order.go` (+9 -2) 📝 `internal/sub/host_sub.go` (+13 -13) 📝 `internal/sub/json_service.go` (+6 -1) 📝 `internal/sub/links.go` (+4 -1) 📝 `internal/sub/service.go` (+7 -3) </details> ### 📄 Description ## Problem `hostEndpoints` and `subscriptionHostVariants` returned the same empty result for "inbound has no enabled hosts" and "all enabled hosts are excluded from this format". An inbound whose hosts were all hidden from raw, json or clash therefore fell back to its bare address and appeared in that subscription anyway. ## Fix The all-excluded case is now reported separately and renders nothing, in raw, json and clash, in both the legacy and hosts-first sort modes, and in `inboundLinks` / `LinkProvider`. Traffic accounting and the usage header are kept, the same as for a client bound to a format-excluded host (`TestSub_ClientHostRule_FormatExcludedFailsClosed`). ## Behaviour change An inbound that has enabled hosts, all of them excluded from a format, no longer appears in that format. Inbounds with no hosts, or only disabled hosts, render as before (covered by a test). - The panel's own tunnel configs and link export (MTProto, WireGuard, AmneziaWG, TUIC) follow the same rule via `allHostsExcluded` in `host-link.ts`. - An existing TUIC Clash test that expected the inbound's own address for a sole excluded Host now covers a second, non-excluded Host instead. ## Tests - `TestSub_AllHostsFormatExcluded_RendersNothing`: 2 sort modes x 3 formats, checks nothing is rendered, usage is kept, and the other formats still render. - `TestSub_OnlyDisabledHosts_StillRendersInbound`: disabled hosts are not "excluded". - `TestLinkProvider_AllHostsRawExcluded_NoLinks`: `LinksForClient` / `LinksForInbounds`. Written test-first; they fail on `main` for the reported reason. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
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#6648
No description provided.