summaryrefslogtreecommitdiff
path: root/internal/federation/federatingprotocol.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-12-20 15:19:53 +0100
committerLibravatar GitHub <noreply@github.com>2021-12-20 15:19:53 +0100
commitcb8688f4298a1a3ed5e28565004588be3c071df0 (patch)
tree038b196e914b949857bf8b7c00f22374408bc1ca /internal/federation/federatingprotocol.go
parentreturn first offer when no accept header set (#351) (diff)
downloadgotosocial-cb8688f4298a1a3ed5e28565004588be3c071df0.tar.xz
Remove unnecessary storage config variables (#344)
* rewire config to not use extraneous serve vars * rename 'file' to 'local' for consistency * use Type and Size again
Diffstat (limited to 'internal/federation/federatingprotocol.go')
-rw-r--r--internal/federation/federatingprotocol.go15
1 files changed, 8 insertions, 7 deletions
diff --git a/internal/federation/federatingprotocol.go b/internal/federation/federatingprotocol.go
index be5ab4d85..636fed3c5 100644
--- a/internal/federation/federatingprotocol.go
+++ b/internal/federation/federatingprotocol.go
@@ -29,9 +29,10 @@ import (
"github.com/superseriousbusiness/activity/pub"
"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"
- "github.com/superseriousbusiness/gotosocial/internal/util"
+ "github.com/superseriousbusiness/gotosocial/internal/uris"
)
/*
@@ -73,7 +74,7 @@ func (f *federator) PostInboxRequestBodyHook(ctx context.Context, r *http.Reques
return nil, err
}
// set the activity on the context for use later on
- return context.WithValue(ctx, util.APActivity, activity), nil
+ return context.WithValue(ctx, ap.ContextActivity, activity), nil
}
// AuthenticatePostInbox delegates the authentication of a POST to an
@@ -100,11 +101,11 @@ func (f *federator) AuthenticatePostInbox(ctx context.Context, w http.ResponseWr
})
l.Trace("received request to authenticate")
- if !util.IsInboxPath(r.URL) {
+ if !uris.IsInboxPath(r.URL) {
return nil, false, fmt.Errorf("path %s was not an inbox path", r.URL.String())
}
- username, err := util.ParseInboxPath(r.URL)
+ username, err := uris.ParseInboxPath(r.URL)
if err != nil {
return nil, false, fmt.Errorf("could not parse path %s: %s", r.URL.String(), err)
}
@@ -157,8 +158,8 @@ func (f *federator) AuthenticatePostInbox(ctx context.Context, w http.ResponseWr
return nil, false, fmt.Errorf("couldn't get requesting account %s: %s", publicKeyOwnerURI, err)
}
- withRequesting := context.WithValue(ctx, util.APRequestingAccount, requestingAccount)
- withReceiving := context.WithValue(withRequesting, util.APReceivingAccount, receivingAccount)
+ withRequesting := context.WithValue(ctx, ap.ContextRequestingAccount, requestingAccount)
+ withReceiving := context.WithValue(withRequesting, ap.ContextReceivingAccount, receivingAccount)
return withReceiving, true, nil
}
@@ -182,7 +183,7 @@ func (f *federator) Blocked(ctx context.Context, actorIRIs []*url.URL) (bool, er
})
l.Debugf("entering BLOCKED function with IRI list: %+v", actorIRIs)
- receivingAccountI := ctx.Value(util.APReceivingAccount)
+ receivingAccountI := ctx.Value(ap.ContextReceivingAccount)
receivingAccount, ok := receivingAccountI.(*gtsmodel.Account)
if !ok {
l.Errorf("receiving account not set on request context")