webui

package
v1.12.0 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2026 License: MIT Imports: 35 Imported by: 0

Documentation

Overview

Package webui serves the kb board to a local browser: a JSON API under /api/ backed by the same store the CLI uses, plus an embedded static UI. The contract lives in docs/web-api.md.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Listen

func Listen(addr string, allowRemote bool) (net.Listener, error)

Listen binds addr (empty means 127.0.0.1:0). Unless allowRemote is set, a host that is not loopback is refused before any socket is opened.

func NewHandler

func NewHandler(st *store.Store, user, dataDir, version string) http.Handler

NewHandler is the testable core: JSON API under /api/ and the embedded static UI at /. The event hub it opens stops with its last subscriber, so a caller that never shuts down (a test) leaks nothing.

func Run

func Run(opts Options, stdout, stderr io.Writer) error

Run opens the local store, listens on opts.Addr, prints the served URL to stdout and serves until SIGINT or SIGTERM.

Types

type Options

type Options struct {
	// DataDir is the kb data directory; empty means the CLI default.
	DataDir string
	// User is the board owner; empty means "default".
	User string
	// Version is the launching binary's display version, reported by
	// /api/meta.
	Version string
	// Addr is the listen address; empty means 127.0.0.1:0.
	Addr string
	// OpenBrowser launches the system browser on the served URL.
	OpenBrowser bool
	// AllowRemote permits a non-loopback Addr. Off by default because the API
	// has no authentication: anything that can reach the port owns the board.
	AllowRemote bool
}

Options configures Run.

Jump to

Keyboard shortcuts

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