From cb9a63807ef9e8716018d6256ce95dff8f3481c0 Mon Sep 17 00:00:00 2001 From: Helen Kwok <107752876+helenkwok@users.noreply.github.com> Date: Thu, 5 Nov 2026 16:47:23 +0800 Subject: [PATCH] figcraft-web: speak the host messages through craft-web-host The transports, the message types and the origin checks come from the shared crate (storytold/craft-libs#420); FigCraft keeps what is its own: which saved files become the document, the open size limit and the author. --- Cargo.lock | 10 ++ apps/figcraft-web/Cargo.toml | 2 + apps/figcraft-web/src/host.rs | 244 +++++++----------------------- apps/figcraft-web/src/hostmode.rs | 43 ++---- apps/figcraft-web/src/web.rs | 18 +-- packaging/web/README.md | 4 +- 6 files changed, 86 insertions(+), 235 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b9fb98654..36bd121b6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1157,6 +1157,15 @@ dependencies = [ "zip 9.1.1", ] +[[package]] +name = "craft-web-host" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=2e2312ddaf21bc3d85cd3395d0955c7d239306f6#2e2312ddaf21bc3d85cd3395d0955c7d239306f6" +dependencies = [ + "wasm-bindgen", + "web-sys", +] + [[package]] name = "craft-window" version = "0.1.0" @@ -2121,6 +2130,7 @@ name = "figcraft-web" version = "0.15.0" dependencies = [ "base64 0.22.1", + "craft-web-host", "eframe", "egui", "figcraft-collab-net", diff --git a/apps/figcraft-web/Cargo.toml b/apps/figcraft-web/Cargo.toml index 15f98bee5..7f0b4ded5 100644 --- a/apps/figcraft-web/Cargo.toml +++ b/apps/figcraft-web/Cargo.toml @@ -19,6 +19,8 @@ figcraft-format = { workspace = true } figcraft-ui-egui = { workspace = true } figcraft-collab-net = { workspace = true } figcraft-text = { workspace = true } +# The host messages (storytold/craft-libs): one contract and one bridge for the web builds. +craft-web-host = { git = "https://github.com/storytold/craft-libs", rev = "2e2312ddaf21bc3d85cd3395d0955c7d239306f6", version = "0.1.0" } base64 = { workspace = true } egui = { workspace = true } log = { workspace = true } diff --git a/apps/figcraft-web/src/host.rs b/apps/figcraft-web/src/host.rs index 5ed0f683a..1000c1490 100644 --- a/apps/figcraft-web/src/host.rs +++ b/apps/figcraft-web/src/host.rs @@ -1,23 +1,21 @@ //! Host modes: a page that runs FigCraft (as an `