From 90cbacb80cf4d351e457fe76d7fcd79758c63d04 Mon Sep 17 00:00:00 2001 From: Akis Date: Tue, 7 Feb 2023 15:55:12 +0000 Subject: [PATCH 1/7] Add dev.gh.akisblack.dev instance --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b38dd8e..5ef46e5 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ These instances run the ``dev`` branch of GotHub. While this might mean they are | Link | Cloudflare | Country | ISP | | -------- | ---------- | ----------- | ----- | | [gh.dev.odyssey346.dev (official)](https://gh.dev.odyssey346.dev) | No | 🇫🇷 | OVHcloud (Trolling Solutions) | -| [gothub.esmailelbob.xyz](https://gothub.esmailelbob.xyz) | No | 🇨🇦 | OVHcloud | +| [gothub.esmailelbob.xyz](https://gothub.esmailelbob.xyz) | No | 🇨🇦 | OVHcloud | +| [dev.gh.akisblack.dev](https://dev.gh.akisblack.dev) | No | 🇩🇪 | OVHcloud | Have an instance you want on the list? Make an issue or PR! From a41e5ac009fd54ef3bc06b2fb0b9a6ce45ca427f Mon Sep 17 00:00:00 2001 From: Odyssey Date: Wed, 8 Feb 2023 17:32:22 +0100 Subject: [PATCH 2/7] Add caching headers to static files, and fix explicit width and height (closes #52) Signed-off-by: Odyssey --- .gitignore | 5 ++++- public/css/global.css | 4 ---- serve/serve.go | 16 +++++++++++----- views/header.html | 2 +- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/.gitignore b/.gitignore index 2bfce47..61891e2 100644 --- a/.gitignore +++ b/.gitignore @@ -24,4 +24,7 @@ go.work tmp/ # Gothub binary. -gothub \ No newline at end of file +gothub + +# Fiber compressed files +*.fiber.gz \ No newline at end of file diff --git a/public/css/global.css b/public/css/global.css index ef3249b..005d91d 100644 --- a/public/css/global.css +++ b/public/css/global.css @@ -42,10 +42,6 @@ main { padding: 8px; } -.navbarImg { - height: 30px; -} - .indexGitHub { background: #252525; color: #fff; diff --git a/serve/serve.go b/serve/serve.go index bd25d2a..4d97bea 100644 --- a/serve/serve.go +++ b/serve/serve.go @@ -74,12 +74,18 @@ func Serve() { }, }) + staticConfig := fiber.Static{ + Compress: true, + // Cache-Control: max-age=31536000 + MaxAge: 31536000, + } + app.Get("/", pages.HandleIndex) - app.Static("/css", "./public/css") - app.Static("/fonts", "./public/fonts") - app.Static("/robots.txt", "./public/robots.txt") - app.Static("/favicon.ico", "./public/assets/favicon.ico") - app.Static("/logo.svg", "./public/assets/logo.svg") + app.Static("/css", "./public/css", staticConfig) + app.Static("/fonts", "./public/fonts", staticConfig) + app.Static("/robots.txt", "./public/robots.txt", staticConfig) + app.Static("/favicon.ico", "./public/assets/favicon.ico", staticConfig) + app.Static("/logo.svg", "./public/assets/logo.svg", staticConfig) app.Get("/explore", ratelimiter, pages.HandleExplore) app.Get("/:user", ratelimiter, pages.HandleUser) app.Get("/avatar/:id", func(c *fiber.Ctx) error { diff --git a/views/header.html b/views/header.html index bf876bd..833732f 100644 --- a/views/header.html +++ b/views/header.html @@ -13,7 +13,7 @@