Serve the prebuilt Companion web app from the gateway root, so vis-agent web
needs no Node.js at runtime.
Release installs unpack vis-web.tar.gz beside the native runtime, and the
launcher exports that folder as VIS_WEB_DIR; a source checkout points it at
apps/vis-companion/dist-web. The launcher names the folder even before it
exists and the gateway looks it up on every request, so a build or install
that lands after the gateway started is served without a restart. Until the
folder holds an index.html the gateway serves its API alone.
The bundle is public content, like /docs: it holds no secret, and the app
authenticates its own API calls. Only GET and HEAD requests for a file that
exists inside the folder are answered here; the API, the docs and every
missing file fall through to the router unchanged.
A web launch connects a fresh browser without a pasted token. vis-agent web
asks its gateway for a one-time launch code that expires in LAUNCH_TTL_MS.
The code goes into the URL fragment, and the app exchanges it once for the
gateway id and token. The long-lived token never enters a URL.
A brand is the white label of the web app: its name, logo and link, the icon links of its header and its one theme. An SDK program saves it here, and the app reads it without a token, because it shows the brand before it connects.
Serve the prebuilt Companion web app from the gateway root, so `vis-agent web` needs no Node.js at runtime. Release installs unpack `vis-web.tar.gz` beside the native runtime, and the launcher exports that folder as `VIS_WEB_DIR`; a source checkout points it at `apps/vis-companion/dist-web`. The launcher names the folder even before it exists and the gateway looks it up on every request, so a build or install that lands after the gateway started is served without a restart. Until the folder holds an `index.html` the gateway serves its API alone. The bundle is public content, like `/docs`: it holds no secret, and the app authenticates its own API calls. Only GET and HEAD requests for a file that exists inside the folder are answered here; the API, the docs and every missing file fall through to the router unchanged. A web launch connects a fresh browser without a pasted token. `vis-agent web` asks its gateway for a one-time launch code that expires in [[LAUNCH_TTL_MS]]. The code goes into the URL fragment, and the app exchanges it once for the gateway id and token. The long-lived token never enters a URL. A brand is the white label of the web app: its name, logo and link, the icon links of its header and its one theme. An SDK program saves it here, and the app reads it without a token, because it shows the brand before it connects.
(brand)The saved brand of the web app as wire data, or {} when none is saved. A file
that holds no valid brand counts as none, so a damaged file shows plain Vis.
The saved brand of the web app as wire data, or `{}` when none is saved. A file
that holds no valid brand counts as none, so a damaged file shows plain Vis.(brand-fault brand)Why wire value brand is not a brand that the web app can show, or nil. The
schema checks the shape; the shipped themes check theme.
Why wire value `brand` is not a brand that the web app can show, or nil. The schema checks the shape; the shipped themes check `theme`.
(brand-file)The file that holds the brand of the web app, below the Vis state directory.
The file that holds the brand of the web app, below the Vis state directory.
(configured-dir)The web app folder the launcher names in VIS_WEB_DIR. It may not exist yet.
The web app folder the launcher names in `VIS_WEB_DIR`. It may not exist yet.
(configured-root)(configured-root dir)The canonical web app folder named by dir (configured-dir by default), or
nil when it is unset or holds no index.html.
The canonical web app folder named by `dir` ([[configured-dir]] by default), or nil when it is unset or holds no `index.html`.
How long a launch code stays redeemable. A browser that vis-agent web opens
redeems it in seconds; a wrapper that opens the address itself gets minutes.
How long a launch code stays redeemable. A browser that `vis-agent web` opens redeems it in seconds; a wrapper that opens the address itself gets minutes.
(mint-launch!)(mint-launch! now)Record a new one-time launch code and return {:code :expires-at-ms}. Expired
codes are dropped on each call, so the store never grows past live launches.
Record a new one-time launch code and return `{:code :expires-at-ms}`. Expired
codes are dropped on each call, so the store never grows past live launches.(redeem-launch! code)(redeem-launch! code now)True once for a code that mint-launch! returned and that has not expired.
Any attempt consumes the code, so a second or a late attempt is false.
True once for a code that [[mint-launch!]] returned and that has not expired. Any attempt consumes the code, so a second or a late attempt is false.
(wrap-web handler)(wrap-web handler dir)Answer GET and HEAD requests for the web app's own files from the folder dir
names (configured-dir by default). configured-root resolves the folder
per request, so a build or install that lands later is served at once. A blank
dir returns handler unchanged.
Answer GET and HEAD requests for the web app's own files from the folder `dir` names ([[configured-dir]] by default). [[configured-root]] resolves the folder per request, so a build or install that lands later is served at once. A blank `dir` returns `handler` unchanged.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |