Documentation
¶
Index ¶
- Constants
- Variables
- func ActorClient(ctl *Base, actor vocab.Item) *client.C
- func BootstrapStorage(conf config.Options, service vocab.Item, l lw.Logger, pair *ap.KeyPair) error
- func CacheKey(fb *FedBOX, auth vocab.Actor, r http.Request) vocab.IRI
- func CleanRequestPath(next http.Handler) http.Handler
- func CreateService(ctl *Base, self vocab.Item, pair *ap.KeyPair, pw []byte) (err error)
- func Errf(out io.Writer, s string, par ...any)
- func FedBOXClient(fb *FedBOX) *client.C
- func GenerateID(base vocab.IRI) func(it vocab.Item, col vocab.Item, by vocab.Item) (vocab.ID, error)
- func HandleActivity(fb *FedBOX) processing.ActivityHandlerFn
- func HandleCollection(fb *FedBOX) processing.CollectionHandlerFn
- func HandleItem(fb *FedBOX) processing.ItemHandlerFn
- func IsProxyURL(i vocab.IRI) bool
- func OutItem(it vocab.Item, b io.Writer) error
- func OutJSON(where io.Writer) func(it vocab.Item) error
- func OutOfOrderMw(f *FedBOX) func(next http.Handler) http.Handler
- func OutText(where io.Writer) func(it vocab.Item) error
- func ProxyURL(fb *FedBOX) http.Handler
- func ResetStorage(conf config.Options, l lw.Logger) error
- func Run(args ...string) error
- func ServeFavIcon() http.HandlerFunc
- func ValidateRequest(r *http.Request) (bool, error)
- type Accounts
- type ActorsCmd
- type AddActorCmd
- type AddClient
- type AddCmd
- type AddToken
- type Base
- func (ctl *Base) AddActor(p *vocab.Actor, author vocab.Actor) (*vocab.Actor, error)
- func (ctl *Base) AddClient(pw []byte, redirectUris []string, u any) (string, error)
- func (ctl *Base) AddObject(p *vocab.Object, author vocab.Actor) (*vocab.Object, error)
- func (ctl *Base) Bootstrap(pw []byte, pair *ap.KeyPair) error
- func (ctl *Base) CopyObjects(to vocab.IRI, from ...vocab.IRI) error
- func (ctl *Base) DeleteClient(id string) error
- func (ctl *Base) DeleteObjects(reason string, inReplyTo []string, ids ...vocab.IRI) error
- func (ctl *Base) GenAuthToken(clientID, actorIdentifier string, _ any) (string, error)
- func (ctl *Base) List(iris vocab.IRIs, types ...vocab.ActivityVocabularyType) (vocab.ItemCollection, error)
- func (ctl *Base) ListClients() ([]osin.Client, error)
- func (ctl *Base) LoadLocalActorWithKey(actorIRI vocab.IRI) (*vocab.Actor, crypto.PrivateKey, error)
- func (ctl *Base) LoadServiceActor() error
- func (ctl *Base) MoveObjects(to vocab.IRI, from ...vocab.IRI) error
- func (ctl *Base) Saver(actor *vocab.Actor) processing.P
- func (ctl *Base) SendSignalToServer(sig syscall.Signal) func() error
- type BootstrapCmd
- type CTL
- type ChangePassword
- type Client
- type CopyCmd
- type DelClient
- type DeleteCmd
- type Export
- type ExportCmd
- type FedBOX
- type FixCollections
- type GenKeys
- type Import
- type ImportCmd
- type IndexCmd
- type InfoCmd
- type ListCmd
- type LogFn
- type LsClient
- type Maintenance
- type MoveCmd
- type OAuth
- type Pub
- type Reload
- type ResetCmd
- type SSH
- type Serve
- type Stop
- type Storage
- type Token
Constants ¶
const AppName = "FedBOX"
const URISeparator = "\n"
Variables ¶
var AppVersion = "HEAD"
var CTLRun = new(CTL)
var InternalIRI = vocab.IRI("https://fedbox/")
var ValidGenericTypes = vocab.ActivityVocabularyTypes{vocab.ObjectType, vocab.ActorType}
Functions ¶
func BootstrapStorage ¶
func CacheKey ¶
CacheKey generates a unique vocab.IRI hash based on its authenticated user and other parameters
func CreateService ¶
func FedBOXClient ¶
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 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 IsProxyURL ¶
func ProxyURL ¶
ProxyURL Endpoint URI so this actor's clients may access remote ActivityStreams objects which require authentication to access. To use this endpoint, the client posts an x-www-form-urlencoded id parameter with the value being the id of the requested ActivityStreams object.
func ServeFavIcon ¶
func ServeFavIcon() http.HandlerFunc
Types ¶
type Accounts ¶
type Accounts struct {
Export Export `cmd:"" help:"Exports accounts metadata."`
Import Import `cmd:"" help:"Imports accounts metadata."`
GenKeys GenKeys `cmd:"" help:"Generate public/private key pairs for actors that are missing them."`
Pass ChangePassword `cmd:"" help:"Change password for an actor."`
}
type ActorsCmd ¶
type ActorsCmd struct {
Add AddActorCmd `cmd:"" help:"Adds an ActivityPub actor."`
}
type AddActorCmd ¶
type AddActorCmd struct {
Type vocab.ActivityVocabularyType `help:"The type of the ActivityPub actor to add."`
KeyType string `help:"Type of keys to generate: ${keyTypes}" enum:"${keyTypes}" default:"${defaultKeyType}"`
AttributedTo vocab.IRI `help:"The IRI of the Actor we should use as author."`
Tags []string `name:"tag" help:"The tag(s) to attach to the actor."`
Names []string `arg:"" name:"name" help:"The name(s) of the actor."`
}
func (AddActorCmd) Run ¶
func (a AddActorCmd) Run(ctl *Base) error
type AddClient ¶
type AddClient struct {
RedirectURIs []string `name:"redirect-uri" help:"The redirect URIs for current application"`
}
type AddCmd ¶
type AddCmd struct {
Type vocab.ActivityVocabularyType `help:"The type of ActivityPub object(s) to create." default:"${defaultObjectTypes}"`
Name string `help:"The name of the ActivityPub object(s) to create."`
AttributedTo string `help:"The IRI of the Actor we should use as author"`
Tag []string `help:"The tag(s) to attach to the object."`
}
type AddToken ¶
type Base ¶
type Base struct {
Conf config.Options
Logger lw.Logger
Service vocab.Actor
ServicePrivateKey crypto.PrivateKey
Storage storage.FullStorage
// contains filtered or unexported fields
}
func (*Base) DeleteClient ¶
func (*Base) DeleteObjects ¶
func (*Base) GenAuthToken ¶
func (*Base) List ¶
func (ctl *Base) List(iris vocab.IRIs, types ...vocab.ActivityVocabularyType) (vocab.ItemCollection, error)
func (*Base) LoadLocalActorWithKey ¶
func (*Base) LoadServiceActor ¶
type BootstrapCmd ¶
type BootstrapCmd struct {
KeyType string `help:"Type of keys to generate: ${keyTypes}" enum:"${keyTypes}" default:"${defaultKeyType}"`
Password string `hidden:""`
}
func (BootstrapCmd) Run ¶
func (b BootstrapCmd) Run(ctl *Base) error
type CTL ¶
type CTL struct {
SSH `embed:""`
Url url.URL `help:"The URL used by the application."`
Env env.Type `enum:"${envTypes}" help:"The environment to use. Expected values: ${envTypes}" default:"${defaultEnv}"`
Verbose int `counter:"v" help:"Increase verbosity level from the default associated with the environment settings."`
Path string `path:"" help:"The path for the storage folder or socket" default:"." env:"STORAGE_PATH"`
Version kong.VersionFlag `short:"V"`
// Commands
Run Serve `cmd:"" name:"run" help:"Run the ${name} instance server (version: ${version})" default:"withargs"`
}
type ChangePassword ¶
type ChangePassword struct {
IRI vocab.IRI `arg:"" optional:"" name:"iri" help:"The actor for which to change the password."`
}
func (ChangePassword) Run ¶
func (c ChangePassword) Run(ctl *Base) error
type CopyCmd ¶
type DelClient ¶
type DelClient struct {
Client []string `arg:"" help:"Removes an existing OAuth2 client"`
}
type DeleteCmd ¶
type ExportCmd ¶
type ExportCmd struct {
File string `help:"The path where to output the items, if absent it will be printed to stdout."`
}
type FedBOX ¶
type FixCollections ¶
type FixCollections struct{}
func (FixCollections) Run ¶
func (f FixCollections) Run(ctl *Base) error
type GenKeys ¶
type InfoCmd ¶
type ListCmd ¶
type ListCmd struct {
Type []vocab.ActivityVocabularyType `help:"The type of ActivityPub object to list" default:"${defaultObjectTypes}"`
Output string `help:"The format in which to output the items." enum:"text,json" default:"text"`
IRIs []vocab.IRI `arg:"" name:"iris"`
}
type Maintenance ¶
type Maintenance struct{}
func (Maintenance) Run ¶
func (m Maintenance) Run(ctl *Base) error
type MoveCmd ¶
type Pub ¶
type Pub struct {
Actors ActorsCmd `cmd:"" name:"actor" help:"Actor management helper."`
Add AddCmd `cmd:"" name:"add" help:"Adds a new object."`
List ListCmd `cmd:"" help:"Lists objects."`
Info InfoCmd `cmd:"" help:"Show information about an object."`
Delete DeleteCmd `cmd:"" help:"Deletes an ActivityPub object."`
Move MoveCmd `cmd:"" help:"Move ActivityPub objects to a new collection."`
Copy CopyCmd `cmd:"" help:"Copy ActivityPub objects."`
Index IndexCmd `cmd:"" help:"Reindex current storage ActivityPub objects."`
Export ExportCmd `cmd:"" help:"Exports ActivityPub objects."`
Import ImportCmd `cmd:"" help:"Imports ActivityPub objects."`
}
type SSH ¶
type SSH struct {
Pub Pub `cmd:"" name:"pub" alt:"ap" help:"ActivityPub management helper"`
OAuth OAuth `cmd:"" name:"oauth"`
Storage Storage `cmd:""`
Accounts Accounts `cmd:"" help:"Accounts helper."`
Maintenance Maintenance `cmd:"" help:"Toggle maintenance mode for the running FedBOX server."`
Reload Reload `cmd:"" help:"Reload the running FedBOX server configuration."`
Stop Stop `cmd:"" help:"Stops the running FedBOX server configuration."`
}
type Serve ¶
type Storage ¶
type Storage struct {
Type storage.Type `help:"Type of the backend to use. Possible values: ${storageTypes}"`
Bootstrap BootstrapCmd `cmd:"" help:"Bootstrap the storage"`
Reset ResetCmd `cmd:"" help:"Reset an existing storage."`
FixCollections FixCollections `cmd:"" help:"Fix storage collections."`
}