feat: add hashfs for static asset cache busting and live clock
All checks were successful
CI / Deploy / test (pull_request) Successful in 32s
CI / Deploy / lint (pull_request) Successful in 42s
CI / Deploy / deploy (pull_request) Has been skipped

- Add assets package with dev/prod build tags
- Dev: serve from filesystem with Cache-Control: no-store
- Prod: use hashfs for cache-busting URLs
- Add LiveClock component to show SSE connection status
- Update templates to use StaticPath for asset URLs
This commit is contained in:
Ryan Hamamura
2026-03-03 13:26:52 -10:00
parent e0f5d555fb
commit 9a8fe4534d
9 changed files with 64 additions and 14 deletions

View File

@@ -2,7 +2,6 @@ package main
import (
"context"
"embed"
"fmt"
"log/slog"
"net"
@@ -29,9 +28,6 @@ import (
"github.com/ryanhamamura/games/version"
)
//go:embed assets
var assets embed.FS
func main() {
ctx, cancel := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)
defer cancel()
@@ -97,7 +93,7 @@ func run(ctx context.Context) error {
sessionManager.LoadAndSave,
)
router.SetupRoutes(r, queries, sessionManager, nc, store, snakeStore, assets)
router.SetupRoutes(r, queries, sessionManager, nc, store, snakeStore)
// HTTP server
srv := &http.Server{