Documentation
¶
Index ¶
- Constants
- func GenerateStatic(outputDir string, options Options) error
- func Handler(options Options) http.Handler
- func IsLoopbackHost(host string) bool
- func LaunchProxyPath(id string) string
- func Listen(host string, port int, fallback bool) (net.Listener, error)
- func TableViewHandler(path string) (http.Handler, error)
- func WithAuthToken(next http.Handler, token string, options AuthOptions) http.Handler
- func WithExecGuard(next http.Handler, allowedHosts []string) http.Handler
- type About
- type AuthEvent
- type AuthOptions
- type AuthRecorder
- type LaunchOptions
- type Options
- type StaticTableViewCopy
Constants ¶
const (
// DefaultPort is the port the Web UI listens on unless told otherwise.
DefaultPort = 8787
)
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 ¶
GenerateStatic writes a read-only static export of the Web UI to outputDir, replacing what is there.
func IsLoopbackHost ¶
IsLoopbackHost reports whether host only accepts local connections.
func LaunchProxyPath ¶
LaunchProxyPath is the URL path a service launch is served under; the service receives it as ROTARI_LAUNCHER_BASE_PATH.
func Listen ¶
Listen listens on host and port. With fallback, a busy port is followed by the next free one.
func TableViewHandler ¶
TableViewHandler serves the Table viewer for one table, document, 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 ¶
WithAuthToken protects the Web UI with an interactive login session and accepts bearer or X-Rotari-Token credentials for API clients.
func WithExecGuard ¶
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 About ¶ added in v0.1.28
site serves one Options. About is which rotari serves the pages: its version, as rotari version prints it, and the path of its binary, or why that is not known.
type AuthEvent ¶ added in v0.1.27
type AuthEvent struct {
Event string
Outcome string
Transport string
Cookie string
CookieSecure *bool
UserAgent string
}
AuthEvent is one allow-listed authentication decision. It intentionally has no URL, credential, cookie value, headers, or client address fields.
type AuthOptions ¶ added in v0.1.27
type AuthOptions struct {
Recorder AuthRecorder
OnSignOut []func()
}
AuthOptions supplies optional authentication hooks.
type AuthRecorder ¶ added in v0.1.27
type AuthRecorder interface {
RecordAuthEvent(AuthEvent)
}
AuthRecorder receives authentication decisions without learning any credential or request details beyond the bounded user agent.
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)
// NotificationLog holds the notifications runs recorded, which the live
// inbox shows; nil for a static export.
NotificationLog *notificationlog.Log
// Launches is set when rotari web runs with --allow-exec.
Launches *LaunchOptions
// Terminal is set when rotari web runs with --allow-terminal.
Terminal *terminal.Keeper
// Shutdown stops the live server as SIGTERM does; POST /_server/shutdown and the
// Settings menu's Stop server call it when job control is on. Nil for a static
// export, which has neither.
Shutdown func()
// About says which rotari serves the pages, in their Settings menu; empty for a
// static export and when nothing says.
About About
// 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
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 or JSON Lines file to outputDir (rotari tableview --static-dir). A delimited file uses the separator its extension suggests and a header row; JSON Lines records keep their object keys as columns. The snapshot contains 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.
Source Files
¶
- activity.go
- artifact_arrays.go
- artifact_files.go
- artifact_trust.go
- artifacts.go
- assets.go
- auth.go
- fonts.go
- history_search.go
- jobs_range.go
- launch_auth.go
- launch_guard.go
- launch_proxy.go
- launcher_config.go
- launches.go
- notifications.go
- options.go
- output_word_cloud.go
- page_policy.go
- shutdown.go
- static_artifacts.go
- status.go
- table_view.go
- table_view_shell.go
- table_view_static.go
- terminal.go
- terminal_dirs.go
- terminal_files.go
- terminal_links.go
- terminal_projects.go
- terminal_transcript.go
- terminal_window.go
- unlock.go
- webui.go