diff options
author | FChannel <> | 2022-06-16 12:39:41 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | aebf10de3b631f452600a5b31c1f43c1bbf8bdf2 (patch) | |
tree | 6d8855a96a0c3188df015e1b8c54e1db3db00a75 /route/routes/actor.go | |
parent | 44a5de2ecef3cba0d4d596f86183e7fd383615c0 (diff) |
fixed query to actor/outbox
Diffstat (limited to 'route/routes/actor.go')
-rw-r--r-- | route/routes/actor.go | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/route/routes/actor.go b/route/routes/actor.go index 8690b78..f5bfb4c 100644 --- a/route/routes/actor.go +++ b/route/routes/actor.go @@ -2,6 +2,7 @@ package routes import ( "bytes" + "encoding/json" "io" "io/ioutil" "mime/multipart" @@ -170,7 +171,7 @@ func ActorInbox(ctx *fiber.Ctx) error { return nil } -func ActorOutbox(ctx *fiber.Ctx) error { +func PostActorOutbox(ctx *fiber.Ctx) error { //var activity activitypub.Activity actor, err := webfinger.GetActorFromPath(ctx.Path(), "/") if err != nil { @@ -195,7 +196,7 @@ func ActorFollowers(ctx *fiber.Ctx) error { return actor.GetFollowersResp(ctx) } -func ActorPost(ctx *fiber.Ctx) error { +func MakeActorPost(ctx *fiber.Ctx) error { header, _ := ctx.FormFile("file") if ctx.FormValue("inReplyTo") == "" && header == nil { @@ -356,7 +357,7 @@ func ActorPost(ctx *fiber.Ctx) error { return ctx.Redirect(config.Domain+"/"+ctx.FormValue("boardName"), 301) } -func ActorPostGet(ctx *fiber.Ctx) error { +func ActorPost(ctx *fiber.Ctx) error { actor, err := activitypub.GetActorByNameFromDB(ctx.Params("actor")) if err != nil { @@ -533,7 +534,7 @@ func ActorCatalog(ctx *fiber.Ctx) error { }, "layouts/main") } -func ActorOutboxGet(ctx *fiber.Ctx) error { +func ActorPosts(ctx *fiber.Ctx) error { actor, err := activitypub.GetActorByNameFromDB(ctx.Params("actor")) if err != nil { @@ -669,3 +670,21 @@ func ActorArchive(ctx *fiber.Ctx) error { "page": returnData, }, "layouts/main") } + +func GetActorOutbox(ctx *fiber.Ctx) error { + actor, _ := webfinger.GetActorFromPath(ctx.Path(), "/") + + collection, _ := actor.GetCollection() + collection.AtContext.Context = "https://www.w3.org/ns/activitystreams" + collection.Actor = actor + + collection.TotalItems, _ = actor.GetPostTotal() + collection.TotalImgs, _ = actor.GetImgTotal() + + enc, _ := json.Marshal(collection) + + ctx.Response().Header.Add("Content-Type", config.ActivityStreams) + _, err := ctx.Write(enc) + + return err +} |