aboutsummaryrefslogtreecommitdiff
path: root/client.go
diff options
context:
space:
mode:
authorFChannel <>2021-07-25 17:35:41 -0700
committerFChannel <>2021-07-25 17:35:41 -0700
commit87fc54c9d41bdbe7eaa8769386776a3723580b34 (patch)
tree208bef1d292eb7aa58b44c7389bd9ed47b61d1fd /client.go
parent6846150cb48d080112981633d6dddabef5ce4439 (diff)
showing post replies bug fix
Diffstat (limited to 'client.go')
-rw-r--r--client.go18
1 files changed, 16 insertions, 2 deletions
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), `/\&lt;`, ">")
+ link := "<a href=\"" + actor.Name + "/" + shortURL(actor.Outbox, op) + "#" + shortURL(actor.Outbox, id) + "\" title=\"" + title + "\">&gt;&gt;" + shortURL(actor.Outbox, id) + "</a>"
+ 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), `/\&lt;`, ">")
+ link := "<a href=\"" + actor.Name + "/" + shortURL(actor.Outbox, op) + "#" + shortURL(actor.Outbox, id) + "\" title=\"" + title + "\">&gt;&gt;" + shortURL(actor.Outbox, id) + "</a>"
+ 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