webapi

package
v0.9.0-rc.53 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: AGPL-3.0 Imports: 43 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 webapi answers the JSON endpoints a page calls back to.

Index

Constants

View Source
const (
	RatingsPath    = "/pw-api/ratings"
	LikedPostsPath = "/pw-api/liked-posts"
	MyTicketsPath  = "/pw-api/my-tickets"
	MyTicketPrefix = MyTicketsPath + "/"
)
View Source
const (
	NotificationsPath     = "/pw-api/notifications"
	NotificationsMutePath = "/pw-api/notifications/mute"
)
View Source
const (
	UsersPath   = "/pw-api/users"
	UsersPrefix = "/pw-api/users/"
)
View Source
const (
	ModulesPath = "/pw-api/modules"
	PreviewPath = "/pw-api/preview"
)
View Source
const AdminPrefix = "/pw-api/admin/"
View Source
const AllArticlesPath = "/pw-api/articles"
View Source
const ArticlesPrefix = "/pw-api/articles/"
View Source
const CreatePath = ArticlesPrefix + "new"
View Source
const FavouritesPath = "/pw-api/favourites"
View Source
const FeedPath = listpages.FeedPath
View Source
const FilesPrefix = "/pw-api/files/"
View Source
const MessagesPrefix = "/pw-api/messages/"
View Source
const SubscribePath = "/pw-api/notifications/subscribe"

Variables

This section is empty.

Functions

This section is empty.

Types

type Admin

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

func NewAdmin

func NewAdmin(d Deps, next http.Handler) *Admin

func (*Admin) ServeHTTP

func (h *Admin) ServeHTTP(w http.ResponseWriter, r *http.Request)

type AllArticles

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

func NewAllArticles

func NewAllArticles(d Deps, next http.Handler) *AllArticles

func (*AllArticles) ServeHTTP

func (h *AllArticles) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Articles

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

func NewArticles

func NewArticles(d Deps, next http.Handler) *Articles

func (*Articles) ServeHTTP

func (h *Articles) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Deps

type Deps struct {
	DB     *db.DB
	Tokens token.Generator
	Trust  *proxyheader.Trust
	Engine renderer.Renderer
	Bundle *i18n.Bundle
	Icons  roles.IconLoader
	Files  string
	Log    *slog.Logger

	// Zero means no ceiling at all, which is what an unconfigured site gets.
	SoftLimit int64
	HardLimit int64
}

type Favourites

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

func NewFavourites

func NewFavourites(d Deps, next http.Handler) *Favourites

func (*Favourites) ServeHTTP

func (h *Favourites) ServeHTTP(w http.ResponseWriter, r *http.Request)

A reader only ever gets and changes their own rows. Nothing in the request names a user, so there is nothing to authorise beyond being signed in.

type Feed

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

func NewFeed

func NewFeed(d Deps) *Feed

func (*Feed) ServeHTTP

func (h *Feed) ServeHTTP(w http.ResponseWriter, r *http.Request)

Feed readers ask without signing in, so the list is whatever a visitor who is not signed in may see.

type FileItems

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

A file's own path carries no page name, so it reaches the same handlers through an entry point of its own.

func NewFileItems

func NewFileItems(d Deps, next http.Handler) *FileItems

func (*FileItems) ServeHTTP

func (h *FileItems) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Handler

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

func New

func New(d Deps, next http.Handler) *Handler

func (*Handler) ServeHTTP

func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Messages

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

func NewMessages

func NewMessages(d Deps, next http.Handler) *Messages

func (*Messages) ServeHTTP

func (h *Messages) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Notifications

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

func NewNotifications

func NewNotifications(d Deps, next http.Handler) *Notifications

func (*Notifications) ServeHTTP

func (h *Notifications) ServeHTTP(w http.ResponseWriter, r *http.Request)

type OwnRows

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

func NewOwnRows

func NewOwnRows(d Deps, next http.Handler) *OwnRows

func (*OwnRows) ServeHTTP

func (h *OwnRows) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Preview

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

func NewPreview

func NewPreview(d Deps) *Preview

func (*Preview) ServeHTTP

func (h *Preview) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Subscriptions

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

func NewSubscriptions

func NewSubscriptions(d Deps, next http.Handler) *Subscriptions

func (*Subscriptions) ServeHTTP

func (h *Subscriptions) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Users

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

func NewUsers

func NewUsers(d Deps, next http.Handler) *Users

func (*Users) ServeHTTP

func (h *Users) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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