fix like target

This commit is contained in:
Clemens 2024-03-28 15:41:43 +01:00
parent e2b11b93bc
commit 2ad685fd2c
2 changed files with 4 additions and 5 deletions

View file

@ -8,7 +8,6 @@ import (
"net/url"
"strings"
"code.gitea.io/gitea/modules/log"
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/modules/validation"
@ -179,8 +178,6 @@ func removeEmptyStrings(ls []string) []string {
func newActorID(uri string) (ActorID, error) {
validatedURI, err := url.ParseRequestURI(uri)
log.Info("Validated URI is: %v", validatedURI)
log.Info("Input is: %v", validatedURI)
if err != nil {
return ActorID{}, err
}

View file

@ -250,7 +250,7 @@ func SendLikeActivities(ctx context.Context, doer user.User, repoID int64) error
}
for _, federatedRepo := range federatedRepos {
target := federatedRepo.Uri + "/inbox/" // A like goes to the inbox of the federated repo
target := federatedRepo.Uri
log.Info("Federated Repo URI is: %v", target)
likeActivity, err := forgefed.NewForgeLike(doer.APAPIURL(), target, time.Now())
if err != nil {
@ -266,7 +266,9 @@ func SendLikeActivities(ctx context.Context, doer user.User, repoID int64) error
// TODO: set timeouts for outgoing request in oder to mitigate DOS by slow lories
// TODO: Check if we need to respect rate limits
// ToDo: Change this to the standalone table of FederatedRepos
apclient.Post([]byte(json), target)
log.Info("Like JSON: %v", string(json))
log.Info("Target URI: %v", target)
apclient.Post([]byte(json), fmt.Sprintf("%v/inbox/", target))
}
return nil