From 5892445df7bc4343cacd6295633967cca10dec4e Mon Sep 17 00:00:00 2001 From: video-prize-ranch Date: Thu, 10 Aug 2023 02:22:46 +0000 Subject: [PATCH] Add search bar --- pages/about.go | 2 +- pages/frontpage.go | 2 +- pages/post.go | 2 +- pages/search.go | 2 +- pages/tag.go | 2 +- pages/user.go | 2 +- views/about.hbs | 5 +++++ views/frontpage.hbs | 2 +- views/partials/searchBar.hbs | 4 ++++ views/post.hbs | 4 ++++ views/privacy.hbs | 4 ++++ views/search.hbs | 4 ++++ views/tag.hbs | 4 ++++ views/user.hbs | 4 ++++ 14 files changed, 36 insertions(+), 7 deletions(-) create mode 100644 views/partials/searchBar.hbs diff --git a/pages/about.go b/pages/about.go index f979d94..b6dc2f9 100644 --- a/pages/about.go +++ b/pages/about.go @@ -12,7 +12,7 @@ func HandleAbout(c *fiber.Ctx) error { utils.SetHeaders(c) c.Set("X-Frame-Options", "DENY") c.Set("Cache-Control", "public,max-age=31557600") - c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; style-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") + c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; style-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") return c.Render("about", fiber.Map{ "proto": c.Protocol(), diff --git a/pages/frontpage.go b/pages/frontpage.go index 0ba7d31..fd16cc0 100644 --- a/pages/frontpage.go +++ b/pages/frontpage.go @@ -11,7 +11,7 @@ func HandleFrontpage(c *fiber.Ctx) error { utils.SetHeaders(c) c.Set("X-Frame-Options", "DENY") c.Set("Cache-Control", "public,max-age=31557600") - c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; style-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") + c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; style-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") return c.Render("frontpage", fiber.Map{ "config": utils.Config, diff --git a/pages/post.go b/pages/post.go index f273b7d..7a876e4 100644 --- a/pages/post.go +++ b/pages/post.go @@ -49,7 +49,7 @@ func HandlePost(c *fiber.Ctx) error { } nonce := "" - csp := "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; media-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content; style-src 'self'" + 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) diff --git a/pages/search.go b/pages/search.go index 743770e..6b8a2ec 100644 --- a/pages/search.go +++ b/pages/search.go @@ -9,7 +9,7 @@ func HandleSearch(c *fiber.Ctx) error { utils.SetHeaders(c) c.Set("X-Frame-Options", "DENY") c.Set("Cache-Control", "public,max-age=604800") - c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; style-src 'unsafe-inline' 'self'; media-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") + c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; style-src 'unsafe-inline' 'self'; media-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") query := c.Query("q") diff --git a/pages/tag.go b/pages/tag.go index 63e964b..8682e46 100644 --- a/pages/tag.go +++ b/pages/tag.go @@ -11,7 +11,7 @@ func HandleTag(c *fiber.Ctx) error { utils.SetHeaders(c) c.Set("X-Frame-Options", "DENY") c.Set("Cache-Control", "public,max-age=604800") - c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; style-src 'unsafe-inline' 'self'; media-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") + c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; style-src 'unsafe-inline' 'self'; media-src 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") page := "1" if c.Query("page") != "" { diff --git a/pages/user.go b/pages/user.go index 6f27e7a..f38d50a 100644 --- a/pages/user.go +++ b/pages/user.go @@ -11,7 +11,7 @@ func HandleUser(c *fiber.Ctx) error { utils.SetHeaders(c) c.Set("X-Frame-Options", "DENY") c.Set("Cache-Control", "public,max-age=604800") - c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'none'; media-src 'self'; style-src 'unsafe-inline' 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") + c.Set("Content-Security-Policy", "default-src 'none'; frame-ancestors 'none'; base-uri 'none'; form-action 'self'; media-src 'self'; style-src 'unsafe-inline' 'self'; img-src 'self'; manifest-src 'self'; block-all-mixed-content") page := "0" if c.Query("page") != "" { diff --git a/views/about.hbs b/views/about.hbs index f0965bc..e00ea7e 100644 --- a/views/about.hbs +++ b/views/about.hbs @@ -10,6 +10,11 @@ {{> partials/nav }} +
+ {{> partials/searchBar }} +
+ +

An alternative frontend for Imgur. Originally based on rimgu.

diff --git a/views/frontpage.hbs b/views/frontpage.hbs index f9beb9c..11b3b97 100644 --- a/views/frontpage.hbs +++ b/views/frontpage.hbs @@ -12,7 +12,7 @@

The fast, private image viewer for Imgur.

- + {{> partials/searchBar }}
diff --git a/views/partials/searchBar.hbs b/views/partials/searchBar.hbs new file mode 100644 index 0000000..a7e2b41 --- /dev/null +++ b/views/partials/searchBar.hbs @@ -0,0 +1,4 @@ +
+ + +
\ No newline at end of file diff --git a/views/post.hbs b/views/post.hbs index d39d28c..a4b34e6 100644 --- a/views/post.hbs +++ b/views/post.hbs @@ -15,6 +15,10 @@ {{> partials/nav }} +
+ {{> partials/searchBar }} +
+

{{post.Title}}

{{post.CreatedAt}}

diff --git a/views/privacy.hbs b/views/privacy.hbs index 0ac50ae..5071890 100644 --- a/views/privacy.hbs +++ b/views/privacy.hbs @@ -9,6 +9,10 @@ {{> partials/nav }} + +
+ {{> partials/searchBar }} +

Instance Privacy

diff --git a/views/search.hbs b/views/search.hbs index b42251a..096ebec 100644 --- a/views/search.hbs +++ b/views/search.hbs @@ -9,6 +9,10 @@ {{> partials/nav }} + +
+ {{> partials/searchBar }} +
diff --git a/views/tag.hbs b/views/tag.hbs index a63fbba..f844169 100644 --- a/views/tag.hbs +++ b/views/tag.hbs @@ -10,6 +10,10 @@ {{> partials/nav }} +
+ {{> partials/searchBar }} +
+

{{tag.Display}}

diff --git a/views/user.hbs b/views/user.hbs index 724daca..0243e1b 100644 --- a/views/user.hbs +++ b/views/user.hbs @@ -9,6 +9,10 @@ {{> partials/nav }} + +
+ {{> partials/searchBar }} +