selfupdate

package
v0.0.0-...-22e1697 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2024 License: AGPL-3.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultUserAgent = "Mozilla/5.0 (compatible; +https://github.com/bloom42/stdx/selfupdate)"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type ChannelManifest

type ChannelManifest struct {
	Name    string `json:"name"`
	Channel string `json:"channel"`
	Version string `json:"version"`
}

func (ChannelManifest) ToJson

func (manifest ChannelManifest) ToJson() (manifestJSON []byte, err error)

type Config

type Config struct {
	ZingPublicKey string
	// BaseURL is the URL of the folder containing the manifest
	// e.g. https://downloads.example.com/myapp
	BaseURL        string
	CurrentVersion string
	ReleaseChannel string

	// Default: 300 seconds
	AutoupdateInterval int64
	// Verbose logs actions with the INFO level
	Verbose    bool
	UserAgent  *string
	HttpClient *http.Client
}

type CreateReleaseInput

type CreateReleaseInput struct {
	// Name of the project. e.g. myapp
	Name string
	// Version of the release of the project. e.g. 1.1.52
	Version string
	Channel string
	Files   []string
	// ZignPrivateKey is the base64 encoded zign privateKey, encrypted with password
	ZignPrivateKey string
	ZignPassword   string
}

type Release

type Release struct {
	Name            string
	ChannelManifest ChannelManifest
	ZignManifest    zign.Manifest
}

func CreateRelease

func CreateRelease(ctx context.Context, info CreateReleaseInput) (release Release, err error)

type Updater

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

func NewUpdater

func NewUpdater(config Config) (updater *Updater, err error)

func (*Updater) CheckUpdate

func (updater *Updater) CheckUpdate(ctx context.Context) (manifest ChannelManifest, err error)

func (*Updater) RestartRequired

func (updater *Updater) RestartRequired() bool

func (*Updater) RunAutoupdateInBackground

func (updater *Updater) RunAutoupdateInBackground(ctx context.Context)

func (*Updater) Update

func (updater *Updater) Update(ctx context.Context, channelManifest ChannelManifest) (err error)

func (*Updater) UpdateAvailable

func (updater *Updater) UpdateAvailable() bool

UpdateAvailable returns true if the latest avaiable version is > to the latest install version

Jump to

Keyboard shortcuts

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