From 2ad685fd2ca1c126c2e3ef7e1f55cd4b1ff15efb Mon Sep 17 00:00:00 2001 From: Clemens Date: Thu, 28 Mar 2024 15:41:43 +0100 Subject: [PATCH] fix like target --- models/forgefed/actor.go | 3 --- services/federation/federation_service.go | 6 ++++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/models/forgefed/actor.go b/models/forgefed/actor.go index efc62284f1..b422ddb201 100644 --- a/models/forgefed/actor.go +++ b/models/forgefed/actor.go @@ -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 } diff --git a/services/federation/federation_service.go b/services/federation/federation_service.go index bb3417f7d3..8e4416b35f 100644 --- a/services/federation/federation_service.go +++ b/services/federation/federation_service.go @@ -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