Bläck StudioPlugin SDK v1.0.0 · API 4
Contents

Start

Building

Beyond Bläck Studio

How it runs

Sharing

Look up

The manifest

{
  "id": "word-of-the-day",
  "name": "Word of the day",
  "version": "1.0.0",
  "description": "A word to use today, every morning.",
  "author": "You",
  "apiVersion": 1,
  "main": "main.js",
  "sandboxed": false,
  "permissions": ["project:write", "network:api.example.com", "files:read", "exec:pandoc"],
  "locales": {
    "sv": { "name": "Dagens ord", "description": "Ett ord att använda i dag, varje morgon." }
  }
}
  • id: lower-case letters, digits and dashes. It's also the folder's name.
  • sandboxed: runs the plugin in a worker of its own, apart from the window (see below).
  • locales: its name and description in other languages, by language code. Settings → Plugins, the plugin list and the questions about permissions show them in the writer's language. Its own strings (commands, settings, notices) are the plugin's to choose by this.app.language. When the writer changes the language, Bläck Studio loads the plugin again, so onload runs in the new one.
  • permissions: what the plugin needs beyond reading the book.
    • project:write lets it change the book.
    • library:read lets it see the writer's recent books and their series (app.library): for the welcome screen's dashboard. It needs "apiVersion": 2.
    • microphone lets a plugin in the window record, with navigator.mediaDevices.getUserMedia({ audio: true }): Bläck Studio lets the page have the microphone only while a plugin with this permission is on, and never a camera. It needs "apiVersion": 3. Let go of the stream as soon as you're done, so the system's sign that it's listening goes. With "apiVersion": 4 it also has app.speech: what the writer says, written down on the device itself and never sent anywhere. On a computer that's Whisper, whose model Bläck Studio downloads once after asking the writer; on a phone or tablet it's the system's own recogniser, which tells you the words as they come. Ask status(language) first; if it isn't ready, prepare(language) gets what's missing. Then listen() until stop(). onLevel tells how loud it is, to show it's hearing, and the session can pause() and resume(). A Bläck Studio from before these has neither, so check they're there.
    • network:<host> lets it reach a host; network:*.<host> also covers that host's subdomains; network:* lets it reach anywhere on the internet. Not this computer, or the network it's on (a router, a NAS): those it reaches only by name, as network:127.0.0.1, say.
    • files:read and files:write let it use files and folders the writer chooses for it, in the system's own dialog (app.files.pickFolder, pickFile). It never gets the whole disk.
    • exec:<program> lets it run that one program: by name, as found on the PATH, with its arguments as given and no shell. exec:pandoc runs Pandoc and nothing else.

network:* and every exec: permission are shown as reaching beyond Bläck Studio, with a warning. A shell, Python or Node gets a stronger one.

The writer is asked to allow these when turning the plugin on. A new version that asks for more stays off until they allow that too.