server

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadAndInstall added in v0.1.4

func DownloadAndInstall(version string, progress ProgressFn) error

DownloadAndInstall downloads the release asset for version, replaces the running binary, and reports progress via progress. It is a no-op for pkg-managed installs (callers should guard).

func ResetUpdateCache added in v0.1.7

func ResetUpdateCache()

ResetUpdateCache zeroes LastChecked so the next CheckForUpdate call hits the network fresh. Called on startup so every run re-fetches the latest version.

func Restart added in v0.1.4

func Restart() error

Restart replaces the current process with a fresh copy of the (possibly updated) binary.

func RestartOnPort added in v0.1.4

func RestartOnPort(port int) error

RestartOnPort spawns a fresh coded process with CODED_PORT set so the new process binds the same port instead of picking a random free one.

func SkipVersion added in v0.1.3

func SkipVersion(v string)

SkipVersion records a version the user chose to skip, suppressing future notices for it.

func Start

func Start(root, version string, viaPkg bool, port int, ln net.Listener, assets embed.FS) error

Start serves the editor using an already-open listener. root is the working directory for the editor (used by API handlers registered in later tasks). assets is an embedded FS rooted at the "static" directory. The caller is responsible for printing the listening address after Start returns successfully.

Types

type ProgressFn added in v0.1.4

type ProgressFn func(downloaded, total int64)

ProgressFn is called periodically during a download with bytes received and total size.

type UpdateInfo added in v0.1.3

type UpdateInfo struct {
	Current   string `json:"current"`
	Latest    string `json:"latest"`
	Available bool   `json:"available"`
	ViaPkg    bool   `json:"viaPkg"`
	Error     string `json:"error,omitempty"`
}

UpdateInfo is the result of an update check, returned to callers and the API.

func CheckForUpdate added in v0.1.3

func CheckForUpdate(current string, viaPkg bool, ignoreSkip bool) UpdateInfo

CheckForUpdate reports whether a newer release than current is available. It caches the GitHub result for checkInterval to avoid hammering the API. Returns Available=false for dev builds, when offline, or when up to date. If ignoreSkip is true, a previously skipped version is still reported as available.

Jump to

Keyboard shortcuts

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