versionstatus

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2026 License: Apache-2.0 Imports: 6 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package versionstatus answers /api/version-status: whether to tell the visitor of a pad that this Etherpad is a minor version or more behind. Only the pad's first author is told, as the person most likely to run or know who runs the instance (etherpad-lite's updateStatus).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FirstAuthor

func FirstAuthor(pool *apool.APool) string

FirstAuthor is the author of the lowest pool entry ['author', id] with an id, or "" for a pad nobody has written in yet.

Types

type Deps

type Deps struct {
	// Status is the updater's view: current and latest version.
	Status func() updater.Status
	// Pool returns the attribute pool of an existing pad, or false.
	Pool func(padID string) (*apool.APool, bool)
	// Author is the author id of the request's token cookie, or "".
	Author func(c fiber.Ctx) string
	// Now and TTL drive the cache; zero values mean time.Now and a minute.
	Now func() time.Time
	TTL time.Duration
	// Capacity bounds the cache (pad and author pairs); 0 means 1000.
	Capacity int
}

Deps are what the handler reads.

type Handler

type Handler struct {

	// Computations counts cache misses (tests).
	Computations int
	// contains filtered or unexported fields
}

Handler is the /api/version-status handler. Answers are cached per pad and author for a minute: every pad load asks.

func New

func New(d Deps) *Handler

New builds the handler.

func (*Handler) Lookup

func (h *Handler) Lookup(padID, author string) Response

Lookup answers for a pad and author, from the cache when it is fresh.

func (*Handler) Serve

func (h *Handler) Serve(c fiber.Ctx) error

Serve is the fiber handler.

type Response

type Response struct {
	Outdated      *string `json:"outdated"`
	IsFirstAuthor bool    `json:"isFirstAuthor"`
}

Response is the answer; Outdated is "minor" or empty (null in JSON).

Jump to

Keyboard shortcuts

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