2
0

🚑 Fix custom CSS sanitization

This commit is contained in:
Baptiste Arnaud
2023-10-09 10:39:47 +02:00
parent 021cae3c29
commit 8eb9f2568b
5 changed files with 6 additions and 7 deletions

View File

@@ -406,9 +406,7 @@ const sanitizeAndParseTheme = (
general: deepParseVariables(variables)(theme.general),
chat: deepParseVariables(variables)(theme.chat),
customCss: theme.customCss
? sanitizeAndParseHeadCode(
parseVariables(variables)(removeLiteBadgeCss(theme.customCss))
)
? removeLiteBadgeCss(parseVariables(variables)(theme.customCss))
: undefined,
})
@@ -420,6 +418,6 @@ const sanitizeAndParseHeadCode = (code: string) => {
}
const removeLiteBadgeCss = (code: string) => {
const liteBadgeCssRegex = /.*#lite-badge[\s]*{[\s\S]*}/gm
const liteBadgeCssRegex = /.*#lite-badge.*{[\s\S][^{]*}/gm
return code.replace(liteBadgeCssRegex, '')
}