← Commit history

readme.html: applet_connect widens connect-src to your own public back-end (adom/wiki#669)

Colby Knox ·8e246ca6f8 ·2mo ago ·parent 15aabf6
1 file changed +17−5
SKILL.md+17−5
@@ -112,11 +112,23 @@ frame as `{type:"readme-hash",hash}`, so you can deep-link a readme section: giv your headings ids, listen for that message, find the element, and post `{type:"readme-scroll-to",top:el.offsetTop}` back. -SANDBOX LIMITS. Scripts run, but `connect-src` is the wiki origin only: you cannot-`fetch()` an arbitrary origin, so INLINE your assets (JS, JSON, fonts as data-URIs). No cookies, no real-origin storage, no direct access to the wiki page;-communicate with the page only through `postMessage`. A `readme.html` over 4 MiB-is refused (`README_TOO_LARGE`). Keep it lean; large media are page assets.+SANDBOX LIMITS. Scripts run, and `connect-src` is the wiki origin by default, so+INLINE your assets (JS, JSON, fonts as data URIs). To let a readme applet fetch its+OWN back-end, declare the origins in `page.json`:++    { "applet_connect": ["https://svc.adom.cloud", "https://api.example.com:8443"] }++The wiki then widens THIS page's readme-frame `connect-src` to those origins (up to+8). Only https PUBLIC DNS names are allowed: IP literals, `localhost`/loopback,+private TLDs (`.internal`, `.local`, ...), and non-https are dropped, so a readme+can never be aimed at a reader's OWN network. Those reads are anonymous and+credential-less (your service sends `Access-Control-Allow-Origin: *`, no cookies).+Pushing a `page.json` with `applet_connect` returns an `APPLET_CONNECT_DECLARED`+hint listing exactly which origins were accepted and which were dropped. To reach+the READER's LOCAL machine (a bridge, an "open in KiCad" button) you still+`postMessage` the PARENT, not a cross-origin fetch. No cookies, no real-origin+storage, no direct access to the wiki page. A `readme.html` over 4 MiB is refused+(`README_TOO_LARGE`). Keep it lean; large media are page assets.  ## Package vs release: install payload vs downloadable binaries