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) http.Handler
- func WithExecGuard(next http.Handler, allowedHosts []string) http.Handler
- 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 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 ¶
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 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
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.
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
- options.go
- output_word_cloud.go
- static_artifacts.go
- status.go
- table_view.go
- table_view_static.go
- webui.go