update

package
v0.25.9 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package update reads the latest GitHub Release tag for sartoopjj/thefeed and proxies the asset bytes when the user clicks Download. Separate from /api/version-check, which reads the version over the DNS protocol.

Index

Constants

View Source
const (
	// Repo is the GitHub repo serving releases.
	Repo = "sartoopjj/thefeed"

	// LatestReleaseURL redirects to /releases/tag/{V}; HEAD it and
	// parse the Location header.
	LatestReleaseURL = "https://github.com/" + Repo + "/releases/latest"

	// BaseURL is the per-release asset directory.
	BaseURL = "https://github.com/" + Repo + "/releases/download"
)

Variables

This section is empty.

Functions

func AssetFilename added in v0.20.0

func AssetFilename(latest string) string

AssetFilename returns just the asset name for the running platform at the given version (e.g. "thefeed-client-v0.19.1-darwin-arm64"). Falls back to a runtime-derived template if AssetTemplate wasn't injected at build time (e.g., `go run`).

func AssetURL

func AssetURL(latest string) string

AssetURL builds the github.com download URL for the running platform at the requested version.

func IsNewer

func IsNewer(latest, current string) bool

IsNewer compares semver-ish version strings, tolerating the "v" prefix and numeric pre-release suffixes. Returns false if either side is "dev".

func StreamAsset added in v0.20.0

func StreamAsset(ctx context.Context, version, asset string, dst http.ResponseWriter, logf func(string)) error

StreamAsset downloads version+asset from GitHub Releases and writes the body to dst with attachment Content-Disposition.

Types

type Status

type Status struct {
	Current     string `json:"current"`
	Latest      string `json:"latest"`
	HasUpdate   bool   `json:"hasUpdate"`
	DownloadURL string `json:"downloadURL"`
}

Status is the JSON returned to the frontend.

func Check

func Check(ctx context.Context) (Status, error)

Check fetches the latest tag and assembles a Status for the running platform.

Jump to

Keyboard shortcuts

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