1
0
mirror of https://github.com/kognise/water.css.git synced 2025-08-12 16:14:34 +02:00

fix: update regex so only valid themes in URL params are used

This commit is contained in:
Jonas Kuske
2019-06-08 23:14:51 +02:00
parent d0ca9554f0
commit cd15e37177
3 changed files with 4 additions and 3 deletions

View File

@@ -114,8 +114,9 @@ const createColorSchemeListener = (scheme, queryHandler) => {
}
const themeFromParams = queryParams.get('theme')
/** @type {VersionOptions} */
const initialVersionOptions = {
theme: /** @type {Theme} */ (/dark|light/.test(themeFromParams) ? themeFromParams : 'dark'),
theme: /** @type {Theme} */ (/^(dark|light)$/.test(themeFromParams) ? themeFromParams : 'dark'),
isLegacy: queryParams.has('legacy') || !supportsCssVars,
isStandalone: queryParams.has('standalone'),
}