Skip to main content

Module editor_link

Module editor_link 

Source
Expand description

litz connect-editor: the link between a build and the editor page.

The editor cannot run a firmware toolchain, and litz build cannot draw a circuit. This module is the smallest bridge between the two: one process, one loopback port, a pairing token, WebSocket text messages for commands and build output, and an in-memory artifact store the editor fetches over plain HTTP.

Nothing leaves the machine on its own. The token is the only way in: a page that was not handed the URL printed by connect-editor gets 403 on every route. The socket accepts five commands — build this project’s own recipe, accept bytes a litz build --push already produced, read or write the editor’s project library, and make one HTTP request from this machine — and never a command string, so the link is not a shell.

The library is the only place the link touches the filesystem for the page: flat .litzproject.json files under .litz/projects, each named by a stem that cannot leave that directory. A forwarded request leaves the machine because the browser is not allowed to make it (a bucket’s control API has no CORS): the page names the method, URL, headers and body, and the link answers with the status, headers and body it got back.

The code is a credential the user may have bookmarked, so a link that starts where one ran before keeps the code .litz/editor.json remembers unless --token names another.

Structs§

Options
What a link serves and who may reach it.

Constants§

DEFAULT_PORT

Functions§

push
A project’s built image, ready to hand to an editor.
serve
Serve a project to an editor page until the process is interrupted.