webui

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2026 License: LGPL-2.1 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Catalog

Catalog builds the catalog page with all keys sorted by name. store provides per-key latest detection for badges, cached with the page by ETag. ctx comes from the HTTP request so client cancellation stops detection queries.

func DecodeCursor

func DecodeCursor(token string) (seq int64, version string, ok bool)

DecodeCursor reverses EncodeCursor. ok=false rejects a malformed token so the caller falls back to the newest page instead of trusting attacker-supplied cursor bytes.

func EncodeCursor

func EncodeCursor(seq int64, version string) string

EncodeCursor packs a (upstream_seq, version) keyset position into an opaque URL-safe token.

func Key

func Key(ctx context.Context, st StateReaderInterface, store VersionReaderInterface, lnk LinkInterface, ctxObj view.ContextObj, key string, cursor PageCursorObj, pageSize int) ([]byte, bool, error)

Key builds the key page: newest-first version window, keyset pagination, badges and install snippets. found=false means the caller will return 404. The zero cursor selects the newest page.

func Metrics

func Metrics(ctxObj view.ContextObj, publicEnabled bool, internalEnabled bool, refreshInterval time.Duration) ([]byte, error)

Metrics builds the metric group index honoring the current entry's flags. Groups that would return 404 are hidden from navigation. refreshInterval sets the live polling period for JSON groups on the page.

func Version

func Version(ctx context.Context, st StateReaderInterface, store DetailReaderInterface, ov OverlayInterface, lnk LinkInterface, ctxObj view.ContextObj, key string, version string, listenerID string, altOv OverlayInterface, altListenerID string) ([]byte, bool, error)

Version builds the version page: integrity, source, downloads, snippets, notes and history navigation. found=false means 404; listenerID keeps host-sensitive artifacts in sync. altOv/altListenerID bind the opposite entry. nil altOv disables alternate snippets to avoid mixing host-sensitive artifacts and current-entry module paths with a different host.

Types

type DetailReaderInterface

type DetailReaderInterface interface {
	GetVersion(ctx context.Context, key string, version string) (core.VersionObj, bool, error)
	GetDetection(ctx context.Context, key string, version string) (core.DetectionObj, bool, error)
	ListArtifacts(ctx context.Context, key string, version string) ([]core.ArtifactObj, error)
	GetArtifact(ctx context.Context, keyObj core.ArtifactKeyObj) (core.ArtifactObj, bool, error)
	ListVersionsKeyset(ctx context.Context, key string, includeDeleted bool, afterSeq int64, afterVersion string, limit int) ([]core.VersionObj, error)
}

DetailReaderInterface reads one version with metadata, artifacts, detection, and history window.

type LinkInterface

type LinkInterface interface {
	Key(key string, suffix string) string
	Abs(path string) string
}

LinkInterface builds serving URLs: per-key paths and entry-scheme absolute URLs.

type OverlayInterface

type OverlayInterface interface {
	GoPublishable(key string, version string, detectionObj core.DetectionObj, candidateObj *overlay.CandidateObj) bool
	TargetModulePath(key string, version string) string
	UniversalTopDir(key string, version string, detectionObj core.DetectionObj, candidateObj *overlay.CandidateObj) string
}

OverlayInterface exposes host-dependent overlay operations already bound to a listener.

type PageCursorObj

type PageCursorObj struct {
	Set     bool   // false → newest page (no cursor in the URL)
	Newer   bool   // true → versions newer than (Seq,Version); false → older
	Seq     int64  // upstream_seq half of the keyset cursor
	Version string // version half of the keyset cursor
}

PageCursorObj addresses one keyset page of the key version list. The zero value (Set=false) selects the newest page.

func AfterCursor

func AfterCursor(seq int64, version string) PageCursorObj

AfterCursor builds the "older" input cursor from a decoded token.

func BeforeCursor

func BeforeCursor(seq int64, version string) PageCursorObj

BeforeCursor builds the "newer" input cursor from a decoded token.

type StateReaderInterface

type StateReaderInterface interface {
	KeyState(key string) (state.KeyStateObj, bool)
	KeyStates() []state.KeyStateObj
	Checksums() state.ChecksumSetObj
}

StateReaderInterface is the narrow state read surface for catalog, key, and version pages.

type VersionReaderInterface

type VersionReaderInterface interface {
	CountVersions(ctx context.Context, key string) (uint64, error)
	ListVersionsKeyset(ctx context.Context, key string, includeDeleted bool, afterSeq int64, afterVersion string, limit int) ([]core.VersionObj, error)
	ListVersionsKeysetBefore(ctx context.Context, key string, includeDeleted bool, beforeSeq int64, beforeVersion string, limit int) ([]core.VersionObj, error)
	GetDetection(ctx context.Context, key string, version string) (core.DetectionObj, bool, error)
}

VersionReaderInterface reads key version history for the key page via keyset pagination.

Jump to

Keyboard shortcuts

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