mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-28 23:42:28 +00:00
fix like target
This commit is contained in:
parent
e2b11b93bc
commit
2ad685fd2c
|
@ -8,7 +8,6 @@ import (
|
||||||
"net/url"
|
"net/url"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"code.gitea.io/gitea/modules/log"
|
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
"code.gitea.io/gitea/modules/validation"
|
"code.gitea.io/gitea/modules/validation"
|
||||||
|
|
||||||
|
@ -179,8 +178,6 @@ func removeEmptyStrings(ls []string) []string {
|
||||||
|
|
||||||
func newActorID(uri string) (ActorID, error) {
|
func newActorID(uri string) (ActorID, error) {
|
||||||
validatedURI, err := url.ParseRequestURI(uri)
|
validatedURI, err := url.ParseRequestURI(uri)
|
||||||
log.Info("Validated URI is: %v", validatedURI)
|
|
||||||
log.Info("Input is: %v", validatedURI)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ActorID{}, err
|
return ActorID{}, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,7 @@ func SendLikeActivities(ctx context.Context, doer user.User, repoID int64) error
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, federatedRepo := range federatedRepos {
|
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)
|
log.Info("Federated Repo URI is: %v", target)
|
||||||
likeActivity, err := forgefed.NewForgeLike(doer.APAPIURL(), target, time.Now())
|
likeActivity, err := forgefed.NewForgeLike(doer.APAPIURL(), target, time.Now())
|
||||||
if err != nil {
|
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: set timeouts for outgoing request in oder to mitigate DOS by slow lories
|
||||||
// TODO: Check if we need to respect rate limits
|
// TODO: Check if we need to respect rate limits
|
||||||
// ToDo: Change this to the standalone table of FederatedRepos
|
// 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
|
return nil
|
||||||
|
|
Loading…
Reference in a new issue