[feature] serdes for moved/also_known_as (#2600)

* [feature] serdes for moved/also_known_as

* document `alsoKnownAs` and `movedTo` properties

* only implicitly populate AKA uris from DB for local accounts

* don't let remotes store more than 20 AKA uris to avoid shenanigans
This commit is contained in:
tobi
2024-02-06 10:45:46 +01:00
committed by GitHub
parent 3cc51d5072
commit aa396c78d3
11 changed files with 392 additions and 22 deletions

View File

@@ -171,7 +171,30 @@ func (c *Converter) AccountToAS(ctx context.Context, a *gtsmodel.Account) (vocab
// alsoKnownAs
// Required for Move activity.
// TODO: NOT IMPLEMENTED **YET** -- this needs to be added as an activitypub extension to https://github.com/go-fed/activity, see https://github.com/go-fed/activity/tree/master/astool
if l := len(a.AlsoKnownAsURIs); l != 0 {
alsoKnownAsURIs := make([]*url.URL, l)
for i, rawURL := range a.AlsoKnownAsURIs {
uri, err := url.Parse(rawURL)
if err != nil {
return nil, err
}
alsoKnownAsURIs[i] = uri
}
ap.SetAlsoKnownAs(person, alsoKnownAsURIs)
}
// movedTo
// Required for Move activity.
if a.MovedToURI != "" {
movedTo, err := url.Parse(a.MovedToURI)
if err != nil {
return nil, err
}
ap.SetMovedTo(person, movedTo)
}
// publicKey
// Required for signatures.