dashboard

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2026 License: MIT Imports: 28 Imported by: 0

Documentation

Overview

Package dashboard serves the admin SPA and its backing JSON API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handler

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

Handler serves the admin dashboard.

func New

func New(
	adminSvc *admin.Service,
	providerSvc *provider.Service,
	credSvc *credential.Service,
	tokenSvc *token.Service,
	modelInfoSvc *modelinfo.Service,
	metricsSvc *metrics.Service,
	agentSvc *agent.Service,
	routerSvc *router.Service,
	configSvc *configsvc.Service,
	luaSvc *luaplugin.Service,
	repoSvc *pluginrepo.Service,
	proxySvc *proxypool.Service,
	geoSvc *geoip.Service,
	logger *slog.Logger,
) (*Handler, error)

New constructs a dashboard Handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux, db interface{ IsBootstrapped() (bool, error) })

func (*Handler) SetDevRedirect

func (h *Handler) SetDevRedirect(origin string)

SetDevRedirect configures the handler to 302-redirect any browser navigation that would otherwise fall through to the embedded SPA (i.e. everything not matched by a more specific route in Register) to origin instead, preserving path and query.

This exists because `make start` never runs a real `vite build` — the embedded build/web directory is just a placeholder stub so the //go:embed directive has something to embed. Without this, hitting the dashboard port directly in dev (or any /login, /bootstrap navigation not proxied to the dev server) serves that meaningless placeholder instead of the actual UI, which is only running on WEB_PORT in dev. Production builds never call this, so it has no effect there.

Jump to

Keyboard shortcuts

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