Add better comments
This commit is contained in:
parent
db13e1d6a1
commit
6336ba2e83
|
@ -42,6 +42,9 @@ func newFederationService() {
|
|||
return
|
||||
}
|
||||
|
||||
// Get MaxSize in bytes instead of MiB
|
||||
Federation.MaxSize = 1 << 20 * Federation.MaxSize
|
||||
|
||||
HttpsigAlgs = make([]httpsig.Algorithm, len(Federation.Algorithms))
|
||||
for i, alg := range Federation.Algorithms {
|
||||
HttpsigAlgs[i] = httpsig.Algorithm(alg)
|
||||
|
|
|
@ -17,11 +17,11 @@ import (
|
|||
ap "github.com/go-ap/activitypub"
|
||||
)
|
||||
|
||||
// Person function
|
||||
// Person function returns the Person actor for a user
|
||||
func Person(ctx *context.APIContext) {
|
||||
// swagger:operation GET /activitypub/user/{username} activitypub activitypubPerson
|
||||
// ---
|
||||
// summary: Returns the person
|
||||
// summary: Returns the Person actor for a user
|
||||
// produces:
|
||||
// - application/json
|
||||
// parameters:
|
||||
|
@ -99,7 +99,7 @@ func Person(ctx *context.APIContext) {
|
|||
}
|
||||
}
|
||||
|
||||
// PersonInbox function
|
||||
// PersonInbox function handles the incoming data for a user inbox
|
||||
func PersonInbox(ctx *context.APIContext) {
|
||||
// swagger:operation POST /activitypub/user/{username}/inbox activitypub activitypubPersonInbox
|
||||
// ---
|
||||
|
|
|
@ -93,8 +93,8 @@ func verifyHTTPSignatures(ctx *gitea_context.APIContext) (authenticated bool, er
|
|||
return
|
||||
}
|
||||
|
||||
// ReqSignature function
|
||||
func ReqSignature() func(ctx *gitea_context.APIContext) {
|
||||
// ReqHTTPSignature function
|
||||
func ReqHTTPSignature() func(ctx *gitea_context.APIContext) {
|
||||
return func(ctx *gitea_context.APIContext) {
|
||||
if authenticated, err := verifyHTTPSignatures(ctx); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "verifyHttpSignatures", err)
|
||||
|
|
|
@ -647,7 +647,7 @@ func Routes() *web.Route {
|
|||
m.Group("/activitypub", func() {
|
||||
m.Group("/user/{username}", func() {
|
||||
m.Get("", activitypub.Person)
|
||||
m.Post("/inbox", activitypub.ReqSignature(), activitypub.PersonInbox)
|
||||
m.Post("/inbox", activitypub.ReqHTTPSignature(), activitypub.PersonInbox)
|
||||
}, context_service.UserAssignmentAPI())
|
||||
})
|
||||
}
|
||||
|
|
Reference in a new issue