fix(warp): preserve WARP Plus license key when changing IP (#6218)

ChangeWarpIP rotated the WireGuard keypair by registering a brand-new
Cloudflare device via RegWarp, which overwrites the stored warp data with
the fresh registration's empty license_key. The old key was then re-applied
only best-effort: any SetWarpLicense failure was swallowed with a warning
log, permanently deleting the saved WARP Plus key, and even on success the
response returned to the UI carried the pre-reapply snapshot (empty key).

Fix: write the old license key back into the stored warp data immediately
after RegWarp (before the remote upgrade attempt), so storage never loses
it; keep the remote re-apply as best-effort but surface its failure as a
warning field in the response; and return the final stored data so the
modal shows the preserved key. The auto-update IP job shares this path and
is fixed too. warpAPIBase is now a var so integration tests can point at a
mock Cloudflare API.

Co-authored-by: rqzbeh <rqzbeh@users.noreply.github.com>
This commit is contained in:
Rouzbeh†
2026-08-16 15:30:16 +03:30
committed by GitHub
parent b53a5515d6
commit 5d6d98d1f9
3 changed files with 215 additions and 3 deletions
@@ -238,6 +238,9 @@ export default function WarpModal({
onResetOutbound({ index: warpOutboundIndex, outbound: merged });
}
}
if (parsed.warning) {
messageApi.warning(parsed.warning);
}
messageApi.success(t('pages.xray.warp.changeIpSuccess', 'WARP IP changed successfully!'));
}
} finally {