diff --git a/src/apps/mobile/harmonyos/genui-runtime/src/components/HtmlSandboxFrame.tsx b/src/apps/mobile/harmonyos/genui-runtime/src/components/HtmlSandboxFrame.tsx
index 6b87635..ac7701f 100644
--- a/src/apps/mobile/harmonyos/genui-runtime/src/components/HtmlSandboxFrame.tsx
+++ b/src/apps/mobile/harmonyos/genui-runtime/src/components/HtmlSandboxFrame.tsx
@@ -6,6 +6,7 @@ import { useColorScheme } from "./openui/scheme";
// ArkWeb serves this URL locally. Its response policy applies to the whole
// authored document, independently of the stricter parent rawfile policy.
const SANDBOX_URL = "https://genui-sandbox.openbitfun.invalid/view";
+const INLINE_POLICY = "default-src 'none'; script-src 'unsafe-inline'; style-src 'unsafe-inline'; img-src data: blob:; media-src data: blob:; font-src data:; connect-src 'none'; frame-src 'none'; object-src 'none'; form-action 'none'; base-uri 'none'";
const REPORTER = ``;
-function documentFor(html: string, scheme: "light" | "dark") {
- return `${REPORTER}${html}`;
+function documentFor(html: string, scheme: "light" | "dark", inline: boolean) {
+ const policy = inline ? `` : "";
+ return `${policy}${REPORTER}${html}`;
}
export function HtmlSandboxFrame({ html, height, title }: { html: string; height: number; title: string }) {
const frame = useRef(null);
const scheme = useColorScheme(frame);
- const srcDoc = useMemo(() => documentFor(html, scheme), [html, scheme]);
+ // Exported MiniApps run inside the desktop storage bridge. That host allows
+ // inline scripts but cannot serve the phone's synthetic ArkWeb address.
+ const desktop = Boolean((window as Window & { app?: { storage?: unknown } }).app?.storage);
+ const srcDoc = useMemo(() => documentFor(html, scheme, desktop), [html, scheme, desktop]);
const gameInput = useMemo(() => /data-openbitfun-game|