Documentation
¶
Overview ¶
Package update provides functionality for checking and managing OpenPass updates.
Index ¶
Constants ¶
View Source
const ( // DefaultCacheTTL is the default time-to-live for cached update check results. DefaultCacheTTL = 24 * time.Hour )
View Source
const DefaultLatestReleaseURL = "https://api.github.com/repos/danieljustus/OpenPass/releases/latest"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache manages persistent caching of update check results.
func NewCache ¶
func NewCache() *Cache
NewCache creates a new Cache instance with the default location and TTL.
func NewCacheWithTTL ¶
NewCacheWithTTL creates a new Cache instance with a custom path and TTL. If path is empty, the default location (~/.openpass/update-cache.json) is used.
func (*Cache) Load ¶
func (c *Cache) Load() (*CacheEntry, error)
Load reads the cache entry from disk if it exists and is still valid. Returns nil if the cache doesn't exist, is expired, or can't be read.
func (*Cache) Save ¶
func (c *Cache) Save(entry *CacheEntry) error
Save writes the cache entry to disk.
type CacheEntry ¶
type CacheEntry struct {
Timestamp time.Time `json:"timestamp"`
LatestVersion string `json:"latest_version"`
ReleaseURL string `json:"release_url"`
}
CacheEntry represents a cached update check result.
Click to show internal directories.
Click to hide internal directories.