httpapi

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: AGPL-3.0 Imports: 23 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 httpapi serves the small JSON API used by the lobby.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DocumentUpload added in v0.9.0

func DocumentUpload(reg *room.Registry, store *documents.Store, meeting func(slug string) (time.Time, bool), stored func(slug string, meeting time.Time)) http.Handler

DocumentUpload takes a meeting document from the facilitator bot (bot contract, see package signal): PUT /internal/documents/{slug}/{id}?title=<text>, loopback only, body Markdown (UTF-8, not blank, at most 512 KiB). id is ^[a-z0-9-]{1,40}$; the same id replaces the document of the meeting. meeting reports the room's live meeting while a facilitator is in it; the document belongs to that meeting. 200 stored, {"id","rev","updated"} with updated in Unix ms (then stored tells the room), 400 a bad id, title or body, 403 not loopback, 404 documents off (store nil) or no such room, 409 no live meeting with a facilitator or the meeting already has 20 documents, 413 a larger body.

func EchoRooms

func EchoRooms(reg *room.Registry) http.Handler

EchoRooms tells the local echo helper which rooms want it: GET /internal/echo returns a JSON list of slugs. Only loopback requests that did not pass through nginx are served.

func FacilitatorRooms added in v0.8.0

func FacilitatorRooms(reg *room.Registry, enabled bool) http.Handler

FacilitatorRooms tells the facilitator bot which rooms want it: GET /internal/facilitator, a JSON list of slugs, empty while facilitator.enabled is off; loopback only (bot contract).

func Health

func Health() http.Handler

Health answers 200 "ok" for systemd and nginx checks.

func Info

func Info(title string, reactions []string, noiseSuppression, notesEnabled, notesLive, recordingEnabled, facilitatorEnabled, documentsEnabled bool, reconnectGrace int, signIn *SignInInfo) http.Handler

Info serves GET /api/info: installation details the client shows: the title, the reactions participants can send, whether the noise filter is on by default, whether meeting notes are offered (notes.enabled), whether phrases are shown live (notes.live) and whether meeting recording is offered (recording.enabled), whether the facilitator is offered (facilitator.enabled; the rooms that offer it say so in their joined message), whether meeting documents are on (documents.enabled), how many seconds a client waits on a disconnected media connection before restarting (media.reconnect_grace) and, as "auth", whether sign-in is on and with which providers (signIn; nil is off).

func Invites added in v0.5.0

func Invites(reg *room.Registry, inv *auth.Invites, pins *ratelimit.Limiter, max time.Duration, publicURL string, revoked func(id string), log *slog.Logger) http.Handler

Invites serves the guest invitations of a room; every request carries the room's PIN:

POST   /api/rooms/{slug}/invites       {"pin","hours"} 201 {"id","link","expires"}
POST   /api/rooms/{slug}/invites/list  {"pin"} 200 [{"id","created_by","expires"}], usable ones, newest first
DELETE /api/rooms/{slug}/invites/{id}  {"pin"} 204, then revoked(id) so that its guests leave at once

The PIN checks are those of the notes download, in the same order: the method (405), the per-address limit (429), the body (400), the room (404) and its PIN (403, counted toward the limit). hours is 1, 24 or 168 and at most max (400). The link is publicURL/join/{slug}#invite=<token>; the token is shown once and never logged. The creator is the signed-in person (auth.IdentityFrom); log may be nil.

func NotesDelete added in v0.3.3

func NotesDelete(reg *room.Registry, store *notes.Store, enabled bool, pins *ratelimit.Limiter) http.Handler

NotesDelete serves DELETE /api/rooms/{slug}/notes with {"pin"}: it deletes the notes of the room's last meeting, 204. The same checks as NotesDownload come first (404 while notes are off, for an unknown room, or for notes that do not exist or have expired; 403 for a wrong PIN, counted in pins); 409 while the room's notes are still being recorded.

func NotesDownload added in v0.3.2

func NotesDownload(reg *room.Registry, store *notes.Store, enabled bool, pins *ratelimit.Limiter, loc *time.Location) http.Handler

NotesDownload serves POST /api/rooms/{slug}/notes with {"pin","lang"}: the notes of the room's last meeting as Markdown, times in loc. A wrong PIN is 403 and counts toward the same per-address limit as joins (pins, may be nil); 404 when the room or its notes do not exist, have expired, are still being written, or notes are off (enabled false).

func NotesRooms added in v0.3.2

func NotesRooms(reg *room.Registry, enabled bool) http.Handler

NotesRooms tells the notes bot (kunveno-notes add-on) which rooms want notes: GET /internal/notes returns a JSON list of slugs, empty while notes.enabled is off. Only loopback requests that did not pass through nginx are served. Part of the bot contract (see package signal).

func RecordingDelete added in v0.4.0

func RecordingDelete(reg *room.Registry, store *recording.Store, pins *ratelimit.Limiter) http.Handler

RecordingDelete serves DELETE /api/rooms/{slug}/recording with {"pin"}: 204 deleted, 404 none, 409 while the room is recording, 403 wrong PIN (counted).

func RecordingFile added in v0.4.0

func RecordingFile(store *recording.Store, links *Links, loc *time.Location) http.Handler

RecordingFile serves GET /api/rooms/{slug}/recording/{token}: the file as an attachment with Range support; 404 for an unknown or expired link or a recording replaced or deleted since.

func RecordingLink(reg *room.Registry, store *recording.Store, pins *ratelimit.Limiter, links *Links) http.Handler

RecordingLink serves POST /api/rooms/{slug}/recording with {"pin"}: after the PIN check (the shared per-address limit) a download link valid for the Links' ttl: {"url","expires"}. 404 when recording is off, the room or its recording does not exist.

func RecordingRooms added in v0.4.0

func RecordingRooms(reg *room.Registry, enabled bool) http.Handler

RecordingRooms tells the recording bot which rooms want a recording: GET /internal/recording, a JSON list of slugs, empty while recording.enabled is off; loopback only (bot contract).

func RecordingUpload added in v0.4.0

func RecordingUpload(reg *room.Registry, store *recording.Store, max int64, stored func(slug string), known func(slug string, meeting time.Time) bool) http.Handler

RecordingUpload takes a finished part of a recording from the bot: PUT /internal/recording/{slug}, loopback only, body video/mp4, X-Kunveno-Meeting the meeting start and X-Kunveno-Part the part's start (RFC 3339; without it the part is the meeting's start, as a recorder of the previous release sends). 204 stored (then stored(slug) tells the room), 400 no or bad meeting or part, 404 recording off or no such room, 409 a meeting the room neither runs nor lists (known false), 413 larger than max. A stored part is replaced by an upload of the same part only.

func RegisterMeetings added in v0.7.0

func RegisterMeetings(mux *http.ServeMux, c MeetingsConfig, wrap func(http.Handler) http.Handler)

RegisterMeetings adds the meeting history routes to mux, each wrapped by wrap (the sign-in gate):

GET    /api/rooms/{slug}/meetings                                the room's meetings, newest first; no names, no PIN
POST   /api/rooms/{slug}/meetings/{meeting}/notes                {"pin","lang"}: the meeting's notes as Markdown
DELETE /api/rooms/{slug}/meetings/{meeting}/notes                {"pin"}: 204
POST   /api/rooms/{slug}/meetings/{meeting}/summary              {"pin","lang"}: the meeting's summary as Markdown
DELETE /api/rooms/{slug}/meetings/{meeting}/summary              {"pin"}: 204
POST   /api/rooms/{slug}/meetings/{meeting}/recording/{part}     {"pin"}: a download link {"url","expires"}
DELETE /api/rooms/{slug}/meetings/{meeting}/recording/{part}     {"pin"}: 204
POST   /api/rooms/{slug}/meetings/{meeting}/documents/{id}       {"pin"}: the document as Markdown
DELETE /api/rooms/{slug}/meetings/{meeting}/documents/{id}       {"pin"}: 204

{meeting} and {part} are starts in Unix milliseconds. The item routes take the PIN with the same per-address limit as the other PIN routes; 404 for an item that is not there or a feature that is off.

func Rooms

func Rooms(cfg RoomsConfig) http.Handler

Rooms serves the room list and its changes. PINs never leave the server.

GET    /api/rooms          list with live participant counts, notes_until, recording_until, last_meeting
POST   /api/rooms          {"name","pin"} creates a room, 201 {"slug","name"}
DELETE /api/rooms/{slug}   {"pin"} deletes an empty created room, its notes, its recording, its meetings and its invitations, 204

notes_until and recording_until are listed for the enabled features only. A room lists last_meeting when it keeps notes or a recording (of the enabled features) of a meeting with a stored summary. Deleting a room deletes all it keeps, whatever is enabled.

func SummaryDelete added in v0.6.0

func SummaryDelete(reg *room.Registry, store *notes.Store, enabled bool, pins *ratelimit.Limiter) http.Handler

SummaryDelete serves DELETE /api/rooms/{slug}/summary with {"pin"}: it deletes the summary of the room's last meeting and keeps the notes; the summary is not written again for them. 204; the same checks as SummaryDownload first; 404 when there is no summary to delete.

func SummaryDownload added in v0.6.0

func SummaryDownload(reg *room.Registry, store *notes.Store, enabled bool, pins *ratelimit.Limiter, loc *time.Location) http.Handler

SummaryDownload serves POST /api/rooms/{slug}/summary with {"pin","lang"}: the summary of the room's last meeting as Markdown, with the same checks as NotesDownload; 404 when there is none (yet) or summaries are off (enabled false).

func SummaryInternal added in v0.6.0

func SummaryInternal(store *notes.Store, enabled bool, loc *time.Location) http.Handler

SummaryInternal serves the summary service of the kunveno-notes add-on (part of the bot contract, see package signal), to loopback requests that did not pass through nginx only:

GET  /internal/notes/summaries                                [{"slug","meeting","end"}]: ready notes waiting for a summary; [] while summaries are off
GET  /internal/notes/summaries/{slug}/{meeting}?end=<ms>      {"room","start","end","notes"}: the notes as Markdown
PUT  /internal/notes/summaries/{slug}/{meeting}?end=<ms>      the summary as Markdown (UTF-8, not blank, at most 256 KiB), 204
POST /internal/notes/summaries/{slug}/{meeting}/failed?end=<ms>  the add-on gave up on these notes, 204

meeting is the meeting's start and end the notes' end, both in Unix milliseconds: 409 when the meeting's ready notes did not end then (they were reopened, deleted or expired). The forms without {meeting} (a summary service of the previous release) mean the room's notes that ended at end. 404 for everything but the list while summaries are off.

Types

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

Links are short-lived download links: a token bound to one part of one meeting's recording as it was when the link was made, so a link never serves a later or replaced file.

func NewLinks(ttl time.Duration) *Links

type MeetingsConfig added in v0.7.0

type MeetingsConfig struct {
	Registry *room.Registry
	Kept     lobby.Kept // the stores and which features are on
	PINs     *ratelimit.Limiter
	Links    *Links // recording download links
	// DocumentsChanged runs after a document of the room's meeting that started at meeting was
	// deleted, so the room hears its new list; may be nil.
	DocumentsChanged func(slug string, meeting time.Time)
	Loc              *time.Location
}

MeetingsConfig is what the meeting history routes work with.

type RoomsConfig added in v0.4.2

type RoomsConfig struct {
	Registry *room.Registry
	Persist  func() error       // saves the created rooms after every change; may be nil
	PINs     *ratelimit.Limiter // wrong PINs per client address, shared with joining; may be nil
	Kept     lobby.Kept         // the notes, recordings and meeting summaries the rooms keep
	// Deleted runs after a room was deleted and the rooms saved: with sign-in on it ends the room's
	// invitations. It may be nil; an error fails the request with 500.
	Deleted func(slug string) error
}

RoomsConfig is what the room API works with.

type SignInInfo added in v0.5.0

type SignInInfo struct {
	Enabled   bool                `json:"enabled"`
	Providers []auth.ProviderInfo `json:"providers"`
}

SignInInfo is the sign-in block of /api/info: whether people sign in, and the providers' buttons.

Jump to

Keyboard shortcuts

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