diff --git a/ISSUE_TEMPLATE.md b/.gitea/ISSUE_TEMPLATE/instance.md similarity index 99% rename from ISSUE_TEMPLATE.md rename to .gitea/ISSUE_TEMPLATE/instance.md index 052bf23..31c25a8 100644 --- a/ISSUE_TEMPLATE.md +++ b/.gitea/ISSUE_TEMPLATE/instance.md @@ -36,4 +36,4 @@ Anything else we should know? (e.g. if you are using a modified version of GotHu ## Contact Details - + \ No newline at end of file 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/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! 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..b3d85da 100644 --- a/serve/serve.go +++ b/serve/serve.go @@ -74,12 +74,30 @@ func Serve() { }, }) + staticConfig := fiber.Static{ + Compress: true, + // Cache-Control: max-age=31536000 + MaxAge: 31536000, + } + + // add global headers + app.Use(func(c *fiber.Ctx) error { + c.Set("X-Frame-Options", "SAMEORIGIN") + c.Set("X-XSS-Protection", "1; mode=block") + c.Set("X-Content-Type-Options", "nosniff") + c.Set("Referrer-Policy", "no-referrer") + c.Set("Content-Security-Policy", "default-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data; font-src 'self'; script-src 'self'; frame-ancestors 'self'; form-action 'self'; base-uri 'self'; connect-src 'self';") + c.Set("Strict-Transport-Security", "max-age=31536000; includeSubDomains; preload") + + return c.Next() + }) + 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..ebac8fc 100644 --- a/views/header.html +++ b/views/header.html @@ -13,7 +13,7 @@