fix(frontend): preserve iframe theme across login

The iframe login used a fixed queryless redirect and called setTheme, which both dropped the iframe theme and persisted it into the normal site's shared theme storage.
This commit is contained in:
Rocky Kwok committed 2026-07-27 09:54:22 +08:00
1 parent 59f2f56124
commit 75aad4eef6
6 files changed
+187 -30

No files matched your search

@@ -0,0 +1,19 @@
/**
* @typedef {"light" | "dark"} EmbedThemeMode
*/
/**
* Map external theme names to the two themes supported by iframe surfaces.
*
* @param {string | null | undefined} rawTheme
* @returns {EmbedThemeMode}
*/
export function resolveEmbedThemeMode(rawTheme) {
const theme = (rawTheme ?? "").trim().toLowerCase();
return theme === "dark" ||
theme === "dark-blue" ||
theme === "深色" ||
theme === "深蓝"
? "dark"
: "light";
}