Appearance
Author extension
The author browser extension shows, beside a Google Docs document or a preview or live page, which page of which site it is, whether the preview and live are up to date, and lets an author View, Preview, Publish and Unpublish that page. It talks to a Foliwake server's API with a sign-in key of its own. This page is what the server offers it; the extension's own installation is described in its repository.
Sign-in
The extension signs in with the same device flow as the CLI (RFC 8628):
POST /api/auth/device/codewith{ "client": "foliwake-extension/<version>", "host": "Chrome on macOS" }.- It shows
user_codeand opensverification_uri_completein a tab: the approval page, without the code. The person signs in to the server there, types the code and approves the request; the page shows where and when the request started, and the client and browser it names (marked as reported by the device). - It polls
POST /api/auth/device/tokenand gets{ access_token: "fwk_…", token_type: "Bearer", expires_in }. POST /api/auth/logoutwith the key revokes it.
A key issued to foliwake-extension is an extension key:
- it expires 30 days after its last use (a CLI key: 90 days, 30 for an account with installation authority);
- it may call only what the extension needs:
whoami,account.me,sites.list,authors.locate,authors.view,authors.viewMedia,authors.editorFile,authors.previewPage,channels.changes,channels.publish,channels.unpublish,operations.getandoperations.wait. Any other call is refused withKEY_FORBIDS(403); - what it may do on a site is its account's grant, read on every call: an author previews and publishes, a developer publishes only with the live permission, a CI role does neither;
- the person sees it among their keys (
account keys list, the dashboard's People → keys) as kindextension, and revokes it there like any other.
Calls
The extension calls https://<server>/api/rpc/<procedure> from its background service worker with Authorization: Bearer fwk_… and no cookies. The server sends no CORS headers: a web page cannot call the API with a visitor's key, and the extension's worker, which has host permission for the server, needs none. A request without a Bearer token gets no grant.
| Procedure | Kind | What |
|---|---|---|
authors.locate { document } or { host, path } | query | the pages a document feeds, or the page an address shows |
authors.previewPage { site, page, expect? } | mutation | sync that page's document alone, then preview that page alone |
channels.publish { site, pages, expect: { preview } } | mutation | put the reviewed preview of the pages live |
channels.unpublish { site, pages, expect: { live } } | mutation | remove the pages from live |
operations.get { site, id } | query | follow a long operation |
authors.locate
Over every site the key's grant covers:
{ "document": "<native ID>" }: every page that document feeds, found by its native ID in the sources' selected snapshots (for Google Drive sources the file ID, so a moved or renamed document is still found). One document can feed pages of several sites: each is a match.{ "host": "<site>.preview.example.org", "path": "/faq" }: the page at that path of the site whose preview host (or live host) it is.
Each match names the site and organisation, the source (id, plugin, kind: google-docs, drive-markdown, git, drupal, other) and the document, the page (id, path, title), its addresses (editUrl, previewUrl, liveUrl, and viewUrl for a Google Docs document), the preview and live heads that hold the page (release, generation, at), the site's current heads (what expect names), differs (none; preview: the preview is newer than live; source: the document is newer than the preview shows), sourceChecked, what the caller may do (access) and the problem codes the page's preview shows. A document no sync has read yet is not found: sync its source once.
For a Google Drive source (google-drive-markdown) the server also asks Drive about the document while it answers: one metadata request, at most 2 s. It tells a Google Docs document from a Markdown file, and a document edited since the last sync is differs: source at once. sourceChecked: false: Drive was not asked or did not answer in time, and kind and differs are as the last sync left them.
authors.previewPage
One operation of kind preview: the page's document is synced alone (a scoped sync of its source), then the preview is rebuilt with that page alone; every other page of the preview stays as it is. Its result carries the new preview release (result.siteRelease, the expect.preview of a publication) and the page's diagnostics; a page with errors fails with them and nothing is previewed. Page previews of one site run one at a time: a second one waits for the first. Without expect the page is previewed over the preview as it is when its turn comes, so two authors' previews of different pages both land; with expect.preview it is refused (PREVIEW_CHANGED) when the preview moved.
View
View is a page of the preview host, not an API call: the extension opens viewUrl (https://<site>.preview.example.org/_foliwake/view/<document>) in a tab, and the browser passes the preview's sign-in hand-over there. See preview and publish.
Behind a proxy with its own sign-in
A team gate (HTTP Basic in the proxy) must let the extension's calls through, as it does for the CLI: requests to /api/auth/*, and to /api/rpc/* with an Authorization: Bearer … header, go to the instance without the team's sign-in (see behind a proxy with its own sign-in). The approval page (/device), the preview host and the view are opened in the browser, behind the gate as usual.
Authoring-tool files
authors.editorFile({ site, path }) reads a file relative to editor/ from the site's current live code release. It returns { release, path, mediaType, bytes }, with base64 bytes and a 2 MiB limit. It uses the same preview permission as View, through the engine API, so a gate on the site host does not block it. The engine treats these files as opaque data. See the authors API contract for path rules, release selection and errors.
