outputshttp

package
v1.135.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package outputshttp serves the outputs of the script runs a caller asked for (#1848): an application that runs scripts for its users reads back what those runs wrote, across scripts, filtered by script, tag and metadata, each with a short-lived link that downloads it.

It is mounted by scripthttp, which resolves the caller. A caller reads the outputs of the runs it requested, whoever owns the scripts, because the run already handed them to it; an administrator reads every run's.

Index

Constants

View Source
const Route = "GET /api/v1/portal/scripts/runs/outputs"

Route is where the listing is served. A literal segment outranks the {id} wildcard, so no script id can shadow it.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Runs RunLister
	// Caller is who is asking, or ok=false after writing the refusal. An
	// administrator reads every run's outputs.
	Caller func(w http.ResponseWriter, r *http.Request) (requester string, isAdmin, ok bool)
	// ContentURL mints a signed link to one asset version, and its expiry.
	// Nil leaves outputs without a link.
	ContentURL func(assetID string, version int) (string, time.Time)
}

Deps carries the run history, the caller, and the link minter.

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler serves the listing.

func New

func New(deps Deps) *Handler

New builds the handler.

func (*Handler) Register

func (h *Handler) Register(mux *http.ServeMux, wrap func(http.Handler) http.Handler)

Register mounts the route, wrapped in the portal authentication middleware.

type RunLister

type RunLister interface {
	ListRuns(ctx context.Context, filter script.RunFilter) ([]script.Run, error)
}

RunLister reads run history.

Jump to

Keyboard shortcuts

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