appupdate

package
v0.75.0 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package appupdate checks GitHub for a newer lich release and, on a Windows install no package manager owns, downloads and runs the release's installer. Everywhere else lich belongs to a package manager (a Linux package, Homebrew, Scoop), so this package only reports the update: the UI drives the install through that manager instead (see install.sh and the /restart endpoint), or points at the release page where it can name none.

Index

Constants

View Source
const ProgressEventName = "appupdate-progress"

ProgressEventName is the hub event Apply's phases ride on, for the toast.

Variables

This section is empty.

Functions

This section is empty.

Types

type Progress

type Progress struct {
	Phase    string `json:"phase"`
	Received int64  `json:"received"`
	Total    int64  `json:"total"`
}

Progress is one step of Apply: bytes received of total during the download (total is -1 when the asset came without a Content-Length), then the phase that has no percentage: "installer", where lich hands over to the Windows installer and closes.

type Service

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

Service reports lich's own update state and applies self-updates where the binary is writable.

func New

func New(version string, install func(string) error, emit func(name string, data any)) *Service

New returns a service that reports version as the running build and polls GitHub for the latest release. install runs a downloaded Windows installer; emit is the app's event hub.

func (*Service) Apply

func (s *Service) Apply() error

Apply verifies the latest release's Windows installer against its SHA-256 checksum and hands the install over to it; the installer closes and relaunches lich. Only valid where CanSelfApply is true.

func (*Service) Status

func (s *Service) Status() Status

Status reports whether a newer release exists and whether this install can update itself through the installer. A failed network lookup leaves everything empty and reports no update — it must not block or break app startup.

type Status

type Status struct {
	CurrentVersion  string `json:"currentVersion"`
	LatestVersion   string `json:"latestVersion"`
	UpdateAvailable bool   `json:"updateAvailable"`
	CanSelfApply    bool   `json:"canSelfApply"`
	ReleaseURL      string `json:"releaseUrl"`
	// InstallCommand is the shell command the UI pastes (never auto-runs) to
	// update a package-manager-owned install; empty on the self-apply platforms.
	InstallCommand string `json:"installCommand"`
}

Status is lich's install/update state, reported to the window.

Jump to

Keyboard shortcuts

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