webpkg

package
v0.16.521 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: AGPL-3.0 Imports: 17 Imported by: 0 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 webpkg keeps the machines' page the hub hands out (/dl/web.json, /dl/web.tar.gz) in step with the newest page a release published: the generic package web/<version> of the project's package registry, which only the pipeline of a protected tag may write (tools/ci/publish-web.sh).

Nothing is taken on trust from the registry's listing. A page is taken only when every file of its package was written by a pipeline of the tag v<version>, at the tag's commit, and the archive matches both the registry's SHA-256 and the SHA256SUMS the same pipeline wrote; the archive is downloaded next to the served one and put in place with a rename. Without HUB_WEB_PACKAGE_URL nothing runs and /dl/web.json answers 404: the machines keep the page compiled into their runtime.

Index

Constants

View Source
const (
	// PackageName is the generic package of the page.
	PackageName = "web"
	// Archive is the page: a tar.gz of web/dist.
	Archive = "web.tar.gz"
	// Sums is the SHA256SUMS file the release writes next to the archive.
	Sums = "SHA256SUMS"
	// Pointer is the file in the hub's folder that names the page it serves.
	Pointer = "web.json"
	// Every is the time between two looks at the registry.
	Every = 5 * time.Minute
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Page

type Page struct {
	Version string `json:"version"`
	SHA256  string `json:"sha256"`
	Size    int64  `json:"size"`
	// File is the archive's name in the folder (web-<version>.tar.gz).
	File string `json:"file"`
	// Pipeline is the tag's pipeline that wrote the package.
	Pipeline int64 `json:"pipeline"`
}

Page is web.json: the page the hub serves now.

func Current

func Current(dir string) (Page, error)

Current is the page the folder serves; the zero Page when there is none.

type Source

type Source struct {
	API    string
	Token  string
	Client *http.Client
}

Source is the project's API in the registry (https://host/api/v4/projects/<id>) and a token that may read it.

func (Source) Run

func (s Source) Run(ctx context.Context, dir string, log *slog.Logger)

Run syncs the folder now and then every Every until ctx ends; failures are logged and the served page stays.

func (Source) Sync

func (s Source) Sync(ctx context.Context, dir string) (Page, bool, error)

Sync brings the folder to the newest published page. changed says whether it took a new one.

Jump to

Keyboard shortcuts

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