Documentation
¶
Overview ¶
Package update checks GitHub for a newer Equinox release and can download and silently install one. It is used by the desktop application; the server variant only checks.
GitHub is not always reachable (from some countries, at some times), so the site keeps a mirror of the latest release (MirrorBase): when the GitHub API does not answer, the check asks the mirror instead, and when GitHub answers but its file downloads do not, the files are taken from the mirror. Either way the installer is checked against the release's SHA256SUMS.txt before it runs, exactly as before.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var APIURL = "https://api.github.com/repos/Ozzvin/equinox/releases/latest"
APIURL is a var so tests can point it at a fake server.
var MirrorBase = "https://equinoxtorrent.com/download/"
MirrorBase is the folder on the site that mirrors the latest release (refreshed from GitHub every hour by the site itself): version.txt with the tag, SHA256SUMS.txt from the release, the installer under both its names, and, if present, notes.md with the release's description. Empty turns the mirror off (tests).
Functions ¶
This section is empty.
Types ¶
type Info ¶
type Info struct {
Version string // e.g. "1.0.6", without the leading "v"
Notes string // what changed, from the release's description (Markdown, see changelog.ReleaseNotes)
URL string // the release's page, for a manual download
// contains filtered or unexported fields
}
Info describes a GitHub release that is newer than the version currently running.
func Check ¶
Check reports the latest GitHub release if it is newer than the running version, or nil if not (or if the check fails). A result is cached for an hour unless force is set, so opening the settings repeatedly does not hit GitHub every time.
func CheckWithin ¶ added in v1.0.19
CheckWithin is Check with the age up to which a cached result is good enough.
func (*Info) Install ¶
Install downloads the installer and its checksum into dir, verifies it against the checksum published in the same release, and runs it silently. The installer's own InitializeSetup closes this process once it starts (see installer/equinox.iss), so the caller does not need to exit separately. When relaunch is true, the installer reopens Equinox once the update is in place (see the IsAutoUpdate check in equinox.iss).
type Progress ¶ added in v1.0.8
type Progress struct {
// Phase is one of "downloading", "verifying", "installing", "error" ("" before any
// install has been attempted this run).
Phase string `json:"phase"`
Percent float64 `json:"percent"` // 0..1, meaningful only while Phase is "downloading"
Err string `json:"error,omitempty"`
}
Progress describes how an in-progress Install call is going, for a UI to poll.
func CurrentProgress ¶ added in v1.0.8
func CurrentProgress() Progress
CurrentProgress reports the state of the most recent Install call.