mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-09 16:55:16 +00:00
review
This commit is contained in:
parent
7316108d56
commit
9ccad50b05
|
@ -19,6 +19,7 @@ type ForgeLike struct {
|
|||
ap.Activity
|
||||
}
|
||||
|
||||
// TODO: Use explicit values instead of ctx !!
|
||||
func NewForgeLike(ctx *context.APIContext) (ForgeLike, error) {
|
||||
result := ForgeLike{}
|
||||
actorIRI := ctx.Repo.Owner.APAPIURL()
|
||||
|
|
|
@ -347,6 +347,8 @@ func (repo *Repository) APIURL() string {
|
|||
}
|
||||
|
||||
// APAPIURL returns the activitypub repository API URL
|
||||
// TODO: At least camel case?
|
||||
// TODO: Mv federation related stuff to federated_repo
|
||||
func (repo *Repository) APAPIURL() string {
|
||||
return setting.AppURL + "api/v1/activitypub/repository-id/" + url.PathEscape(string(repo.ID))
|
||||
}
|
||||
|
|
|
@ -157,6 +157,7 @@ func IsValidFederatedRepoURLList(urls string) bool {
|
|||
return true
|
||||
}
|
||||
|
||||
// TODO: use validateable/ValidateMaxLen instead !!
|
||||
func IsOfValidLength(str string) bool {
|
||||
return len(str) <= 2048
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
// Copyright 2016 The Gogs Authors. All rights reserved.
|
||||
// Copyright 2020 The Gitea Authors.
|
||||
// Copyright 2024 The forgejo Authors.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package user
|
||||
|
@ -164,6 +165,7 @@ func Star(ctx *context.APIContext) {
|
|||
ctx.Error(http.StatusInternalServerError, "StarRepo", err)
|
||||
return
|
||||
}
|
||||
// TODO: move this code to repo.federated_repository
|
||||
if setting.Federation.Enabled {
|
||||
|
||||
likeActivity, err := forgefed.NewForgeLike(ctx)
|
||||
|
@ -183,6 +185,7 @@ func Star(ctx *context.APIContext) {
|
|||
ctx.Error(http.StatusInternalServerError, "StarRepo", err)
|
||||
return
|
||||
}
|
||||
// TODO: set timeouts for outgoing request in oder to mitigate DOS by slow lories
|
||||
// ToDo: Change this to the standalone table of FederatedRepos
|
||||
for _, target := range strings.Split(ctx.Repo.Repository.FederationRepos, ";") {
|
||||
apclient.Post([]byte(json), target)
|
||||
|
|
Loading…
Reference in a new issue