Liking cljdoc? Tell your friends :D

com.blockether.vis.internal.gateway.server.web

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.

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.
raw docstring

configured-dirclj

(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.
sourceraw docstring

configured-rootclj

(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`.
sourceraw docstring

handlersclj

source

LAUNCH_TTL_MSclj

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.
sourceraw docstring

mint-launch!clj

(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.
sourceraw docstring

redeem-launch!clj

(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.
sourceraw docstring

wrap-webclj

(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.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close