white labels hotfix

This commit is contained in:
typescreep
2025-11-02 00:01:21 +03:00
parent a5c68b3adb
commit fe23751834
2 changed files with 12 additions and 8 deletions

View File

@@ -7,15 +7,19 @@ export const getDynamicIndex = (baseprefix: string): string => {
// Generate favicon from SVG if provided
const generateFavicon = (): string => {
if (!iconSvg) {
return ''
}
if (!iconSvg) return ''
try {
const decodedSvg = Buffer.from(iconSvg, 'base64').toString('utf-8')
const dataUri = `data:image/svg+xml;base64,${decodedSvg}`
// If iconSvg is base64-of-base64, unwrap once
const maybeInner = Buffer.from(iconSvg, 'base64').toString('utf8')
const payload =
/^[A-Za-z0-9+/=\n\r]+$/.test(maybeInner) && !maybeInner.trim().startsWith('<')
? maybeInner // double-encoded → use inner base64
: iconSvg // single-encoded → already fine
const dataUri = `data:image/svg+xml;base64,${payload}`
return `<link rel="icon" type="image/svg+xml" href="${dataUri}">`
} catch (error) {
console.error('Error processing icon SVG:', error)
} catch (e) {
console.error('Error processing icon SVG:', e)
return ''
}
}

View File

@@ -213,7 +213,7 @@ app.get(`${basePrefix ? basePrefix : ''}/env.js`, (_, res) => {
window._env_ = {
${basePrefix ? ` BASEPREFIX: "${basePrefix}",` : ''}
TITLE_TEXT: ${JSON.stringify(TITLE_TEXT) || '"check envs"'},
LOGO_TEXT: ${JSON.stringify(LOGO_TEXT) || '"check envs"'},
LOGO_TEXT: ${LOGO_TEXT !== undefined ? JSON.stringify(LOGO_TEXT) : '"check envs"'},
FOOTER_TEXT: ${JSON.stringify(FOOTER_TEXT) || '"check envs"'},
${CUSTOM_LOGO_SVG ? ` CUSTOM_LOGO_SVG: "${CUSTOM_LOGO_SVG}",` : ''}
${CUSTOM_TENANT_TEXT ? ` CUSTOM_TENANT_TEXT: "${CUSTOM_TENANT_TEXT}",` : ''}