From a737f5a77321c02704e23beb8fcb504fc52c0c12 Mon Sep 17 00:00:00 2001 From: video-prize-ranch Date: Mon, 17 Jan 2022 19:07:07 -0500 Subject: [PATCH] Add frontpage --- main.go | 1 + pages/frontpage.go | 16 +++++++++++++ static/css/base.css | 5 ++++ views/frontpage.hbs | 53 +++++++++++++++++++++++++++++++++++++++++ views/partials/head.hbs | 1 + 5 files changed, 76 insertions(+) create mode 100644 pages/frontpage.go create mode 100644 views/frontpage.hbs diff --git a/main.go b/main.go index dfe2200..b1d7198 100644 --- a/main.go +++ b/main.go @@ -43,6 +43,7 @@ func main() { Root: http.FS(static.GetFiles()), })) + app.Get("/", pages.FrontpageHandler) app.Get("/:baseName.:extension", pages.HandleMedia) app.Get("/a/:albumID", pages.HandleAlbum) app.Get("/t/:tagID", pages.HandleAlbum) diff --git a/pages/frontpage.go b/pages/frontpage.go new file mode 100644 index 0000000..375d7af --- /dev/null +++ b/pages/frontpage.go @@ -0,0 +1,16 @@ +package pages + +import "github.com/gofiber/fiber/v2" + +func FrontpageHandler(c *fiber.Ctx) error { + c.Set("Cache-Control", "public,max-age=1800") + c.Set("X-Frame-Options", "DENY") + c.Set("Referrer-Policy", "no-referrer") + c.Set("X-Content-Type-Options", "nosniff") + c.Set("X-Robots-Tag", "noindex, noimageindex, nofollow") + c.Set("Strict-Transport-Security", "max-age=31557600") + c.Set("Permissions-Policy", "accelerometer=(), ambient-light-sensor=(), autoplay=(), battery=(), camera=(), cross-origin-isolated=(), display-capture=(), document-domain=(), encrypted-media=(), execution-while-not-rendered=(), execution-while-out-of-viewport=(), fullscreen=(), geolocation=(), gyroscope=(), magnetometer=(), microphone=(), midi=(), navigation-override=(), payment=(), picture-in-picture=(), publickey-credentials-get=(), screen-wake-lock=(), sync-xhr=(), usb=(), web-share=(), xr-spatial-tracking=()") + c.Set("Content-Security-Policy", "default-src 'none'; style-src 'self' 'unsafe-inline'; script-src 'self'; img-src 'self'; font-src 'self'; form-action 'self'; block-all-mixed-content; manifest-src 'self'") + + return c.Render("frontpage", fiber.Map{}) +} \ No newline at end of file diff --git a/static/css/base.css b/static/css/base.css index bc7a47f..23e8253 100644 --- a/static/css/base.css +++ b/static/css/base.css @@ -1,7 +1,12 @@ a { + color: #1e88e5; text-decoration: none; } +p { + font-size: 18px; +} + body { background-color: black; color: white; diff --git a/views/frontpage.hbs b/views/frontpage.hbs new file mode 100644 index 0000000..eb77c93 --- /dev/null +++ b/views/frontpage.hbs @@ -0,0 +1,53 @@ + + + + + {{> partials/head }} + + + + + + + {{> partials/header }} + +
+

An alternative frontend for Imgur. Based on rimgu and rewritten in Go.

+ +

It's read-only and works without JavaScript. Images and albums can be viewed without wasting resources from downloading and running tracking scripts. No sign-up nags.

+ +

Try it!

+ + Album + +

Features

+ + + +

Usage

+ +

Just replace imgur.com with the domain of this instance! You can setup automatic redirects using Redirector.

+ +

Redirector configuration

+ + + +
+ + {{> partials/footer }} + + + \ No newline at end of file diff --git a/views/partials/head.hbs b/views/partials/head.hbs index c7bce98..8d3b50c 100644 --- a/views/partials/head.hbs +++ b/views/partials/head.hbs @@ -14,4 +14,5 @@ + \ No newline at end of file