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.
20 lines
460 B
JavaScript
20 lines
460 B
JavaScript
/**
|
|
* @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";
|
|
}
|