Help us shape the future of Go! Take the 2026 Go Developer Survey

console

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Oct 6, 2026 License: AGPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package console provides the embedded web console for operating a Starport gateway: playground chat, the Starmap model catalog, provider status, key management, and gateway settings. The built single-page console is embedded in the binary so it works offline with a strict same-origin content security policy.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocsFS added in v1.3.0

func DocsFS() (fs.FS, bool)

DocsFS returns the embedded documentation site from dist/docs. It returns false when the build has no documentation site.

Types

type PageServer

type PageServer interface {
	Register(r chi.Router)
}

PageServer registers console page and asset routes on a router.

type SPAHandler

type SPAHandler struct {
	// contains filtered or unexported fields
}

SPAHandler serves the built single-page console: hashed immutable assets under /assets/ and the SPA index for every page path, so the client router owns navigation (spaFallback). It also serves the static documentation site under /docs/.

func NewSPAHandler

func NewSPAHandler(logger *zerolog.Logger) (*SPAHandler, error)

NewSPAHandler creates a handler over the embedded console build.

func NewSPAHandlerFS added in v1.3.0

func NewSPAHandlerFS(logger *zerolog.Logger, dist fs.FS) *SPAHandler

NewSPAHandlerFS creates a handler over any tree with the console build layout: index.html, assets/, and docs/. Tests use it to serve a fixed build, because the embedded build is absent until the console builds.

func (*SPAHandler) Assets

func (h *SPAHandler) Assets(w http.ResponseWriter, r *http.Request)

Assets serves the hashed build outputs. The content hash in every asset filename makes the response immutable.

func (*SPAHandler) Built

func (h *SPAHandler) Built() bool

Built reports whether the embedded build contains the console.

func (*SPAHandler) Docs added in v1.3.0

func (h *SPAHandler) Docs(w http.ResponseWriter, r *http.Request)

Docs serves the static documentation site. A path that ends in a slash serves the index.html of that directory, and a directory path without the slash redirects to it. The pages, the manifest, and the search index stay no-cache so a new binary always delivers matching content; the hashed files under docs/assets/ are immutable.

func (*SPAHandler) DocsRoot added in v1.3.0

func (h *SPAHandler) DocsRoot(w http.ResponseWriter, r *http.Request)

DocsRoot redirects /docs to /docs/, so the relative links in every documentation page resolve under the site directory.

func (*SPAHandler) Index

func (h *SPAHandler) Index(w http.ResponseWriter, _ *http.Request)

Index serves the SPA shell for a page path. index.html stays no-cache so a new binary always delivers the matching hashed assets.

func (*SPAHandler) Register

func (h *SPAHandler) Register(r chi.Router)

Register mounts the SPA page routes, the hashed assets, and the documentation site on the router. Every console page path serves the same shell (spaFallback); the client router renders the matching page. The documentation is static and is not a client route.

Jump to

Keyboard shortcuts

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