Template
1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo synced 2024-11-22 09:54:24 +01:00

get repo now works somehow

This commit is contained in:
Michael Jerger 2023-10-27 14:10:13 +02:00
parent da7a38b03d
commit fe2a3d86d4
3 changed files with 5 additions and 7 deletions

View file

@ -7,7 +7,6 @@ import (
"net/http" "net/http"
"code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/log"
) )
// Repository function returns the Repository actor for a repo // Repository function returns the Repository actor for a repo
@ -27,7 +26,6 @@ func Repository(ctx *context.APIContext) {
// "200": // "200":
// "$ref": "#/responses/ActivityPub" // "$ref": "#/responses/ActivityPub"
log.Error("Repository")
ctx.Status(http.StatusNoContent) ctx.Status(http.StatusNoContent)
} }

View file

@ -895,7 +895,7 @@ func Routes() *web.Route {
m.Post("/inbox", activitypub.ReqHTTPSignature(), activitypub.PersonInbox) m.Post("/inbox", activitypub.ReqHTTPSignature(), activitypub.PersonInbox)
}, context_service.UserIDAssignmentAPI()) }, context_service.UserIDAssignmentAPI())
// TODO: implement ctx // TODO: implement ctx
m.Group("/repository-id/{repsitory-id}", func() { m.Group("/repository-id/{repository-id}", func() {
m.Get("", activitypub.Repository) m.Get("", activitypub.Repository)
m.Post("/inbox", activitypub.ReqHTTPSignature(), activitypub.RepositoryInbox) m.Post("/inbox", activitypub.ReqHTTPSignature(), activitypub.RepositoryInbox)
}, context_service.RepositoryIDAssignmentAPI()) }, context_service.RepositoryIDAssignmentAPI())

View file

@ -20,10 +20,10 @@ func RepositoryIDAssignmentAPI() func(ctx *context.APIContext) {
log.Info("RepositoryIDAssignmentAPI: %v", repositoryID) log.Info("RepositoryIDAssignmentAPI: %v", repositoryID)
//TODO: check auth here ? //TODO: check auth here ?
if !ctx.Repo.HasAccess() && !ctx.IsUserSiteAdmin() { //if !ctx.Repo.HasAccess() && !ctx.IsUserSiteAdmin() {
ctx.Error(http.StatusForbidden, "reqAnyRepoReader", "user should have any permission to read repository or permissions of site admin") // ctx.Error(http.StatusForbidden, "reqAnyRepoReader", "user should have any permission to read repository or permissions of site admin")
return // return
} //}
var err error var err error
repository := new(context.Repository) repository := new(context.Repository)