updatecheck

package
v0.1.22 Latest Latest
Warning

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

Go to latest
Published: May 28, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CacheFilename    = "version.json"
	LatestReleaseURL = "https://api.github.com/repos/usewhale/DeepSeek-Code-Whale/releases/latest"
	ReleaseNotesURL  = "https://github.com/usewhale/DeepSeek-Code-Whale/releases/latest"
	CheckInterval    = 20 * time.Hour
)

Variables

This section is empty.

Functions

func WriteInfo

func WriteInfo(path string, info Info) error

Types

type Action

type Action struct {
	Name       string
	Cmd        string
	Args       []string
	ManualOnly bool
}

func DetectAction

func DetectAction(goos, executablePath string) Action

func (Action) String

func (a Action) String() string

type Checker

type Checker struct {
	DataDir        string
	CurrentVersion string
	Enabled        bool
	Now            func() time.Time
	Client         *http.Client
	Goos           string
	ExecutablePath string
}

func (Checker) CachedUpgradeVersion

func (c Checker) CachedUpgradeVersion() (Result, bool)

CachedUpgradeVersion returns an upgrade prompt from the on-disk cache only, never contacting the network. Callers should pair this with RefreshIfStaleAsync so the cache is refreshed in the background for the next startup, keeping the UI startup path fail-open and non-blocking.

func (Checker) Dismiss

func (c Checker) Dismiss(version string) error

func (Checker) FetchLatestVersion

func (c Checker) FetchLatestVersion(ctx context.Context) (string, error)

func (Checker) RecordCheckAttempt

func (c Checker) RecordCheckAttempt() error

func (Checker) Refresh

func (c Checker) Refresh(ctx context.Context) error

func (Checker) RefreshIfStaleAsync

func (c Checker) RefreshIfStaleAsync() <-chan struct{}

RefreshIfStaleAsync kicks off a background refresh when the cache is stale. Returns immediately; the caller should not wait on the returned channel except in tests that need deterministic completion.

func (Checker) UpgradeVersion

func (c Checker) UpgradeVersion(ctx context.Context) (Result, bool)

type Info

type Info struct {
	LatestVersion    string    `json:"latest_version"`
	LastCheckedAt    time.Time `json:"last_checked_at"`
	DismissedVersion string    `json:"dismissed_version,omitempty"`
}

func ReadInfo

func ReadInfo(path string) (*Info, error)

type Result

type Result struct {
	LatestVersion   string
	CurrentVersion  string
	ReleaseNotesURL string
	UpdateAction    Action
}

Jump to

Keyboard shortcuts

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