Adopt shared credits accessibility and cache fixes
5 files changed,
+18
−8
Makefile+1 −0go.mod+3 −1go.sum+4 −2internal/meet/credits.go+9 −4internal/meet/credits_test.go+1 −1
CI passed — run details
diff --git a/Makefile b/Makefile| index 9ba5a29..803ce50 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -1,3 +1,4 @@ |
| +export GOTOOLCHAIN := go1.26.5 |
| export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git |
| APP := meet |
diff --git a/go.mod b/go.mod| index 6f00ba9..304b56f 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -2,8 +2,10 @@ module amadan.net/oficina/meet |
| go 1.26.0 |
| +toolchain go1.26.5 |
| + |
| require ( |
| - amadan.net/oficina/estilo.git v0.0.0-20260911162556-f5fa1128b794 |
| + amadan.net/oficina/estilo.git v0.0.0-20260911182719-0bcb9287988d |
| amadan.net/oficina/home/connect v0.0.0-20260910000424-5b8d8410775f |
| amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489 |
| amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd |
diff --git a/go.sum b/go.sum| index 2a5c97c..7ea9177 100644 |
| --- a/go.sum |
| +++ b/go.sum |
| @@ -1,5 +1,5 @@ |
| -amadan.net/oficina/estilo.git v0.0.0-20260911162556-f5fa1128b794 h1:2oBeIneg/f+m3/n8qLsQGlpEhdnAfW3kOI80yRv60pw= |
| -amadan.net/oficina/estilo.git v0.0.0-20260911162556-f5fa1128b794/go.mod h1:0R45/vCUAT+kpS7S6K/ZxBdE8f7YxFN4HT3HyDJ3nPY= |
| +amadan.net/oficina/estilo.git v0.0.0-20260911182719-0bcb9287988d h1:3HsB96tGs+P0tGf2VzqpqA8yqYBhJ+apBh2txAoz9qI= |
| +amadan.net/oficina/estilo.git v0.0.0-20260911182719-0bcb9287988d/go.mod h1:0R45/vCUAT+kpS7S6K/ZxBdE8f7YxFN4HT3HyDJ3nPY= |
| amadan.net/oficina/home/connect v0.0.0-20260910000424-5b8d8410775f h1:lkw3tjzHfZxe74pNfo+tGDz4mkZLg+D6R+FTkmsym6M= |
| amadan.net/oficina/home/connect v0.0.0-20260910000424-5b8d8410775f/go.mod h1:YroavXe43Wietec+po8mtSk4a9Bir2h31Q3iAf4MWxI= |
| amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489 h1:RPKtyry/71i06o8L+gjAaUyexbmG56kO1YPs601URAM= |
| @@ -8,6 +8,8 @@ amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd h1:jlFSt95M |
| amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd/go.mod h1:RpyHVPD0udcSfHJroY0KZE/FUjgw6Tvfo8SJm2qeZGE= |
| github.com/BurntSushi/toml v1.6.0 h1:dRaEfpa2VI55EwlIW72hMRHdWouJeRF7TPYhI+AUQjk= |
| github.com/BurntSushi/toml v1.6.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho= |
| +github.com/carlosframework/rastrillo v0.23.0 h1:tKAAlwPt4Pg/rkqk7o6jvV12bbZ0r34oEVpuOlKfX7w= |
| +github.com/carlosframework/rastrillo v0.23.0/go.mod h1:pZlrE5F5OhspvZFzef0DrfjHAjA8FXycb9J5/8vc8Tw= |
| github.com/chromedp/cdproto v0.0.0-20250724212937-08a3db8b4327 h1:UQ4AU+BGti3Sy/aLU8KVseYKNALcX9UXY6DfpwQ6J8E= |
| github.com/chromedp/cdproto v0.0.0-20250724212937-08a3db8b4327/go.mod h1:NItd7aLkcfOA/dcMXvl8p1u+lQqioRMq/SqDp71Pb/k= |
| github.com/chromedp/chromedp v0.14.2 h1:r3b/WtwM50RsBZHMUm9fsNhhzRStTHrKdr2zmwbZSzM= |
diff --git a/internal/meet/credits.go b/internal/meet/credits.go| index 521ce89..064ac87 100644 |
| --- a/internal/meet/credits.go |
| +++ b/internal/meet/credits.go |
| @@ -16,19 +16,24 @@ type creditInventory struct { |
| MissingNotices []string `json:"missing_notices"` |
| } |
| -func (a *app) credits(w http.ResponseWriter, r *http.Request) { |
| +var embeddedCredits = func() creditInventory { |
| var inventory creditInventory |
| if err := json.Unmarshal(creditNotices, &inventory); err != nil { |
| - http.Error(w, "something went wrong", http.StatusInternalServerError) |
| - return |
| + panic(err) |
| } |
| + return inventory |
| +}() |
| + |
| +func (a *app) credits(w http.ResponseWriter, r *http.Request) { |
| + |
| w.Header().Set("Content-Type", "text/html; charset=utf-8") |
| w.Header().Set("Cache-Control", "no-store") |
| w.Header().Set("Referrer-Policy", "no-referrer") |
| - render(w, "credits", a.page(r, map[string]any{"Data": credits.PageData{Title: "Open source", Components: inventory.Components}})) |
| + render(w, "credits", a.page(r, map[string]any{"Data": credits.PageData{Title: "Open source", MissingNoticeLabel: "No notice file is included in this release.", Components: embeddedCredits.Components}})) |
| } |
| func serveCreditsCSS(w http.ResponseWriter, r *http.Request) { |
| w.Header().Set("Content-Type", "text/css; charset=utf-8") |
| + w.Header().Set("Cache-Control", "no-cache") |
| w.Write(credits.CSS()) |
| } |
diff --git a/internal/meet/credits_test.go b/internal/meet/credits_test.go| index 5598199..dc01ca9 100644 |
| --- a/internal/meet/credits_test.go |
| +++ b/internal/meet/credits_test.go |
| @@ -22,7 +22,7 @@ func TestCreditsArePublicAndContainDependencyNotices(t *testing.T) { |
| if response.Header().Get("Cache-Control") != "no-store" || response.Header().Get("Referrer-Policy") != "no-referrer" { |
| t.Fatal("credits shell may retain account context") |
| } |
| - for _, wanted := range []string{"estilo-credits", "Open source", "Lucide and Feather", "gorm.io/gorm", "gormlite/LICENSE", "/static/credits.css"} { |
| + for _, wanted := range []string{"No notice file is included in this release.", "estilo-credits", "Open source", "Lucide and Feather", "gorm.io/gorm", "gormlite/LICENSE", "/static/credits.css"} { |
| if !strings.Contains(response.Body.String(), wanted) { |
| t.Fatal("missing credit", wanted) |
| } |