asobi_console_shell (asobi v0.72.6)
View SourceThe console's shell document, rendered by Erlang.
The bundler emits hashed chunks and nothing else. The one document is built here, because the two things it has to carry are only knowable at response time: the CSP nonce, and where this deployment's ops API answers.
Runtime configuration travels in <meta> tags, not in an inline script.
That is the difference between a page with zero inline scripts and a page
with one, and it is the reason script-src can be a bare nonce with no
'unsafe-inline' anywhere. It also means the only escaping this module needs
is HTML-attribute escaping - there is no JavaScript string context for a
value to break out of.
Fonts are declared by family and never fetched from a CDN. Loading Fraunces
and Instrument Sans from a font host would need font-src and style-src to
name it, and committing the woff2 files would put roughly 800 KB of binaries
into a Hex package for a page an operator opens during an incident. The
console asks for the families and falls back through the system stack, so it
matches asobi.dev where the fonts are installed and stays legible where they
are not.
Summary
Functions
HTML-escape a value bound for an attribute.
Both quote forms as well as the three structural characters, so the same function is correct in a double-quoted attribute, a single-quoted one and element content.
-spec render(binary(), asobi_console:bundle(), binary()) -> binary().
The shell document.
Nonce goes on the single script tag and nowhere else. Version is reported
to the operator so a console and a node that have drifted apart say so.