mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 03:32:24 -06:00
start adding remote instance dereference
This commit is contained in:
parent
c1e107266f
commit
18c39ad23d
4 changed files with 115 additions and 1 deletions
|
|
@ -125,6 +125,18 @@ func (f *federator) AuthenticatePostInbox(ctx context.Context, w http.ResponseWr
|
|||
return ctx, false, fmt.Errorf("not authenticated: %s", err)
|
||||
}
|
||||
|
||||
// authentication has passed, so add an instance entry for this instance if it hasn't been done already
|
||||
i := >smodel.Instance{}
|
||||
if err := f.db.GetWhere([]db.Where{{Key: "domain", Value: publicKeyOwnerURI.Host, CaseInsensitive: true}}, i); err != nil {
|
||||
if _, ok := err.(db.ErrNoEntries); !ok {
|
||||
// there's been an actual error
|
||||
return ctx, false, fmt.Errorf("error getting requesting account with public key id %s: %s", publicKeyOwnerURI.String(), err)
|
||||
}
|
||||
// we don't have an entry for this instance yet so create it
|
||||
var err error
|
||||
i, err := f.DereferenceRemoteInstance()
|
||||
}
|
||||
|
||||
requestingAccount := >smodel.Account{}
|
||||
if err := f.db.GetWhere([]db.Where{{Key: "uri", Value: publicKeyOwnerURI.String()}}, requestingAccount); err != nil {
|
||||
// there's been a proper error so return it
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue