[PR #5929] [MERGED] feat(sub): Add XHTTP session field compatibility in share links and subscriptions #6030

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

📋 Pull Request Information

Original PR: https://github.com/MHSanaei/3x-ui/pull/5929
Author: @beehunt9r
Created: 7/13/2026
Status: ✅ Merged
Merged: 7/28/2026
Merged by: @MHSanaei

Base: main ← Head: main


📝 Commits (2)

  • 15b2cbf ✨ Add sessionKey and sessionPlacement compatability for previous clients
  • c5fd3d0 ✨ Add sessionKey and sessionPlacement compatability for previous clients on backend

📊 Changes

4 files changed (+119 additions, -2 deletions)

View changed files

📝 frontend/src/lib/xray/inbound-link.ts (+10 -2)
📝 frontend/src/test/inbound-link.test.ts (+70 -0)
📝 internal/sub/service.go (+9 -0)
📝 internal/sub/service_test.go (+30 -0)

📄 Description

Summary

Adds backward-compatible XHTTP session field aliases to generated share links and subscription links. XHTTP extra now carries both sessionIDPlacement / sessionIDKey and
legacy sessionPlacement / sessionKey, while saved inbound configs keep only the canonical sessionID* fields.

Why

Recent Xray versions renamed sessionPlacement and sessionKey to sessionIDPlacement and sessionIDKey. Older clients still expect the legacy names in XHTTP extra, so
subscription/share links could lose compatibility even though the inbound config itself is valid.

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?

Ran targeted backend and frontend tests:

go test ./internal/sub
go test ./internal/web/service
npm test -- --run src/test/inbound-link.test.ts src/test/xhttp-session-id.test.ts src/test/inbound-form-adapter.test.ts src/test/stream-wire-normalize.test.ts

Added coverage for generated VLESS XHTTP subscription links to ensure the extra JSON contains both canonical and legacy session field names. Existing tests also confirm inbound
wire payloads and Xray runtime config do not emit duplicate legacy keys.

Screenshots / recordings

N/A

Breaking changes

None

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.
  • 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.
  • 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/5929 **Author:** [@beehunt9r](https://github.com/beehunt9r) **Created:** 7/13/2026 **Status:** ✅ Merged **Merged:** 7/28/2026 **Merged by:** [@MHSanaei](https://github.com/MHSanaei) **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (2) - [`15b2cbf`](https://github.com/MHSanaei/3x-ui/commit/15b2cbf8f9bb05171bcda2a022d2654df66ec09f) :sparkles: Add sessionKey and sessionPlacement compatability for previous clients - [`c5fd3d0`](https://github.com/MHSanaei/3x-ui/commit/c5fd3d01be74ccbbe670511d516015adca8bfd0a) :sparkles: Add sessionKey and sessionPlacement compatability for previous clients on backend ### 📊 Changes **4 files changed** (+119 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `frontend/src/lib/xray/inbound-link.ts` (+10 -2) 📝 `frontend/src/test/inbound-link.test.ts` (+70 -0) 📝 `internal/sub/service.go` (+9 -0) 📝 `internal/sub/service_test.go` (+30 -0) </details> ### 📄 Description ## Summary Adds backward-compatible XHTTP session field aliases to generated share links and subscription links. XHTTP `extra` now carries both `sessionIDPlacement` / `sessionIDKey` and legacy `sessionPlacement` / `sessionKey`, while saved inbound configs keep only the canonical `sessionID*` fields. ## Why Recent Xray versions renamed `sessionPlacement` and `sessionKey` to `sessionIDPlacement` and `sessionIDKey`. Older clients still expect the legacy names in XHTTP `extra`, so subscription/share links could lose compatibility even though the inbound config itself is valid. ## Type of change - [ ] Bug fix - [x] 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 - [x] 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? Ran targeted backend and frontend tests: ```bash go test ./internal/sub go test ./internal/web/service npm test -- --run src/test/inbound-link.test.ts src/test/xhttp-session-id.test.ts src/test/inbound-form-adapter.test.ts src/test/stream-wire-normalize.test.ts ``` Added coverage for generated VLESS XHTTP subscription links to ensure the extra JSON contains both canonical and legacy session field names. Existing tests also confirm inbound wire payloads and Xray runtime config do not emit duplicate legacy keys. ## Screenshots / recordings N/A ## Breaking changes None ## Checklist - [x] I tested the change locally and confirmed the described behavior. - [x] I added or updated tests for the new behavior (when applicable). - [x] go build ./... and the test suite pass locally. - [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. - [ ] 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:05:52 +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#6030
No description provided.