Add func to add ap links to local users (untested)
All checks were successful
/ docker (push) Successful in 4m27s

This commit is contained in:
Melody Becker 2025-05-15 11:13:58 +02:00
parent e69f53bbd7
commit f991a1f353
7 changed files with 84 additions and 22 deletions

View file

@ -72,7 +72,7 @@ func users(w http.ResponseWriter, r *http.Request) {
return
}
apUrl := userIdToApUrl(user.ID)
apUrl := activitypub.UserIdToApUrl(user.ID)
var keyBytes string
if config.GlobalConfig.Experimental.UseEd25519Keys {
keyBytes = shared.KeyBytesToPem(user.PublicKeyEd, true)
@ -160,7 +160,7 @@ func userFollowing(w http.ResponseWriter, r *http.Request) {
webutils.ProblemDetailsStatusOnly(w, http.StatusNotFound)
return
}
apUrl := userIdToApUrl(userId)
apUrl := activitypub.UserIdToApUrl(userId)
var data []byte
followingCount, err := dbgen.UserToUserRelation.CountFollowingForId(userId)
if err != nil {
@ -212,7 +212,7 @@ func userFollowing(w http.ResponseWriter, r *http.Request) {
Context: "https://www.w3.org/ns/activitystreams",
Type: "OrderedCollectionPage",
Id: fmt.Sprintf("%s/following?page=%d", apUrl, pageNr),
PartOf: userIdToApUrl(userId) + "/following",
PartOf: activitypub.UserIdToApUrl(userId) + "/following",
Items: sliceutils.Map(links, func(t string) any { return t }),
}
if hasNextPage {
@ -247,7 +247,7 @@ func userFollowers(w http.ResponseWriter, r *http.Request) {
webutils.ProblemDetailsStatusOnly(w, http.StatusNotFound)
return
}
apUrl := userIdToApUrl(userId)
apUrl := activitypub.UserIdToApUrl(userId)
var data []byte
followersCount, err := dbgen.UserToUserRelation.CountFollowersForId(userId)
if err != nil {
@ -300,7 +300,7 @@ func userFollowers(w http.ResponseWriter, r *http.Request) {
Context: activitypub.BaseLdContext,
Type: "OrderedCollectionPage",
Id: fmt.Sprintf("%s/followers?page=%d", apUrl, pageNr),
PartOf: userIdToApUrl(userId) + "/followers",
PartOf: activitypub.UserIdToApUrl(userId) + "/followers",
Items: sliceutils.Map(links, func(t string) any { return t }),
}
if hasNextPage {