aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Wang2022-06-16 10:59:36 -0500
committerAnthony Wang2022-06-16 10:59:36 -0500
commit6336ba2e830f6d9b0cc2fd3edb1b9a74b8e5ff73 (patch)
tree9304ed7d409afc413653b2b221c0e88b43be4932
parentdb13e1d6a115f37afcda5c34672af293cee6db44 (diff)
Add better comments
-rw-r--r--modules/setting/federation.go3
-rw-r--r--routers/api/v1/activitypub/person.go6
-rw-r--r--routers/api/v1/activitypub/reqsignature.go4
-rw-r--r--routers/api/v1/api.go2
4 files changed, 9 insertions, 6 deletions
diff --git a/modules/setting/federation.go b/modules/setting/federation.go
index db81eaebb..53a83fa84 100644
--- a/modules/setting/federation.go
+++ b/modules/setting/federation.go
@@ -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)
diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go
index 7e09a5050..0e123881a 100644
--- a/routers/api/v1/activitypub/person.go
+++ b/routers/api/v1/activitypub/person.go
@@ -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
// ---
diff --git a/routers/api/v1/activitypub/reqsignature.go b/routers/api/v1/activitypub/reqsignature.go
index e734da89d..5897765d9 100644
--- a/routers/api/v1/activitypub/reqsignature.go
+++ b/routers/api/v1/activitypub/reqsignature.go
@@ -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)
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index cecf6513c..c93606ae8 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -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())
})
}