updater

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2025 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubRelease

type GitHubRelease struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	Body        string    `json:"body"`
	Draft       bool      `json:"draft"`
	Prerelease  bool      `json:"prerelease"`
	CreatedAt   time.Time `json:"created_at"`
	PublishedAt time.Time `json:"published_at"`
	Assets      []struct {
		Name               string `json:"name"`
		BrowserDownloadURL string `json:"browser_download_url"`
		Size               int64  `json:"size"`
		ContentType        string `json:"content_type"`
	} `json:"assets"`
}

GitHubRelease represents a GitHub release response

type UpdateInfo

type UpdateInfo struct {
	Version     string    `json:"version"`
	DownloadURL string    `json:"download_url"`
	Checksum    string    `json:"checksum"`
	ReleaseDate time.Time `json:"release_date"`
	Changelog   string    `json:"changelog"`
	Critical    bool      `json:"critical"`
	AssetName   string    `json:"asset_name"`
	AssetSize   int64     `json:"asset_size"`
	PreRelease  bool      `json:"pre_release"`
}

UpdateInfo represents information about an available update

type Updater

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

Updater handles application updates

func NewUpdater

func NewUpdater(cfg *config.Config, logger *logger.Logger, currentVersion string, updaterConfig UpdaterConfig) *Updater

NewUpdater creates a new updater instance

func (*Updater) CheckForUpdate

func (u *Updater) CheckForUpdate(ctx context.Context) (*UpdateInfo, error)

CheckForUpdate checks if a new version is available

func (*Updater) GetCurrentVersion

func (u *Updater) GetCurrentVersion() string

GetCurrentVersion returns the current version

func (*Updater) SetGithubToken

func (u *Updater) SetGithubToken(token string)

SetGithubToken sets the GitHub token for private repositories

func (*Updater) TestDaemonRestart added in v0.4.2

func (u *Updater) TestDaemonRestart(testVersion string) error

TestDaemonRestart is a public method for testing daemon restart functionality

func (*Updater) Update

func (u *Updater) Update(ctx context.Context, updateInfo *UpdateInfo) error

Update performs the actual update process

type UpdaterConfig

type UpdaterConfig struct {
	RepoOwner   string
	RepoName    string
	GithubToken string // Optional for private repos
	Timeout     time.Duration
}

UpdaterConfig holds configuration for the updater

Jump to

Keyboard shortcuts

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