updater

package
v1.8.12 Latest Latest
Warning

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

Go to latest
Published: Nov 29, 2021 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultPublicKey = `` /* 9390-byte string literal not displayed */

DefaultPublicKey is the public key used to sign builds.

View Source
const Host = "https://protonmail.com/download"

Variables

View Source
var (
	ErrDownloadVerify = errors.New("failed to download or verify the update")
	ErrInstall        = errors.New("failed to install the update")
)
View Source
var DefaultUpdateChannel = StableChannel // nolint[gochecknoglobals]

DefaultUpdateChannel is the default update channel to subscribe to. It is set to the stable channel by default, unless overridden at build time.

View Source
var ErrManualUpdateRequired = errors.New("manual update is required")
View Source
var ErrOperationOngoing = errors.New("the operation is already ongoing")

Functions

This section is empty.

Types

type Installer

type Installer interface {
	InstallUpdate(*semver.Version, io.Reader) error
}

type InstallerDefault

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

func NewInstaller

func NewInstaller(versioner *versioner.Versioner) *InstallerDefault

func (*InstallerDefault) InstallUpdate

func (i *InstallerDefault) InstallUpdate(version *semver.Version, r io.Reader) error

type Settings

type Settings interface {
	Get(string) string
	Set(string, string)
	GetFloat64(string) float64
}

type UpdateChannel

type UpdateChannel string

UpdateChannel represents an update channel users can be subscribed to.

const (
	// StableChannel is the channel all users are subscribed to by default.
	StableChannel UpdateChannel = "stable"

	// EarlyChannel is the channel users subscribe to when they enable "Early Access".
	EarlyChannel UpdateChannel = "early"
)

type Updater

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

func New

func New(
	cm pmapi.Manager,
	installer Installer,
	s Settings,
	kr *crypto.KeyRing,
	curVer *semver.Version,
	updateURLName, platform string,
) *Updater

func (*Updater) CanInstall

func (u *Updater) CanInstall(version VersionInfo) bool

func (*Updater) Check

func (u *Updater) Check() (VersionInfo, error)

func (*Updater) InstallUpdate

func (u *Updater) InstallUpdate(update VersionInfo) error

func (*Updater) IsDowngrade

func (u *Updater) IsDowngrade(version VersionInfo) bool

func (*Updater) IsUpdateApplicable

func (u *Updater) IsUpdateApplicable(version VersionInfo) bool

type VersionInfo

type VersionInfo struct {
	// Version is the semantic version of the release.
	Version *semver.Version

	// MinAuto is the earliest version that is able to autoupdate to this version.
	// Apps older than this version must run the manual installer and cannot autoupdate.
	MinAuto *semver.Version

	// Package is the location of the update package.
	Package string

	// Installers are the locations of installer files (for manual installation).
	Installers []string

	// LandingPage is the address of the app landing page on protonmail.com.
	LandingPage string

	// ReleaseNotesPage is the address of the page containing the release notes.
	ReleaseNotesPage string

	// RolloutProportion indicates the proportion (0,1] of users that should update to this version.
	RolloutProportion float64
}

VersionInfo is information about one version of the app.

type VersionMap

type VersionMap map[string]VersionInfo

VersionMap represents the structure of the version.json file. It looks like this:

{
  "stable": {
    "Version": "2.3.4",
    "Package": "https://protonmail.com/.../bridge_2.3.4_linux.tgz",
    "Installers": [
      "https://protonmail.com/.../something.deb",
      "https://protonmail.com/.../something.rpm",
      "https://protonmail.com/.../PKGBUILD"
    ],
    "LandingPage": "https://protonmail.com/bridge",
    "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
    "RolloutProportion": 0.5
  },
  "early": {
    "Version": "2.4.0",
    "Package": "https://protonmail.com/.../bridge_2.4.0_linux.tgz",
    "Installers": [
      "https://protonmail.com/.../something.deb",
      "https://protonmail.com/.../something.rpm",
      "https://protonmail.com/.../PKGBUILD"
    ],
    "LandingPage": "https://protonmail.com/bridge",
    "ReleaseNotesPage": "https://protonmail.com/.../release_notes.html",
    "RolloutProportion": 0.5
  },
  "...": {
    ...
  }
}.

Jump to

Keyboard shortcuts

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