webclient

package
v0.3.18 Latest Latest
Warning

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

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

Documentation

Overview

Package webclient provides the official Jellyfin Web build that the native Jellyfin apps (Android, iOS/iPadOS, Desktop, webOS, Xbox) load from <server>/web/. Nothing is bundled: the pinned .deb is downloaded from repo.jellyfin.org when Jellyfin is turned on and cached under the data directory.

Index

Constants

View Source
const (
	Version = "12.4"
	URL     = "https://repo.jellyfin.org/files/server/debian/stable/v12.4/amd64/jellyfin-web_12.4%2Bdeb13_all.deb"
	SHA256  = "30561fda7e4ec2f48cfc86119b7bdf7f9fe319ebdc22069a5096ba4999198b64"
	Size    = 32062514
)

Pinned artifact. One place, so an upgrade is a single edit. The URL is the stable Debian pool path; repo.jellyfin.org redirects it to a mirror, so the downloader must follow redirects (HTTPS only).

Variables

This section is empty.

Functions

func AdaptSubtitles

func AdaptSubtitles(name string, raw []byte) ([]byte, error)

AdaptSubtitles adds an explicit progressive-text capability and a reader for it to the pinned client. Changes are made in memory, leaving the verified upstream install intact. Exact anchors fail closed on an upstream upgrade.

func Extract

func Extract(r io.ReaderAt, dstDir string) error

Extract unpacks the Jellyfin Web files from a .deb read at the start of r into dstDir. It reads only the "data.tar.xz" member and refuses anything outside the web prefix. dstDir must already exist.

func ServeVela

func ServeVela(w http.ResponseWriter, r *http.Request, dir string)

ServeVela serves the installed build with SPA deep-link fallback and default branding.

func ServeVelaBrand

func ServeVelaBrand(w http.ResponseWriter, r *http.Request, dir, appName string)

ServeVelaBrand serves the installed build with SPA deep-link fallback, patching the root HTML <title> and web manifest name/short_name when appName is set.

func ServeVelaWithBrand

func ServeVelaWithBrand(w http.ResponseWriter, r *http.Request, dir string, brand VelaBrand)

ServeVelaWithBrand serves the installed Vela build with dynamic branding for index.html, manifest.webmanifest, and PWA/favicon icons.

func SubtitleAdapterAsset

func SubtitleAdapterAsset(name string) bool

func VelaReady

func VelaReady(dir string) bool

VelaReady reports an owner-installed optional build. No download is attempted until a pinned Vela release artifact is published and verified by the host.

Types

type Installer

type Installer struct {
	// Dir is the install root: Dir/Version holds the extracted files, and a
	// ".complete" marker beside it records the verified version and sha.
	Dir string
	// HTTP downloads the artifact. It should go through Ether's egress when a
	// client is available to the caller; nil falls back to a plain client.
	HTTP *http.Client

	// Overridable in tests; they default to the pinned constants.
	URL    string
	SHA256 string
	Size   int64
	// contains filtered or unexported fields
}

Installer fetches, verifies and caches the pinned Jellyfin Web build. The zero value is unusable; construct with New.

func New

func New(dir string, httpClient *http.Client) *Installer

VerifyState proves the pinned artifact is trustworthy and reports whether a file's sha256 matches. It is used by the extractor and by tests.

func (*Installer) Begin

func (in *Installer) Begin() (Status, error)

Begin starts the first install in the background if none is present or running, and reports the current state. It never blocks on the download, so a request handler can answer a "preparing" page while it runs. Concurrent calls share one download.

func (*Installer) Ensure

func (in *Installer) Ensure(ctx context.Context) (string, error)

Ensure returns the directory holding the extracted build, installing it on first use. Concurrent callers share a single download. After a failure the error is remembered for backoffDelay; callers within that window receive the same error without another attempt.

func (*Installer) State

func (in *Installer) State() (Status, error)

State reports the current status without starting any work. Err is non-nil only for StatusFailed and carries owner-facing text.

type Status

type Status int

Status is the observable state of the local install.

const (
	// StatusReady means a verified install is present.
	StatusReady Status = iota
	// StatusDownloading means the first download is in progress.
	StatusDownloading
	// StatusFailed means the last download or extraction failed.
	StatusFailed
)

type VelaBrand

type VelaBrand struct {
	AppName        string
	IconVersion    string
	IconIsSVG      bool
	IconAsset      func(name string) (VelaIconAsset, bool)
	RedirectPrefix string
}

VelaBrand carries the owner's optional Vela app name and icon resolver for dynamic index.html, manifest.webmanifest, and PWA icon serving.

type VelaIconAsset

type VelaIconAsset struct {
	ContentType string
	ETag        string
	Data        []byte
	IsSVG       bool
}

VelaIconAsset is a pre-rendered owner PWA icon served in place of the release's built-in icon files.

Jump to

Keyboard shortcuts

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