oficina / calendar Public

Adopt shared credits accessibility and cache fixes

Paul Campbell pushed by paul@keymail.dev b635204557ca4eb849213d5dfaab748f5bfc6b8b parent 167a8b5
5 files changed, +16 −10
  • Makefile +1 −0
  • go.mod +3 −1
  • go.sum +2 −4
  • internal/calendar/credits.go +9 −4
  • internal/calendar/credits_test.go +1 −1

CI passed — run details

diff --git a/Makefile b/Makefile
index 65e1a35..510cc7f 100644
--- a/Makefile
+++ b/Makefile
@@ -1,3 +1,4 @@
+export GOTOOLCHAIN := go1.26.5
export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git
APP := calendar
diff --git a/go.mod b/go.mod
index 10dbd5b..5aba938 100644
--- a/go.mod
+++ b/go.mod
@@ -2,6 +2,8 @@ module amadan.net/oficina/calendar
go 1.25.0
+toolchain go1.26.5
+
require (
amadan.net/oficina/home/connect v0.0.0-20260910000424-5b8d8410775f
amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489
@@ -12,7 +14,7 @@ require (
gorm.io/gorm v1.31.2
)
-require amadan.net/oficina/estilo.git v0.0.0-20260911162556-f5fa1128b794 // indirect
+require amadan.net/oficina/estilo.git v0.0.0-20260911182719-0bcb9287988d
require (
github.com/BurntSushi/toml v1.6.0 // indirect
diff --git a/go.sum b/go.sum
index 13599b2..e9f169a 100644
--- a/go.sum
+++ b/go.sum
@@ -1,7 +1,5 @@
-amadan.net/oficina/estilo.git v0.0.0-20260909234655-dec3908b237c h1:LgE7WLm6zMG/qZScoAHb4X2gguzorctB4XGjPYavXts=
-amadan.net/oficina/estilo.git v0.0.0-20260909234655-dec3908b237c/go.mod h1:0R45/vCUAT+kpS7S6K/ZxBdE8f7YxFN4HT3HyDJ3nPY=
-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=
diff --git a/internal/calendar/credits.go b/internal/calendar/credits.go
index 74a00d7..60999fd 100644
--- a/internal/calendar/credits.go
+++ b/internal/calendar/credits.go
@@ -16,19 +16,24 @@ type creditInventory struct {
MissingNotices []string `json:"missing_notices"`
}
-func (h *handlers) 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 (h *handlers) 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", h.page(r, "Open source", credits.PageData{Title: "Open source", Components: inventory.Components}))
+ render(w, "credits", h.page(r, "Open source", 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/calendar/credits_test.go b/internal/calendar/credits_test.go
index 0e380bf..ba2a304 100644
--- a/internal/calendar/credits_test.go
+++ b/internal/calendar/credits_test.go
@@ -21,7 +21,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)
}