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 ¶
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 ¶
Types ¶
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.