Documentation
¶
Overview ¶
Package shared provides static assets shared across all unum web UIs.
Index ¶
- Variables
- func FreePort() (int, error)
- func OpenBrowser(url string)
- func PrintStartupBanner(toolName, url string)
- func RegisterMetrics(mux *http.ServeMux)
- func RegisterUmamiProxy(mux *http.ServeMux)
- func ServeAsset(fs embed.FS, path, contentType string) http.HandlerFunc
- func ServeSharedAsset(path, contentType string) http.HandlerFunc
- func ServeTemplate(fs embed.FS, path string) func(d IndexData) http.HandlerFunc
- type IndexData
Constants ¶
This section is empty.
Variables ¶
var Assets embed.FS
Functions ¶
func OpenBrowser ¶
func OpenBrowser(url string)
OpenBrowser opens url in the default browser after a short delay.
func PrintStartupBanner ¶
func PrintStartupBanner(toolName, url string)
PrintStartupBanner writes the tool startup lines to stderr.
func RegisterMetrics ¶ added in v1.3.0
RegisterMetrics registers the /metrics endpoint for Prometheus scraping.
func RegisterUmamiProxy ¶ added in v1.3.0
RegisterUmamiProxy registers /umami/* routes that reverse-proxy to the internal Umami instance. No-op if UMAMI_URL is empty.
func ServeAsset ¶
func ServeAsset(fs embed.FS, path, contentType string) http.HandlerFunc
ServeAsset serves a file from fs at path with the given Content-Type.
func ServeSharedAsset ¶
func ServeSharedAsset(path, contentType string) http.HandlerFunc
ServeSharedAsset serves a file from the shared Assets embed.
func ServeTemplate ¶
ServeTemplate parses the named template from fs and serves it with data d.
Types ¶
type IndexData ¶
type IndexData struct {
DarkTheme string
LightTheme string
Version string
ThemeData template.JS // JSON: {dark:{cyber:{...},...}, light:{clean:{...},...}}
UmamiEnabled bool // true if UMAMI_URL is set — enables JS tracking snippet
UmamiWebsiteID string // Umami website ID for the tracking snippet
}
IndexData holds the theme config injected into HTML templates.
func NewIndexData ¶ added in v1.2.0
NewIndexData builds IndexData with all palette CSS vars pre-serialised.