httpapi

package
v0.0.0-...-58f053a Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 42 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 REST API, the browser sessions and the embedded reading interface. Handlers parse input, check the caller's role, call the area operations and serialize the result.

Index

Constants

View Source
const ClientHeader = "X-Veda-Client"

ClientHeader is the label veda mcp puts on its requests: "mcp/reader", "mcp/editor" or "mcp/owner"; the /mcp endpoint labels its own as "mcp/remote". It is a label, never authorization: a mode is recorded only when the request's own credential matches it.

Variables

This section is empty.

Functions

func New

func New(cfg Config, deps Deps) http.Handler

New returns the handler for one listener.

Types

type Card

type Card struct {
	Page        domain.Page
	Image       string
	Description string
	Tag         string
	ImageURL    string
}

Card is a recently updated page on the home view.

type ClientActivity

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

ClientActivity remembers when each MCP mode last reached the server. It is process-local and shared by every listener of one process.

type Config

type Config struct {
	// Public serves only public content and ignores every credential.
	Public bool
	// ReaderLocal marks the private reader socket: requests without a key
	// read as a reader unless ReaderKeyRequired is set.
	ReaderLocal       bool
	ReaderKeyRequired bool
	// LocalImportSource is the private local source that root on the reader
	// socket may import into or remove; empty disables those routes.
	LocalImportSource string
	// AllowedHosts lists the accepted Host names; empty accepts any.
	AllowedHosts []string
	OwnerToken   string
	ReaderToken  string
	// TrustedProxies are peer addresses whose X-Real-IP header names the
	// visitor, for the public request form's per-address limit.
	TrustedProxies []string
}

Config describes one listener.

type Deps

type Deps struct {
	Store *store.Store
	// Observations are the process's import observations. Every listener
	// must receive the same set; nil starts an empty one.
	Observations   *importer.Observations
	Sessions       *auth.Sessions
	AdminSessions  *auth.Sessions
	AccessSessions *auth.Sessions
	// Sync is the running synchronization manager, or nil when none runs.
	Sync *syncer.Manager
	// Knowledge is the knowledge service, or nil when the module is off.
	Knowledge *knowledge.Service
	// Activity records MCP clients; every listener of one process must
	// receive the same one. nil starts an empty one.
	Activity *ClientActivity
	// Notify sends owner notifications and keeps access requests, or nil.
	Notify *notify.Service
}

Deps are the services every listener of one process shares.

type Group

type Group struct {
	Name        string
	ID          string
	Count       int
	Pages       []domain.Page
	Description string `json:",omitempty"`
	SourceURL   string `json:",omitempty"`
}

Group lists the pages of one source.

type LocalRootKey

type LocalRootKey struct{}

LocalRootKey is the request context key, set only from kernel credentials on the reader socket, that marks a request from the local root user.

type SourceWarning

type SourceWarning struct {
	ID                   string
	Name                 string
	Partial              bool
	Dirty                bool
	Conflicts            int
	Withheld             *int
	SyncIssue            string `json:",omitempty"`
	LastImportObservedAt string `json:",omitempty"`
}

SourceWarning tells the owner that a source needs attention.

type View

type View struct {
	GraphEdges     []render.Edge
	Cards          []Card
	SourceWarnings []SourceWarning

	Public      bool
	Groups      []Group
	Pages       []domain.Page
	Page        *domain.Page
	Query       string
	Selected    string
	Generated   string
	Withheld    int
	Count       int
	GitHubCount int
	// MCPLastSeen is when any MCP client last reached this process, to the
	// minute so the state's ETag stays stable; private views only.
	MCPLastSeen string `json:",omitempty"`
	TOC         template.HTML
}

View is the reading interface state; its field names are the JSON keys.

Jump to

Keyboard shortcuts

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