diff --git a/README.md b/README.md index 2c3762f..01e99fa 100644 --- a/README.md +++ b/README.md @@ -23,6 +23,7 @@ It's read-only and works without JavaScript. Images and albums can be viewed wit - Albums - User page - Tag page +- Bandwidth efficient - automatically use WebP with the `FORCE_WEBP` environment variable Some things left to implement (contributions welcome!): diff --git a/pages/frontpage.go b/pages/frontpage.go index e5e77d0..cf992ad 100644 --- a/pages/frontpage.go +++ b/pages/frontpage.go @@ -1,6 +1,8 @@ package pages import ( + "os" + "codeberg.org/video-prize-ranch/rimgo/utils" "github.com/gofiber/fiber/v2" ) @@ -13,5 +15,6 @@ func HandleFrontpage(c *fiber.Ctx) error { return c.Render("frontpage", fiber.Map{ "proto": c.Protocol(), "domain": c.Hostname(), + "force_webp": os.Getenv("FORCE_WEBP"), }) } \ No newline at end of file diff --git a/views/frontpage.hbs b/views/frontpage.hbs index fb17db5..befdcf8 100644 --- a/views/frontpage.hbs +++ b/views/frontpage.hbs @@ -43,6 +43,10 @@
Just replace imgur.com or i.imgur.com with {{domain}}
! You can setup automatic redirects using LibRedirect (recommended) or Redirector.
To download images as their original filetype, add ?no_webp=1
to the end of the image URL.