From 84c48d0523d0ad3bce643e1acc2d9f2c7944ddf7 Mon Sep 17 00:00:00 2001 From: 170-carry Date: Tue, 28 Apr 2026 00:13:21 +0800 Subject: [PATCH] Fix room turnover token parsing --- h5/activity/room-turnover-reward/index.html | 23 +++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/h5/activity/room-turnover-reward/index.html b/h5/activity/room-turnover-reward/index.html index de47a22..63efe99 100644 --- a/h5/activity/room-turnover-reward/index.html +++ b/h5/activity/room-turnover-reward/index.html @@ -489,7 +489,7 @@ const DEFAULT_API_BASE = "https://jvapi.haiyihy.com/"; const DEFAULT_API_PREFIX = "/go"; const DEFAULT_AVATAR = "../../assets/defaultAvatar-CdxWBK1k.png"; - const query = new URLSearchParams(window.location.search); + const query = buildPageQueryParams(); const resolvedAPIBase = resolveAPIBase(); const fallbackLevels = Array.from({ length: 7 }, (_, index) => ({ level: index + 1, @@ -525,6 +525,21 @@ return value == null ? "" : String(value).trim(); } + function buildPageQueryParams() { + const params = new URLSearchParams(window.location.search); + const hash = window.location.hash || ""; + const queryIndex = hash.indexOf("?"); + if (queryIndex >= 0) { + const hashParams = new URLSearchParams(hash.slice(queryIndex + 1)); + hashParams.forEach((value, key) => { + if (!params.has(key)) { + params.append(key, value); + } + }); + } + return params; + } + function textFromQuery(keys, fallback) { for (const key of keys) { const value = trimValue(query.get(key)); @@ -536,7 +551,11 @@ } function resolveToken() { - return textFromQuery(["token", "accessToken", "authorization"], ""); + const token = textFromQuery(["token", "accessToken", "authorization"], ""); + if (token.toLowerCase().startsWith("bearer ")) { + return "Bearer " + token.slice(7).replace(/ /g, "+"); + } + return token.replace(/ /g, "+"); } function numberFromQuery(keys, fallback) {