* initial turnstile frame Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add interactive flag Signed-off-by: Jens Langhammer <jens@goauthentik.io> * add interactive support for all Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fix missing migration Signed-off-by: Jens Langhammer <jens@goauthentik.io> * don't hide in identification stage if interactive Signed-off-by: Jens Langhammer <jens@goauthentik.io> * fixup Signed-off-by: Jens Langhammer <jens@goauthentik.io> * require less hacky css Signed-off-by: Jens Langhammer <jens@goauthentik.io> * update docs Signed-off-by: Jens Langhammer <jens@goauthentik.io> --------- Signed-off-by: Jens Langhammer <jens@goauthentik.io>
26 lines
813 B
TypeScript
26 lines
813 B
TypeScript
import DOMPurify from "dompurify";
|
|
|
|
import { render } from "@lit-labs/ssr";
|
|
import { collectResult } from "@lit-labs/ssr/lib/render-result.js";
|
|
import { TemplateResult, html } from "lit";
|
|
import { unsafeHTML } from "lit/directives/unsafe-html.js";
|
|
import { until } from "lit/directives/until.js";
|
|
|
|
export const DOM_PURIFY_STRICT: DOMPurify.Config = {
|
|
ALLOWED_TAGS: ["#text"],
|
|
};
|
|
|
|
export async function renderStatic(input: TemplateResult): Promise<string> {
|
|
return await collectResult(render(input));
|
|
}
|
|
|
|
export function purify(input: TemplateResult): TemplateResult {
|
|
return html`${until(
|
|
(async () => {
|
|
const rendered = await renderStatic(input);
|
|
const purified = DOMPurify.sanitize(rendered);
|
|
return html`${unsafeHTML(purified)}`;
|
|
})(),
|
|
)}`;
|
|
}
|