outbox

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: May 11, 2025 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Copyright 2025 Dima Krasner

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Package outbox handles user actions and translates them into outgoing activities.

Outgoing activities are queued and delivered by [fed.Queue].

Index

Constants

This section is empty.

Variables

View Source
var ErrDeliveryQueueFull = errors.New("delivery queue is full")

Functions

func Accept

func Accept(ctx context.Context, domain string, followed, follower, followID string, tx *sql.Tx) error

Accept queues an Accept activity for delivery.

func Announce

func Announce(ctx context.Context, domain string, tx *sql.Tx, actor *ap.Actor, note *ap.Object) error

Announce queues an Announce activity for delivery.

func Create

func Create(ctx context.Context, domain string, cfg *cfg.Config, db *sql.DB, post *ap.Object, author *ap.Actor) error

Create queues a Create activity for delivery.

func Delete

func Delete(ctx context.Context, domain string, cfg *cfg.Config, db *sql.DB, note *ap.Object) error

Delete queues a Delete activity for delivery.

func Follow

func Follow(ctx context.Context, domain string, follower *ap.Actor, followed string, db *sql.DB) error

Follow queues a Follow activity for delivery.

func ForwardActivity

func ForwardActivity(ctx context.Context, domain string, cfg *cfg.Config, tx *sql.Tx, note *ap.Object, activity *ap.Activity, rawActivity string) error

ForwardActivity forwards an activity if needed. A reply by B in a thread started by A is forwarded to all followers of A. A post by a follower of a local group, which mentions the group or replies to a post in the group, is forwarded to followers of the group.

func Move

func Move(ctx context.Context, db *sql.DB, domain string, from *ap.Actor, to string) error

Move queues a Move activity for delivery.

func NewID

func NewID(domain, prefix string) (string, error)

NewID generates a pseudo-random ID.

func Reject

func Reject(ctx context.Context, domain string, followed, follower, followID string, tx *sql.Tx) error

Reject queues a Reject activity for delivery.

func Undo

func Undo(ctx context.Context, domain string, db *sql.DB, activity *ap.Activity) error

Undo queues an Undo activity for delivery.

func Unfollow

func Unfollow(ctx context.Context, domain string, db *sql.DB, follower, followed, followID string) error

Unfollow queues an Undo activity for delivery.

func UpdateActor

func UpdateActor(ctx context.Context, domain string, tx *sql.Tx, actorID string) error

UpdateActor queues an Update activity for delivery.

func UpdateNote

func UpdateNote(ctx context.Context, domain string, cfg *cfg.Config, db *sql.DB, note *ap.Object) error

UpdateNote queues an Update activity for delivery.

Types

type Deleter

type Deleter struct {
	Domain string
	Config *cfg.Config
	DB     *sql.DB
}

func (*Deleter) Run

func (d *Deleter) Run(ctx context.Context) error

type Mover

type Mover struct {
	Domain   string
	DB       *sql.DB
	Resolver ap.Resolver
	Key      httpsig.Key
}

func (*Mover) Run

func (m *Mover) Run(ctx context.Context) error

Run makes users who follow a moved account follow the target account instead. It queues two activites for delivery: an Unfollow activity for the old account and a Follow activity for the new one.

type Poller

type Poller struct {
	Domain string
	Config *cfg.Config
	DB     *sql.DB
}

func (*Poller) Run

func (p *Poller) Run(ctx context.Context) error

Jump to

Keyboard shortcuts

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