webserver

package
v0.9.6 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Overview

Package webserver provides the HTTP server for tens-city

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FSStorage

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

FSStorage implements Storage using filesystem

func NewFSStorage

func NewFSStorage(basePath string) *FSStorage

NewFSStorage creates a new filesystem-backed storage

func (*FSStorage) GetHistory

func (fs *FSStorage) GetHistory(user, slug string) ([]store.HistoryEntry, error)

func (*FSStorage) GetLatest

func (fs *FSStorage) GetLatest(user, slug string) (string, error)

func (*FSStorage) GetObject

func (fs *FSStorage) GetObject(cid string) ([]byte, error)

func (*FSStorage) ReadMarkdownContent

func (fs *FSStorage) ReadMarkdownContent(cid string) ([]byte, error)

type Server

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

Server is the main HTTP server for tens-city

func NewServer

func NewServer(storage Storage, publicFS fs.FS, docServer *docserver.DocServer, fallbackURL string, googleAnalyticsID string, actor *activitypub.Actor, contentDir string) *Server

NewServer creates a new Server instance

func (*Server) GetBlogPosts

func (s *Server) GetBlogPosts() []activitypub.BlogPost

GetBlogPosts loads blog posts and converts them to ActivityPub format

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

ServeHTTP implements http.Handler

type Storage

type Storage interface {
	GetObject(cid string) ([]byte, error)
	GetLatest(user, slug string) (string, error)
	GetHistory(user, slug string) ([]store.HistoryEntry, error)
	ReadMarkdownContent(cid string) ([]byte, error)
}

Storage interface abstracts filesystem backends

Jump to

Keyboard shortcuts

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