web

package
v0.0.0-...-51f55be Latest Latest
Warning

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

Go to latest
Published: Jan 27, 2026 License: MIT Imports: 22 Imported by: 0

Documentation

Overview

Package web provides the HTTP server for the Orbit web interface.

Index

Constants

View Source
const CSSVersion = "4"

CSSVersion is used for cache busting. Bump when CSS changes.

Variables

This section is empty.

Functions

func PathSanitizer

func PathSanitizer(next http.Handler) http.Handler

PathSanitizer rejects requests with path traversal attempts. Returns 404 for paths containing ".." to prevent directory traversal.

func SecurityHeaders

func SecurityHeaders(next http.Handler) http.Handler

SecurityHeaders adds security headers to all responses. Headers added: - X-Content-Type-Options: nosniff - X-Frame-Options: DENY - Referrer-Policy: no-referrer - Content-Security-Policy (for HTML responses only)

func ValidateUUID

func ValidateUUID(paramName string) func(http.Handler) http.Handler

ValidateUUID validates that a path parameter is a valid UUID v4. Returns 404 for invalid UUIDs to prevent path enumeration.

Types

type Config

type Config struct {
	Port     int    // Default: 8080
	Bind     string // Default: "localhost"
	Registry *registry.Registry
}

Config holds web server configuration.

type DashboardData

type DashboardData struct {
	TemplateData
	Repositories []RepositoryGroup
	Empty        bool
}

DashboardData is passed to dashboard.html.

type ErrorData

type ErrorData struct {
	TemplateData
	Code    int
	Message string
}

ErrorData is passed to error.html.

type PhaseView

type PhaseView struct {
	Number        int
	Status        string
	RunCount      int
	HasTranscript bool
}

PhaseView represents a phase for display.

type RelatedVariant

type RelatedVariant struct {
	ID        string
	Number    int
	Status    string
	Agent     string
	IsCurrent bool
}

RelatedVariant represents another variant from the same run.

type RepositoryGroup

type RepositoryGroup struct {
	Name string
	Runs []RunSummary
}

RepositoryGroup groups runs by repository.

type RunDetailData

type RunDetailData struct {
	TemplateData
	Run               *registry.RunEntry
	Phases            []PhaseView
	Duration          string
	StartedAt         string
	FinishedAt        string
	Summary           *logs.Summary
	Missing           bool
	HasPostCompletion bool
	// Variant-specific fields
	IsVariant       bool
	VariantID       int
	VariantTotal    int
	VariantAgent    string
	VariantBranch   string
	RelatedVariants []RelatedVariant
}

RunDetailData is passed to run_detail.html.

type RunSummary

type RunSummary struct {
	ID        string
	Name      string
	Branch    string
	Status    string
	StartedAt string

	IsVariant    bool
	VariantAgent string
	// contains filtered or unexported fields
}

RunSummary is a summary of a run for the dashboard.

type Server

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

Server is the HTTP server for the web interface.

func New

func New(config Config) *Server

New creates a new web server.

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

Shutdown gracefully stops the server. Waits up to 5 seconds for in-flight requests.

func (*Server) Start

func (s *Server) Start() error

Start begins listening and serving requests. It sets up signal handling for graceful shutdown. Blocks until shutdown.

type TemplateData

type TemplateData struct {
	Title      string
	CurrentURL string
	CSSVersion string
}

TemplateData is the base data for all templates.

type TranscriptData

type TranscriptData struct {
	TemplateData
	RunID            string
	RunName          string
	Phase            int
	RunNumber        int
	Content          template.HTML
	PrevPhase        *int
	NextPhase        *int
	IsPostCompletion bool
}

TranscriptData is passed to transcript.html.

Jump to

Keyboard shortcuts

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