aboutsummaryrefslogtreecommitdiff
path: root/route
diff options
context:
space:
mode:
Diffstat (limited to 'route')
-rw-r--r--route/routes/actor.go6
-rw-r--r--route/util.go13
2 files changed, 19 insertions, 0 deletions
diff --git a/route/routes/actor.go b/route/routes/actor.go
index e1372ee..fc9795a 100644
--- a/route/routes/actor.go
+++ b/route/routes/actor.go
@@ -398,6 +398,12 @@ func ActorPostGet(ctx *fiber.Ctx) error {
inReplyTo := actor.Id + "/" + postId
+ // check if actually OP if not redirect to op to get full thread
+ var obj = activitypub.ObjectBase{Id: inReplyTo}
+ if OP, _ := obj.GetOP(); OP != obj.Id {
+ return ctx.Redirect(config.Domain+"/"+actor.Name+"/"+util.ShortURL(actor.Outbox, OP)+"#"+util.ShortURL(actor.Outbox, inReplyTo), http.StatusMovedPermanently)
+ }
+
var data route.PageData
re = regexp.MustCompile("f(\\w|[!@#$%^&*<>])+-(\\w|[!@#$%^&*<>])+")
diff --git a/route/util.go b/route/util.go
index 838961e..9a2de75 100644
--- a/route/util.go
+++ b/route/util.go
@@ -373,4 +373,17 @@ func TemplateFunctions(engine *html.Engine) {
return returnString
})
+
+ engine.AddFunc("parseLink", func(board activitypub.Actor, link string) string {
+ var obj = activitypub.ObjectBase{
+ Id: link,
+ }
+
+ var OP string
+ if OP, _ = obj.GetOP(); OP == obj.Id {
+ return board.Name + "/" + util.ShortURL(board.Outbox, obj.Id)
+ }
+
+ return board.Name + "/" + util.ShortURL(board.Outbox, OP) + "#" + util.ShortURL(board.Outbox, link)
+ })
}