mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-06-05 12:44:22 +00:00
fix(warp): persist client_id so WARP outbound gets reserved bytes (#4781)
RegWarp now stores config.client_id from the Cloudflare registration, and WarpModal sources the reserved bytes from the live config response (falling back to stored creds). Previously reservedFor read an always-missing client_id, producing an empty reserved array.
This commit is contained in:
parent
47d9b49666
commit
3657ed55dc
2 changed files with 7 additions and 1 deletions
|
|
@ -38,6 +38,7 @@ interface WarpConfig {
|
||||||
model?: string;
|
model?: string;
|
||||||
enabled?: boolean;
|
enabled?: boolean;
|
||||||
config?: {
|
config?: {
|
||||||
|
client_id?: string;
|
||||||
interface?: { addresses?: { v4?: string; v6?: string } };
|
interface?: { addresses?: { v4?: string; v6?: string } };
|
||||||
peers?: { public_key?: string; endpoint?: { host?: string } }[];
|
peers?: { public_key?: string; endpoint?: { host?: string } }[];
|
||||||
};
|
};
|
||||||
|
|
@ -99,7 +100,7 @@ export default function WarpModal({
|
||||||
mtu: 1420,
|
mtu: 1420,
|
||||||
secretKey: data?.private_key,
|
secretKey: data?.private_key,
|
||||||
address: addressesFor(cfg.interface?.addresses || {}),
|
address: addressesFor(cfg.interface?.addresses || {}),
|
||||||
reserved: reservedFor(data?.client_id),
|
reserved: reservedFor(cfg.client_id ?? data?.client_id),
|
||||||
domainStrategy: 'ForceIP',
|
domainStrategy: 'ForceIP',
|
||||||
peers: [{ publicKey: peer.public_key, endpoint: peer.endpoint?.host }],
|
peers: [{ publicKey: peer.public_key, endpoint: peer.endpoint?.host }],
|
||||||
noKernelTun: false,
|
noKernelTun: false,
|
||||||
|
|
|
||||||
|
|
@ -106,6 +106,11 @@ func (s *WarpService) RegWarp(secretKey string, publicKey string) (string, error
|
||||||
"license_key": license,
|
"license_key": license,
|
||||||
"private_key": secretKey,
|
"private_key": secretKey,
|
||||||
}
|
}
|
||||||
|
if config, ok := rsp["config"].(map[string]any); ok {
|
||||||
|
if clientID, ok := config["client_id"].(string); ok {
|
||||||
|
warpData["client_id"] = clientID
|
||||||
|
}
|
||||||
|
}
|
||||||
warpJSON, err := json.MarshalIndent(warpData, "", " ")
|
warpJSON, err := json.MarshalIndent(warpData, "", " ")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue