PersonInboxGet and PersonOutboxPost
This commit is contained in:
parent
530175e030
commit
d602177eed
3 changed files with 102 additions and 8 deletions
|
@ -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)
|
||||
}
|
|
@ -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)
|
||||
|
|
|
@ -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": {
|
||||
|
|
Reference in a new issue