Documentation
¶
Index ¶
- Constants
- type ChannelManifest
- type Config
- type CreateReleaseInput
- type Release
- type Updater
- func (updater *Updater) CheckUpdate(ctx context.Context) (manifest ChannelManifest, err error)
- func (updater *Updater) RestartRequired() bool
- func (updater *Updater) RunAutoupdateInBackground(ctx context.Context)
- func (updater *Updater) Update(ctx context.Context, channelManifest ChannelManifest) (err error)
- func (updater *Updater) UpdateAvailable() bool
Constants ¶
View Source
const (
DefaultUserAgent = "Mozilla/5.0 (compatible; +https://git.sr.ht/~pingoo/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 (*Updater) CheckUpdate ¶
func (updater *Updater) CheckUpdate(ctx context.Context) (manifest ChannelManifest, err error)
func (*Updater) RestartRequired ¶
func (*Updater) RunAutoupdateInBackground ¶
func (*Updater) Update ¶
func (updater *Updater) Update(ctx context.Context, channelManifest ChannelManifest) (err error)
func (*Updater) UpdateAvailable ¶
UpdateAvailable returns true if the latest avaiable version is > to the latest install version
Click to show internal directories.
Click to hide internal directories.