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 @@ -
-
- {{#noteq this.User.Username "[deleted]"}} - - -

{{this.User.Username}}

-
- {{/noteq}} - {{#equal this.User.Username "[deleted]"}} -

[deleted]

- {{/equal}} -
-
-

{{{this.Comment}}}

-
- {{this.RelTime}} - {{#if this.DeletedAt}} - (deleted {{this.DeletedAt}}) - {{/if}} - | - Likes {{this.Upvotes}} - Dislikes {{this.Downvotes}} -
-
- {{#if this.Comments}} -
- {{#each this.Comments}} - {{> partials/comment }} - {{/each}} -
- {{/if}} -
\ No newline at end of file diff --git a/views/partials/post.hbs b/views/partials/post.hbs index 1ce54df..8ce4ce7 100644 --- a/views/partials/post.hbs +++ b/views/partials/post.hbs @@ -9,19 +9,5 @@ {{/equal}}

{{Title}}

-
-
- Points - {{Points}} -
-
- Comments - {{Comments}} -
-
- Views - {{Views}} -
-
- \ No newline at end of file + diff --git a/views/post.hbs b/views/post.hbs index e14ac46..fb8256e 100644 --- a/views/post.hbs +++ b/views/post.hbs @@ -26,32 +26,6 @@
-
- {{#if post.User.Username}} - - -

- {{post.User.Username}} -

-
- {{/if}} -
-
- Views -

{{post.Views}}

-
- {{#if post.SharedWithCommunity}} -
- Likes -

{{post.Upvotes}}

-
-
- Dislikes -

{{post.Downvotes}}

-
- {{/if}} -
-
{{#noteq next ""}} @@ -79,50 +53,9 @@ {{/if}} {{/each}}
- - {{#if post.tags}} -
- - {{#each post.tags}} - -
-

- {{#if tag.Display}} - {{this.Display}} - {{else}} - {{this.Tag}} - {{/if}} -

-
-
- {{/each}} -
- {{/if}}
-
- {{#if comments}} -
- - -
- {{#each comments}} - {{> partials/comment }} - {{/each}} -
-
- {{/if}} -
- {{> partials/footer }} - \ No newline at end of file +