web

package
v0.38.1 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2026 License: Apache-2.0 Imports: 50 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleClientsPage added in v0.23.4

func HandleClientsPage(w http.ResponseWriter, r *http.Request)

func HandleCopyFileStream added in v0.19.0

func HandleCopyFileStream(w http.ResponseWriter, r *http.Request)

func HandleCreateQRCode added in v0.15.0

func HandleCreateQRCode(w http.ResponseWriter, r *http.Request)

func HandleHealthPage

func HandleHealthPage(w http.ResponseWriter, r *http.Request)

func HandleInitialSystemSetupPage

func HandleInitialSystemSetupPage(w http.ResponseWriter, r *http.Request)

func HandleJobsList added in v0.33.0

func HandleJobsList(w http.ResponseWriter, r *http.Request)

HandleJobsList returns the space's jobs live status (running state, next run, last run) from the agent. Job definitions live on the space record (/api/spaces/{id}/jobs) and are available for stopped spaces too; this endpoint needs a running agent.

func HandleJobsRun added in v0.33.0

func HandleJobsRun(w http.ResponseWriter, r *http.Request)

HandleJobsRun triggers a job immediately by name. Manual triggering works for disabled and manual-only jobs.

func HandleListSpaces

func HandleListSpaces(w http.ResponseWriter, r *http.Request)

func HandleLoginPage

func HandleLoginPage(w http.ResponseWriter, r *http.Request)

func HandleLogoutPage

func HandleLogoutPage(w http.ResponseWriter, r *http.Request)

func HandleLogsPage added in v0.11.5

func HandleLogsPage(w http.ResponseWriter, r *http.Request)

func HandleLogsStream added in v0.11.5

func HandleLogsStream(w http.ResponseWriter, r *http.Request)

func HandleOAuth2GrantPage added in v0.19.0

func HandleOAuth2GrantPage(w http.ResponseWriter, r *http.Request)

func HandlePageNotFound added in v0.14.0

func HandlePageNotFound(next *http.ServeMux) http.Handler

func HandlePluginAsset added in v0.34.0

func HandlePluginAsset(w http.ResponseWriter, r *http.Request)

HandlePluginAsset serves a plugin's declared assets (the logos from [tool.knot]). Only paths a plugin declared at load time are reachable: the requested path is matched against the loaded plugin's LogoLight / LogoDark exactly, so nothing else in the plugin folder — or the server — is exposed by this handler.

func HandlePluginPage added in v0.34.0

func HandlePluginPage(w http.ResponseWriter, r *http.Request)

HandlePluginPage dispatches a declared plugin page: knot checks the gate, then evaluates the plugin's entry file in a fresh run-as-user environment and calls the declared handler, rendering its returned value. The environment (and everything in it) is discarded with the request — plugin code runs only here, never at boot.

Handler URLs: /plugins/<name>/<page-path>/<handler> calls that handler, and /plugins/<name>/<handler> calls a [[tool.knot.handlers]]-declared handler at the plugin root — the addressable ajax surface any page (or any other plugin's page) fetches. The response is always JSON. The gate is the calling page's permission unless the handler has its own declaration, which is authoritative everywhere the handler is called — the same semantics as row/column gates.

func HandlePortApply added in v0.24.0

func HandlePortApply(w http.ResponseWriter, r *http.Request)

func HandlePortForward added in v0.22.2

func HandlePortForward(w http.ResponseWriter, r *http.Request)

func HandlePortList added in v0.22.2

func HandlePortList(w http.ResponseWriter, r *http.Request)

func HandlePortStop added in v0.22.2

func HandlePortStop(w http.ResponseWriter, r *http.Request)

func HandlePortThrottle added in v0.31.0

func HandlePortThrottle(w http.ResponseWriter, r *http.Request)

func HandleRunCommandStream added in v0.19.0

func HandleRunCommandStream(w http.ResponseWriter, r *http.Request)

func HandleSimplePage

func HandleSimplePage(w http.ResponseWriter, r *http.Request)

func HandleSpacesCreate

func HandleSpacesCreate(w http.ResponseWriter, r *http.Request)

func HandleSpacesEdit

func HandleSpacesEdit(w http.ResponseWriter, r *http.Request)

func HandleSwitchUserPage added in v0.34.0

func HandleSwitchUserPage(w http.ResponseWriter, r *http.Request)

HandleSwitchUserPage moves the current web session onto another user — fast user switching, one way. The become-list is maintained by the user manager (PermissionLinkUsers): a user may switch to any account it is linked to, never the reverse. The one exception is flicking back: the session may always return to the account that originally authenticated (OriginalUserId), which grants the target nothing.

Called by fetch from the profile menu, so it answers with a bare status — never a redirect. A redirect would make fetch follow it and render the whole landing page into the discarded response body, doubling the work and whitening the screen before the real navigation starts.

func HandleTerminalPage

func HandleTerminalPage(w http.ResponseWriter, r *http.Request)

func HandleTokenCreatePage

func HandleTokenCreatePage(w http.ResponseWriter, r *http.Request)

func HandleTunnelList added in v0.29.0

func HandleTunnelList(w http.ResponseWriter, r *http.Request)

HandleTunnelList lists the agent-owned web tunnels in a space.

func HandleTunnelStart added in v0.29.0

func HandleTunnelStart(w http.ResponseWriter, r *http.Request)

HandleTunnelStart starts an agent-owned web tunnel inside a space. The request is relayed to the space's agent, which owns the tunnel for the life of the agent (daemon implied).

func HandleTunnelStop added in v0.29.0

func HandleTunnelStop(w http.ResponseWriter, r *http.Request)

HandleTunnelStop stops an agent-owned web tunnel in a space by name.

func HandleUserProfilePage

func HandleUserProfilePage(w http.ResponseWriter, r *http.Request)

func HandleVNCPage added in v0.35.0

func HandleVNCPage(w http.ResponseWriter, r *http.Request)

HandleVNCPage serves the browser page hosting noVNC for a KVM space's QEMU display; the websocket it connects to is proxied by proxy.HandleSpacesVNCProxy.

func Routes

func Routes(router *http.ServeMux, cfg *config.ServerConfig)

Types

type NavItem struct {
	URL      string
	Label    string
	Icon     template.HTML
	Starred  bool
	External bool
	Active   bool // owns the current page
}

NavItem is a single sidebar entry rendered from data in menus.tmpl. Icon holds the inner SVG markup (one or more <path/> elements) and is typed template.HTML so html/template renders it verbatim — plugin logo items use the same field to carry themed <img> markup. External marks an off-site URL, rendered with target="_blank" and an indicator.

type NavSection struct {
	Key         string
	Label       string
	Items       []NavItem
	DefaultOpen bool
	Active      bool // holds the current page
}

NavSection is one titled group of sidebar entries. Every section collapses; Workspace, the everyday destinations, starts open and the others closed, and a section opens by itself when it holds the current page.

Jump to

Keyboard shortcuts

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