Add shared inbox support for ActivityPub delivery (#4755)

* feat(ap): add support for shared inboxes to reduce outbound load

* feat(db): refactor ap followers db into followers repository

* fix(ap): use the updated activity library to pull out the shared inbox endpoint

* chore(deps): point at updated build of owncast/activity

* fix(ap): typeless endpoints

* feat(test): update ActivityPub test to support shared inboxes

* chore(test): remove unused variable

* fix: feedback from review. Guard against SSRF/non-HTTPS/local and handle transaction errors
This commit is contained in:
Gabe Kangas
2026-01-22 15:33:22 -08:00
committed by GitHub
parent 7a735e6902
commit de6468ad89
31 changed files with 1033 additions and 410 deletions
+19
View File
@@ -33,6 +33,8 @@ func MigrateDatabaseSchema(db *sql.DB, from, to int) error {
migrateToSchema6(db)
case 6:
migrateToSchema7(db)
case 7:
migrateToSchema8(db)
default:
log.Fatalln("missing database migration step")
}
@@ -46,6 +48,23 @@ func MigrateDatabaseSchema(db *sql.DB, from, to int) error {
return nil
}
func migrateToSchema8(db *sql.DB) {
// Add shared_inbox column to ap_followers for ActivityPub shared inbox support.
// This allows delivering messages to a server's shared inbox instead of each
// user's individual inbox, reducing the number of outbound requests.
stmt, err := db.Prepare("ALTER TABLE ap_followers ADD COLUMN shared_inbox TEXT")
if err != nil {
log.Errorln("Error running migration. This may be because you have already been running a dev version.", err)
return
}
defer stmt.Close()
_, err = stmt.Exec()
if err != nil {
log.Warnln(err)
}
}
func migrateToSchema7(db *sql.DB) {
log.Println("Migrating users. This may take time if you have lots of users...")