import { getStaticDir } from "@utils/env"; import { Helmet } from "inferno-helmet"; import { renderToString } from "inferno-server"; import serialize from "serialize-javascript"; import { favIconUrl } from "../../shared/config"; import { IsoDataOptionalSite } from "../../shared/interfaces"; import { buildThemeList } from "./build-themes-list"; const customHtmlHeader = process.env["LEMMY_UI_CUSTOM_HTML_HEADER"] || ""; const appleTouchIcon: string | undefined = undefined; export async function createSsrHtml( root: string, isoData: IsoDataOptionalSite, cspNonce: string, ) { const site = isoData.site_res; const fallbackTheme = ``; const customHtmlHeaderScriptTag = new RegExp(" >, ) : ""; const helmet = Helmet.renderStatic(); return `
${erudaStr} ${customHtmlHeaderWithNonce} ${helmet.title.toString()} ${helmet.meta.toString()} ${helmet.link.toString() || fallbackTheme}