diff options
Diffstat (limited to 'internal/federation/federatingdb')
-rw-r--r-- | internal/federation/federatingdb/accept.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/announce.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/create.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/db.go | 4 | ||||
-rw-r--r-- | internal/federation/federatingdb/followers.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/followers_test.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/following.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/following_test.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/get.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/inbox.go | 27 | ||||
-rw-r--r-- | internal/federation/federatingdb/liked.go | 4 | ||||
-rw-r--r-- | internal/federation/federatingdb/outbox.go | 4 | ||||
-rw-r--r-- | internal/federation/federatingdb/reject.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/reject_test.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/undo.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/update.go | 2 | ||||
-rw-r--r-- | internal/federation/federatingdb/util.go | 4 |
17 files changed, 45 insertions, 22 deletions
diff --git a/internal/federation/federatingdb/accept.go b/internal/federation/federatingdb/accept.go index 8d295161c..1509b37bc 100644 --- a/internal/federation/federatingdb/accept.go +++ b/internal/federation/federatingdb/accept.go @@ -23,8 +23,8 @@ import ( "errors" "fmt" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" diff --git a/internal/federation/federatingdb/announce.go b/internal/federation/federatingdb/announce.go index 7a40cd051..b506a9f78 100644 --- a/internal/federation/federatingdb/announce.go +++ b/internal/federation/federatingdb/announce.go @@ -22,8 +22,8 @@ import ( "context" "fmt" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/messages" ) diff --git a/internal/federation/federatingdb/create.go b/internal/federation/federatingdb/create.go index 862f84473..d992c2bd7 100644 --- a/internal/federation/federatingdb/create.go +++ b/internal/federation/federatingdb/create.go @@ -24,8 +24,8 @@ import ( "fmt" "strings" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" diff --git a/internal/federation/federatingdb/db.go b/internal/federation/federatingdb/db.go index 196d6163c..4b2f92fd4 100644 --- a/internal/federation/federatingdb/db.go +++ b/internal/federation/federatingdb/db.go @@ -23,8 +23,8 @@ import ( "sync" "time" - "github.com/go-fed/activity/pub" - "github.com/go-fed/activity/streams/vocab" + "github.com/superseriousbusiness/activity/pub" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/config" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/typeutils" diff --git a/internal/federation/federatingdb/followers.go b/internal/federation/federatingdb/followers.go index 2eccf167d..96b824c66 100644 --- a/internal/federation/federatingdb/followers.go +++ b/internal/federation/federatingdb/followers.go @@ -5,8 +5,8 @@ import ( "fmt" "net/url" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/db" ) diff --git a/internal/federation/federatingdb/followers_test.go b/internal/federation/federatingdb/followers_test.go index d993a7201..fbdf738a9 100644 --- a/internal/federation/federatingdb/followers_test.go +++ b/internal/federation/federatingdb/followers_test.go @@ -23,8 +23,8 @@ import ( "encoding/json" "testing" - "github.com/go-fed/activity/streams" "github.com/stretchr/testify/suite" + "github.com/superseriousbusiness/activity/streams" "github.com/superseriousbusiness/gotosocial/testrig" ) diff --git a/internal/federation/federatingdb/following.go b/internal/federation/federatingdb/following.go index cc6111715..54d703742 100644 --- a/internal/federation/federatingdb/following.go +++ b/internal/federation/federatingdb/following.go @@ -5,8 +5,8 @@ import ( "fmt" "net/url" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/db" ) diff --git a/internal/federation/federatingdb/following_test.go b/internal/federation/federatingdb/following_test.go index 7788840d7..7c2727269 100644 --- a/internal/federation/federatingdb/following_test.go +++ b/internal/federation/federatingdb/following_test.go @@ -23,8 +23,8 @@ import ( "encoding/json" "testing" - "github.com/go-fed/activity/streams" "github.com/stretchr/testify/suite" + "github.com/superseriousbusiness/activity/streams" "github.com/superseriousbusiness/gotosocial/testrig" ) diff --git a/internal/federation/federatingdb/get.go b/internal/federation/federatingdb/get.go index 6c629d717..a409b7b91 100644 --- a/internal/federation/federatingdb/get.go +++ b/internal/federation/federatingdb/get.go @@ -23,8 +23,8 @@ import ( "errors" "net/url" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/util" ) diff --git a/internal/federation/federatingdb/inbox.go b/internal/federation/federatingdb/inbox.go index 95886b571..90a10a499 100644 --- a/internal/federation/federatingdb/inbox.go +++ b/internal/federation/federatingdb/inbox.go @@ -22,8 +22,9 @@ import ( "context" "net/url" - "github.com/go-fed/activity/streams" - "github.com/go-fed/activity/streams/vocab" + "github.com/superseriousbusiness/activity/streams" + "github.com/superseriousbusiness/activity/streams/vocab" + "github.com/superseriousbusiness/gotosocial/internal/db" ) // InboxContains returns true if the OrderedCollection at 'inbox' @@ -56,3 +57,25 @@ func (f *federatingDB) GetInbox(c context.Context, inboxIRI *url.URL) (inbox voc func (f *federatingDB) SetInbox(c context.Context, inbox vocab.ActivityStreamsOrderedCollectionPage) error { return nil } + +// InboxForActor fetches the inbox corresponding to the given actorIRI. +// +// It is acceptable to just return nil for the inboxIRI. In this case, the library will +// attempt to resolve the inbox of the actor by remote dereferencing instead. +// +// The library makes this call only after acquiring a lock first. +func (f *federatingDB) InboxForActor(c context.Context, actorIRI *url.URL) (inboxIRI *url.URL, err error) { + account, err := f.db.GetAccountByURI(c, actorIRI.String()) + if err != nil { + // if there are just no entries for this account yet it's fine, return nil + // and go-fed will try to dereference it instead + if err == db.ErrNoEntries { + return nil, nil + } + // there's been an actual error... + return nil, err + } + + // we got it! + return url.Parse(account.InboxURI) +} diff --git a/internal/federation/federatingdb/liked.go b/internal/federation/federatingdb/liked.go index 93b3d2c88..2729c1223 100644 --- a/internal/federation/federatingdb/liked.go +++ b/internal/federation/federatingdb/liked.go @@ -22,8 +22,8 @@ import ( "context" "net/url" - "github.com/go-fed/activity/streams" - "github.com/go-fed/activity/streams/vocab" + "github.com/superseriousbusiness/activity/streams" + "github.com/superseriousbusiness/activity/streams/vocab" ) // Liked obtains the Liked Collection for an actor with the diff --git a/internal/federation/federatingdb/outbox.go b/internal/federation/federatingdb/outbox.go index 07caf999e..9d540e3a2 100644 --- a/internal/federation/federatingdb/outbox.go +++ b/internal/federation/federatingdb/outbox.go @@ -22,8 +22,8 @@ import ( "context" "net/url" - "github.com/go-fed/activity/streams" - "github.com/go-fed/activity/streams/vocab" + "github.com/superseriousbusiness/activity/streams" + "github.com/superseriousbusiness/activity/streams/vocab" ) // GetOutbox returns the first ordered collection page of the outbox diff --git a/internal/federation/federatingdb/reject.go b/internal/federation/federatingdb/reject.go index d05c41654..2d8687ee9 100644 --- a/internal/federation/federatingdb/reject.go +++ b/internal/federation/federatingdb/reject.go @@ -23,8 +23,8 @@ import ( "errors" "fmt" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" diff --git a/internal/federation/federatingdb/reject_test.go b/internal/federation/federatingdb/reject_test.go index 5e5f12a79..2b213a3f0 100644 --- a/internal/federation/federatingdb/reject_test.go +++ b/internal/federation/federatingdb/reject_test.go @@ -22,8 +22,8 @@ import ( "testing" "time" - "github.com/go-fed/activity/streams" "github.com/stretchr/testify/suite" + "github.com/superseriousbusiness/activity/streams" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/messages" diff --git a/internal/federation/federatingdb/undo.go b/internal/federation/federatingdb/undo.go index 934b5970d..f2dcc72c5 100644 --- a/internal/federation/federatingdb/undo.go +++ b/internal/federation/federatingdb/undo.go @@ -23,8 +23,8 @@ import ( "errors" "fmt" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" diff --git a/internal/federation/federatingdb/update.go b/internal/federation/federatingdb/update.go index 646b155dc..8f318ce71 100644 --- a/internal/federation/federatingdb/update.go +++ b/internal/federation/federatingdb/update.go @@ -23,8 +23,8 @@ import ( "errors" "fmt" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" "github.com/superseriousbusiness/gotosocial/internal/messages" diff --git a/internal/federation/federatingdb/util.go b/internal/federation/federatingdb/util.go index 34a103a49..87b85aed6 100644 --- a/internal/federation/federatingdb/util.go +++ b/internal/federation/federatingdb/util.go @@ -25,9 +25,9 @@ import ( "fmt" "net/url" - "github.com/go-fed/activity/streams" - "github.com/go-fed/activity/streams/vocab" "github.com/sirupsen/logrus" + "github.com/superseriousbusiness/activity/streams" + "github.com/superseriousbusiness/activity/streams/vocab" "github.com/superseriousbusiness/gotosocial/internal/ap" "github.com/superseriousbusiness/gotosocial/internal/db" "github.com/superseriousbusiness/gotosocial/internal/gtsmodel" |