From 4de1fa1e79f7e7564f205c91a5cd0afa7e6a6318 Mon Sep 17 00:00:00 2001 From: video-prize-ranch Date: Sat, 10 Jun 2023 12:04:29 -0400 Subject: [PATCH] Merge redesign into main (#111) --- .air.toml | 47 +++++++++++ .dockerignore | 6 +- .gitignore | 6 +- api/user.go | 10 ++- main.go | 51 +++++++---- pages/about.go | 22 +++++ pages/frontpage.go | 9 +- pages/media.go | 12 ++- pages/post.go | 4 +- pages/privacy.go | 2 - pages/tag.go | 4 +- pages/user.go | 8 +- static/icons/PhArrowFatDown.svg | 1 + static/icons/PhArrowFatUp.svg | 1 + static/icons/PhChat.svg | 1 + static/icons/PhCheckCircle.svg | 1 + static/icons/PhDevices.svg | 1 + static/icons/PhEye.svg | 1 + static/icons/PhGlobe.svg | 1 + static/icons/PhLink.svg | 1 + static/icons/PhWarning.svg | 1 + static/icons/PhWarningCircle.svg | 1 + static/icons/PhWrench.svg | 1 + static/icons/alert-circle.svg | 1 - static/icons/alert-triangle.svg | 1 - static/icons/check-circle.svg | 1 - static/icons/chevron-down.svg | 1 - static/icons/chevron-up.svg | 1 - static/icons/eye.svg | 1 - static/icons/hash.svg | 1 - static/icons/link.svg | 1 - static/icons/message-square.svg | 1 - static/icons/smartphone.svg | 1 - static/icons/tool.svg | 1 - static/tailwind.css | 74 ++++++++++++++++ tailwind.config.js | 8 ++ views/about.hbs | 105 +++++++++++++++++++++++ views/errors/404.hbs | 15 ++-- views/errors/429.hbs | 15 ++-- views/errors/error.hbs | 17 ++-- views/frontpage.hbs | 133 +++++++++-------------------- views/partials/comment.hbs | 22 ++--- views/partials/footer.hbs | 16 +++- views/partials/head.hbs | 3 +- views/partials/header.hbs | 8 -- views/partials/nav.hbs | 6 ++ views/partials/post.hbs | 16 ++-- views/partials/privacy.hbs | 48 +++++++++++ views/post.hbs | 51 +++++------ views/privacy.hbs | 141 ++++++++++--------------------- views/tag.hbs | 57 ++++++------- views/user.hbs | 31 +++---- 52 files changed, 598 insertions(+), 371 deletions(-) create mode 100644 .air.toml create mode 100644 pages/about.go create mode 100644 static/icons/PhArrowFatDown.svg create mode 100644 static/icons/PhArrowFatUp.svg create mode 100644 static/icons/PhChat.svg create mode 100644 static/icons/PhCheckCircle.svg create mode 100644 static/icons/PhDevices.svg create mode 100644 static/icons/PhEye.svg create mode 100644 static/icons/PhGlobe.svg create mode 100644 static/icons/PhLink.svg create mode 100644 static/icons/PhWarning.svg create mode 100644 static/icons/PhWarningCircle.svg create mode 100644 static/icons/PhWrench.svg delete mode 100644 static/icons/alert-circle.svg delete mode 100644 static/icons/alert-triangle.svg delete mode 100644 static/icons/check-circle.svg delete mode 100644 static/icons/chevron-down.svg delete mode 100644 static/icons/chevron-up.svg delete mode 100644 static/icons/eye.svg delete mode 100644 static/icons/hash.svg delete mode 100644 static/icons/link.svg delete mode 100644 static/icons/message-square.svg delete mode 100644 static/icons/smartphone.svg delete mode 100644 static/icons/tool.svg create mode 100644 static/tailwind.css create mode 100644 tailwind.config.js create mode 100644 views/about.hbs delete mode 100644 views/partials/header.hbs create mode 100644 views/partials/nav.hbs create mode 100644 views/partials/privacy.hbs diff --git a/.air.toml b/.air.toml new file mode 100644 index 0000000..bbd4b15 --- /dev/null +++ b/.air.toml @@ -0,0 +1,47 @@ +# Config file for [Air](https://github.com/cosmtrek/air) in TOML format + +# Working directory +# . or absolute path, please note that the directories following must be under root. +root = "." +tmp_dir = "tmp" + +[build] +# Just plain old shell command. You could use `make` as well. +cmd = "ENV=dev go build -o ./tmp/rimgo ./main.go" +# Binary file yields from `cmd`. +bin = "./tmp/rimgo" +# Customize binary. +full_bin = "./tmp/rimgo" +# Watch these filename extensions. +include_ext = ["go", "tpl", "tmpl", "html", "mustache", "hbs", "pug", "css"] +# Ignore these filename extensions or directories. +exclude_dir = ["tmp", "vendor", "node_modules"] +# Watch these directories if you specified. +include_dir = [] +# Exclude files. +exclude_file = [] +# This log file places in your tmp_dir. +log = "air.log" +# It's not necessary to trigger build each time file changes if it's too frequent. +delay = 1000 # ms +# Stop running old binary when build errors occur. +stop_on_error = true +# Send Interrupt signal before killing process (windows does not support this feature) +send_interrupt = false +# Delay after sending Interrupt signal +kill_delay = 500 # ms + +[log] +# Show log time +time = false + +[color] +# Customize each part's color. If no color found, use the raw app log. +main = "magenta" +watcher = "cyan" +build = "yellow" +runner = "green" + +[misc] +# Delete tmp directory on exit +clean_on_exit = true \ No newline at end of file diff --git a/.dockerignore b/.dockerignore index 67ab480..8db6a73 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,3 +1,3 @@ -node_modules -samples -dist +.env +tmp +static/app.css \ No newline at end of file diff --git a/.gitignore b/.gitignore index d14eab8..8db6a73 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ -dist -node_modules -.env \ No newline at end of file +.env +tmp +static/app.css \ No newline at end of file diff --git a/api/user.go b/api/user.go index 404a3ef..dd8fd1c 100644 --- a/api/user.go +++ b/api/user.go @@ -3,6 +3,7 @@ package api import ( "io" "net/http" + "regexp" "strings" "sync" "time" @@ -34,6 +35,8 @@ type Submission struct { IsAlbum bool } +var imgurRe = regexp.MustCompile(`https?://i?\.?imgur\.com`) + func (client *Client) FetchUser(username string) (User, error) { cacheData, found := client.Cache.Get(username + "-user") if found { @@ -108,10 +111,15 @@ func (client *Client) FetchSubmissions(username string, sort string, page string } id := value.Get("id").String() + + link := "/a/" + id + if value.Get("in_gallery").Bool() { + link = "/gallery/" + id + } submissions = append(submissions, Submission{ Id: id, - Link: "/a/" + id, + Link: link, Title: value.Get("title").String(), Cover: cover, Points: value.Get("points").Int(), diff --git a/main.go b/main.go index e20f8f5..486391a 100644 --- a/main.go +++ b/main.go @@ -4,6 +4,7 @@ import ( "flag" "fmt" "net/http" + "os" "time" "codeberg.org/video-prize-ranch/rimgo/pages" @@ -29,8 +30,12 @@ func main() { pages.InitializeApiClient() - engine := handlebars.NewFileSystem(http.FS(views.GetFiles()), ".hbs") - + views := http.FS(views.GetFiles()) + if os.Getenv("ENV") == "dev" { + views = http.Dir("./views") + } + engine := handlebars.NewFileSystem(views, ".hbs") + engine.AddFunc("noteq", func(a interface{}, b interface{}, options *raymond.Options) interface{} { if raymond.Str(a) != raymond.Str(b) { return options.Fn() @@ -67,19 +72,34 @@ func main() { fmt.Println(e) }, })) - app.Use("/static", filesystem.New(filesystem.Config{ - Next: func(c *fiber.Ctx) bool { - c.Response().Header.Add("Cache-Control", "public,max-age=2592000") - return false - }, - Root: http.FS(static.GetFiles()), - })) - app.Use(cache.New(cache.Config{ - Expiration: 30 * time.Minute, - MaxBytes: 25000000, - CacheControl: true, - StoreResponseHeaders: true, - })) + + if os.Getenv("ENV") == "dev" { + app.Use("/static", filesystem.New(filesystem.Config{ + MaxAge: 2592000, + Root: http.Dir("./static"), + })) + app.Get("/errors/429", func(c *fiber.Ctx) error { + return c.Render("errors/429", nil) + }) + app.Get("/errors/404", func(c *fiber.Ctx) error { + return c.Render("errors/404", nil) + }) + app.Get("/errors/error", func(c *fiber.Ctx) error { + return c.Render("errors/error", fiber.Map{ + "err": "Test error", + }) + }) + } else { + app.Use("/static", filesystem.New(filesystem.Config{ + Root: http.FS(static.GetFiles()), + })) + app.Use(cache.New(cache.Config{ + Expiration: 30 * time.Minute, + MaxBytes: 25000000, + CacheControl: true, + StoreResponseHeaders: true, + })) + } app.Get("/robots.txt", func(c *fiber.Ctx) error { file, _ := static.GetFiles().ReadFile("robots.txt") @@ -93,6 +113,7 @@ func main() { }) app.Get("/", pages.HandleFrontpage) + app.Get("/about", pages.HandleAbout) app.Get("/privacy", pages.HandlePrivacy) app.Get("/a/:postID", pages.HandlePost) app.Get("/a/:postID/embed", pages.HandleEmbed) diff --git a/pages/about.go b/pages/about.go new file mode 100644 index 0000000..b4328ae --- /dev/null +++ b/pages/about.go @@ -0,0 +1,22 @@ +package pages + +import ( + "os" + + "codeberg.org/video-prize-ranch/rimgo/utils" + "github.com/gofiber/fiber/v2" +) + + +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") + + return c.Render("about", fiber.Map{ + "proto": c.Protocol(), + "domain": c.Hostname(), + "force_webp": os.Getenv("FORCE_WEBP"), + }) +} \ No newline at end of file diff --git a/pages/frontpage.go b/pages/frontpage.go index 4bd400a..55e2f00 100644 --- a/pages/frontpage.go +++ b/pages/frontpage.go @@ -1,12 +1,12 @@ package pages import ( - "os" - "codeberg.org/video-prize-ranch/rimgo/utils" "github.com/gofiber/fiber/v2" ) +var VersionInfo string + func HandleFrontpage(c *fiber.Ctx) error { utils.SetHeaders(c) c.Set("X-Frame-Options", "DENY") @@ -14,8 +14,7 @@ func HandleFrontpage(c *fiber.Ctx) error { 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") return c.Render("frontpage", fiber.Map{ - "proto": c.Protocol(), - "domain": c.Hostname(), - "force_webp": os.Getenv("FORCE_WEBP"), + "config": utils.Config, + "version": VersionInfo, }) } \ No newline at end of file diff --git a/pages/media.go b/pages/media.go index ebd27af..dd58c30 100644 --- a/pages/media.go +++ b/pages/media.go @@ -59,17 +59,21 @@ func handleMedia(c *fiber.Ctx, url string) error { c.Status(res.StatusCode) if res.StatusCode == 404 { - return c.Render("errors/404", nil) + return c.Render("errors/404", fiber.Map{ + "path": c.Path(), + }) } else if res.StatusCode == 429 { - return c.Render("errors/429", nil) + return c.Render("errors/429", fiber.Map{ + "path": c.Path(), + }) } - + c.Set("Accept-Ranges", "bytes") c.Set("Content-Type", res.Header.Get("Content-Type")); c.Set("Content-Length", res.Header.Get("Content-Length")) if res.Header.Get("Content-Range") != "" { c.Set("Content-Range", res.Header.Get("Content-Range")) } - + return c.SendStream(res.Body) } \ No newline at end of file diff --git a/pages/post.go b/pages/post.go index 93b4d55..03020f3 100644 --- a/pages/post.go +++ b/pages/post.go @@ -24,7 +24,9 @@ func HandlePost(c *fiber.Ctx) error { post, err = ApiClient.FetchMedia(c.Params("postID")) } if err != nil && err.Error() == "ratelimited by imgur" { - return c.Status(429).Render("errors/429", nil) + return c.Status(429).Render("errors/429", fiber.Map{ + "path": c.Path(), + }) } if err != nil && post.Id == "" && strings.Contains(err.Error(), "404") { return c.Status(404).Render("errors/404", nil) diff --git a/pages/privacy.go b/pages/privacy.go index d0bc026..163fbea 100644 --- a/pages/privacy.go +++ b/pages/privacy.go @@ -6,8 +6,6 @@ import ( "codeberg.org/video-prize-ranch/rimgo/utils" ) -var VersionInfo string - func HandlePrivacy(c *fiber.Ctx) error { utils.SetHeaders(c) c.Set("X-Frame-Options", "DENY") diff --git a/pages/tag.go b/pages/tag.go index 611148d..fa62f9c 100644 --- a/pages/tag.go +++ b/pages/tag.go @@ -30,7 +30,9 @@ func HandleTag(c *fiber.Ctx) error { tag, err := ApiClient.FetchTag(c.Params("tag"), c.Query("sort"), page) if err != nil && err.Error() == "ratelimited by imgur" { - return c.Status(429).Render("errors/429", nil) + return c.Status(429).Render("errors/429", fiber.Map{ + "path": c.Path(), + }) } if err != nil { return err diff --git a/pages/user.go b/pages/user.go index 2756a22..285d44e 100644 --- a/pages/user.go +++ b/pages/user.go @@ -25,7 +25,9 @@ func HandleUser(c *fiber.Ctx) error { user, err := ApiClient.FetchUser(c.Params("userID")) if err != nil && err.Error() == "ratelimited by imgur" { - return c.Status(429).Render("errors/429", nil) + return c.Status(429).Render("errors/429", fiber.Map{ + "path": c.Path(), + }) } if err != nil { return err @@ -37,7 +39,9 @@ func HandleUser(c *fiber.Ctx) error { submissions, err := ApiClient.FetchSubmissions(c.Params("userID"), "newest", page) if err != nil && err.Error() == "ratelimited by imgur" { c.Status(429) - return c.Render("errors/429", nil) + return c.Render("errors/429", fiber.Map{ + "path": c.Path(), + }) } if err != nil { return err diff --git a/static/icons/PhArrowFatDown.svg b/static/icons/PhArrowFatDown.svg new file mode 100644 index 0000000..6be1c31 --- /dev/null +++ b/static/icons/PhArrowFatDown.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhArrowFatUp.svg b/static/icons/PhArrowFatUp.svg new file mode 100644 index 0000000..0340317 --- /dev/null +++ b/static/icons/PhArrowFatUp.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhChat.svg b/static/icons/PhChat.svg new file mode 100644 index 0000000..0d1b7a9 --- /dev/null +++ b/static/icons/PhChat.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhCheckCircle.svg b/static/icons/PhCheckCircle.svg new file mode 100644 index 0000000..bb2719d --- /dev/null +++ b/static/icons/PhCheckCircle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhDevices.svg b/static/icons/PhDevices.svg new file mode 100644 index 0000000..69fcaa0 --- /dev/null +++ b/static/icons/PhDevices.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhEye.svg b/static/icons/PhEye.svg new file mode 100644 index 0000000..d782f5d --- /dev/null +++ b/static/icons/PhEye.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhGlobe.svg b/static/icons/PhGlobe.svg new file mode 100644 index 0000000..d874f1c --- /dev/null +++ b/static/icons/PhGlobe.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhLink.svg b/static/icons/PhLink.svg new file mode 100644 index 0000000..0f841e5 --- /dev/null +++ b/static/icons/PhLink.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhWarning.svg b/static/icons/PhWarning.svg new file mode 100644 index 0000000..4b0e5c1 --- /dev/null +++ b/static/icons/PhWarning.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhWarningCircle.svg b/static/icons/PhWarningCircle.svg new file mode 100644 index 0000000..2db71db --- /dev/null +++ b/static/icons/PhWarningCircle.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/PhWrench.svg b/static/icons/PhWrench.svg new file mode 100644 index 0000000..a5dff99 --- /dev/null +++ b/static/icons/PhWrench.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/static/icons/alert-circle.svg b/static/icons/alert-circle.svg deleted file mode 100644 index dcc802a..0000000 --- a/static/icons/alert-circle.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/alert-triangle.svg b/static/icons/alert-triangle.svg deleted file mode 100644 index 53c4326..0000000 --- a/static/icons/alert-triangle.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/check-circle.svg b/static/icons/check-circle.svg deleted file mode 100644 index cef44f3..0000000 --- a/static/icons/check-circle.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/chevron-down.svg b/static/icons/chevron-down.svg deleted file mode 100644 index affee97..0000000 --- a/static/icons/chevron-down.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/chevron-up.svg b/static/icons/chevron-up.svg deleted file mode 100644 index 0fd7760..0000000 --- a/static/icons/chevron-up.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/eye.svg b/static/icons/eye.svg deleted file mode 100644 index 4fdb2ba..0000000 --- a/static/icons/eye.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/hash.svg b/static/icons/hash.svg deleted file mode 100644 index 267dc0e..0000000 --- a/static/icons/hash.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/link.svg b/static/icons/link.svg deleted file mode 100644 index a983646..0000000 --- a/static/icons/link.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/message-square.svg b/static/icons/message-square.svg deleted file mode 100644 index 416a7ca..0000000 --- a/static/icons/message-square.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/smartphone.svg b/static/icons/smartphone.svg deleted file mode 100644 index 56cb714..0000000 --- a/static/icons/smartphone.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/icons/tool.svg b/static/icons/tool.svg deleted file mode 100644 index 91fc16e..0000000 --- a/static/icons/tool.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/static/tailwind.css b/static/tailwind.css new file mode 100644 index 0000000..dfb7445 --- /dev/null +++ b/static/tailwind.css @@ -0,0 +1,74 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +body { + margin: 0 24vw; +} + +p a { + text-decoration: underline +} + +.posts { + margin-top: 1em; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); + grid-auto-rows: 1fr; + gap: 1rem; +} + +.posts img:not(.icon), +.posts video:not(:fullscreen) { + object-fit: cover; + aspect-ratio: 1; +} + +#comments__expandBtn { + display: none; +} + +.comments__expandBtn__label { + display: flex; + flex-direction: row; + justify-content: space-between; + align-items: center; + cursor: pointer; + user-select: none; + text-decoration: none; + color: #fff +} + +.comments__expandBtn__icon { + font-size: 24px; +} + +#comments__expandBtn ~ .comments__expandBtn__label > span::after { + content: "⌄"; +} + +#comments__expandBtn:checked ~ .comments__expandBtn__label > span::after { + content: "⌃"; +} + +#comments__expandBtn:checked ~ .comments { + display: none; +} + +.comment__media { + height: 12em; + display: block; + margin: 0.5em 0; +} + +@media only screen and (max-width: 1280px) { + body { + margin: 0 8vw; + } +} + +@media only screen and (max-width: 812px) { + body { + margin: 0 4vw; + } +} \ No newline at end of file diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 0000000..714d24f --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1,8 @@ +module.exports = { + content: ["./views/*.hbs", "./views/**/*.hbs"], + theme: { + extend: {}, + }, + variants: {}, + plugins: [], +}; \ No newline at end of file diff --git a/views/about.hbs b/views/about.hbs new file mode 100644 index 0000000..f0965bc --- /dev/null +++ b/views/about.hbs @@ -0,0 +1,105 @@ + + + + + About - rimgo + + {{> partials/head }} + + + + {{> partials/nav }} + +
+

An alternative frontend for Imgur. Originally based on rimgu.

+ +

Features

+ + +

Comparison

+

Comparing rimgo to Imgur.

+ +

Speed

+

Tested using Google PageSpeed Insights.

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
rimgoImgur
Performance9128
Request count29340
Resource Size218 KiB2,542 KiB
Time to Interactive1.6s23.8s
+ +

Privacy

+

Imgur collects information about your device and uses tracking cookies for advertising, this is mentioned in their privacy policy. Blacklight found 31 trackers and 87 third-party cookies.

+

See what cookies and trackers Imgur uses and where your data gets sent: https://themarkup.org/blacklight?url=imgur.com

+ +

Usage

+

Just replace imgur.com or i.imgur.com with {{domain}} (add stack/ before the media ID for i.stack.imgur.com). You can setup automatic redirects using LibRedirect (recommended) or Redirector.

+ + {{#if force_webp}} +

To download images as their original filetype, add ?no_webp=1 to the end of the image URL.

+ {{/if}} + +

Automatically redirect links

+ +

LibRedirect

+

Use LibRedirect to automatically redirect Imgur links to rimgo!

+ +

GreaseMonkey script

+

There is a script to redirect Imgur links to rimgo. https://codeberg.org/zortazert/GreaseMonkey-Redirect/src/branch/main/imgur-to-rimgo.user.js

+ +

Redirector

+

You can use the Redirector extension to redirect Imgur links to rimgo with the configuration below:

+ +
+

For Stack Overflow Images:

+ + +

Notice

+

All images and media are from Imgur. rimgo does not allow uploads or comments. Any issues with content should be reported to Imgur.

+
+ + {{> partials/footer }} + + + \ No newline at end of file diff --git a/views/errors/404.hbs b/views/errors/404.hbs index 58e6c0a..8257d0a 100644 --- a/views/errors/404.hbs +++ b/views/errors/404.hbs @@ -2,21 +2,20 @@ - {{> 'partials/head' }} + Not Found - rimgo - - - 404 Not Found - rimgo + {{> partials/head }} - - {{> 'partials/header' }} + + {{> partials/nav }}
-

404 Not Found

-

Click here to return to home.

+

Not Found

+

Click here to return to home.

+ {{> partials/footer }} \ No newline at end of file diff --git a/views/errors/429.hbs b/views/errors/429.hbs index d80eb4d..0b46b65 100644 --- a/views/errors/429.hbs +++ b/views/errors/429.hbs @@ -2,21 +2,20 @@ - {{> 'partials/head' }} - - - Rate limited by Imgur - rimgo + + {{> partials/head }} - - {{> 'partials/header' }} + + {{> partials/nav }}
-

Rate limited by Imgur

-

This instance has been temporarily blocked by Imgur. Try using another instance.

+

Rate limited by Imgur

+

This instance has been temporarily blocked by Imgur. Try using another instance >

+ {{> partials/footer }} \ No newline at end of file diff --git a/views/errors/error.hbs b/views/errors/error.hbs index 39b1ed4..354f0f5 100644 --- a/views/errors/error.hbs +++ b/views/errors/error.hbs @@ -2,22 +2,21 @@ - {{> 'partials/head' }} - - - Error - rimgo + + {{> partials/head }} - - {{> 'partials/header' }} + + {{> partials/nav }} -
-

An error occurred

+
+

An error occurred

You may have found a bug in rimgo. If this is a bug, open an issue on Codeberg.

- {{err}} + {{err}}
+ {{> partials/footer }} \ No newline at end of file diff --git a/views/frontpage.hbs b/views/frontpage.hbs index b35159d..f9beb9c 100644 --- a/views/frontpage.hbs +++ b/views/frontpage.hbs @@ -5,104 +5,49 @@ rimgo {{> partials/head }} - - - - - {{> partials/header }} - -
-

An alternative frontend for Imgur. Originally based on rimgu.

- -

Features

-
    -
  • Lightweight
  • -
  • No JavaScript
  • -
  • No ads or tracking
  • -
  • No sign up or app install prompts
  • -
  • Bandwidth efficient - automatically uses newer image formats (if enabled)
  • -
- -

Comparison

-

Comparing rimgo to Imgur.

- -

Speed

-

Tested using Google PageSpeed Insights.

- - - - - - - - - - - - - - - - - - - - - - - - - - -
rimgoImgur
Performance9128
Request count29340
Resource Size218 KiB2,542 KiB
Time to Interactive1.6s23.8s
- -

Privacy

-

Imgur collects information about your device and uses tracking cookies for advertising, this is mentioned in their privacy policy. Blacklight found 31 trackers and 87 third-party cookies.

-

See what cookies and trackers Imgur uses and where your data gets sent: https://themarkup.org/blacklight?url=imgur.com

- -

Usage

-

Just replace imgur.com or i.imgur.com with {{domain}} (add stack/ before the media ID for i.stack.imgur.com). You can setup automatic redirects using LibRedirect (recommended) or Redirector.

- - {{#if force_webp}} -

To download images as their original filetype, add ?no_webp=1 to the end of the image URL.

- {{/if}} - -

Automatically redirect links

- -

LibRedirect

-

Use LibRedirect to automatically redirect Imgur links to rimgo!

- -

GreaseMonkey script

-

There is a script to redirect Imgur links to rimgo. https://codeberg.org/zortazert/GreaseMonkey-Redirect/src/branch/main/imgur-to-rimgo.user.js

- -

Redirector

-

You can use the Redirector extension to redirect Imgur links to rimgo with the configuration below:

-
    -
  • Description: Imgur -> rimgo
  • -
  • Example URL: https://imgur.com/a/H8M4rcp
  • -
  • Include pattern: ^https?://i?.?imgur.com(/.*)?$
  • -
  • Redirect to: {{proto}}://{{domain}}$1
  • -
  • Pattern type: Regular Expression
  • -
  • Advanced Options > Apply to: Check Images
  • -
- -

For Stack Overflow Images:

-
    -
  • Description: Stack Overflow Imgur -> rimgo
  • -
  • Example URL: https://i.stack.imgur.com/BTKqD.png?s=128&g=1
  • -
  • Include pattern: ^https?://i\.stack\.imgur\.com(/.*)?$
  • -
  • Redirect to: {{proto}}://{{domain}}/stack$1
  • -
  • Pattern type: Regular Expression
  • -
  • Advanced Options > Apply to: Check Images
  • -
- -

Notice

+ + {{> partials/nav }} + +
+

The fast, private image viewer for Imgur.

+ +
+ +
+

What is rimgo?

+

+ rimgo is an alternative frontend for Imgur. + Originally based on rimgu. + It's a way to access Imgur without the ads, tracking, and other garbage. + rimgo is not affiliated with Imgur, all content is proxied from Imgur. +

+
+

Notice

All images and media are from Imgur. rimgo does not allow uploads or comments. Any issues with content should be reported to Imgur.

- + +

This instance

+
+ {{> partials/privacy }} +
+

Additional information

+
    +
  • Version: {{version}}
  • +
  • Country: {{config.Privacy.country}}
  • +
  • Provider: {{config.Privacy.provider}}
  • + {{#if config.Privacy.cloudflare}} +
  • Using Cloudflare?: Yes
  • + {{else}} +
  • Using Cloudflare?: No
  • + {{/if}} +
+
+
+

Learn more about instance privacy >

+ {{> partials/footer }} - + \ No newline at end of file diff --git a/views/partials/comment.hbs b/views/partials/comment.hbs index f8dd8ff..476f868 100644 --- a/views/partials/comment.hbs +++ b/views/partials/comment.hbs @@ -1,30 +1,32 @@ -
-
+
+
{{#noteq this.User.Username "[deleted]"}} - + -

{{this.User.Username}}

+

{{this.User.Username}}

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

[deleted]

+

[deleted]

{{/equal}}

{{{this.Comment}}}

-
+
{{this.RelTime}} {{#if this.DeletedAt}} - (deleted {{this.DeletedAt}}) + (deleted {{this.DeletedAt}}) {{/if}} | - Likes {{this.Upvotes}} - Dislikes {{this.Downvotes}} + 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/footer.hbs b/views/partials/footer.hbs index 93376c1..3aab847 100644 --- a/views/partials/footer.hbs +++ b/views/partials/footer.hbs @@ -1,4 +1,14 @@ -