version

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package version provides functionality for checking for Surge updates via GitHub API.

Index

Constants

View Source
const (
	// GitHubAPIURL is the endpoint for fetching the latest release
	GitHubAPIURL = "https://api.github.com/repos/SurgeDM/Surge/releases/latest"
	// RequestTimeout is the timeout for the GitHub API request
	RequestTimeout = 10 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GitHubRelease

type GitHubRelease struct {
	TagName string `json:"tag_name"`
	HTMLURL string `json:"html_url"`
}

GitHubRelease represents the relevant fields from the GitHub API response

type UpdateInfo

type UpdateInfo struct {
	CurrentVersion  string // The current version of Surge
	LatestVersion   string // The latest version available on GitHub
	ReleaseURL      string // URL to the GitHub release page
	UpdateAvailable bool   // Whether an update is available
}

UpdateInfo contains information about an available update

func CheckForUpdate

func CheckForUpdate(currentVersion string) (*UpdateInfo, error)

CheckForUpdate checks if a newer version of Surge is available on GitHub. Returns nil, nil if there's a network error (fail silently). Returns UpdateInfo with UpdateAvailable=false if current version is up to date. Returns UpdateInfo with UpdateAvailable=true if a newer version exists.

Jump to

Keyboard shortcuts

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