fedbox

package module
v0.0.0-...-4b4c67a Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2024 License: MIT Imports: 41 Imported by: 0

README

FedBOX

MIT Licensed Build Status Go Report Card

FedBOX is a simple ActivityPub enabled server. Its goal is to serve as a reference implementation for the rest of the GoActivityPub packages.

It provides the base for some of the common functionality that such a service would require, such as: HTTP handlers and middlewares, storage and filtering etc.

The current iteration can persist data to BoltDB, Badger, SQLite and directly on the file system, but I want to also add support for PostgreSQL.

Features

Support for C2S ActivityPub:
  • Support for content management actitivies: Create, Update, Delete.
  • Follow, Accept, Reject with actors as objects.
  • Appreciation activities: Like, Dislike.
  • Reaction activities: Block on actors, Flag on objects.
  • Negating content management and appreciation activities using Undo.
  • OAuth2 authentication
Support for S2S ActivityPub
  • Support the same operations as the client to server activities.
  • Capabilities of generating and loading HTTP Signatures from requests.

Installation

See the INSTALL file.

Further reading

If you are interested in using FedBOX from an application developer point of view, make sure to read the Client to Server document, which details how the local flavour of ActivityPub C2S API can be used.

More information about FedBOX and the other packages in the GoActivityPub library can be found on the wiki.

Contact and feedback

If you have problems, questions, ideas or suggestions, please contact us by posting to the mailing list, or on GitHub. If you desire quick feedback, the mailing list is preferred, as the GitHub issues are not checked very often.

Documentation

Index

Constants

View Source
const (
	KeyTypeECDSA   = "ECDSA"
	KeyTypeED25519 = "ED25519"
	KeyTypeRSA     = "RSA"
)

Variables

View Source
var InternalIRI = vocab.IRI("https://fedbox/")

Functions

func AddKeyToPerson

func AddKeyToPerson(metaSaver storage.MetadataTyper, typ string) func(act *vocab.Actor) error

func CacheKey

func CacheKey(fb FedBOX, r http.Request) vocab.IRI

CacheKey generates a unique vocab.IRI hash based on its authenticated user and other parameters

func CleanRequestPath

func CleanRequestPath(next http.Handler) http.Handler

func GenerateECKeyPair

func GenerateECKeyPair() (pem.Block, pem.Block)

func GenerateID

func GenerateID(base vocab.IRI) func(it vocab.Item, col vocab.Item, by vocab.Item) (vocab.ID, error)

GenerateID creates an IRI that can be used to uniquely identify the "it" item, based on the collection "col" and its creator "by"

func GenerateRSAKeyPair

func GenerateRSAKeyPair() (pem.Block, pem.Block)

func HandleActivity

func HandleActivity(fb FedBOX) processing.ActivityHandlerFn

HandleActivity handles POST requests to an ActivityPub actor's inbox/outbox, based on the CollectionType

func HandleCollection

func HandleCollection(fb FedBOX) processing.CollectionHandlerFn

HandleCollection serves content from the generic collection end-points that return ActivityPub objects or activities

func HandleItem

func HandleItem(fb FedBOX) processing.ItemHandlerFn

HandleItem serves content from the following, followers, liked, and likes end-points that returns a single ActivityPub object

func SetCORSHeaders

func SetCORSHeaders(next http.Handler) http.Handler

func Storage

func Storage(c config.Options, l lw.Logger) (st.FullStorage, error)

func ValidateRequest

func ValidateRequest(r *http.Request) (bool, error)

Types

type FedBOX

type FedBOX struct {
	R chi.Router
	// contains filtered or unexported fields
}

func New

func New(l lw.Logger, ver string, conf config.Options, db st.FullStorage) (*FedBOX, error)

New instantiates a new FedBOX instance

func (FedBOX) CollectionRoutes

func (f FedBOX) CollectionRoutes(descend bool) func(chi.Router)

func (*FedBOX) Config

func (f *FedBOX) Config() config.Options

func (FedBOX) Routes

func (f FedBOX) Routes() func(chi.Router)

func (*FedBOX) Run

func (f *FedBOX) Run(ctx context.Context) error

Run is the wrapper for starting the web-server and handling signals

func (*FedBOX) Stop

func (f *FedBOX) Stop(ctx context.Context)

Stop

func (*FedBOX) Storage

func (f *FedBOX) Storage() st.FullStorage

type LogFn

type LogFn func(string, ...any)

Directories

Path Synopsis
cmd
cmd
env

Jump to

Keyboard shortcuts

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