server

package
v0.0.0-...-7227349 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Overview

Package server contains the microsub server itself. It implements http.Handler. It follows the spec at https://indieweb.org/Microsub-spec.

Index

Constants

View Source
const (
	OutputContentType = "application/json; charset=utf-8"
)

Constants used for the responses

Variables

This section is empty.

Functions

func NewMicrosubHandler

func NewMicrosubHandler(backend microsub.Microsub) (http.Handler, *sse.Broker)

NewMicrosubHandler is the main entry point for the microsub server It returns a handler for HTTP and a broker that will send events.

Types

type NullBackend

type NullBackend struct {
}

NullBackend is the simplest possible backend

func (*NullBackend) ChannelsCreate

func (b *NullBackend) ChannelsCreate(ctx context.Context, name string) (microsub.Channel, error)

ChannelsCreate creates no channels

func (*NullBackend) ChannelsDelete

func (b *NullBackend) ChannelsDelete(ctx context.Context, uid string) error

ChannelsDelete delets no channels

func (*NullBackend) ChannelsGetList

func (b *NullBackend) ChannelsGetList(ctx context.Context) ([]microsub.Channel, error)

ChannelsGetList gets no channels

func (*NullBackend) ChannelsUpdate

func (b *NullBackend) ChannelsUpdate(ctx context.Context, uid, name string) (microsub.Channel, error)

ChannelsUpdate updates no channels

func (*NullBackend) Events

func (b *NullBackend) Events(ctx context.Context) (chan sse.Message, error)

Events returns a closed channel.

func (*NullBackend) FollowGetList

func (b *NullBackend) FollowGetList(ctx context.Context, uid string) ([]microsub.Feed, error)

FollowGetList implements the follow list command

func (*NullBackend) FollowURL

func (b *NullBackend) FollowURL(ctx context.Context, uid string, url string) (microsub.Feed, error)

FollowURL follows a new url

func (*NullBackend) ItemSearch

func (b *NullBackend) ItemSearch(ctx context.Context, channel, query string) ([]microsub.Item, error)

ItemSearch returns a list of zero items

func (*NullBackend) MarkRead

func (b *NullBackend) MarkRead(ctx context.Context, channel string, uids []string) error

MarkRead marks no items as read

func (*NullBackend) PreviewURL

func (b *NullBackend) PreviewURL(ctx context.Context, url string) (microsub.Timeline, error)

PreviewURL shows an empty feed

func (*NullBackend) Search

func (b *NullBackend) Search(ctx context.Context, query string) ([]microsub.Feed, error)

Search search for a query and return an example list of feeds

func (*NullBackend) TimelineGet

func (b *NullBackend) TimelineGet(ctx context.Context, before, after, channel string) (microsub.Timeline, error)

TimelineGet gets no timeline

func (*NullBackend) UnfollowURL

func (b *NullBackend) UnfollowURL(ctx context.Context, uid string, url string) error

UnfollowURL unfollows a url

Jump to

Keyboard shortcuts

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