CMMS embedding: load-from-URL on boot, POST-save instead of download

Additive only - standalone/opencadstudio.com use is unaffected since every
new path is gated on window.CAD_EDITOR_CONFIG being present (set by the
CMMS's cad-edit.php host page, absent everywhere else).

- src/sys.rs: cmms_config() reads window.CAD_EDITOR_CONFIG; post_bytes_to_host()
  POSTs saved bytes back via FormData instead of triggering a download.
- src/io/mod.rs: load_from_cmms_web() fetches bytes from the host-provided
  loadUrl and feeds them through the existing load_web_bytes parse path.
- src/app/mod.rs: boot_web() auto-loads via load_from_cmms_web() when
  embedded; CmmsSaveResult message variant carries the save outcome.
- src/app/update/mod.rs: CmmsSaveResult handler surfaces success/failure
  in the command line.
- src/app/update/file.rs: web save branch calls post_bytes_to_host() instead
  of download_bytes() when embedded.
- Cargo.toml: add Request/RequestInit/FormData to the web-sys feature list.
This commit is contained in:
AI Assistant 2026-08-23 14:49:00 +10:00
commit 494ddfece9
6 changed files with 221 additions and 5 deletions

View file

@ -98,6 +98,9 @@ web-sys = { version = "=0.3.85", features = [
"WritableStream",
"Url",
"Response",
"Request",
"RequestInit",
"FormData",
"Worker",
"WorkerOptions",
"WorkerType",