mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-24 18:32:23 +00:00
Plug-ins: the plug-ins folder can't block startup on a special file
A folder load checked each .wasm path and then opened it with a blocking open. When a named pipe replaced the file between the two, the open held the load until something wrote to the pipe, and with it startup or a prefs.set of the folder. On Unix the file is now opened without waiting and without making a terminal the controlling terminal, and the opened file is checked again: anything that is not a regular file, or is over the module limit, is refused and listed in the folder report. A folder load still reads at most 1,000 .wasm files, the first by file name, and now holds only those paths while it lists the folder. The files past the first 1,000 were dropped and not reported; plugin.reload and plugin.list now return their count as leftOut. An error while the folder is listed fails the load, as an error opening the folder does, instead of dropping the entries after it.
This commit is contained in:
+5
-2
@@ -34,7 +34,7 @@ in `crates/engine/src/cmd/plugin.rs`).
|
||||
| `plugin.inspect` | as `plugin.install`: `{"path"}` or `{"dataBase64", "name"?}` | Validates a module without installing it; returns the `plugin.list` entry it would have, plus `needsApproval` (true when installing it needs a person's approval), `needsReplace` (true when `plugin.install` needs `replace: true`), and the `commandAllowlist` ids no command has (`unknownCommands`) and those no plug-in may call (`refusedCommands`). |
|
||||
| `plugin.remove` | `{"id"}` | Uninstalls, and deletes it from the `Plug-ins` folder with its [settings and cache](#settings-and-cache). |
|
||||
| `plugin.clearCache` | `{"id"?}` | Deletes every entry in the [cache](#settings-and-cache) of plug-in `id`, or of every installed plug-in; settings stay. Returns `{"cleared": [id], "bytesFreed"}`. |
|
||||
| `plugin.reload` | `{"path"?: "folder"}` (default: the preference folder) | Installs every `*.wasm` in a folder; a bad module is reported and skipped, and so are a heavy filter and a plug-in whose permissions the user hasn't granted (nobody was asked). |
|
||||
| `plugin.reload` | `{"path"?: "folder"}` (default: the preference folder) | Installs every `*.wasm` in a folder, the first 1,000 by file name; a bad module is reported and skipped, and so are an entry that is not a regular file, a heavy filter and a plug-in whose permissions the user hasn't granted (nobody was asked). Returns `{"folder", "loaded", "failed": [{file, error}], "leftOut"}`; `leftOut` counts the `*.wasm` files past the first 1,000, which were not tried. |
|
||||
|
||||
Live effects are applied like any effect: `effect.apply {"effect": "plugin.<id>", "params": {…}}`, edited with
|
||||
`effect.setParams`, listed by `effect.list` (menu `Effect › Plug-ins`) and baked by Object › Expand Appearance.
|
||||
@@ -108,7 +108,10 @@ replaced by a module without it.
|
||||
**Preference folder.** Edit › Preferences › Plug-ins & Scratch Disks › *Additional Plug-ins Folder*: when set, every
|
||||
`*.wasm` in that folder (not recursive) is installed at startup and whenever the preference changes (desktop builds;
|
||||
the web build installs from bytes). On the desktop, Choose… beside the field picks the folder; the dialog refuses a
|
||||
picked or typed folder whose contents can't be listed, and `prefs.set` refuses such a folder too.
|
||||
picked or typed folder whose contents can't be listed, and `prefs.set` refuses such a folder too. A folder load reads at
|
||||
most 1,000 `.wasm` files, the first ones by file name (VectorCraft's own limit); its report counts the files left out
|
||||
(`leftOut`). An entry that is not a regular file, such as a subfolder or a named pipe with a `.wasm` name, is listed in
|
||||
the report and skipped, and the load does not wait on a named pipe.
|
||||
|
||||
Plug-ins are installed **per process**, not per document. Documents store a live effect as an ordinary effect record
|
||||
(`{"id": "plugin.<id>", "params": {…}}`): while the plug-in is installed it is drawn, exported and expanded; without it
|
||||
|
||||
Reference in New Issue
Block a user