Documentation
¶
Overview ¶
Package updater keeps an app up to date the way its platform does. On macOS and Windows, Sparkle and WinSparkle, which nsgo build bundles when nsgo.yaml configures updates, read the app's appcast on their own schedule, download a newer release, verify its EdDSA signature, install it and restart the app. Linux and Android read the same appcast, verify and install its package after the user confirms, and iOS asks the App Store, once a day and whenever the user asks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Check ¶
Check checks for a newer version now, as a Check for Updates… item does, and shows what it finds: on macOS and Windows in Sparkle's and WinSparkle's windows, on Linux and Android an alert that installs the signed package after confirmation, elsewhere an alert that offers to open the newer version's page, says the app is up to date, or says the check failed.
func CheckDaily ¶
CheckDaily checks in the background, as CheckInBackground does, unless it has within the last day, so a newer version is offered once a day rather than at every start. Sparkle and WinSparkle keep such a schedule of their own; on Linux, Android and iOS nsgo.Run calls CheckDaily as the app starts and as the user comes back to it when nsgo.yaml's updates.automatic is on. A check that failed, as one offline does, is tried again an hour later.
func CheckInBackground ¶
CheckInBackground checks without showing anything unless it finds a newer version, as the platforms' scheduled checks do.
func Download ¶
func Download(ctx context.Context, update core.UpdateCheck, dir string, progress func(DownloadProgress)) (string, error)
Download fetches an update's signed package into dir. It verifies the appcast's SHA-256 and Ed25519 metadata before making the file visible, so an interrupted or tampered download cannot be installed.
Types ¶
type DownloadProgress ¶
type DownloadProgress struct {
Loaded, Total int64
}
DownloadProgress reports bytes written while an update is downloaded.