vela

package
v0.3.17 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: GPL-3.0 Imports: 52 Imported by: 0

Documentation

Overview

Package vela presents the Vela v0 protocol through neutral host services.

Index

Constants

View Source
const (
	MaxAppNameChars   = 40
	MaxWordmarkBytes  = 512 << 10
	MaxWordmarkWidth  = 1024
	MaxWordmarkHeight = 256
)
View Source
const (
	LivePreviewAuto    = "auto"
	LivePreviewOnClick = "on-click"
	LivePreviewOff     = "off"
)
View Source
const (
	MaxAppIconBytes = 512 << 10
	MaxAppIconSize  = 1024
)
View Source
const (
	MaxSkinArchiveBytes  = 8 << 20  // 8 MB .vskin archive
	MaxSkinExpandedBytes = 32 << 20 // 32 MB expanded contents
	MaxSkinArchiveFiles  = 200      // max files in .vskin
	MaxSkinPackBytes     = 64 << 10 // 64 KB SkinPack JSON
	MaxSkinDocumentBytes = 2 << 20  // 2 MB SkinDocument JSON

)
View Source
const DefaultPort = 8098

Variables

View Source
var (
	ErrBuiltinSkin  = errors.New("built-in skins cannot be modified or removed")
	ErrSkinNotFound = errors.New("skin not found")
	ErrSkinInvalid  = errors.New("invalid skin package")
)
View Source
var (
	ErrAppIconTooLarge = errors.New("app icon exceeds 512 KB")
)
View Source
var (
	ErrWordmarkTooLarge = errors.New("wordmark exceeds 512 KB")
)

Functions

func AppearanceChanged

func AppearanceChanged(before, after map[string]any) bool

AppearanceChanged reports whether two Vela settings maps produce a different appearance/branding snapshot.

func CapabilitiesChanged

func CapabilitiesChanged(before, after map[string]any) bool

CapabilitiesChanged reports whether two Vela settings maps produce different advertised sign-in capabilities.

func DedicatedPort

func DedicatedPort(s map[string]any) int

DedicatedPort extracts a valid optional dedicated listener port (1..65535) from Vela settings, or returns 0 when Vela uses only Ether's main port.

func IsBuiltinSkinID

func IsBuiltinSkinID(id string) bool

IsBuiltinSkinID reports whether id names the compiled cinematic engine alias or one of Vela's non-removable built-in skin documents.

func NativeLibraryType

func NativeLibraryType(mt frontend.MediaType) string

func NormalizeSettings

func NormalizeSettings(s frontend.Settings) frontend.Settings

NormalizeSettings trims appName, omits unset branding keys, and clones wordmark/icon maps.

func ProjectLibrary

func ProjectLibrary(p frontend.Presentations, fallback frontend.MediaType) (frontend.MediaType, string, bool)

ProjectLibrary interprets this adapter's presentation declaration. Console-only and adapter-only sources remain unpublished; visibility is still applied by Experience.Views.

func PruneAppIcons

func PruneAppIcons(ctx context.Context, db *sql.DB, settings map[string]any)

PruneAppIcons removes unreferenced app icons (and their generated variants) older than an hour so an uploaded draft is never deleted mid-edit while old assets do not accumulate.

func PruneWordmarks

func PruneWordmarks(ctx context.Context, db *sql.DB, settings map[string]any)

PruneWordmarks removes unreferenced wordmarks older than an hour so an uploaded draft is never deleted mid-edit while old assets do not accumulate.

func ServeOnMainPort

func ServeOnMainPort(s map[string]any) bool

ServeOnMainPort reports whether Vela should continue serving /vela and /sessions/media on Ether's main (Plex) port. Defaults to true when omitted.

func ValidLivePreviewMode

func ValidLivePreviewMode(mode string) bool

ValidLivePreviewMode reports whether mode is a supported Vela Live TV preview setting value.

func ValidSkinID

func ValidSkinID(id string) bool

ValidSkinID reports whether id matches the Vela skin identifier grammar.

Types

type AppIcon

type AppIcon struct {
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Digest string `json:"digest"`
}

AppIcon is a validated, content-addressed square owner PWA icon asset.

func UploadAppIcon

func UploadAppIcon(ctx context.Context, db *sql.DB, r io.Reader) (AppIcon, error)

UploadAppIcon validates a square PNG, SVG, or WebP app icon (<= 512 KB, 1x1..1024x1024 px), generates safe PNG sizes for PWA any/maskable (192, 512), apple-touch-icon (180), and favicons (16, 32, 48), and stores them by SHA-256 digest.

type AppIconValidationError

type AppIconValidationError struct {
	Message string
}

AppIconValidationError reports an invalid square app icon image or dimension check.

func (*AppIconValidationError) Error

func (e *AppIconValidationError) Error() string

type BuiltinSkin

type BuiltinSkin struct {
	ID       string
	Name     string
	Version  string
	Swatches []string
}

BuiltinSkin describes a non-removable skin shipped with Vela.

func BuiltinSkins

func BuiltinSkins() []BuiltinSkin

BuiltinSkins returns the non-removable built-in skin documents in display order.

type Frontend

type Frontend struct {
	AssetsDir string
	DB        *sql.DB
	ReplayKey []byte
	Skins     *SkinStore
}

func (Frontend) Describe

func (Frontend) Describe() frontend.Descriptor

func (Frontend) Mount

func (f Frontend) Mount(ctx context.Context, host frontend.Host) (frontend.Instance, error)

func (Frontend) ValidateSettings

func (f Frontend) ValidateSettings(s frontend.Settings) error

ValidateSettings keeps the owner setting additive without accepting arbitrary config.

type SignInMethods

type SignInMethods struct {
	Password     bool
	Plex         bool
	QuickConnect bool
}

SignInMethods holds the owner's enabled sign-in methods for Vela viewers. Each method defaults to enabled when absent from persisted settings.

func SignInMethodsFromSettings

func SignInMethodsFromSettings(s map[string]any) SignInMethods

SignInMethodsFromSettings returns the effective Vela sign-in method toggles.

type SkinDocumentEntry

type SkinDocumentEntry struct {
	ID       string   `json:"id"`
	Name     string   `json:"name"`
	Version  string   `json:"version"`
	URL      string   `json:"url"`
	Preview  string   `json:"preview,omitempty"`
	Swatches []string `json:"swatches"`
}

SkinDocumentEntry is an entry in GET /vela/v0/appearance documents[].

type SkinStore

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

SkinStore manages owner-installed Vela skins on disk and in the database.

func NewSkinStore

func NewSkinStore(db *sql.DB, dir string) *SkinStore

NewSkinStore creates a store backed by db and dir (typically <dataDir>/vela-skins).

func (*SkinStore) HasInstalled

func (s *SkinStore) HasInstalled(ctx context.Context, id string) bool

HasInstalled reports whether id is currently installed.

func (*SkinStore) InstallArchive

func (s *SkinStore) InstallArchive(ctx context.Context, pkg []byte) (SkinSummary, error)

InstallArchive validates, rewrites, atomically unpacks, and persists a .vskin archive.

func (*SkinStore) List

func (s *SkinStore) List(ctx context.Context, velaClientDir string) []SkinSummary

List returns built-in skins followed by owner-installed skins. When velaClientDir contains skins/catalog.json, built-in previews, versions, and swatches are enriched from it.

func (*SkinStore) Remove

func (s *SkinStore) Remove(ctx context.Context, id string) error

Remove deletes an owner-installed skin from the database and disk.

func (*SkinStore) Snapshot

func (s *SkinStore) Snapshot(ctx context.Context) (generation uint64, packs []json.RawMessage, documents []SkinDocumentEntry, kinds map[string]string)

Snapshot returns the cached appearance entries and installed skin kinds.

type SkinSummary

type SkinSummary struct {
	ID          string   `json:"id"`
	Name        string   `json:"name"`
	Version     string   `json:"version"`
	Kind        string   `json:"kind"` // "pack" or "document"
	Builtin     bool     `json:"builtin"`
	Preview     string   `json:"preview,omitempty"`
	Swatches    []string `json:"swatches"`
	InstalledAt int64    `json:"installedAt,omitempty"`
}

SkinSummary describes a built-in or owner-installed skin for the console.

type Wordmark

type Wordmark struct {
	URL    string `json:"url"`
	Width  int    `json:"width"`
	Height int    `json:"height"`
	Digest string `json:"digest"`
}

Wordmark is a validated, content-addressed owner wordmark asset.

func UploadWordmark

func UploadWordmark(ctx context.Context, db *sql.DB, r io.Reader) (Wordmark, error)

UploadWordmark validates a PNG, SVG, or WebP wordmark (<= 512 KB, <= 1024x256 px) and stores it by SHA-256 digest for unauthenticated immutable serving under /vela/v0/branding/.

type WordmarkValidationError

type WordmarkValidationError struct {
	Message string
}

WordmarkValidationError reports an invalid wordmark image or dimension check.

func (*WordmarkValidationError) Error

func (e *WordmarkValidationError) Error() string

Jump to

Keyboard shortcuts

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