mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 19:11:53 +07:00
[PR #6218] [MERGED] fix(warp): preserve WARP Plus license key when changing IP #6180
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#6180
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/6218
Author: @rqzbeh
Created: 8/15/2026
Status: ✅ Merged
Merged: 8/16/2026
Merged by: @MHSanaei
Base:
main← Head:fix/warp-change-ip-preserves-license-key📝 Commits (2)
943d324fix(warp): preserve WARP Plus license key when changing IP280f284Merge branch 'main' into fix/warp-change-ip-preserves-license-key📊 Changes
3 files changed (+215 additions, -3 deletions)
View changed files
📝
frontend/src/pages/xray/overrides/WarpModal.tsx(+3 -0)📝
internal/web/service/integration/warp.go(+39 -3)➕
internal/web/service/integration/warp_change_ip_test.go(+173 -0)📄 Description
Summary
Clicking "Change IP" in the WARP modal no longer deletes a saved WARP Plus license key. The key is written back into stored warp data before the Cloudflare re-apply attempt, and the response now returns the final data so the UI keeps showing the key.
Why
ChangeWarpIProtates the WireGuard keypair by registering a brand-new Cloudflare device (RegWarp), which overwrites the stored warp JSON with the fresh registration's data — including an emptylicense_key. The old key was then re-applied only best-effort:SetWarpLicensefailed (license rejected/rate-limited/network), the failure was swallowed with a warning log and the key was permanently gone from storage.The same path is used by the auto-update IP job (
warp_ip_job.go), so a scheduled rotation could delete the key too.Type of change
Areas affected
How was this tested?
internal/web/service/integration/warp_change_ip_test.goagainst a mock Cloudflare API:TestChangeWarpIPPreservesLicenseKey— stored + returned data keep the key, device still rotates, license re-applied to the new device.TestChangeWarpIPKeepsLicenseWhenReapplyFails— when the license PUT is rejected (HTTP 500), the key stays in storage and the response carries awarningthe UI surfaces.go build ./...,go test -shuffle=on -count=1 $(go list ./...), andgolangci-lint(latest) all pass locally.npm run lint,npm run typecheck,npm test,npm run buildpass; the change toWarpModal.tsxshows a warning toast when the license re-apply fails./panel/api/xray/warp/changeIp→ stored warp JSON still contains the key.Screenshots / recordings
N/A (no visual layout change; a warning toast appears only when the license re-apply fails remotely).
Breaking changes
None. Response shape gains an optional
warningfield;datanow reflects the final stored state (license key present) instead of the transient post-registration state.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.