aboutsummaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
authorFChannel <>2022-05-01 12:13:25 -0700
committerFChannel <>2022-06-19 12:53:29 -0700
commite80fe14f7985f9e85bfb9582926acd7891455786 (patch)
tree80f4fb97c3299d94cb590a23be2eb531ec66c3db /main.go
parent2af4a39ac16c6245f0e87ddf3cc137339f6c604f (diff)
fix for parsing reply link and showing images in static folder
Diffstat (limited to 'main.go')
-rw-r--r--main.go13
1 files changed, 5 insertions, 8 deletions
diff --git a/main.go b/main.go
index 125369a..bafa0ee 100644
--- a/main.go
+++ b/main.go
@@ -7,6 +7,7 @@ import (
"github.com/FChannel0/FChannel-Server/activitypub"
"github.com/FChannel0/FChannel-Server/config"
"github.com/FChannel0/FChannel-Server/db"
+ "github.com/FChannel0/FChannel-Server/post"
"github.com/FChannel0/FChannel-Server/routes"
"github.com/FChannel0/FChannel-Server/util"
"github.com/FChannel0/FChannel-Server/webfinger"
@@ -112,6 +113,7 @@ func main() {
app.Use(logger.New())
app.Static("/static", "./views")
+ app.Static("/static", "./static")
app.Static("/public", "./public")
/*
@@ -636,14 +638,9 @@ func TemplateFunctions(engine *html.Engine) {
engine.AddFunc("isOnion", util.IsOnion)
engine.AddFunc("parseReplyLink", func(actorId string, op string, id string, content string) template.HTML {
- actor, err := webfinger.FingerActor(actorId)
- if err != nil {
- // TODO: figure out what to do here
- panic(err)
- }
-
- title := strings.ReplaceAll(ParseLinkTitle(actor.Id, op, content), `/\&lt;`, ">")
- link := fmt.Sprintf("<a href=\"%s/%s#%s\" title=\"%s\" class=\"replyLink\">&gt;&gt;%s</a>", actor.Name, util.ShortURL(actor.Outbox, op), util.ShortURL(actor.Outbox, id), title, util.ShortURL(actor.Outbox, id))
+ actor, _ := webfinger.FingerActor(actorId)
+ title := strings.ReplaceAll(post.ParseLinkTitle(actor.Id+"/", op, content), `/\&lt;`, ">")
+ link := "<a href=\"/" + actor.Name + "/" + util.ShortURL(actor.Outbox, op) + "#" + util.ShortURL(actor.Outbox, id) + "\" title=\"" + title + "\" class=\"replyLink\">&gt;&gt;" + util.ShortURL(actor.Outbox, id) + "</a>"
return template.HTML(link)
})