mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #5295] [MERGED] fix(reality): load dest as target alias so existing inbounds aren't wiped #5842
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5842
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5295
Author: @volov-de
Created: 6/13/2026
Status: ✅ Merged
Merged: 6/14/2026
Merged by: @MHSanaei
Base:
main← Head:fix/reality-dest-target-alias📝 Commits (1)
3203129fix(reality): loaddestastargetalias so existing inbounds aren't wiped📊 Changes
2 files changed (+77 additions, -18 deletions)
View changed files
📝
frontend/src/schemas/protocols/security/reality.ts(+41 -18)📝
frontend/src/test/security.test.ts(+36 -0)📄 Description
Summary
REALITY inbounds whose
realitySettingsuse thedestkey load with an empty Target field in the edit form, and re-saving silently drops the destination. Normalizedest→targeton parse so these configs load (and round-trip) correctly.Why
xray-core accepts both
targetanddestas the REALITY destination — they are aliases:The frontend reads/writes only
target:frontend/src/schemas/protocols/security/reality.ts—RealityStreamSettingsSchemadefinestargetonly.frontend/src/pages/inbounds/form/security/reality.tsx— the field binds to['streamSettings','realitySettings','target'].So an inbound created by an older panel build, an external tool, or the panel's own
/panel/api/inboundsAPI (which commonly writedest) loads withtarget: ''— Zod ignores the unknowndest. The Target field shows empty with the "required" warning even though xray is running fine.Worse, re-saving such an inbound serializes the blank
targetand drops the workingdest, so the REALITY inbound has no destination on the next xray restart — a silent break from just opening and saving the edit form.Type of change
Areas affected
How was this tested?
Manual repro:
realitySettingsusedest, e.g.{ "dest": "example.com:443", "serverNames": ["example.com"], ... }(via the API, or restore an older config).example.com:443) with the "required" warning, despite xray running. After: Target loads asexample.com:443.Added unit tests in
frontend/src/test/security.test.tscovering the alias on the schema directly (target absent, both keys present, emptytarget+ presentdest) and throughSecuritySettingsSchema.Validated locally:
cd frontend && npm run test→ 513 passed (31 files), no snapshot changescd frontend && npm run typecheckcd frontend && npm run lintcd frontend && npm run buildgit diff --check origin/main...HEADScreenshots / recordings
No visual/layout change — this is a form-state fix. Symptom: the Target field renders empty (placeholder
example.com:443) for adest-based REALITY inbound; after the fix it loads the configured destination.Breaking changes
None.
Checklist
go build ./...and the test suite pass locally. — frontend-only change; ran the frontend suite (above).npm run lint,npm run typecheck, andnpm run buildpass.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.