installer

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2026 License: MIT Imports: 42 Imported by: 0

Documentation

Overview

Package installer provides cross-platform installation functionality

Index

Constants

This section is empty.

Variables

View Source
var ErrWindowsUninstallBlocked = errors.New("Close mpv and any apps using its installation folder, then retry uninstalling. If the problem persists, check the folder's permissions")

ErrWindowsUninstallBlocked means an owned file is open or inaccessible. The preflight returns this before removing payload files, shortcuts or registration.

Functions

func ApplyUserSettings

func ApplyUserSettings(configPath string, settings *UserSettings, cr *CommandRunner) error

ApplyUserSettings applies preserved user settings to the mpv.conf file This should be called after writing a new config file to restore user preferences

func CanElevateWithoutPassword added in v1.3.0

func CanElevateWithoutPassword(parent context.Context) bool

CanElevateWithoutPassword checks the current OS authorization without opening a prompt or reading a credential. Actual commands still use sudo -n, so an expired timestamp or a narrower command policy fails without prompting.

func CommandExists

func CommandExists(name string) bool

CommandExists checks if a command is available in PATH

func CreateFullBackup

func CreateFullBackup(fs FileSystem, filePath string, cr *CommandRunner) (string, error)

CreateFullBackup creates a backup in the conf_backups directory with full timestamp

func CreateLinuxWebUIShortcutWithOutput

func CreateLinuxWebUIShortcutWithOutput(cr *CommandRunner) error

func DetectAndSyncApps added in v1.1.0

func DetectAndSyncApps() (added int, removed int)

DetectAndSyncApps is a convenience function that detects and syncs in one call

func DownloadAndExtract

func DownloadAndExtract(installer *Installer, cr *CommandRunner, url, targetDir, archiveName, expectedHash string) error

DownloadAndExtract downloads a file and extracts it to the target directory This is a common pattern used across Windows and macOS installers. The downloaded archive is verified against expectedHash (BLAKE3) after download; a missing hash and a mismatch are both hard failures.

func EnsureDirectory

func EnsureDirectory(path string, cr *CommandRunner) error

EnsureDirectory creates a directory if it doesn't exist

func GetAndClearPendingNotice added in v1.1.0

func GetAndClearPendingNotice() string

GetAndClearPendingNotice gets and clears the pending notice

func GetConfigBackupDir

func GetConfigBackupDir() (string, error)

GetConfigBackupDir returns the path to config backups directory

func GetMPVConfigDir

func GetMPVConfigDir() (string, error)

GetMPVConfigDir returns the path to mpv config directory

func GetMPVConfigDirFromHome

func GetMPVConfigDirFromHome(homeDir string) string

GetMPVConfigDirFromHome returns the MPV config directory path from home directory

func GetMPVConfigPath

func GetMPVConfigPath() (string, error)

GetMPVConfigPath returns the path to mpv.conf (Unix)

func GetMethodDisplayName

func GetMethodDisplayName(methodID string) string

GetMethodDisplayName returns the display name for a method ID

func GetPendingNotice added in v1.1.0

func GetPendingNotice() string

GetPendingNotice gets the pending notice without clearing it

func GetPrivilegePrefix

func GetPrivilegePrefix() []string

GetPrivilegePrefix returns sudo prefix if needed for Linux

func InstallMPVConfigSafely

func InstallMPVConfigSafely(installer *Installer, cr *CommandRunner) error

InstallMPVConfigSafely installs MPV config and returns any failure after recording it in the command output.

func InstallMPVConfigWithPlatformDefaults

func InstallMPVConfigWithPlatformDefaults(installer *Installer, cr *CommandRunner, ostype platform.OSType, gpuInfo *platform.GPUInfo) error

InstallMPVConfigWithPlatformDefaults installs the MPV config and sets platform-specific recommended defaults. This wraps InstallMPVConfigWithOutput and adds the recommended hardware decoder setting for fresh installs.

func InstallUISafely

func InstallUISafely(installer *Installer, cr *CommandRunner, configDir string, uiType string) error

InstallUISafely installs the specified UI type with safe error handling Also sets the appropriate osc= setting in mpv.conf - UITypeUOSC: installs uOSC and sets osc=yes - UITypeModernZ: installs ModernZ and sets osc=no - UITypeNone: removes all UI files and osc= setting

func MigrateWindowsInstallOwnership added in v1.3.0

func MigrateWindowsInstallOwnership(installDir string) error

MigrateWindowsInstallOwnership records the two MPV launchers selected by an explicit adoption. DLLs, scripts, documents and user files remain unclaimed.

func RecordedInstallPath added in v1.3.0

func RecordedInstallPath(methodID, destination string) string

RecordedInstallPath identifies the installed application using the same path convention as discovery. It never executes a detected player.

func RecoverInstallerTransactions added in v1.3.0

func RecoverInstallerTransactions(paths ...string) error

RecoverInstallerTransactions rolls back interrupted installer/UI mutations adjacent to the supplied live paths. It validates every persisted path against the scanned parent before removing or restoring anything.

func RemoveAllUIFiles

func RemoveAllUIFiles(configDir string) error

RemoveAllUIFiles removes all known UI files (both uOSC and ModernZ) This is useful when switching UI types to ensure a clean slate

func RemoveThumbfast

func RemoveThumbfast(configDir string) error

RemoveThumbfast removes the thumbfast.lua script from the scripts directory This should be called when switching to "No UI" since thumbfast is only needed for UOSC/ModernZ

func RemoveUIFiles

func RemoveUIFiles(configDir string, uiType string) error

RemoveUIFiles removes UI files for the specified UI type This should be called before switching to a different UI type - UITypeUOSC: removes the uosc script, config, and current/legacy uOSC fonts - UITypeModernZ: removes modernz.lua, modernz.conf, fonts/modernz-icons.ttf Also cleans up legacy font files (material-design-icons.ttf, fluent-system-icons.ttf) from pre-0.3.1 installs

func RestoreBackup

func RestoreBackup(fs FileSystem, backupPath, configPath string, cr *CommandRunner) error

RestoreBackup restores a backup file to the config location

func SetPendingNotice added in v1.1.0

func SetPendingNotice(notice string)

SetPendingNotice sets a pending notice for the Web UI (cleared on restart)

func SetRecommendedHWADecoderIfEmpty

func SetRecommendedHWADecoderIfEmpty(configPath string, ostype platform.OSType, gpuInfo *platform.GPUInfo, cr *CommandRunner) error

SetRecommendedHWADecoderIfEmpty sets the hardware decoder to the platform-specific recommended value if the current setting in mpv.conf is empty, missing, or set to "auto". This is called after applying user settings to ensure fresh installs get optimal defaults.

func SyncInstalledAppObservations added in v1.3.0

func SyncInstalledAppObservations(observations []DetectionObservation) (added int, removed int)

SyncInstalledAppObservations reconciles discovery by canonical method/path identity. Multiple paths using the same install method remain independent; Unknown never mutates state, and NotFound requires an exact non-empty path.

func SyncInstalledApps added in v1.1.0

func SyncInstalledApps(detected []DetectedApp) (added int, removed int)

SyncInstalledApps adds or refreshes proven detections. Absence from this slice is not evidence of uninstallation, so existing records are preserved. Call SyncInstalledAppObservations with an exact NotFound observation only when a caller has independently proven that one installation disappeared.

func VerifyBLAKE3File added in v1.3.0

func VerifyBLAKE3File(filePath, expectedHash string) error

VerifyBLAKE3File verifies a file's BLAKE3 hash against an expected value. The expected hash has the form "blake3:<hex>" as published in the release JSON. Implemented locally because pkg/version imports pkg/installer (import cycle).

Types

type ArchitectureInfo

type ArchitectureInfo struct {
	Arch      string
	URL       string
	FFmpegURL string
}

ArchitectureInfo contains architecture details and URLs

func GetArchitectureInfo

func GetArchitectureInfo(platformArch string, isV3 bool, releaseInfo ReleaseInfo) (ArchitectureInfo, error)

GetArchitectureInfo returns architecture details for Windows install

type CommandExecutor

type CommandExecutor interface {
	RunCommand(name string, args ...string) error
	RunCommandOutput(name string, args ...string) ([]byte, error)
	RunShellCommand(script string) error
	RunCommands(commands []string) error
	Context() context.Context
	SetContext(ctx context.Context)
	IsCancelled() bool
	CheckCancelled() error
}

CommandExecutor defines the interface for executing shell commands

type CommandRunner

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

func NewCommandRunner

func NewCommandRunner(outputChan chan<- string, errorChan chan<- error) *CommandRunner

NewCommandRunner creates a new command runner with output and error channels

func NewCommandRunnerWithContext

func NewCommandRunnerWithContext(ctx context.Context, outputChan chan<- string, errorChan chan<- error) *CommandRunner

NewCommandRunnerWithContext creates a new command runner with a specific context for cancellation

func (*CommandRunner) BeginCommit added in v1.3.0

func (cr *CommandRunner) BeginCommit() error

func (*CommandRunner) CheckCancelled

func (cr *CommandRunner) CheckCancelled() error

CheckCancelled returns an error if the context has been cancelled

func (*CommandRunner) Context

func (cr *CommandRunner) Context() context.Context

Context returns the command runner's context

func (*CommandRunner) InteractiveSudoAllowed added in v1.3.0

func (cr *CommandRunner) InteractiveSudoAllowed() bool

InteractiveSudoAllowed reports whether sudo may prompt on stdin.

func (*CommandRunner) IsCancelled

func (cr *CommandRunner) IsCancelled() bool

IsCancelled returns true if the context has been cancelled

func (*CommandRunner) RunCommand

func (cr *CommandRunner) RunCommand(name string, args ...string) error

func (*CommandRunner) RunCommandOutput added in v1.3.0

func (cr *CommandRunner) RunCommandOutput(name string, args ...string) ([]byte, error)

RunCommandOutput runs a command and returns its captured standard output, mirroring exec.Command(name, args...).Output() under the runner's context.

func (*CommandRunner) RunCommandWithOutput

func (cr *CommandRunner) RunCommandWithOutput(cmd *exec.Cmd) error

func (*CommandRunner) RunCommands

func (cr *CommandRunner) RunCommands(commands []string) error

func (*CommandRunner) RunShellCommand

func (cr *CommandRunner) RunShellCommand(script string) error

func (*CommandRunner) RunSudoCommand added in v1.1.0

func (cr *CommandRunner) RunSudoCommand(name string, args ...string) error

RunSudoCommand runs a command with sudo, using existing OS authorization or a keyring password when necessary.

func (*CommandRunner) SetCommitGuard added in v1.3.0

func (cr *CommandRunner) SetCommitGuard(guard func() error)

SetCommitGuard binds the irreversible boundary to the owning UI job. Staging code must not invoke the guard until it is about to mutate the live install.

func (*CommandRunner) SetContext

func (cr *CommandRunner) SetContext(ctx context.Context)

SetContext sets the context for the command runner

func (*CommandRunner) SetInteractiveSudoAllowed added in v1.3.0

func (cr *CommandRunner) SetInteractiveSudoAllowed(allowed bool)

SetInteractiveSudoAllowed controls whether sudo may prompt on the runner's inherited terminal when no keyring credential is available. Interactive terminal UIs disable this because a child prompt would compete with the application's raw terminal ownership.

type DetectedApp added in v1.1.0

type DetectedApp struct {
	AppName     string // "MPV", "Celluloid"
	MethodID    string // "mpv-flatpak", "celluloid-package", etc.
	Version     string // Installed version
	InstallPath string // Path to binary if known
	InstallType string // "flatpak", "package"
}

DetectedApp represents a detected MPV application installation

func DetectInstalledMPVApps added in v1.1.0

func DetectInstalledMPVApps() []DetectedApp

DetectInstalledMPVApps concurrently detects all installed MPV applications Checks Flatpak and system package managers for mpv and celluloid on Linux, well-known install locations for mpv.exe on Windows, and application bundles in /Applications on macOS. Discovery never executes a detected application.

func DetectWindowsMPVInstalls added in v1.3.0

func DetectWindowsMPVInstalls() []DetectedApp

DetectWindowsMPVInstalls scans well-known Windows locations for existing mpv.exe installations (portable installs, Scoop, Chocolatey, PATH) and the Windows uninstall registry (HKLM/HKCU, including Wow6432Node). Returns nil on non-Windows platforms.

type DetectionObservation added in v1.3.0

type DetectionObservation struct {
	State DetectionState
	App   DetectedApp
}

DetectionObservation is one identity-scoped discovery result. NotFound is only actionable when InstallPath identifies an exact installation; method- wide absence is intentionally non-destructive because several installations can share one method.

func DetectInstalledMPVAppObservations added in v1.3.0

func DetectInstalledMPVAppObservations() []DetectionObservation

DetectInstalledMPVAppObservations returns every proven installation plus an Unknown marker for supported methods that produced no result. The current heterogeneous OS probes cannot prove that an unobserved custom/package install is absent, so they never synthesize NotFound.

type DetectionState added in v1.3.0

type DetectionState string

DetectionState distinguishes a proven installation from a proven absence and an inconclusive probe. Automatic discovery is conservative: a missing tool, timeout, permission error, or incomplete search is Unknown, never an instruction to delete durable application state.

const (
	DetectionFound    DetectionState = "found"
	DetectionNotFound DetectionState = "not-found"
	DetectionUnknown  DetectionState = "unknown"
)

type Downloader

type Downloader interface {
	DownloadFile(ctx context.Context, url, dest string, progress func(int64, int64)) error
}

Downloader defines the interface for downloading files

type FileSystem

type FileSystem interface {
	Exists(path string) bool
	IsDir(path string) bool
	MkdirAll(path string, perm os.FileMode) error
	MkdirTemp(dir, prefix string) (string, error)
	ReadFile(path string) ([]byte, error)
	WriteFile(path string, data []byte, perm os.FileMode) error
	Remove(path string) error
	RemoveAll(path string) error
	Rename(oldPath, newPath string) error
	CopyFile(src, dst string, perm os.FileMode) error
	CopyDir(src, dst string) error
	Stat(path string) (os.FileInfo, error)
	Walk(root string, walkFn filepath.WalkFunc) error
	Glob(pattern string) ([]string, error)
}

FileSystem defines the interface for file system operations

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient defines the interface for HTTP operations

type HTTPDownloader added in v1.3.0

type HTTPDownloader struct {
	Client HTTPClient
}

HTTPDownloader is the production Downloader implementation backed by net/http. The underlying HTTPClient is injectable; nil uses the bounded artifact client.

func NewHTTPDownloader added in v1.3.0

func NewHTTPDownloader(client HTTPClient) *HTTPDownloader

NewHTTPDownloader creates a downloader using the given HTTP client (the bounded artifact client when client is nil).

func (*HTTPDownloader) DownloadFile added in v1.3.0

func (d *HTTPDownloader) DownloadFile(ctx context.Context, url, dest string, progressCallback func(int64, int64)) error

DownloadFile downloads a file with context support for cancellation. Returns an error if the context is cancelled during download.

type InstallMethod

type InstallMethod struct {
	ID          string
	Name        string
	Description string
	Recommended bool
	Priority    int
	Icon        string
	Type        string
	AppType     string
	Homepage    string
}

InstallMethod represents an install method for MPV or related apps

type InstallationHandler

type InstallationHandler struct {
	Platform          *platform.Platform
	Installer         *Installer
	PlatformInstaller PlatformInstaller
}

InstallationHandler provides unified method handling across platforms

func NewInstallationHandler

func NewInstallationHandler(p *platform.Platform, inst *Installer) *InstallationHandler

NewInstallationHandler creates a new installation handler for Linux

func (*InstallationHandler) CreateInstallerShortcutWithOutput

func (ih *InstallationHandler) CreateInstallerShortcutWithOutput(cr *CommandRunner) error

CreateInstallerShortcutWithOutput creates a platform-native manager shortcut.

func (*InstallationHandler) CreateMPVShortcutWithOutput

func (ih *InstallationHandler) CreateMPVShortcutWithOutput(cr *CommandRunner) error

CreateMPVShortcutWithOutput creates Desktop and Start Menu shortcuts for MPV This is Windows-specific

func (*InstallationHandler) CreateWebUIShortcutWithOutput

func (ih *InstallationHandler) CreateWebUIShortcutWithOutput(cr *CommandRunner) error

CreateWebUIShortcutWithOutput creates a shortcut that opens the Web UI.

func (*InstallationHandler) ExecuteInstall

func (ih *InstallationHandler) ExecuteInstall(ctx context.Context, cr *CommandRunner, methodID string, uiType string, isUpdate bool) error

ExecuteInstall executes an installation method based on methodID The context can be used to cancel long-running operations

func (*InstallationHandler) ExecuteUninstall

func (ih *InstallationHandler) ExecuteUninstall(ctx context.Context, cr *CommandRunner, app *config.InstalledApp) error

ExecuteUninstall executes an uninstallation method based on app info The context can be used to cancel long-running operations

func (*InstallationHandler) ExecuteUpdate

func (ih *InstallationHandler) ExecuteUpdate(ctx context.Context, cr *CommandRunner, methodID string) error

ExecuteUpdate executes an update operation based on methodID This is a convenience wrapper around ExecuteInstall with isUpdate=true

func (*InstallationHandler) RemoveFileAssociationsWithOutput

func (ih *InstallationHandler) RemoveFileAssociationsWithOutput(cr *CommandRunner) error

RemoveFileAssociationsWithOutput removes file associations Windows retains OS-owned default-app selection; no mutable batch file is elevated.

func (*InstallationHandler) SetupFileAssociationsWithOutput

func (ih *InstallationHandler) SetupFileAssociationsWithOutput(cr *CommandRunner) error

SetupFileAssociationsWithOutput registers MPV and opens Windows Default apps. This is Windows-specific and creates shortcuts that user runs as Administrator

type Installer

type Installer struct {
	ReleaseInfo ReleaseInfo
	InstallDir  string
	// contains filtered or unexported fields
}

Installer holds release info and install paths

func NewInstaller

func NewInstaller(releaseInfo ReleaseInfo, installDir string, opts ...InstallerOption) *Installer

func (*Installer) BackupConfigWithOutput

func (i *Installer) BackupConfigWithOutput(cr *CommandRunner) error

func (*Installer) CloneForOperation added in v1.3.0

func (i *Installer) CloneForOperation(releaseInfo ReleaseInfo, installDir string) *Installer

CloneForOperation returns an installer whose manifest and destination are immutable for the lifetime of one operation. Injectable dependencies are intentionally shared; production implementations are concurrency-safe and tests retain their configured mocks.

func (*Installer) CopyAsset

func (i *Installer) CopyAsset(embedFS embed.FS, srcPath, destPath string) error

func (*Installer) CopyDirWithOutput

func (i *Installer) CopyDirWithOutput(cr *CommandRunner, src, dest string) error

func (*Installer) CopyFileWithOutput

func (i *Installer) CopyFileWithOutput(cr *CommandRunner, src, dest string) error

func (*Installer) DisableOSCForCelluloid

func (i *Installer) DisableOSCForCelluloid(cr *CommandRunner) error

func (*Installer) DownloadFile

func (i *Installer) DownloadFile(url, dest string) error

func (*Installer) DownloadFileWithContext

func (i *Installer) DownloadFileWithContext(ctx context.Context, url, dest string, progressCallback func(int64, int64)) error

DownloadFileWithContext downloads a file with context support for cancellation Returns an error if the context is cancelled during download

func (*Installer) DownloadFileWithProgress

func (i *Installer) DownloadFileWithProgress(url, dest string, progressCallback func(int64, int64)) error

func (*Installer) DownloadFileWithProgressToChannel

func (i *Installer) DownloadFileWithProgressToChannel(cr *CommandRunner, url, dest string) error

func (*Installer) EnsureDir

func (i *Installer) EnsureDir(path string) error

func (*Installer) EnsureDirWithOutput

func (i *Installer) EnsureDirWithOutput(cr *CommandRunner, path string) error

func (*Installer) ExtractArchive

func (i *Installer) ExtractArchive(src, dest string) error

ExtractArchive extracts an archive without progress output.

func (*Installer) ExtractArchiveWithOutput

func (i *Installer) ExtractArchiveWithOutput(cr *CommandRunner, src, dest string) error

ExtractArchiveWithOutput extracts an archive through a private sibling staging directory. The live destination is not touched until the complete archive has passed path/type/size preflight and staged-tree validation.

func (*Installer) FileExists

func (i *Installer) FileExists(path string) bool

func (*Installer) InstallMPVConfigWithOutput

func (i *Installer) InstallMPVConfigWithOutput(cr *CommandRunner) error

func (*Installer) InstallModernZWithOutput

func (i *Installer) InstallModernZWithOutput(cr *CommandRunner, installDir string) error

InstallModernZWithOutput installs ModernZ UI for MPV ModernZ requires osc=no in mpv.conf (unlike uOSC which needs osc=yes) ModernZ releases have individual files: modernz.lua, modernz-icons.ttf, modernz.conf

func (*Installer) InstallUOSCWithOutput

func (i *Installer) InstallUOSCWithOutput(cr *CommandRunner, installDir string) error

func (*Installer) PrepareUI added in v1.3.0

func (installer *Installer) PrepareUI(cr *CommandRunner, configDir, uiType string) (*PreparedUI, error)

PrepareUI downloads and verifies a UI before an operation changes live files. The caller owns the result and must close it after commit or cancellation.

func (*Installer) RestoreConfigWithOutput

func (i *Installer) RestoreConfigWithOutput(cr *CommandRunner, backupPath string) error

func (*Installer) SetInstallDir added in v1.3.0

func (i *Installer) SetInstallDir(path string)

SetInstallDir updates the install directory used by the platform installers (WindowsInstaller embeds *Installer and reads InstallDir directly). Call it before starting an install, not concurrently with one.

func (*Installer) SetOSCConfig

func (i *Installer) SetOSCConfig(cr *CommandRunner, configPath, oscValue string) error

SetOSCConfig updates the osc= setting in mpv.conf uOSC requires osc=yes, ModernZ requires osc=no

func (*Installer) SetOSCDefault

func (i *Installer) SetOSCDefault(cr *CommandRunner, configPath string) error

SetOSCDefault ensures osc=yes is set in mpv.conf This is used when setting UI type to "none" to enable MPV's default OSC

func (*Installer) UpdateFFmpegWithOutput

func (i *Installer) UpdateFFmpegWithOutput(cr *CommandRunner, installDir string) error

UpdateFFmpegWithOutput updates FFmpeg binary (Windows only)

func (*Installer) UpdateModernZWithOutput

func (i *Installer) UpdateModernZWithOutput(cr *CommandRunner, installDir string) error

UpdateModernZWithOutput updates ModernZ to the latest version

func (*Installer) UpdateUOSCWithOutput

func (i *Installer) UpdateUOSCWithOutput(cr *CommandRunner, installDir string) error

UpdateUOSCWithOutput updates UOSC to the latest version

func (*Installer) VerifyBLAKE3WithOutput

func (i *Installer) VerifyBLAKE3WithOutput(cr *CommandRunner, filePath, expectedHash string) error

VerifyBLAKE3WithOutput verifies a file's BLAKE3 hash with output logging. Downloaded application artifacts fail closed when the release manifest does not provide a concrete checksum.

type InstallerOption added in v1.3.0

type InstallerOption func(*Installer)

InstallerOption configures an optional Installer dependency. Production code uses the zero defaults; tests inject mocks via these options.

func WithDownloader added in v1.3.0

func WithDownloader(d Downloader) InstallerOption

WithDownloader overrides the Downloader used for context-aware downloads.

func WithExecutor added in v1.3.0

func WithExecutor(e CommandExecutor) InstallerOption

WithExecutor overrides the CommandExecutor used by archive extraction.

func WithFileSystem added in v1.3.0

func WithFileSystem(fs FileSystem) InstallerOption

WithFileSystem overrides the FileSystem used for file operations.

func WithHTTPClient added in v1.3.0

func WithHTTPClient(c HTTPClient) InstallerOption

WithHTTPClient overrides the HTTPClient used for direct HTTP requests.

type LinuxInstaller

type LinuxInstaller struct {
	*Installer
	Platform *platform.Platform
}

func NewLinuxInstaller

func NewLinuxInstaller(installer *Installer, p *platform.Platform) *LinuxInstaller

func (*LinuxInstaller) CanUpdate

func (li *LinuxInstaller) CanUpdate() bool

func (*LinuxInstaller) CheckFlathubEnabled

func (li *LinuxInstaller) CheckFlathubEnabled() bool

func (*LinuxInstaller) CheckFlatpakInstalled

func (li *LinuxInstaller) CheckFlatpakInstalled() bool

func (*LinuxInstaller) CheckInstalled

func (li *LinuxInstaller) CheckInstalled() bool

func (*LinuxInstaller) ConfigureCelluloidFlatpakWithOutput

func (li *LinuxInstaller) ConfigureCelluloidFlatpakWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) ConfigureCelluloidPackageWithOutput

func (li *LinuxInstaller) ConfigureCelluloidPackageWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) ConfigureMPVFlatpakWithOutput

func (li *LinuxInstaller) ConfigureMPVFlatpakWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) CreateInstallerShortcutToBinaryWithOutput

func (li *LinuxInstaller) CreateInstallerShortcutToBinaryWithOutput(cr *CommandRunner, binaryPath string) error

func (*LinuxInstaller) CreateInstallerShortcutWithOutput

func (li *LinuxInstaller) CreateInstallerShortcutWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) CreateMPVShortcut

func (li *LinuxInstaller) CreateMPVShortcut(cr *CommandRunner) error

CreateMPVShortcut is a no-op on Linux (shortcuts are not needed)

func (*LinuxInstaller) CreateWebUIShortcutWithOutput

func (li *LinuxInstaller) CreateWebUIShortcutWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) EnsureGSettingsInstalled

func (li *LinuxInstaller) EnsureGSettingsInstalled(cr *CommandRunner) error

func (*LinuxInstaller) GetAvailableMethods

func (li *LinuxInstaller) GetAvailableMethods(filterInstalled bool) []InstallMethod

func (*LinuxInstaller) GetDefaultInstallPath

func (li *LinuxInstaller) GetDefaultInstallPath() string

func (*LinuxInstaller) GetInstalledVersion

func (li *LinuxInstaller) GetInstalledVersion() string

func (*LinuxInstaller) InstallCelluloidViaPackage

func (li *LinuxInstaller) InstallCelluloidViaPackage() error

InstallCelluloidViaPackage installs Celluloid using the system package manager.

func (*LinuxInstaller) InstallCelluloidViaPackageWithOutput

func (li *LinuxInstaller) InstallCelluloidViaPackageWithOutput(cr *CommandRunner, isUpdate bool) error

InstallCelluloidViaPackageWithOutput installs Celluloid using the system package manager with output streaming.

func (*LinuxInstaller) InstallFlatpakWithOutput

func (li *LinuxInstaller) InstallFlatpakWithOutput(cr *CommandRunner, flatpakID string, uiType string, isUpdate bool) error

func (*LinuxInstaller) InstallIINAWithOutput

func (li *LinuxInstaller) InstallIINAWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) InstallIcon

func (li *LinuxInstaller) InstallIcon(cr *CommandRunner) error

InstallIcon installs the icon to ~/.local/share/icons/hicolor/128x128/apps/

func (*LinuxInstaller) InstallMPCQTWithOutput

func (li *LinuxInstaller) InstallMPCQTWithOutput(cr *CommandRunner, method string) error

func (*LinuxInstaller) InstallMPVAppWithOutput

func (li *LinuxInstaller) InstallMPVAppWithOutput(cr *CommandRunner, uiType string) error

func (*LinuxInstaller) InstallMPVViaBrewWithOutput

func (li *LinuxInstaller) InstallMPVViaBrewWithOutput(cr *CommandRunner, uiType string, isUpdate bool) error

func (*LinuxInstaller) InstallMPVViaPackage

func (li *LinuxInstaller) InstallMPVViaPackage(installUOSC bool) error

InstallMPVViaPackage installs MPV using the system package manager.

func (*LinuxInstaller) InstallMPVViaPackageWithOutput

func (li *LinuxInstaller) InstallMPVViaPackageWithOutput(cr *CommandRunner, uiType string, isUpdate bool) error

InstallMPVViaPackageWithOutput installs MPV using the system package manager with output streaming.

func (*LinuxInstaller) InstallMPVWithOutput

func (li *LinuxInstaller) InstallMPVWithOutput(cr *CommandRunner, method string, uiType string) error

func (*LinuxInstaller) NormalizePath

func (li *LinuxInstaller) NormalizePath(path string) string

func (*LinuxInstaller) RemoveFileAssociationsWithOutput

func (li *LinuxInstaller) RemoveFileAssociationsWithOutput(cr *CommandRunner) error

RemoveFileAssociationsWithOutput is a no-op on Linux

func (*LinuxInstaller) SetupFileAssociationsWithOutput

func (li *LinuxInstaller) SetupFileAssociationsWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) UninstallAppWithOutput

func (li *LinuxInstaller) UninstallAppWithOutput(cr *CommandRunner, appName string) error

func (*LinuxInstaller) UninstallBrewWithOutput

func (li *LinuxInstaller) UninstallBrewWithOutput(cr *CommandRunner, appName string) error

func (*LinuxInstaller) UninstallFlatpakWithOutput

func (li *LinuxInstaller) UninstallFlatpakWithOutput(cr *CommandRunner, appID string) error

func (*LinuxInstaller) UninstallMPCQTWithOutput

func (li *LinuxInstaller) UninstallMPCQTWithOutput(cr *CommandRunner) error

UninstallMPCQTWithOutput is a no-op on Linux (MPC-QT is Windows-only)

func (*LinuxInstaller) UninstallViaPackage

func (li *LinuxInstaller) UninstallViaPackage(appName string) error

UninstallViaPackage uninstalls an application using the system package manager.

func (*LinuxInstaller) UninstallViaPackageWithOutput

func (li *LinuxInstaller) UninstallViaPackageWithOutput(cr *CommandRunner, appName string) error

UninstallViaPackageWithOutput uninstalls an application using the system package manager with output streaming.

func (*LinuxInstaller) UninstallWithOutput

func (li *LinuxInstaller) UninstallWithOutput(cr *CommandRunner) error

UninstallWithOutput is a no-op on Linux

func (*LinuxInstaller) UpdateMPVAppWithOutput

func (li *LinuxInstaller) UpdateMPVAppWithOutput(cr *CommandRunner) error

func (*LinuxInstaller) UpdateMPVWithOutput

func (li *LinuxInstaller) UpdateMPVWithOutput(cr *CommandRunner, method string) error

type OSFileSystem added in v1.3.0

type OSFileSystem struct{}

OSFileSystem is the production FileSystem implementation backed by the os package.

func (OSFileSystem) CopyDir added in v1.3.0

func (fs OSFileSystem) CopyDir(src, dst string) error

CopyDir recursively copies a directory tree.

func (OSFileSystem) CopyFile added in v1.3.0

func (OSFileSystem) CopyFile(src, dst string, perm os.FileMode) error

CopyFile copies a file from src to dst with the given permission mode.

func (OSFileSystem) Exists added in v1.3.0

func (OSFileSystem) Exists(path string) bool

Exists reports whether path exists.

func (OSFileSystem) Glob added in v1.3.0

func (OSFileSystem) Glob(pattern string) ([]string, error)

Glob returns matches for a pattern.

func (OSFileSystem) IsDir added in v1.3.0

func (OSFileSystem) IsDir(path string) bool

IsDir reports whether path is a directory.

func (OSFileSystem) MkdirAll added in v1.3.0

func (OSFileSystem) MkdirAll(path string, perm os.FileMode) error

MkdirAll creates a directory tree.

func (OSFileSystem) MkdirTemp added in v1.3.0

func (OSFileSystem) MkdirTemp(dir, prefix string) (string, error)

MkdirTemp creates a temporary directory.

func (OSFileSystem) ReadFile added in v1.3.0

func (OSFileSystem) ReadFile(path string) ([]byte, error)

ReadFile reads file contents.

func (OSFileSystem) Remove added in v1.3.0

func (OSFileSystem) Remove(path string) error

Remove removes a file or empty directory.

func (OSFileSystem) RemoveAll added in v1.3.0

func (OSFileSystem) RemoveAll(path string) error

RemoveAll removes a path and all children.

func (OSFileSystem) Rename added in v1.3.0

func (OSFileSystem) Rename(oldPath, newPath string) error

Rename renames a file or directory.

func (OSFileSystem) Stat added in v1.3.0

func (OSFileSystem) Stat(path string) (os.FileInfo, error)

Stat returns file info for a path.

func (OSFileSystem) Walk added in v1.3.0

func (OSFileSystem) Walk(root string, walkFn filepath.WalkFunc) error

Walk walks a directory tree.

func (OSFileSystem) WriteFile added in v1.3.0

func (OSFileSystem) WriteFile(path string, data []byte, perm os.FileMode) error

WriteFile writes data to a file.

type PackageManager

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

PackageManager handles package manager operations

func NewPackageManager

func NewPackageManager(family string) *PackageManager

NewPackageManager creates a new package manager instance

func (*PackageManager) BuildInstallCommand

func (pm *PackageManager) BuildInstallCommand(packageName string, withPrivilege bool) []string

BuildInstallCommand builds an install command with privilege prefix

func (*PackageManager) BuildRemoveCommand

func (pm *PackageManager) BuildRemoveCommand(packageName string, withPrivilege bool) []string

BuildRemoveCommand builds a remove command with privilege prefix

func (*PackageManager) BuildUpdateCommand

func (pm *PackageManager) BuildUpdateCommand(withPrivilege bool) []string

BuildUpdateCommand builds a package update command with privilege prefix

func (*PackageManager) BuildUpgradeCommand

func (pm *PackageManager) BuildUpgradeCommand(packageName string, withPrivilege bool) []string

BuildUpgradeCommand builds an upgrade command with privilege prefix

func (*PackageManager) GetCommandName

func (pm *PackageManager) GetCommandName() string

GetCommandName returns the base command name

type PartialInstallError added in v1.3.0

type PartialInstallError struct{ Err error }

PartialInstallError means application files were committed but subsequent configuration failed. Callers must report a reconciliation outcome.

func (*PartialInstallError) Error added in v1.3.0

func (e *PartialInstallError) Error() string

func (*PartialInstallError) Unwrap added in v1.3.0

func (e *PartialInstallError) Unwrap() error

type PlatformInstaller

type PlatformInstaller interface {
	// GetAvailableMethods returns available installation methods
	GetAvailableMethods(filterInstalled bool) []InstallMethod

	// Installation methods with output
	InstallMPVWithOutput(cr *CommandRunner, method string, uiType string) error
	InstallMPCQTWithOutput(cr *CommandRunner, method string) error
	InstallMPVAppWithOutput(cr *CommandRunner, uiType string) error
	InstallMPVViaBrewWithOutput(cr *CommandRunner, uiType string, isUpdate bool) error
	InstallIINAWithOutput(cr *CommandRunner) error
	InstallFlatpakWithOutput(cr *CommandRunner, flatpakId string, uiType string, isUpdate bool) error
	InstallMPVViaPackageWithOutput(cr *CommandRunner, uiType string, isUpdate bool) error
	InstallCelluloidViaPackageWithOutput(cr *CommandRunner, isUpdate bool) error

	// Update methods
	UpdateMPVWithOutput(cr *CommandRunner, method string) error
	UpdateMPVAppWithOutput(cr *CommandRunner) error

	// Uninstall methods with output
	UninstallFlatpakWithOutput(cr *CommandRunner, appId string) error
	UninstallViaPackageWithOutput(cr *CommandRunner, appName string) error
	UninstallBrewWithOutput(cr *CommandRunner, appName string) error
	UninstallAppWithOutput(cr *CommandRunner, appName string) error
	UninstallWithOutput(cr *CommandRunner) error
	UninstallMPCQTWithOutput(cr *CommandRunner) error

	// Windows-specific methods
	SetupFileAssociationsWithOutput(cr *CommandRunner) error
	RemoveFileAssociationsWithOutput(cr *CommandRunner) error
	CreateInstallerShortcutWithOutput(cr *CommandRunner) error
	CreateInstallerShortcutToBinaryWithOutput(cr *CommandRunner, binaryPath string) error
	CreateWebUIShortcutWithOutput(cr *CommandRunner) error
	CreateMPVShortcut(cr *CommandRunner) error
}

PlatformInstaller defines the interface for platform-specific installation methods

type PostInstallMessage

type PostInstallMessage struct {
	Message string
}

PostInstallMessage is a message to show after installation

func (PostInstallMessage) Error

func (p PostInstallMessage) Error() string

type PreparedUI added in v1.3.0

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

PreparedUI owns a verified private UI tree. Call Close after Commit or when abandoning preparation. It does not snapshot or alter live configuration.

func (*PreparedUI) Close added in v1.3.0

func (p *PreparedUI) Close() error

func (*PreparedUI) Commit added in v1.3.0

func (p *PreparedUI) Commit(cr *CommandRunner) error

Commit reads the latest live configs under editor locks, then replaces the UI files and version metadata in one recoverable transaction.

type ReleaseInfo

type ReleaseInfo = releasemanifest.Manifest

ReleaseInfo is the shared producer/consumer release manifest schema.

type UserSettings

type UserSettings struct {
	// Language settings
	AudioLanguages    []string
	SubtitleLanguages []string

	// Hardware acceleration
	HardwareDecoder string

	// Additional settings to preserve (can be expanded as needed)
	VideoOutput     string
	ScaleFilter     string
	DitherAlgorithm string
}

UserSettings contains settings that should be preserved when overwriting mpv.conf

func PreserveUserSettings

func PreserveUserSettings(configPath string, cr *CommandRunner) (*UserSettings, error)

PreserveUserSettings reads the current mpv.conf and extracts user-configurable settings that should be preserved when overwriting the config file

Source Files

  • command_runner.go
  • common.go
  • common_handler.go
  • common_handler_linux.go
  • config_preservation.go
  • detection.go
  • detection_probe.go
  • dmg_mount.go
  • download.go
  • embedded_assets.go
  • file_transaction.go
  • file_validation.go
  • installer.go
  • installer_archive.go
  • installer_sevenzip.go
  • interfaces.go
  • linux.go
  • linux_package.go
  • macos_detection.go
  • package_manager.go
  • partial_install.go
  • real.go
  • recorded_path.go
  • shortcut_encoding.go
  • transaction_journal.go
  • transaction_lock_unix.go
  • ui_config_update.go
  • ui_version_transaction.go
  • windows_detection.go
  • windows_ownership.go
  • windows_powershell.go
  • windows_registry.go
  • windows_registry_stub.go

Jump to

Keyboard shortcuts

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