Something went wrong. Try again.
twinkl.social forked from kandake.africa/twinkl
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536373839404142<script lang="ts"> import { buildSandboxDocument, USER_JS_SANDBOX } from '../domain/js-sandbox';
interface Props { /** Raw user JS. Runs ONLY inside the sandboxed, null-origin iframe below. */ js: string; /** Iframe height; the effect surface is decorative. */ height?: string; }
let { js, height = '120px' }: Props = $props();
const srcdoc = $derived(buildSandboxDocument(js));</script>
<!-- SECURITY: user JS runs in a sandboxed iframe with `allow-scripts` and NO `allow-same-origin`, giving it a null origin. It cannot read the parent DOM, cookies, OAuth tokens, or other users' data. Never add allow-same-origin here, and never inject user JS into the main document.-->{#if js.trim().length > 0} <iframe class="user-script" title="custom page effect" sandbox={USER_JS_SANDBOX} {srcdoc} style="height: {height};" referrerpolicy="no-referrer" loading="lazy" ></iframe>{/if}
<style> .user-script { display: block; width: 100%; border: 0; background: transparent; }</style>