pwa

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 8, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package pwa serves the static frontend bundle (index.html, sw.js, manifest, icons, /static/*) from the embedded asset FS.

index.html carries two Jinja directives: "{{ git_hash }}" (cache-busting query string, used several times) and "{{ ui_config_json }}" (the opaque UI config blob). We substitute both at startup once and reuse the rendered bytes per request.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetFile

func AssetFile(filename, contentType string) http.Handler

AssetFile serves a single embedded file with the given Content-Type.

func IndexHandler

func IndexHandler(uiConfig json.RawMessage) http.Handler

IndexHandler serves "/" with {{ git_hash }} and {{ ui_config_json }} replaced.

uiConfig is the opaque config.UI blob delivered to the frontend as window.__UI_CONFIG__; nil/empty emits the JS literal null. It must already be valid JSON (config.Load fails loud otherwise). "</" is escaped to "<\/" so a "</script>" appearing inside the blob cannot break out of the inline <script>.

func RescueHandler

func RescueHandler() http.Handler

RescueHandler serves the standalone /rescue console (templates/rescue.html, self-contained by design — it must work while tmux and the main app don't).

func StaticFS

func StaticFS() http.Handler

StaticFS serves "/static/..." from the embedded `static/` subtree.

func SwjsHandler

func SwjsHandler() http.Handler

SwjsHandler serves "/sw.js" with __GIT_HASH__ replaced. Cache-Control: no-cache so iOS Safari notices SW updates.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL