From 87fc54c9d41bdbe7eaa8769386776a3723580b34 Mon Sep 17 00:00:00 2001 From: FChannel <> Date: Sun, 25 Jul 2021 17:35:41 -0700 Subject: showing post replies bug fix --- client.go | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) (limited to 'client.go') diff --git a/client.go b/client.go index 930cd6f..80ec75b 100644 --- a/client.go +++ b/client.go @@ -183,6 +183,7 @@ func AllNewsGet(w http.ResponseWriter, r *http.Request, db *sql.DB) { } func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Collection){ + t := template.Must(template.New("").Funcs(template.FuncMap{ "proxy": func(url string) string { return MediaProxy(url) @@ -192,7 +193,13 @@ func OutboxGet(w http.ResponseWriter, r *http.Request, db *sql.DB, collection Co }, "parseAttachment": func(obj ObjectBase, catalog bool) template.HTML { return ParseAttachment(obj, catalog) - }, + }, + "parseReplyLink": func(actorId string, op string, id string, content string) template.HTML { + actor := FingerActor(actorId) + title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\<`, ">") + link := ">>" + shortURL(actor.Outbox, id) + "" + return template.HTML(link) + }, "sub": func (i, j int) int { return i - j }}).ParseFiles("./static/main.html", "./static/nposts.html", "./static/top.html", "./static/bottom.html", "./static/posts.html")) @@ -300,9 +307,16 @@ func PostGet(w http.ResponseWriter, r *http.Request, db *sql.DB){ "short": func(actorName string, url string) string { return shortURL(actorName, url) }, + "parseAttachment": func(obj ObjectBase, catalog bool) template.HTML { return ParseAttachment(obj, catalog) - }, + }, + "parseReplyLink": func(actorId string, op string, id string, content string) template.HTML { + actor := FingerActor(actorId) + title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\<`, ">") + link := ">>" + shortURL(actor.Outbox, id) + "" + return template.HTML(link) + }, "sub": func (i, j int) int { return i - j }}).ParseFiles("./static/main.html", "./static/npost.html", "./static/top.html", "./static/bottom.html", "./static/posts.html")) path := r.URL.Path -- cgit v1.2.3