web

package
v1.58.0 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2026 License: MIT Imports: 61 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CoderInputAnswer = map[string]string{"status": "ok"}

CoderInputAnswer is what a successful input POST answers. The local API client requires a JSON object on every 2xx (internal/localapi), so a plain text answer here would make `coder-send-prompt` and `coder-send-control-keys` report a delivered input as an error. The CLI test replays exactly this value instead of inventing an answer, so the two cannot drift apart.

Functions

func NewProjectChanged

func NewProjectChanged(bus *eventbus.Bus) func(ctx context.Context) error

NewProjectChanged is what a plugin's Project.Changed runs: the same projects event NewProjectCreator publishes, so every open list pulls the project's fresh state. It cannot fail today, the error is the facade's room to grow.

func NewProjectCreator

func NewProjectCreator(projects *project.Repository, bus *eventbus.Bus) func(ctx context.Context, name string) (string, error)

NewProjectCreator is the one project creation path of the cockpit: the repository makes the directory (or adopts an existing empty one, see project.Repository.Create), the projects event tells every open page. The projects page handler runs it, and so does the plugin package's Projects facade, which is what makes a project created by a plugin exactly a project created on the page. A name whose directory holds content answers plugin.ErrProjectExists, the one sentinel both surfaces word their refusal from. It stands apart from the Server because the plugins configure before the server is built, on the same bus the server is then given.

Types

type AlphaNumDashString

type AlphaNumDashString string

AlphaNumDashString normalizes user-entered slug fields during Gin form binding.

func (AlphaNumDashString) String

func (s AlphaNumDashString) String() string

func (*AlphaNumDashString) UnmarshalParam

func (s *AlphaNumDashString) UnmarshalParam(value string) error

type CheckboxBool

type CheckboxBool bool

CheckboxBool accepts browser checkbox values during Gin form binding.

func (CheckboxBool) Bool

func (b CheckboxBool) Bool() bool

func (*CheckboxBool) UnmarshalParam

func (b *CheckboxBool) UnmarshalParam(value string) error

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server wires HTTP handling against the domain services.

func NewServer

func NewServer(cfg config.Config, coders []*coder.Manager, shells *shell.Shells, conversations *assistant.Service, workspace *assistant.Workspace, watcher *assistant.Watcher, projects *project.Repository, notifier *notify.Service, settingsStore *settings.Store, pusher *push.Service, restorer *restore.Service, backups *backup.Service, dockerService *docker.Service, intel *editorintelligence.Service, voiceService *voice.Service, plugins []*pluginhost.Serve, bus *eventbus.Bus, version, updateFeedURL, updateFeedFormat string, devBuild bool) (*Server, error)

NewServer constructs a Server serving the given coders. bus is the app wide event stream; it is built by the caller because the plugins configure before this server exists, against the same bus.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the fully-wired HTTP handler.

func (*Server) LocalHandler

func (s *Server) LocalHandler() http.Handler

LocalHandler serves the same routes for callers on this machine, over the socket in the state directory (see internal/localapi). Reaching that socket is the whole credential: it lives in a directory only the owner of this process may enter, so a caller that can open it is already allowed to change what the cockpit holds. The request is marked here, at the door, and that marker is what the session check and the CSRF check read.

func (*Server) PublishConversations

func (s *Server) PublishConversations()

PublishConversations announces a coarse change of the conversation list. Individual answer deltas never travel this bus, they belong to the conversation's own stream.

func (*Server) ResumeProjectDeletes

func (s *Server) ResumeProjectDeletes()

ResumeProjectDeletes takes up the deletions the last process was in the middle of. Their rows already say they are working, that was read before this server answered anything; this is the work behind them starting again.

It waits for the docker connection first: the deletion's whole point is that the containers go before the directory does, and a cache that has not answered yet would look exactly like a host without docker. A host that really has none is not waited out for long.

func (*Server) SetAskpass

func (s *Server) SetAskpass(broker *askpass.Broker, script string)

SetAskpass wires the bridge a user-triggered git action may ask the browser through. Without it every prompt keeps failing fast. The broker's change hook becomes the gitprompt event, which is how a parked, answered or expired question reaches every open page at once, and it keeps the notification center in step, which is how a question reaches somebody with no page open at all.

The boot sweep marks every unread git question entry read first: the broker's questions live in memory, so after a restart none stands, and an entry a killed process left unread would claim a question forever.

Directories

Path Synopsis
Package render contains HTML template models and parsing.
Package render contains HTML template models and parsing.

Jump to

Keyboard shortcuts

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