diff options
author | FChannel <> | 2022-05-01 12:13:25 -0700 |
---|---|---|
committer | FChannel <> | 2022-06-19 12:53:29 -0700 |
commit | e80fe14f7985f9e85bfb9582926acd7891455786 (patch) | |
tree | 80f4fb97c3299d94cb590a23be2eb531ec66c3db /main.go | |
parent | 2af4a39ac16c6245f0e87ddf3cc137339f6c604f (diff) |
fix for parsing reply link and showing images in static folder
Diffstat (limited to 'main.go')
-rw-r--r-- | main.go | 13 |
1 files changed, 5 insertions, 8 deletions
@@ -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), `/\<`, ">") - link := fmt.Sprintf("<a href=\"%s/%s#%s\" title=\"%s\" class=\"replyLink\">>>%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), `/\<`, ">") + link := "<a href=\"/" + actor.Name + "/" + util.ShortURL(actor.Outbox, op) + "#" + util.ShortURL(actor.Outbox, id) + "\" title=\"" + title + "\" class=\"replyLink\">>>" + util.ShortURL(actor.Outbox, id) + "</a>" return template.HTML(link) }) |