From 4cd12c8ae7c4e7837a764f90cd89e9af0c3c9567 Mon Sep 17 00:00:00 2001 From: MrMugame <40832361+MrMugame@users.noreply.github.com> Date: Fri, 9 Jan 2026 15:30:34 +0100 Subject: [PATCH] Set base inside of iframes (#1766) * Set base inside of iframes * Add `system.getURLPrefix` syscall --- client/components/panel.tsx | 8 ++++++-- client/components/panel_html.ts | 2 +- client/document_editor.ts | 4 ++++ client/plugos/syscalls/system.ts | 5 +++++ plug-api/syscalls/system.ts | 7 +++++++ website/API/system.md | 9 +++++++++ 6 files changed, 32 insertions(+), 3 deletions(-) diff --git a/client/components/panel.tsx b/client/components/panel.tsx index 932d9680..1ea70016 100644 --- a/client/components/panel.tsx +++ b/client/components/panel.tsx @@ -1,4 +1,4 @@ -import { useEffect, useRef } from "preact/hooks"; +import { useEffect, useMemo, useRef } from "preact/hooks"; import type { Client } from "../client.ts"; import type { PanelConfig } from "../types/ui.ts"; import { panelHtml } from "./panel_html.ts"; @@ -12,6 +12,10 @@ export function Panel({ }) { const iFrameRef = useRef(null); + const html = useMemo(() => { + return panelHtml.replace("{{.HostPrefix}}", document.baseURI); + }, []); + function updateContent() { if (!iFrameRef.current?.contentWindow) { return; @@ -87,7 +91,7 @@ export function Panel({ return (