Add caching headers to static files, and fix explicit width and height (closes #52)
Signed-off-by: Odyssey <hi@odyssey346.dev>
このコミットが含まれているのは:
コミット
a41e5ac009
5
.gitignore
vendored
5
.gitignore
vendored
@ -24,4 +24,7 @@ go.work
|
||||
tmp/
|
||||
|
||||
# Gothub binary.
|
||||
gothub
|
||||
gothub
|
||||
|
||||
# Fiber compressed files
|
||||
*.fiber.gz
|
@ -42,10 +42,6 @@ main {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
.navbarImg {
|
||||
height: 30px;
|
||||
}
|
||||
|
||||
.indexGitHub {
|
||||
background: #252525;
|
||||
color: #fff;
|
||||
|
@ -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 {
|
||||
|
@ -13,7 +13,7 @@
|
||||
<body>
|
||||
<nav>
|
||||
<div class="navbar">
|
||||
<a href="/" style="text-decoration: none;" class="brand"><img src="/logo.svg" class="navbarImg" alt="GotHub" /><b class="navbarSlogan">GotHub (alpha)</b></a>
|
||||
<a href="/" style="text-decoration: none;" class="brand"><img src="/logo.svg" class="navbarImg" height="30" width="30" alt="GotHub" /><b class="navbarSlogan">GotHub (alpha)</b></a>
|
||||
<div class="navbarLinks">
|
||||
<a href="/explore">Explore</a>
|
||||
<a href="https://codeberg.org/gothub/gothub">Source code</a>
|
||||
|
読み込み中…
新しいイシューから参照
ユーザーをブロックする