From 7dead193e4dc2ca6cc0723ae529b9d4364684422 Mon Sep 17 00:00:00 2001 From: CyberFox-81 Date: Sun, 11 Oct 2026 11:47:27 -0400 Subject: [PATCH] Web: opt-in embedding bridge for host pages (?host=parent) (#509) Squash of PR #509 by @CyberFox-81. Co-Authored-By: Claude Opus 5.5 --- apps/cadcraft-web/Cargo.toml | 2 +- apps/cadcraft-web/src/host.rs | 150 ++++++++++++++++++++++++++++++++ apps/cadcraft-web/src/main.rs | 51 +++++++++-- apps/cadcraft-web/src/upload.rs | 14 +++ 4 files changed, 208 insertions(+), 9 deletions(-) create mode 100644 apps/cadcraft-web/src/host.rs diff --git a/apps/cadcraft-web/Cargo.toml b/apps/cadcraft-web/Cargo.toml index c3a8c2bce..5b6a2e828 100644 --- a/apps/cadcraft-web/Cargo.toml +++ b/apps/cadcraft-web/Cargo.toml @@ -29,4 +29,4 @@ web-sys = { version = "0.3", features = ["HtmlInputElement", "FileList", "File"] eframe = { workspace = true, features = ["persistence", "default_fonts", "wgpu", "accesskit"] } wasm-bindgen = "0.2" wasm-bindgen-futures = "0.4" -web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlAnchorElement", "Location", "Navigator", "Blob", "BlobPropertyBag", "Url"] } +web-sys = { version = "0.3", features = ["Window", "Document", "Element", "HtmlElement", "HtmlCanvasElement", "HtmlAnchorElement", "Location", "Navigator", "Blob", "BlobPropertyBag", "Url", "MessageEvent", "UrlSearchParams"] } diff --git a/apps/cadcraft-web/src/host.rs b/apps/cadcraft-web/src/host.rs new file mode 100644 index 000000000..03fe15b22 --- /dev/null +++ b/apps/cadcraft-web/src/host.rs @@ -0,0 +1,150 @@ +//! The `postMessage` bridge to a same-origin parent page (`?host=parent`), for pages that embed +//! CADCraft in an `