Private
Public Access
1
0

fix game
Some checks failed
Dynamic Branch Deploy / build-and-deploy (push) Failing after 8m27s

This commit is contained in:
Sebastian Unterschütz
2026-03-21 21:55:15 +01:00
parent 08abe2867a
commit 66f72d7a83
4 changed files with 17 additions and 4 deletions

View File

@@ -32,7 +32,7 @@ func SetupGinServer(ec *nats.EncodedConn, port string) *gin.Engine {
// Cache Control Middleware für statische Assets
r.Use(func(c *gin.Context) {
path := c.Request.URL.Path
// Assets (Bilder, Fonts, etc.) - 1 Jahr cachen
// Assets (Bilder, Audio, etc.) - 1 Jahr cachen
if len(path) > 7 && path[:8] == "/assets/" {
c.Header("Cache-Control", "public, max-age=31536000, immutable")
}
@@ -40,6 +40,14 @@ func SetupGinServer(ec *nats.EncodedConn, port string) *gin.Engine {
if (path == "/main.wasm" || path == "/game.js" || path == "/wasm_exec.js") && c.Query("v") != "" {
c.Header("Cache-Control", "public, max-age=31536000, immutable")
}
// CSS und Hintergrundbild - 1 Tag cachen
if path == "/style.css" || path == "/background.jpg" {
c.Header("Cache-Control", "public, max-age=86400")
}
// HTML - immer neu laden (enthält BUILD_VERSION für Cache-Busting der JS/WASM)
if path == "/" || path == "/index.html" {
c.Header("Cache-Control", "no-cache")
}
c.Next()
})