[PR #6528] [MERGED] fix(panel): read the outbound protocol id in the Outbounds row like the core #6335

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/6528
Author: @BlindMaster24
Created: 9/14/2026
Status: ✅ Merged
Merged: 9/14/2026
Merged by: @BlindMaster24

Base: main ← Head: fix/outbounds-address-column-case


📝 Commits (4)

  • b374e5c fix(panel): read the outbound protocol id in the address column like the core
  • 4f05774 fix(panel): fill the outbound address column from one protocol-id rule
  • b070daf fix(panel): read the vnext shape of a vless outbound in the address column
  • 6510284 fix(panel): read the protocol id of the outbound stream tags like the core

📊 Changes

4 files changed (+154 additions, -14 deletions)

View changed files

📝 frontend/src/pages/xray/outbounds/outbounds-tab-helpers.ts (+18 -11)
📝 frontend/src/pages/xray/outbounds/useOutboundColumns.tsx (+3 -3)
➕ frontend/src/test/outbound-identity-tags-case.test.tsx (+60 -0)
➕ frontend/src/test/outbounds-addresses-case.test.ts (+73 -0)

📄 Description

Summary

The Outbounds row reads the outbound's protocol id the way the core does. Three readers were involved, all display-only:

  1. outboundAddresses switched on o.protocol with exact case labels, so a row spelled "VMess" fell through to default and rendered an empty Address column.
  2. The same switch had no case for hysteria or amneziawg — both selectable in the outbound form — so a canonically spelled row was blank too, and its VLESS branch read only the flat settings.address/port, so a vnext-shaped row rendered a bare :.
  3. The identity cell gated the network/security tags on an exact-match includes() over four ids, so the same "VMess" row rendered without its ws/tls tags.

Why

The core lowercases the id in LoadWithID (infra/conf/loader.go:46 at the pinned revision 52a412d9e2f5), so a template that spells an outbound "VMess" runs normally. The panel's readers do not all agree; these were the ones left in the Outbounds row.

Scenario. An operator's template comes from elsewhere — pasted, generated by another tool, hand-edited — and spells an outbound "VMess" with populated settings.vnext. On the Outbounds page the row is otherwise healthy: the tag is right, the protocol label is right, the Test button works. Only the Address column is blank and the stream tags are missing, even though both are in the settings. The same blank cell appears in the card view and in the subscription outbounds table, which read through the same helper. Nothing breaks functionally, but a row that looks like it has no server is exactly what sends someone to re-create an outbound that was already correct.

The hysteria/amneziawg half needs no unusual spelling at all: pick those protocols in the outbound form and the Address cell is blank from the moment the row is created.

Reproduced before the fix, which is what the new tests pin:

× reads a capitalised vmess id     expected [] to deeply equal [ 'a.example.com:443' ]
× reads a capitalised trojan id    expected [] to deeply equal [ 'b.example.com:8443' ]
× reads a capitalised wireguard id expected [] to deeply equal [ 'c.example.com:51820' ]
× reads the vnext server of a vless row          expected [] to deeply equal [ 'a.example.com:443' ]
× reads the flat server of a hysteria id         expected [] to deeply equal [ 'e.example.com:443' ]
× reads the peer endpoint of an amneziawg id     expected [] to deeply equal [ 'f.example.com:51820' ]
× renders the stream tags and the address of a "VMess" row
    expected [ 'VMess' ] to deeply equal [ 'VMess', 'ws', 'tls' ]
✓ leaves a canonical id unchanged
✓ still returns nothing for a protocol that carries no address
✓ returns no bare separator for a vless row that carries no server

What changed

  • outbounds-tab-helpers.ts: the switch routes through the shared isOutboundProtocol (schemas/primitives/outbound-protocol.ts), the module that owns the rule, instead of folding the id inline — isUntestable, two functions below it in the same file, already reads it that way. The VLESS branch reads vnext first and falls back to the flat pair, the order the probe's extractor uses (internal/web/service/outbound/outbound.go:259-269), which also stops it emitting a bare :. hysteria joins that branch and amneziawg joins the peers branch, the shape each form writes.
  • useOutboundColumns.tsx: the identity cell asks isOutboundProtocol per id instead of includes(record.protocol as never).

Relationship to #6526 and #6527. All three are the same defect — a reader of a protocol id disagreeing with the core — split by subject: #6526 is the probe's lane gate and endpoint extractor (Go), #6527 is the probe's untestable gate (Go batch gate + isUntestable), and this is the Outbounds row. #6527 touches isUntestable in this same file; the hunks do not overlap, so whichever merges second needs no more than a trivial rebase.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Documentation
  • Tests only
  • Build / CI / tooling
  • Other

Areas affected

  • Frontend (UI / panel pages)
  • Backend (API endpoints, login, settings)
  • Xray config generation
  • Subscription (share links / Clash / JSON)
  • Statistics / traffic counters
  • Database / migrations
  • Install / upgrade script
  • Docker image
  • Multi-node (sub-nodes)
  • Telegram bot

How was this tested?

  • frontend/src/test/outbounds-addresses-case.test.ts — 11 cases: the three case-variant spellings, the vnext-shaped VLESS row, the VLESS flat fallback, hysteria, amneziawg, and four controls that are unchanged either way (a canonical "vmess" row, a "freedom" row that legitimately carries no address, a VLESS row with no server, a capitalised DNS row).
  • frontend/src/test/outbound-identity-tags-case.test.tsx — renders OutboundsTab with a "VMess" row and asserts the identity cell's tags are exactly ['VMess', 'ws', 'tls'] and that the row shows a.example.com:443.

Each of the seven assertions above was watched red with its fix reverted and green with it restored.

Gates run locally (Node 24): npm run lint — 0 warnings, 0 errors; npm run format:check — clean; npm run typecheck — clean; npm run build — passes, and gen:api left no generated artefact dirty.

npx vitest run --project unit — 73 of 75 files pass. The two failures are not from this change: input-number-guard.test.ts (expected [] to have a length of 3) fails on the pristine tree too, in isolation, and lints a fixture under tools/oxlint/ that this PR does not touch; language-scope.test.ts passes in isolation (2.7s against the default 5s timeout) and only fails inside the full run. npx vitest run --project components — 54 of 56 pass, and the failing files differ from run to run (inbound-form-modal.test.tsx, calendar-expire-setting.test.tsx, geodata-section.test.tsx, subscription-general-tab.test.tsx across three runs); each passes in isolation and none imports this PR's modules. The storybook project was not run here — chromium is not installed in this environment; CI covers it.

Screenshots / recordings

N/A — no markup changed; the assertions above cover the rendered value.

Breaking changes

None. Canonical spellings produce byte-identical output; only rows the core already runs and the readers previously misread change, and they change from a blank cell to the address and tags that are in the settings.

Checklist

  • I tested the change locally and confirmed the described behavior.
  • I added or updated tests for the new behavior (when applicable).
  • go build ./... and the test suite pass locally. — No Go file is touched by this PR.
  • For frontend changes: npm run lint, npm run typecheck, and npm run build pass.
  • I updated the Wiki / README / API docs if user-facing behavior changed. — No endpoint or response shape changed.
  • My commits follow the project's existing message style.
  • I have no unrelated changes mixed into this PR.

🔄 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/6528 **Author:** [@BlindMaster24](https://github.com/BlindMaster24) **Created:** 9/14/2026 **Status:** ✅ Merged **Merged:** 9/14/2026 **Merged by:** [@BlindMaster24](https://github.com/BlindMaster24) **Base:** `main` ← **Head:** `fix/outbounds-address-column-case` --- ### 📝 Commits (4) - [`b374e5c`](https://github.com/MHSanaei/3x-ui/commit/b374e5ce7c35c718420cba72b4392d94f13e8bf7) fix(panel): read the outbound protocol id in the address column like the core - [`4f05774`](https://github.com/MHSanaei/3x-ui/commit/4f05774f4232da1b1ac7599d42222df766f8f7c3) fix(panel): fill the outbound address column from one protocol-id rule - [`b070daf`](https://github.com/MHSanaei/3x-ui/commit/b070daf01f9b5663d697a68ae0b621e6d011f609) fix(panel): read the vnext shape of a vless outbound in the address column - [`6510284`](https://github.com/MHSanaei/3x-ui/commit/65102845a2df5137220970ddac3563c9e9966d93) fix(panel): read the protocol id of the outbound stream tags like the core ### 📊 Changes **4 files changed** (+154 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/pages/xray/outbounds/outbounds-tab-helpers.ts` (+18 -11) 📝 `frontend/src/pages/xray/outbounds/useOutboundColumns.tsx` (+3 -3) ➕ `frontend/src/test/outbound-identity-tags-case.test.tsx` (+60 -0) ➕ `frontend/src/test/outbounds-addresses-case.test.ts` (+73 -0) </details> ### 📄 Description ## Summary The Outbounds row reads the outbound's protocol id the way the core does. Three readers were involved, all display-only: 1. `outboundAddresses` switched on `o.protocol` with exact `case` labels, so a row spelled `"VMess"` fell through to `default` and rendered an empty Address column. 2. The same switch had no `case` for `hysteria` or `amneziawg` — both selectable in the outbound form — so a canonically spelled row was blank too, and its VLESS branch read only the flat `settings.address`/`port`, so a `vnext`-shaped row rendered a bare `:`. 3. The identity cell gated the network/security tags on an exact-match `includes()` over four ids, so the same `"VMess"` row rendered without its `ws`/`tls` tags. ## Why The core lowercases the id in `LoadWithID` (`infra/conf/loader.go:46` at the pinned revision `52a412d9e2f5`), so a template that spells an outbound `"VMess"` runs normally. The panel's readers do not all agree; these were the ones left in the Outbounds row. **Scenario.** An operator's template comes from elsewhere — pasted, generated by another tool, hand-edited — and spells an outbound `"VMess"` with populated `settings.vnext`. On the Outbounds page the row is otherwise healthy: the tag is right, the protocol label is right, the Test button works. Only the **Address** column is blank and the stream tags are missing, even though both are in the settings. The same blank cell appears in the card view and in the subscription outbounds table, which read through the same helper. Nothing breaks functionally, but a row that looks like it has no server is exactly what sends someone to re-create an outbound that was already correct. The hysteria/amneziawg half needs no unusual spelling at all: pick those protocols in the outbound form and the Address cell is blank from the moment the row is created. Reproduced before the fix, which is what the new tests pin: ``` × reads a capitalised vmess id expected [] to deeply equal [ 'a.example.com:443' ] × reads a capitalised trojan id expected [] to deeply equal [ 'b.example.com:8443' ] × reads a capitalised wireguard id expected [] to deeply equal [ 'c.example.com:51820' ] × reads the vnext server of a vless row expected [] to deeply equal [ 'a.example.com:443' ] × reads the flat server of a hysteria id expected [] to deeply equal [ 'e.example.com:443' ] × reads the peer endpoint of an amneziawg id expected [] to deeply equal [ 'f.example.com:51820' ] × renders the stream tags and the address of a "VMess" row expected [ 'VMess' ] to deeply equal [ 'VMess', 'ws', 'tls' ] ✓ leaves a canonical id unchanged ✓ still returns nothing for a protocol that carries no address ✓ returns no bare separator for a vless row that carries no server ``` **What changed** - `outbounds-tab-helpers.ts`: the switch routes through the shared `isOutboundProtocol` (`schemas/primitives/outbound-protocol.ts`), the module that owns the rule, instead of folding the id inline — `isUntestable`, two functions below it in the same file, already reads it that way. The VLESS branch reads `vnext` first and falls back to the flat pair, the order the probe's extractor uses (`internal/web/service/outbound/outbound.go:259-269`), which also stops it emitting a bare `:`. `hysteria` joins that branch and `amneziawg` joins the `peers` branch, the shape each form writes. - `useOutboundColumns.tsx`: the identity cell asks `isOutboundProtocol` per id instead of `includes(record.protocol as never)`. **Relationship to #6526 and #6527.** All three are the same defect — a reader of a protocol id disagreeing with the core — split by subject: #6526 is the probe's lane gate and endpoint extractor (Go), #6527 is the probe's untestable gate (Go batch gate + `isUntestable`), and this is the Outbounds row. #6527 touches `isUntestable` in this same file; the hunks do not overlap, so whichever merges second needs no more than a trivial rebase. ## Type of change - [x] Bug fix - [ ] New feature - [ ] Refactoring (no behavior change) - [ ] Documentation - [ ] Tests only - [ ] Build / CI / tooling - [ ] Other ## Areas affected - [x] Frontend (UI / panel pages) - [ ] Backend (API endpoints, login, settings) - [ ] Xray config generation - [ ] Subscription (share links / Clash / JSON) - [ ] Statistics / traffic counters - [ ] Database / migrations - [ ] Install / upgrade script - [ ] Docker image - [ ] Multi-node (sub-nodes) - [ ] Telegram bot ## How was this tested? - `frontend/src/test/outbounds-addresses-case.test.ts` — 11 cases: the three case-variant spellings, the `vnext`-shaped VLESS row, the VLESS flat fallback, hysteria, amneziawg, and four controls that are unchanged either way (a canonical `"vmess"` row, a `"freedom"` row that legitimately carries no address, a VLESS row with no server, a capitalised DNS row). - `frontend/src/test/outbound-identity-tags-case.test.tsx` — renders `OutboundsTab` with a `"VMess"` row and asserts the identity cell's tags are exactly `['VMess', 'ws', 'tls']` and that the row shows `a.example.com:443`. Each of the seven assertions above was watched red with its fix reverted and green with it restored. Gates run locally (Node 24): `npm run lint` — 0 warnings, 0 errors; `npm run format:check` — clean; `npm run typecheck` — clean; `npm run build` — passes, and `gen:api` left no generated artefact dirty. `npx vitest run --project unit` — 73 of 75 files pass. The two failures are not from this change: `input-number-guard.test.ts` (`expected [] to have a length of 3`) fails on the pristine tree too, in isolation, and lints a fixture under `tools/oxlint/` that this PR does not touch; `language-scope.test.ts` passes in isolation (2.7s against the default 5s timeout) and only fails inside the full run. `npx vitest run --project components` — 54 of 56 pass, and the failing files differ from run to run (`inbound-form-modal.test.tsx`, `calendar-expire-setting.test.tsx`, `geodata-section.test.tsx`, `subscription-general-tab.test.tsx` across three runs); each passes in isolation and none imports this PR's modules. The `storybook` project was not run here — chromium is not installed in this environment; CI covers it. ## Screenshots / recordings N/A — no markup changed; the assertions above cover the rendered value. ## Breaking changes None. Canonical spellings produce byte-identical output; only rows the core already runs and the readers previously misread change, and they change from a blank cell to the address and tags that are in the settings. ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [ ] `go build ./...` and the test suite pass locally. — No Go file is touched by this PR. - [x] For frontend changes: `npm run lint`, `npm run typecheck`, and `npm run build` pass. - [ ] I updated the Wiki / README / API docs if user-facing behavior changed. — No endpoint or response shape changed. - [x] My commits follow the project's existing message style. - [x] I have no unrelated changes mixed into this PR. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-11-02 04:08:01 +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#6335
No description provided.