feat: add hashfs for static asset cache busting and live clock
- 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:
6
main.go
6
main.go
@@ -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{
|
||||
|
||||
Reference in New Issue
Block a user