Commit Graph
14 Commits
Author SHA1 Message Date
dotCooCoo 64eb88e604 Plug-ins: web worker runs end on failure, deadline and automation as on the page
- A panic while a held run's output is applied ends the run, so the
  documents go back to their state before it, and ending a held run
  drops the output handed in for it.
- The worker loads a plug-in with the limits the page sends with the
  run, so its memory limit applies.
- A worker that is ready only after the run's deadline is not sent the
  run, with or without a dialog open.
- A run that holds the documents and fails while a dialog is open ends
  at once and frees them.
- A plug-in command's dialog that automation confirms runs the command
  on the page and returns its result.
- A plug-in file opened or dropped on the web whose worker check fails
  is reported in the Can't open dialog, not only in the status bar.
- The web README lists connect-src among the CSP directives the app
  needs.
2026-11-27 18:39:30 -08:00
dotCooCoo 239d7ff61f Block mutating queries during held plugin runs 2026-11-26 11:27:37 -08:00
dotCooCoo 93b7a9c627 Merge main into feat/plugins-web-worker 2026-11-26 10:32:00 -08:00
dotCooCoo cff9f3dcbe Docs: the start-up script's CSP hash goes in script-src-elem when set
A policy that sets script-src-elem governs the inline start-up script,
so its hash belongs there instead of in script-src.
2026-11-22 14:04:20 -08:00
dotCooCoo e2c2776655 Plug-ins: a failed install check ends while a run holds the documents
A check whose module fails in the worker now ends at once while a dialog
is open, a run holds the documents or a script runs: its worker is
terminated and the status bar says why. Only a checked install waits.

packaging/web/README.md lists everything a Content Security Policy must
allow: the inline start-up script Trunk writes into index.html,
'wasm-unsafe-eval' for WebAssembly, and the plug-in worker.
2026-11-22 13:25:43 -08:00
dotCooCoo d998e7245d Plug-ins: web worker runs hold the documents safely and end on time
- A run that holds the documents applies its output only through the
  command and params it was started with, and one that ends without
  changing a document keeps that document's revision, so another worker
  run on it still applies.
- Clipboard imports are refused while a run holds the documents, and
  recovery copies wait until the run ends.
- A command call waiting under a dialog no longer keeps a run past its
  time budget, and a run whose document changed stops while a dialog is
  open too.
- A checked install waits for the run that holds the documents, and the
  progress window shows that run first.
- While a script runs, worker runs still get their requests, Cancel and
  their time budgets still end them, and no new worker run starts.
- Command call arguments and answers travel in blobs of their own, so
  they nest as deep as a JSON parse allows; the worker protocol is 2.
- docs/plugins.md and packaging/web/README.md scope the off-page runs,
  document the first ui.installPlugin reply, the start-up time in the
  budget, and the CSP fallback through child-src.
2026-11-22 12:37:28 -08:00
dotCooCoo 82e3d6dac3 Plug-ins: the web build checks plug-ins and runs filters in a Web Worker
On the web, a plug-in being installed ran its start function and
vc_manifest on the page, and a filter ran on the page for its whole
budget, so a slow or looping module froze the tab for up to a minute
(five for a heavy filter), and Cancel could not stop it.

- A second wasm, apps/vectorcraft-plugin-worker, is built by Trunk as a
  worker (data-type="worker" with data-loader-shim in index.html). The
  page starts one worker for each check and each run, and terminates it
  on Cancel, when the document or the plug-in changes, and 5 s past the
  run's time budget, also while a dialog is open. Each worker's inbox
  holds its latest progress report and at most 8 other messages.
- crates/plugins/src/worker.rs holds the messages and the worker's
  side. Runs can pause at each vc_call (Plugin::begin_run and
  resume_run), which the desktop's synchronous calls now use too.
- Install Plug-in... and File > Open check a module in a worker first;
  the page then loads it with Plugin::load_checked, which runs none of
  its code.
- A filter that calls commands sends each call to the page. The session
  holds the run's undo step open and refuses other edits with "a
  plug-in is running: cancel it or wait for it to finish" until the run
  ends; the progress window shows at once with Cancel only.
- On the web every filter and plug-in command started from the menus
  or their dialogs runs in a worker, and the dialogs have no Preview.
  A plug-in command applies as itself, one undo step named after it.
  Commands that automation runs directly still run where they are
  called and return their result.
- packaging/web: the worker files carry no hash, so the sample cache
  rules make only the hashed app files immutable.
2026-11-22 10:15:28 -08:00
vangel76andClaude Sonnet 5.5 c95d711d4b Web: document the browser minimums the SIMD build needs (#2786)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-04 00:45:25 +01:00
Dylan M. Taylor c6e6c23b99 packaging: use [[ for bash conditional tests (SonarCloud S7688) (#3853)
SonarCloud flags every bare [ conditional in bash scripts under packaging/ as a reliability smell (rule S7688). Convert the flagged [ ... ] tests to [[ ... ]]: safer word-splitting and no glob surprises, same semantics for these string and file tests.
2026-10-23 13:21:42 -04:00
Ahmed Moussa 3e20c2cf29 build(web): copy web fonts with cargo xtask, not sh
Replace the Trunk post_build hook packaging/web/copy-fonts.sh with `cargo xtask web-fonts` (xtask/src/web_fonts.rs), so the web build only needs trunk, the wasm32 target and cargo, with no POSIX shell, and works the same on Windows.

The new task reuses crates/text/build/web_fonts.rs for list parsing and URLs, so build.rs and the copier can't disagree on fonts/<sha16>/<file>. It still does nothing without CRAFT_FONTS_DIR, checks each file's SHA-256 against the manifest, and copies the licence next to each face. A listed face that an older craft-fonts checkout lacks is now skipped with a warning, as build.rs does, instead of failing the build. A relative CRAFT_FONTS_DIR is resolved from the workspace root.

Update the references in Trunk.toml, fonts.rs, build.rs, craft_fonts.rs and web-fonts.txt, and document the web build's requirements in docs/development.md. Add tests for the copy, a hash mismatch and the no-op case.

Signed-off-by: Ahmed Moussa <moussa.ahmed95@gmail.com>
2026-10-09 17:18:54 +03:00
Ahmed Moussa 3c85f3f9e3 feat(text): load craft-fonts' Arabic families, fetch them on web
Desktop builds made with CRAFT_FONTS_DIR now load craft-fonts' 12 Arabic families into the document font database. Noto Sans Arabic comes first and is the fallback for Arabic text. Cairo, Tajawal, Almarai, IBM Plex Sans Arabic, Noto Kufi Arabic, Amiri, Alexandria, Fustat, Reem Kufi, Aref Ruqaa and Gulzar can be picked by name from the font menus.

The web build doesn't embed these fonts because they would make the wasm too large. It fetches them from beside the wasm instead:
- crates/text/web-fonts.txt lists each face as startup or background.
- build.rs turns that list into vectorcraft_text::WEB_FONTS, with each face's URL (fonts/<sha16>/<file>) and SRI hash taken from the craft-fonts manifest.
- packaging/web/copy-fonts.sh, a Trunk post_build hook, copies the font files and their OFL licences there.
- apps/vectorcraft-web/src/fonts.rs fetches Noto Sans Arabic before the app starts, so Arabic text never shows as boxes. It loads the other faces in the background and logs `web font …` for any that fail.

Because fonts can now arrive after startup, the Type tool's layout cache also checks the font database's generation, so text lays out again when new fonts arrive.

_headers and .htaccess serve fonts/* as font/ttf and cache it as immutable. packaging/web/README.md and docs/development.md explain the fonts folder, and ROADMAP.md lists the Arabic typefaces under Type. Also adds Ahmed Moussa to contributors/people.toml.

Signed-off-by: Ahmed Moussa <moussa.ahmed95@gmail.com>
2026-10-09 16:09:34 +03:00
bflatasticandClaude Opus 5.5 0af38a31fd M4.11: packaging metadata describes a vector illustration app
Drop the file types and wording carried over from the sibling raster
editor: the macOS exported type now declares .vectorcraft/.drawcraft
(was .pcraft) and the raster imported types (large raster documents, QOI)
are gone; the dev bundle's PDF type is "PDF Document"; Linux categories and
keywords say vector graphics (no trademark keyword), the AppStream
description and screenshot show VectorCraft, and the deb/rpm, MSI and web
embedding descriptions say vector illustration app. File associations stay
as they are. An xtask test rejects raster-editor wording in packaging/.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 11:19:13 +07:00
Brandon ThomasandClaude Opus 4.8 2d0b055c7e Make ported packaging scripts executable (fixes exit 126)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-02 12:03:30 -04:00
Brandon ThomasandClaude Opus 4.8 da8a14dd04 Signed release pipeline (macOS/Windows/Linux/Web); README community note
Ports photocraft's release workflow + packaging (signing, notarization,
MSI/DMG/deb/rpm/AppImage/web), adds `cargo xtask version`. File-type
associations omitted for now (route B); app keeps its own .desktop. Fresh
WiX UpgradeCode. README 'about' note updated.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-10-02 11:35:29 -04:00