From 187c935de3bcaa454feeff2712c747f28d407318 Mon Sep 17 00:00:00 2001 From: ZuoZuo <68836346+Mrz-sakura@users.noreply.github.com> Date: Fri, 1 May 2026 15:04:25 +0800 Subject: [PATCH] fix: use correct H5 transfer origin --- h5/hyapp/withdraw-exchange/script.js | 35 +++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/h5/hyapp/withdraw-exchange/script.js b/h5/hyapp/withdraw-exchange/script.js index 6a3ca9b..759ed92 100644 --- a/h5/hyapp/withdraw-exchange/script.js +++ b/h5/hyapp/withdraw-exchange/script.js @@ -293,6 +293,38 @@ return ""; } + function splitHeaderPairs(value) { + const result = {}; + String(value || "").split(";").forEach((item) => { + const index = item.indexOf("="); + if (index > -1) result[item.slice(0, index).trim()] = item.slice(index + 1).trim(); + }); + return result; + } + + function firstRawParam(names) { + for (const name of names) { + const value = readRawParam(name); + if (value) return value; + } + return ""; + } + + function readRequestSysOrigin() { + const packed = splitHeaderPairs(firstRawParam(["req-sys-origin", "Req-Sys-Origin", "reqSysOrigin", "ReqSysOrigin"])); + const origin = String(firstRawParam(["sysOrigin", "origin", "Sys-Origin"]) || packed.origin || "LIKEI") + .trim() + .toUpperCase(); + const originChild = String( + firstRawParam(["sysOriginChild", "originChild", "child", "Sys-Origin-Child"]) + || packed.originChild + || packed.child + || origin + ).trim().toUpperCase(); + + return { origin, originChild }; + } + function normalizeLanguage(lang) { const value = String(lang || "en").toLowerCase(); return supportedLanguages.includes(value) ? value : "en"; @@ -344,6 +376,7 @@ } function authHeadersFromToken(token, hasBody) { + const sysOrigin = readRequestSysOrigin(); const headers = { Authorization: normalizeAuthorization(token), "req-lang": currentLang, @@ -351,7 +384,7 @@ "req-version": "V2", "req-zone": Intl.DateTimeFormat().resolvedOptions().timeZone || "Asia/Shanghai", "req-app-intel": "version=1.0.0;build=1;model=H5;sysVersion=Web;channel=Web", - "req-sys-origin": "origin=ATYOU;originChild=ATYOU" + "req-sys-origin": `origin=${sysOrigin.origin};originChild=${sysOrigin.originChild}` }; if (hasBody) headers["content-type"] = "application/json"; return headers;