webui

package
v0.1.20 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2026 License: MIT Imports: 54 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// DefaultPort is the port the Web UI listens on unless told otherwise.
	DefaultPort = 8787
)
View Source
const TableViewPort = DefaultPort + 1

TableViewPort is the port rotari tableview listens on unless told otherwise, next to the Web UI's.

Variables

This section is empty.

Functions

func GenerateStatic

func GenerateStatic(outputDir string, options Options) error

GenerateStatic writes a read-only static export of the Web UI to outputDir, replacing what is there.

func Handler

func Handler(options Options) http.Handler

Handler serves the Web UI and its JSON API.

func IsLoopbackHost

func IsLoopbackHost(host string) bool

IsLoopbackHost reports whether host only accepts local connections.

func LaunchProxyPath

func LaunchProxyPath(id string) string

LaunchProxyPath is the URL path a service launch is served under; the service receives it as ROTARI_LAUNCHER_BASE_PATH.

func Listen

func Listen(host string, port int, fallback bool) (net.Listener, error)

Listen listens on host and port. With fallback, a busy port is followed by the next free one.

func TableViewHandler

func TableViewHandler(path string) (http.Handler, error)

TableViewHandler serves the Table viewer for one delimited file or directory named on the command line (rotari tableview), with the fonts and design tokens its page links. It reads only under that directory, or the file's: the only root, and the only base media paths resolve from. For a directory, the query's child names a file or directory inside it to show instead, as for an artifact.

func WithAuthToken

func WithAuthToken(next http.Handler, token string) http.Handler

WithAuthToken protects the Web UI with an interactive login session and accepts bearer or X-Rotari-Token credentials for API clients.

func WithExecGuard

func WithExecGuard(next http.Handler, allowedHosts []string) http.Handler

WithExecGuard protects a server that can launch commands from requests a browser makes on behalf of another site:

  • Host must be a loopback name or one of allowedHosts (DNS rebinding).
  • A request that is not GET or HEAD, and a WebSocket handshake, must carry an Origin equal to its own scheme and Host, or, without Origin, an X-Rotari-Token or bearer Authorization header, which a browser never adds by itself. A missing Origin is never taken as proof that the request is same-origin.

Authentication itself is WithAuthToken's job.

Types

type LaunchOptions

type LaunchOptions struct {
	Manager  *launcher.Manager
	Registry launcher.Registry
	// contains filtered or unexported fields
}

LaunchOptions enables launching registered commands from artifacts (rotari web --allow-exec).

type Options

type Options struct {
	BaseDir string
	// WorkspaceDir is captured at server startup, never a viewed job's cwd.
	WorkspaceDir string
	// RootBaseDir is the Web process's original state directory and anchors
	// the unprefixed routes while the browser switches to other basedirs.
	RootBaseDir string
	// BaseDirs are previously registered state directories available to switch
	// to from the sidebar. BaseDir is always included.
	BaseDirs []string
	// ReloadBaseDirs, when set, rereads BaseDirs on each page load and on
	// /api/basedirs (the Refresh button); other requests reuse the last list.
	ReloadBaseDirs func() ([]string, error)
	// AllowControl enables the endpoints that edit queues, configs, and runs.
	AllowControl bool
	// AuthEnabled adds the sign-out control to the main Web page.
	AuthEnabled bool
	// Notifications is the default of the desktop notification toggle.
	Notifications bool
	// ArtifactRoots are directories, besides each job's working directory,
	// whose recorded artifact candidates the live server may serve.
	ArtifactRoots []string
	// StaticArtifactContents makes a static export copy the contents of
	// previewable artifact candidates, so previews work without a server.
	StaticArtifactContents bool
	// StaticArtifactsCopied, when set, is told how many files and bytes a
	// static export copied for StaticArtifactContents.
	StaticArtifactsCopied func(files int, bytes int64)
	// NotificationSettings controls which browser events and fields are shown.
	NotificationSettings notification.ChannelSettings
	// Launches is set when rotari web runs with --allow-exec.
	Launches *LaunchOptions
	// LauncherFile is where launchers.toml is read from. Explanations of why
	// launching is unavailable name it even when Launches is nil.
	LauncherFile string

	Store      state.Store
	Editor     queueops.Editor
	Controller jobcontrol.Controller
	// Executors lists the executor names the UI offers.
	Executors []string
	// Environments are included in the Web state projection.
	Environments []web.EnvironmentDefinition
	// ConfigTemplate returns the TOML config template that "generate config"
	// writes.
	ConfigTemplate         func() ([]byte, error)
	ConfigTemplateForScope func(string) ([]byte, error)
}

Options configures the Web UI for one base directory.

type StaticTableViewCopy added in v0.1.19

type StaticTableViewCopy struct {
	Rows, MediaFiles int
	MediaBytes       int64
}

StaticTableViewCopy is what a static snapshot holds: the rows, and the media files copied with their total size.

func GenerateStaticTableView added in v0.1.19

func GenerateStaticTableView(path, outputDir string) (StaticTableViewCopy, error)

GenerateStaticTableView writes a static snapshot of the Table viewer for one delimited file to outputDir (rotari tableview --static-dir): the file read with the separator its extension suggests and a header row, every row with its order under each sort and its Describe, and the media files its cells name, copied beside the page. The page is titled with the file's name alone. It reads only under the file's directory, as rotari tableview does.

Jump to

Keyboard shortcuts

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