web

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 20, 2026 License: MIT Imports: 15 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 web implements snagbox's server-rendered admin dashboard: managing projects, agents (queue consumers) and their per-project permissions, ingest tokens, and the Telegram user allowlist, plus an issue browser and the bot-first login-link redemption endpoint.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Deps

type Deps struct {
	Store        *store.Store
	Blob         *blob.Store
	AuthService  LoginRedeemer
	Sessions     auth.SessionValidator
	ServerSecret []byte
	CookieSecure bool
	// BotUsername is the Telegram bot's @username (without the @). When set,
	// the login page shows a "Login with Telegram" button that deep-links to
	// the bot with the login start parameter. Empty hides the button.
	BotUsername string
	Logger      *slog.Logger
}

Deps carries the dependencies required to build a Server. AuthService may be nil, in which case login is disabled and protected pages redirect to /login.

type LoginRedeemer

type LoginRedeemer interface {
	RedeemLoginLink(ctx context.Context, in authkit.RedeemLoginLinkInput) (authkit.WebSession, error)
}

LoginRedeemer redeems a signed login-link token into a web session. It is satisfied by *authkit.AuthService and may be nil when login is disabled.

type Server

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

Server renders and serves the snagbox admin dashboard.

func NewServer

func NewServer(d Deps) *Server

NewServer builds a Server, parsing its embedded templates up front.

func (*Server) Handler

func (s *Server) Handler() http.Handler

Handler returns the admin UI mux: the login/logout endpoints are open, every other page is wrapped in the session-enforcing middleware.

Jump to

Keyboard shortcuts

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