server

package
v0.0.0-...-cab72fd Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2026 License: AGPL-3.0 Imports: 118 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-or-later Copyright (C) 2026 WittyWilla and contributors

Package server wires the HTTP API, streaming endpoints and the web UI.

Index

Constants

This section is empty.

Variables

View Source
var SetupSteps = []string{"welcome", "account", "name", "look", "theme", "modules", "libraries", "details", "livetv", "games", "discs", "people", "remote", "ready"}

SetupSteps are the first run's steps, in order.

Functions

func BackupSecretSettings

func BackupSecretSettings() []string

BackupSecretSettings are the settings a backup with no password leaves out.

func EarlierLogs

func EarlierLogs(dataDir, logDir string) []logging.Earlier

EarlierLogs are where the logs and crash reports from before each reset went: into the copy the reset made, newest first, the last three. A log folder outside the data folder wasn't moved, so only the crash reports are there.

func IntegrationCheck

func IntegrationCheck(id string, in *wittymodule.Integration) error

IntegrationCheck holds a module's integration.json to what this server can do.

func UIChecks

func UIChecks() sdui.ModuleChecks

UIChecks is what the module manager checks a module's colours with.

Types

type AchievementView

type AchievementView struct {
	ID          int    `json:"id"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Points      int    `json:"points"`
	Badge       string `json:"badge"`
}

AchievementView is one achievement. Badge is this server's address for its greyed-out picture, "" if it has none.

type AchievementsAnswer

type AchievementsAnswer struct {
	State        string            `json:"state"`
	Game         *AchievementsGame `json:"game"`
	Achievements []AchievementView `json:"achievements"`
	Message      string            `json:"message"`
}

AchievementsAnswer is GET /api/items/{id}/achievements.

type AchievementsGame

type AchievementsGame struct {
	ID     int    `json:"id"`
	Title  string `json:"title"`
	URL    string `json:"url"`
	Points int    `json:"points"`
}

AchievementsGame is the game as RetroAchievements knows it.

type BrandWarning

type BrandWarning struct {
	Text string `json:"text"`
	// Surface is the colour token the name sits on (bg, bg2, bg3) and Where what is drawn on it:
	// the top bar and page (bg), the side menu and bars (bg2), the bevelled bars (bg3).
	Surface string  `json:"surface"`
	Where   string  `json:"where"`
	Ratio   float64 `json:"ratio"`
	Need    float64 `json:"need"`
	// Variant is "dark" or "light" for one of an automatic theme's two looks, else empty.
	Variant string `json:"variant,omitempty"`
}

BrandWarning is one part of the name that is hard to read on a surface.

type CoreAudit

type CoreAudit struct {
	At     int64  `json:"at"`
	User   string `json:"user"`
	Action string `json:"action"`
	Core   string `json:"core,omitempty"`
	Detail string `json:"detail,omitempty"`
}

CoreAudit is one row of the audit log.

type DriveHealthView

type DriveHealthView struct {
	Mount   string   `json:"mount"`
	Checked bool     `json:"checked"`
	Bad     bool     `json:"bad,omitempty"`
	Lines   []string `json:"lines"`
	Note    string   `json:"note,omitempty"` // why it wasn't checked
}

DriveHealthView is what one disk says about itself.

type FolderSpace

type FolderSpace struct {
	Role  string `json:"role"`
	Path  string `json:"path"`
	Free  int64  `json:"free"`
	Total int64  `json:"total"`
	Error string `json:"error,omitempty"`
}

FolderSpace is one folder the server uses.

type GameView

type GameView struct {
	ID            string  `json:"id"`
	UserID        int64   `json:"userId"`
	User          string  `json:"user"`
	Title         string  `json:"title"`
	Core          string  `json:"core,omitempty"`
	Encoder       string  `json:"encoder,omitempty"`
	GameFPS       float64 `json:"gameFps"`
	SentFPS       float64 `json:"sentFps"`
	EncodeMs      float64 `json:"encodeMs"`
	Kbps          float64 `json:"kbps"`
	DroppedFrames int64   `json:"droppedFrames"`
	Width         int     `json:"width,omitempty"`
	Height        int     `json:"height,omitempty"`
	Paused        bool    `json:"paused,omitempty"`
	StartedAt     int64   `json:"startedAt"`
}

GameView is someone playing a game. Latency here is the server's part of it, the time to encode a frame: the network's part is only known to the player.

type LogModule

type LogModule struct {
	ID        string     `json:"id"`
	Name      string     `json:"name"`
	Version   string     `json:"version"`
	Delivery  string     `json:"delivery,omitempty"`
	New       bool       `json:"new,omitempty"`     // appeared since an admin last looked
	Missing   bool       `json:"missing,omitempty"` // was here once and isn't now
	FirstSeen time.Time  `json:"firstSeen"`
	Level     string     `json:"level"` // "" follows its area
	Topics    []LogTopic `json:"topics"`
	Lines     int        `json:"lines"` // of its messages in memory just now
	Warnings  int        `json:"warnings"`
	Errors    int        `json:"errors"`
}

LogModule is what the settings page shows for one module.

type LogTopic

type LogTopic struct {
	ID          string `json:"id"`
	Label       string `json:"label"`
	Description string `json:"description"`
	On          bool   `json:"on"`
}

LogTopic is one advanced option of a module: a kind of detail that can be turned on by itself, without making everything else in that module detailed too.

type MetricSection

type MetricSection struct {
	ID        string `json:"id"`
	Title     string `json:"title"`
	Available bool   `json:"available"`
	Why       string `json:"why,omitempty"`
	Full      bool   `json:"full,omitempty"` // only with the whole machine
}

MetricSection says whether a part of the screen can show anything on this server, and if not, why, so the screen can say so rather than draw a zero.

type MetricsCatalog

type MetricsCatalog struct {
	Access   metricsAccess   `json:"access"`
	Sections []MetricSection `json:"sections"`
	Series   []string        `json:"series"`
	Ranges   []string        `json:"ranges"`
	EverySec int             `json:"everySec"`
}

MetricsCatalog is what this server and this account can show.

type MetricsNow

type MetricsNow struct {
	Time    int64                `json:"time"`
	Server  *ServerNow           `json:"server,omitempty"`
	CPU     *metrics.CPUView     `json:"cpu,omitempty"`
	Memory  *metrics.MemoryView  `json:"memory,omitempty"`
	GPU     []metrics.GPU        `json:"gpu,omitempty"`
	Disks   []metrics.DiskView   `json:"disks,omitempty"`
	Volumes []metrics.VolumeView `json:"volumes,omitempty"`
	Net     []metrics.NetView    `json:"net,omitempty"`
	Process *metrics.ProcessView `json:"process,omitempty"`
	Modules []ModuleNow          `json:"modules,omitempty"`
	Streams []StreamView         `json:"streams,omitempty"`
	Games   []GameView           `json:"games,omitempty"`
	// Transcodes is how many are going, and how many the server allows at once.
	Transcodes *TranscodeNow  `json:"transcodes,omitempty"`
	Tasks      *tasks.Summary `json:"tasks,omitempty"`
}

MetricsNow is the state of things at one moment. A section that wasn't asked for, or that this account or this system doesn't have, is left out.

type MetricsReport

type MetricsReport struct {
	GeneratedAt int64             `json:"generatedAt"`
	Libraries   []ReportLibrary   `json:"libraries"`
	ByType      []ReportCount     `json:"byType"`
	Codecs      []ReportCount     `json:"codecs"`
	Resolutions []ReportCount     `json:"resolutions"`
	Duplicates  *ReportDuplicates `json:"duplicates,omitempty"`
	Savings     *ReportSavings    `json:"savings,omitempty"`
	Scans       []ReportScan      `json:"scans,omitempty"`
	Database    *ReportDatabase   `json:"database,omitempty"`
	Caches      []ReportCache     `json:"caches,omitempty"`
	Logs        []ReportLogHour   `json:"logs,omitempty"`
	MostWatched []ReportWatched   `json:"mostWatched"`
	Bandwidth   []ReportBandwidth `json:"bandwidth,omitempty"`
	Peak        *ReportPeak       `json:"peak,omitempty"`
}

MetricsReport is everything that takes a look through the database: slow enough that it's kept for a minute, and only made when someone asks.

type ModuleAudit

type ModuleAudit struct {
	At     int64  `json:"at"`
	User   string `json:"user"`
	Action string `json:"action"`
	Module string `json:"module"`
	Detail string `json:"detail,omitempty"`
}

ModuleAudit is one change to which code runs.

type ModuleNow

type ModuleNow struct {
	ID        string `json:"id"`
	Name      string `json:"name"`
	Version   string `json:"version"`
	Latest    string `json:"latest,omitempty"`
	Phase     string `json:"phase,omitempty"`
	Error     string `json:"error,omitempty"`
	Installed bool   `json:"installed"`
}

ModuleNow is a module and how it stands.

type MusicLinkSide

type MusicLinkSide struct {
	ID         int64   `json:"id"`
	LibraryID  int64   `json:"libraryId"`
	Title      string  `json:"title"`
	Artist     string  `json:"artist"`
	Album      string  `json:"album,omitempty"`
	RuntimeSec float64 `json:"runtimeSec"`
	UpdatedAt  int64   `json:"updatedAt"`
}

MusicLinkSide is the song or the video at one end of a link.

type MusicLinkView

type MusicLinkView struct {
	SongID  int64          `json:"songId"`
	VideoID int64          `json:"videoId"`
	State   string         `json:"state"` // tied | suggested
	How     string         `json:"how"`   // isrc | recording | name | close | hand
	SyncMS  *int64         `json:"syncMs,omitempty"`
	By      string         `json:"by,omitempty"`
	Song    *MusicLinkSide `json:"song"`
	Video   *MusicLinkSide `json:"video"`
}

MusicLinkView is a link with what's at both ends.

type MusicLinks struct {
	ItemID    int64           `json:"itemId"`
	Role      string          `json:"role"` // song | video
	Tied      []MusicLinkView `json:"tied"`
	Suggested []MusicLinkView `json:"suggested"`
	CanEdit   bool            `json:"canEdit"`
}

MusicLinks is everything one song or video is tied to, and (for admins) what it might be.

type MusicVideoCard

type MusicVideoCard struct {
	library.VideoCard
	Song   *MusicLinkSide `json:"song,omitempty"`
	SyncMS *int64         `json:"syncMs,omitempty"`
}

MusicVideoCard is a music video in a music library's Music videos, with the song it's tied to, when this person may see that song.

type ReportBandwidth

type ReportBandwidth struct {
	UserID int64  `json:"userId"`
	User   string `json:"user"`
	Bytes  int64  `json:"bytes"`
}

ReportBandwidth is how much one person has been sent.

type ReportCache

type ReportCache struct {
	Name    string `json:"name"`
	Bytes   int64  `json:"bytes"`
	Files   int64  `json:"files"`
	Partial bool   `json:"partial,omitempty"` // too many to finish counting
}

ReportCache is one of the server's folders of things it can make again.

type ReportCount

type ReportCount struct {
	Name  string `json:"name"`
	Items int64  `json:"items"`
	Bytes int64  `json:"bytes"`
}

ReportCount is how many of something, and how big they are.

type ReportDatabase

type ReportDatabase struct {
	Bytes    int64 `json:"bytes"`
	WALBytes int64 `json:"walBytes"`
}

ReportDatabase is the size of the server's database.

type ReportDupe

type ReportDupe struct {
	Title  string `json:"title"`
	Year   *int64 `json:"year,omitempty"`
	Copies int64  `json:"copies"`
	Bytes  int64  `json:"bytes"`
	Wasted int64  `json:"wasted"`
}

ReportDupe is one title held more than once.

type ReportDuplicates

type ReportDuplicates struct {
	Groups      int64        `json:"groups"`
	WastedBytes int64        `json:"wastedBytes"` // what's left if only the largest of each stays
	Top         []ReportDupe `json:"top"`
}

ReportDuplicates is the same title held more than once.

type ReportLibrary

type ReportLibrary struct {
	ID       int64  `json:"id"`
	Name     string `json:"name"`
	Type     string `json:"type"`
	Items    int64  `json:"items"`
	Bytes    int64  `json:"bytes"`
	Missing  int64  `json:"missing"`
	LastScan *int64 `json:"lastScanAt,omitempty"`
}

ReportLibrary is one library's size.

type ReportLogHour

type ReportLogHour struct {
	Hour     int64 `json:"hour"`
	Warnings int   `json:"warnings"`
	Errors   int   `json:"errors"`
}

ReportLogHour is how much went wrong in one hour.

type ReportPeak

type ReportPeak struct {
	Streams int   `json:"streams"`
	At      int64 `json:"at,omitempty"`
}

ReportPeak is the most people at once.

type ReportSavings

type ReportSavings struct {
	Items          int64 `json:"items"`
	Bytes          int64 `json:"bytes"`
	EstimatedSaved int64 `json:"estimatedSaved"`
}

ReportSavings is a rough idea of what converting older video could save. An estimate, and the screen says so.

type ReportScan

type ReportScan struct {
	Library    string `json:"library"`
	State      string `json:"state"`
	Files      int64  `json:"files"`
	TookSec    int64  `json:"tookSec"`
	FinishedAt int64  `json:"finishedAt"`
}

ReportScan is how a scan went.

type ReportWatched

type ReportWatched struct {
	ItemID  int64   `json:"itemId"`
	Title   string  `json:"title"`
	Seconds float64 `json:"seconds"`
	People  int64   `json:"people"`
}

ReportWatched is one title and how long it's been played.

type ResolvedTheme

type ResolvedTheme struct {
	// ID is the theme in use; Source says whose choice it is: "server" or "user".
	ID     string `json:"id"`
	Source string `json:"source"`
	// Tokens are its colours by token name, with the overrides applied: the global ones,
	// then the profile's own, each with the colours worked out from it (themes.Derive).
	Tokens map[string]string `json:"tokens"`
	// Overrides are the global overrides applied (none when the account chose its own theme).
	Overrides map[string]string `json:"overrides"`
	// Personal are the profile's own colour overrides (GET /api/theme/personal).
	Personal map[string]string `json:"personal"`
	// Modules are the colours for each module scope with colours of its own: the whole
	// palette, with the scope's colours and the profile's over Tokens.
	Modules map[string]ThemeModule `json:"modules"`
	// Scheme is "dark" or "light": which the theme is. "auto" for the automatic theme,
	// which is dark or light as the device is; Tokens and Modules are then its dark look
	// and Variants has both.
	Scheme string `json:"scheme"`
	// Shape is the theme's corners and focus ring in points, Type its typefaces and
	// weights: what SDUI components' tokens.shape and tokens.type name.
	Shape themes.Shape      `json:"shape"`
	Type  themes.TypeTokens `json:"type"`
	// TV, Elevation and Density are Design 2's additions (docs/plans/DESIGN-2.md section 2):
	// the ten-foot colours and units, the surface each elevation step fills with, and the
	// spacing steps. Clients that don't know them ignore them.
	TV        themes.TV                       `json:"tv"`
	Elevation map[string]themes.ElevationStep `json:"elevation"`
	Density   themes.Density                  `json:"density"`
	// Look is the experience and theme in force and who required what: the choice order is
	// required, the trial asked for, the person's own, the server's, the experience's own
	// (docs/plans/DESIGN-2.md section 8).
	Look ThemeLook `json:"look"`
	// Brand is the server's name ready to draw, and the colour token its coloured parts
	// take, resolved like every other colour.
	Brand ThemeBrand `json:"brand"`
	// Variants are the theme's looks by scheme, each resolved the same way: one entry for
	// an ordinary theme, "dark" and "light" for the automatic one. A client that follows
	// the device's setting picks from here.
	Variants map[string]ThemeVariant `json:"variants"`
	Warnings []ThemeWarning          `json:"warnings"`
	ETag     string                  `json:"etag"`
	// Revision is ui_config.json's revision the overrides come from.
	Revision int64 `json:"revision"`
}

ResolvedTheme is what GET /api/theme answers.

type Server

type Server struct {
	Cfg     *config.Config
	DB      *db.DB
	Log     *slog.Logger
	Tools   *ffmpeg.Tools
	Store   *library.Store
	Scanner *library.Scanner
	// GameMeta finds out about games, in the background.
	GameMeta *library.GameMeta
	Auth     *auth.Service
	HLS      *hls.Manager
	DVD      *dvdsession.Manager
	BD       *bdsession.Manager
	Themes   *themes.Manager
	Web      fs.FS
	Version  string
	// Tasks is every background job; see api_tasks.go. Made in Handler.
	Tasks *tasks.Registry
	// LibConvert converts libraries' files ahead of time. Nil without FFmpeg.
	LibConvert *libtranscode.Engine

	// Metrics watches the machine; see api_metrics.go. Made in Handler.
	Metrics *metrics.Collector

	Logs    *logging.Logger
	Crashes *logging.CrashGuard // crash reports; nil when they can't be kept
	// Instance is this run's random id, given out by /api/health so that a second start on
	// the same data folder knows it's this server answering. Not a secret.
	Instance string

	// BundleExtras adds files to the support bundle (WittyDiagnoser's reports).
	BundleExtras func() []logging.BundleFile
	Update       *update.Updater // nil: this build can't update itself
	Restart      func()          // stops the server and starts it again; nil when it can't
	Modules      *modmgr.Manager // nil: modules can't be updated here
	ModuleStores *modmgr.Stores  // the store's pages; nil with Modules
	// Discovery announces the server on the home network; nil when it can't
	// be reached from other devices.
	Discovery interface{ Refresh() }
	HTTPS     *remote.HTTPS     // the HTTPS port; nil until StartRemote
	Conns     *remote.ConnLimit // open connections on both ports; nil for none
	Mapper    *portmap.Keeper   // automatic port mapping; nil until StartRemote
	// Channels and Live TV (see api_channels.go, api_tuners.go).
	Channels *channels.Store
	TV       *livetv.Manager
	// contains filtered or unexported fields
}

func (*Server) ApplyEvidenceSettings

func (s *Server) ApplyEvidenceSettings(ctx context.Context)

ApplyEvidenceSettings turns the recorders on or off as Settings say. At start, and whenever they change.

func (*Server) Close

func (s *Server) Close()

Close ends the server's own background work and waits for it, then Live TV's, then the activity still on its way to the database. The database is closed after it, by whoever opened it. The server calls it once it has stopped answering; a test, when it ends, so nothing writes into its folder as that is removed. It can be called more than once.

func (*Server) DiscoveryInfo

func (s *Server) DiscoveryInfo(port int) discovery.Info

DiscoveryInfo is all that's announced on the home network. tls stays false until the server itself speaks HTTPS.

func (*Server) EndStreams

func (s *Server) EndStreams()

EndStreams ends the event streams, which otherwise hold a server's shutdown until its time runs out: they never finish by themselves. Clients connect again when it's back.

func (*Server) Handler

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

Handler builds the root handler.

func (*Server) HostAPI

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

HostAPI is the host API's handler, for StartHostAPI and tests.

func (*Server) Identity

func (s *Server) Identity() (*identity.Identity, error)

Identity is this server's ID and key, made the first time they're needed.

func (*Server) LogStartup

func (s *Server) LogStartup(ctx context.Context)

LogStartup writes the summary to the log, so a report always says what it came from, and tells the secrets it holds to the redactor.

func (*Server) ModuleSettingsEnv

func (s *Server) ModuleSettingsEnv(mod string) []string

ModuleSettingsEnv is a module's server settings, with defaults, as environment for its helper when it starts.

func (*Server) NetPolicy

func (s *Server) NetPolicy() *remote.Policy

NetPolicy is the owner's current choices about networks.

func (*Server) NoteRestore

func (s *Server) NoteRestore(r *backup.Result)

NoteRestore is told how the restore at this start went.

func (*Server) RunningNow

func (s *Server) RunningNow() []any

RunningNow is what the server is in the middle of, as log attributes, for the line that says why it's stopping: what a stop cut short is half of what someone reading it needs. Counts and kinds only, never titles.

func (*Server) ServerName

func (s *Server) ServerName(ctx context.Context) string

ServerName is what the server calls itself to other devices. Never the computer's own name, which is often a person's.

func (*Server) SetupCode

func (s *Server) SetupCode() string

SetupCode is this run's first-run code.

func (*Server) StartBackupSchedule

func (s *Server) StartBackupSchedule(ctx context.Context)

StartBackupSchedule keeps the schedule. It sleeps until something is due or the schedule changes, so a server with none does nothing at all.

func (*Server) StartHostAPI

func (s *Server) StartHostAPI() error

StartHostAPI listens for the host API on this machine, and tells the module manager where.

func (*Server) StartMetadata

func (s *Server) StartMetadata()

StartMetadata wakes the services that follow scans, and brings in anything added before they existed. The server's own start calls it once.

func (*Server) StartP2P

func (s *Server) StartP2P(ctx context.Context, handler http.Handler)

StartP2P starts peer-to-peer connections if the saved settings ask for them. handler is what requests arriving that way are served by: the same one as every other request.

func (*Server) StartRemote

func (s *Server) StartRemote(ctx context.Context, handler http.Handler)

StartRemote opens what the saved settings ask for. handler is what the HTTPS port serves.

func (*Server) StopP2P

func (s *Server) StopP2P()

StopP2P ends them: connections close, and the router's mappings are removed.

func (*Server) StopRemote

func (s *Server) StopRemote(ctx context.Context)

StopRemote closes the HTTPS port and removes any port mapping.

func (*Server) SystemSummary

func (s *Server) SystemSummary(ctx context.Context) SystemSummary

SystemSummary gathers the summary. It starts no programs and doesn't go online.

func (*Server) WatchChecks

func (s *Server) WatchChecks(base string) []logging.Check

WatchChecks are the watchdog's questions: does the server answer a web request, and does its database answer. base is the server's own address, as this machine reaches it.

func (*Server) WatchModules

func (s *Server) WatchModules(ctx context.Context)

WatchModules notices modules that arrive by themselves, such as an automatic update. It only reads the module list, so this is cheap.

func (*Server) WriteSetupCode

func (s *Server) WriteSetupCode() error

WriteSetupCode leaves the code where the person at the server can read it.

type ServerNow

type ServerNow struct {
	Name      string `json:"name,omitempty"`
	Version   string `json:"version"`
	OS        string `json:"os"`
	Arch      string `json:"arch"`
	UptimeSec int64  `json:"uptimeSec"`
	Update    string `json:"updateAvailable,omitempty"` // admins only
}

ServerNow is the server itself.

type SetupState

type SetupState struct {
	Complete bool     `json:"complete"`
	Steps    []string `json:"steps"`
	// Step is the one the setup is on; Done the steps finished.
	Step string   `json:"step"`
	Done []string `json:"done"`
	// URL is where to finish it, in a web browser.
	URL string `json:"url"`
}

SetupState is what GET /api/setup/state answers.

type StreamView

type StreamView struct {
	ID          string   `json:"id"`
	UserID      int64    `json:"userId"`
	User        string   `json:"user"`
	Device      string   `json:"device,omitempty"`
	Where       string   `json:"where,omitempty"` // home, internet...
	ItemID      int64    `json:"itemId,omitempty"`
	Title       string   `json:"title,omitempty"`
	Decision    string   `json:"decision"`
	Reasons     []string `json:"reasons"`
	Width       int      `json:"width,omitempty"`
	Height      int      `json:"height,omitempty"`
	FileKbps    int64    `json:"fileKbps,omitempty"` // the file's own average
	SendingKbps int64    `json:"sendingKbps"`        // what's actually going out
	Bytes       int64    `json:"bytes"`
	StartedAt   int64    `json:"startedAt"`
}

StreamView is someone playing something. Paths are never in here. Decision is direct, remux, transcode or what a playback answer said; Reasons say why, when it isn't direct.

type SystemSummary

type SystemSummary struct {
	Time         time.Time         `json:"time"`
	Version      string            `json:"version"`
	Go           string            `json:"go"`
	Started      time.Time         `json:"started"`
	System       sysinfo.Info      `json:"system"`
	Modules      []moduleInfo      `json:"modules"`
	FFmpeg       string            `json:"ffmpeg"`
	FFmpegInfo   string            `json:"ffmpegInfo"`
	Encoders     []string          `json:"encoders"`
	Hardware     []string          `json:"hardware,omitempty"`
	HardwareDone bool              `json:"hardwareTested"`
	Folders      []FolderSpace     `json:"folders"`
	Settings     map[string]string `json:"settings"`
	SecretsSet   []string          `json:"secretsSet"`
	Libraries    map[string]int    `json:"libraries"`
	MaxTranscode int               `json:"maxTranscode"`
	Log          logging.Health    `json:"log"`
	LogLevels    map[string]string `json:"logLevels"`
}

SystemSummary is what a support report starts with.

type TaskList

type TaskList struct {
	Access  activityAccess `json:"access"`
	Tasks   []tasks.Task   `json:"tasks"`
	Recent  []tasks.Task   `json:"recent"`
	Summary tasks.Summary  `json:"summary"`
}

TaskList is what's going on, as this account may see it.

type ThemeBrand

type ThemeBrand struct {
	Parts []brandname.Part `json:"parts"`
	Token string           `json:"token"`
	Color string           `json:"color"`
	// Mark is the badge for small spaces (the rail's header); Warnings say where a fixed
	// colour of the name is under 4.5:1 on a surface it is drawn on, in this theme.
	Mark     ThemeMark      `json:"mark"`
	Warnings []BrandWarning `json:"warnings"`
}

ThemeBrand is the server's name as GET /api/status gives it (brandParts), and how its parts are coloured: parts with accent in Token's colour (Color, from Tokens; a variant's from its own tokens), the rest in fg.

type ThemeLook

type ThemeLook struct {
	Experience string `json:"experience"`
	Theme      string `json:"theme"`
	// RequiredExperience and RequiredTheme are set when an administrator requires the part:
	// who, when, and for whom (a profile, the kids or everyone). A client shows the part
	// locked: "Required by Willow".
	RequiredExperience *sdui.RequiredPart `json:"requiredExperience,omitempty"`
	RequiredTheme      *sdui.RequiredPart `json:"requiredTheme,omitempty"`
	// TVTheme is the WittyTV look the experience suggests.
	TVTheme string `json:"tvTheme"`
	// What the experience brings: see sdui.Experience.
	Effects sdui.Effects          `json:"effects"`
	Shape   sdui.ExperienceShape  `json:"shape"`
	Type    string                `json:"type"`
	Density string                `json:"density"`
	Motion  sdui.ExperienceMotion `json:"motion"`
	// Finish and Scene are the theme's glass and gloss recipes and its background scene.
	Finish themes.Finish `json:"finish"`
	Scene  themes.Scene  `json:"scene"`
	// ProfileThemes: this profile may import themes of its own.
	ProfileThemes bool `json:"profileThemes"`
}

ThemeLook is the finished look a client draws: the experience in force with what it brings (finish, type set, shape, motion), the theme, and who required which part.

type ThemeMark

type ThemeMark struct {
	brandname.Mark
	// Shown is the characters the badge draws (the first letter, the initials or the owner's own).
	Shown string `json:"shown"`
}

ThemeMark is the name's badge: what it holds and the text it shows.

func (ThemeMark) ShownFor

func (m ThemeMark) ShownFor(name string) string

ShownFor fills Shown.

type ThemeModule

type ThemeModule struct {
	Tokens    map[string]string `json:"tokens"`
	Overrides map[string]string `json:"overrides"`
	// Personal are the profile's own colours for the scope.
	Personal map[string]string `json:"personal,omitempty"`
}

ThemeModule is one module scope's colours.

type ThemeVariant

type ThemeVariant struct {
	ID      string                       `json:"id"`
	Tokens  map[string]string            `json:"tokens"`
	Modules map[string]map[string]string `json:"modules"`
	Shape   themes.Shape                 `json:"shape"`
	Type    themes.TypeTokens            `json:"type"`
	// The same Design 2 additions, in this look's colours.
	TV        themes.TV                       `json:"tv"`
	Elevation map[string]themes.ElevationStep `json:"elevation"`
}

ThemeVariant is one look of a theme: the built-in theme behind it, its colours with the global and the profile's overrides applied, each module's whole palette, and its shape and type.

type ThemeWarning

type ThemeWarning struct {
	// Scope is "global", "module:<id>", "personal" (the profile's own colours) or
	// "personal:<id>" (its own colours for a module).
	Scope string `json:"scope"`
	// Variant is "dark" or "light" when the warning is about one of an automatic theme's
	// two looks; empty for a theme with one look.
	Variant string `json:"variant,omitempty"`
	themes.ContrastIssue
}

ThemeWarning is text that would be hard to read: WCAG AA wants 4.5:1.

type TranscodeNow

type TranscodeNow struct {
	Active int `json:"active"`
	Max    int `json:"max"`
}

TranscodeNow is how busy the converting is.

Source Files

Jump to

Keyboard shortcuts

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