updatecheck

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2026 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Overview

Package updatecheck asks GitHub, once a day, whether a newer Miabi release exists and caches the answer for the dashboard to read.

It notifies; it never upgrades. This process holds the Docker socket and orchestrates every workspace, so restarting itself into a new image is a decision for a human with a shell, not a cron tick.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNewer added in v1.4.0

func IsNewer(current, latest string) bool

IsNewer reports whether latest is a strictly newer release than current.

Readers use this to gate the notice rather than trusting the cached row on its own. The row is written by a daily cron, so between an upgrade and the next tick it still describes the *previous* build — without this guard an install that just moved to 1.3.0 would keep advertising the v1.2.1 it is already past. Comparing at read time makes offering a downgrade structurally impossible, whatever is cached.

A non-version build ("dev", a sha) compares against nothing: false.

Types

type Release

type Release struct {
	TagName     string    `json:"tag_name"`
	HTMLURL     string    `json:"html_url"`
	Draft       bool      `json:"draft"`
	Prerelease  bool      `json:"prerelease"`
	PublishedAt time.Time `json:"published_at"`
}

Release is the subset of GitHub's release object we rely on.

func Newest

func Newest(current string, releases []Release) (Release, bool)

Newest picks the newest release the running build should be offered, or "" when none is newer. Exported for tests.

Ordering is semver, never lexical: "v1.0.0-beta.10" sorts *after* "v1.0.0-beta.9" here, and "v1.0.0" after both — a string compare gets both backwards, which would tell a beta.10 user to "upgrade" to beta.9.

type Service

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

Service performs the check and persists its result.

func NewService

func NewService(db *gorm.DB, version string, enabled bool) *Service

func (*Service) Check

func (s *Service) Check(ctx context.Context) error

Check fetches the release list and updates the cached row. Errors are stored on the row rather than returned to a user: an air-gapped install fails this every day, and that must be visible to an admin without being noisy.

func (*Service) Dismiss

func (s *Service) Dismiss(version string) error

Dismiss silences the notice for a specific version. Recording the version — rather than a boolean — means the next release notifies again.

func (*Service) Enabled

func (s *Service) Enabled() bool

Enabled reports whether checks run at all. A `dev` build never checks: its version does not compare meaningfully against any release.

func (*Service) Status

func (s *Service) Status() (*models.UpdateStatus, error)

Status returns the cached row, creating the singleton on first read.

Jump to

Keyboard shortcuts

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