- {{post.User.Username}} -
- - {{/if}} -{{post.Views}}
-{{post.Upvotes}}
-{{post.Downvotes}}
-- {{#if tag.Display}} - {{this.Display}} - {{else}} - {{this.Tag}} - {{/if}} -
-diff --git a/pages/post.go b/pages/post.go index 8507878..bb5f4f0 100644 --- a/pages/post.go +++ b/pages/post.go @@ -1,8 +1,6 @@ package pages import ( - "crypto/rand" - "fmt" "strconv" "strings" @@ -58,25 +56,9 @@ func HandlePost(c *fiber.Ctx) error { return err } - comments := []api.Comment{} - if post.SharedWithCommunity { - c.Set("Cache-Control", "public,max-age=604800") - comments, err = ApiClient.FetchComments(c.Params("postID")) - if err != nil { - return err - } - } else { - c.Set("Cache-Control", "public,max-age=31557600") - } + c.Set("Cache-Control", "public,max-age=31557600") - nonce := "" csp := "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; media-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content; style-src 'self'" - if len(post.Tags) != 0 { - b := make([]byte, 8) - rand.Read(b) - nonce = fmt.Sprintf("%x", b) - csp = csp + " 'nonce-" + nonce + "'" - } c.Set("Content-Security-Policy", csp) var next string @@ -89,7 +71,5 @@ func HandlePost(c *fiber.Ctx) error { return c.Render("post", fiber.Map{ "post": post, "next": next, - "comments": comments, - "nonce": nonce, }) } diff --git a/views/partials/comment.hbs b/views/partials/comment.hbs deleted file mode 100644 index 476f868..0000000 --- a/views/partials/comment.hbs +++ /dev/null @@ -1,32 +0,0 @@ -
{{this.User.Username}}
- - {{/noteq}} - {{#equal this.User.Username "[deleted]"}} -[deleted]
- {{/equal}} -{{{this.Comment}}}
-{{Title}}
-- {{post.User.Username}} -
- - {{/if}} -{{post.Views}}
-{{post.Upvotes}}
-{{post.Downvotes}}
-- {{#if tag.Display}} - {{this.Display}} - {{else}} - {{this.Tag}} - {{/if}} -
-