aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--routers/api/v1/activitypub/person.go56
-rw-r--r--routers/api/v1/api.go6
-rw-r--r--templates/swagger/v1_json.tmpl48
3 files changed, 102 insertions, 8 deletions
diff --git a/routers/api/v1/activitypub/person.go b/routers/api/v1/activitypub/person.go
index 019610291..8d3119590 100644
--- a/routers/api/v1/activitypub/person.go
+++ b/routers/api/v1/activitypub/person.go
@@ -94,8 +94,30 @@ func Person(ctx *context.APIContext) {
ctx.JSON(http.StatusOK, jsonmap)
}
-// PersonInbox function
-func PersonInbox(ctx *context.APIContext) {
+// PersonInboxGet function
+func PersonInboxGet(ctx *context.APIContext) {
+ // swagger:operation GET /activitypub/user/{username}/outbox activitypub activitypubPersonInbox
+ // ---
+ // summary: Returns the inbox
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: username
+ // in: path
+ // description: username of the user
+ // type: string
+ // required: true
+ // responses:
+ // responses:
+ // "200":
+ // "$ref": "#/responses/ActivityPub"
+
+ ctx.Status(http.StatusOK)
+ activitypub.GetUserActor().GetInbox(ctx, ctx.Resp, ctx.Req)
+}
+
+// PersonInboxPost function
+func PersonInboxPost(ctx *context.APIContext) {
// swagger:operation POST /activitypub/user/{username}/inbox activitypub activitypubPersonInbox
// ---
// summary: Send to the inbox
@@ -113,11 +135,11 @@ func PersonInbox(ctx *context.APIContext) {
// "$ref": "#/responses/ActivityPub"
ctx.Status(http.StatusOK)
- activitypub.GetUserActor().PostOutbox(ctx, ctx.Resp, ctx.Req)
+ activitypub.GetUserActor().PostInbox(ctx, ctx.Resp, ctx.Req)
}
-// PersonOutbox function
-func PersonOutbox(ctx *context.APIContext) {
+// PersonOutboxGet function
+func PersonOutboxGet(ctx *context.APIContext) {
// swagger:operation GET /activitypub/user/{username}/outbox activitypub activitypubPersonOutbox
// ---
// summary: Returns the outbox
@@ -134,6 +156,28 @@ func PersonOutbox(ctx *context.APIContext) {
// "200":
// "$ref": "#/responses/ActivityPub"
- ctx.Status(http.StatusNoContent)
+ ctx.Status(http.StatusOK)
activitypub.GetUserActor().GetOutbox(ctx, ctx.Resp, ctx.Req)
+}
+
+// PersonOutboxPost function
+func PersonOutboxPost(ctx *context.APIContext) {
+ // swagger:operation POST /activitypub/user/{username}/outbox activitypub activitypubPersonOutbox
+ // ---
+ // summary: Send to the outbox
+ // produces:
+ // - application/json
+ // parameters:
+ // - name: username
+ // in: path
+ // description: username of the user
+ // type: string
+ // required: true
+ // responses:
+ // responses:
+ // "200":
+ // "$ref": "#/responses/ActivityPub"
+
+ ctx.Status(http.StatusOK)
+ activitypub.GetUserActor().PostOutbox(ctx, ctx.Resp, ctx.Req)
} \ No newline at end of file
diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go
index ea0109bfe..614134014 100644
--- a/routers/api/v1/api.go
+++ b/routers/api/v1/api.go
@@ -600,8 +600,10 @@ func Routes(sessioner func(http.Handler) http.Handler) *web.Route {
m.Get("/nodeinfo", misc.NodeInfo)
m.Group("/activitypub", func() {
m.Get("/user/{username}", activitypub.Person)
- m.Post("/user/{username}/inbox", activitypub.ReqSignature(), activitypub.PersonInbox)
- m.Get("/user/{username}/outbox", activitypub.ReqSignature(), activitypub.PersonOutbox)
+ m.Get("/user/{username}/inbox", activitypub.ReqSignature(), activitypub.PersonInboxGet)
+ m.Post("/user/{username}/inbox", activitypub.ReqSignature(), activitypub.PersonInboxPost)
+ m.Get("/user/{username}/outbox", activitypub.ReqSignature(), activitypub.PersonOutboxGet)
+ m.Post("/user/{username}/outbox", activitypub.ReqSignature(), activitypub.PersonOutboxPost)
})
}
m.Get("/signing-key.gpg", misc.SigningKey)
diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl
index fdefee778..154eba5ae 100644
--- a/templates/swagger/v1_json.tmpl
+++ b/templates/swagger/v1_json.tmpl
@@ -50,6 +50,30 @@
}
},
"/activitypub/user/{username}/inbox": {
+ "get": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "activitypub"
+ ],
+ "summary": "Returns the inbox",
+ "operationId": "activitypubPersonInbox",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "username of the user",
+ "name": "username",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActivityPub"
+ }
+ }
+ },
"post": {
"produces": [
"application/json"
@@ -99,6 +123,30 @@
"$ref": "#/responses/ActivityPub"
}
}
+ },
+ "post": {
+ "produces": [
+ "application/json"
+ ],
+ "tags": [
+ "activitypub"
+ ],
+ "summary": "Send to the outbox",
+ "operationId": "activitypubPersonOutbox",
+ "parameters": [
+ {
+ "type": "string",
+ "description": "username of the user",
+ "name": "username",
+ "in": "path",
+ "required": true
+ }
+ ],
+ "responses": {
+ "200": {
+ "$ref": "#/responses/ActivityPub"
+ }
+ }
}
},
"/admin/cron": {