Adopt shared credits accessibility and cache fixes
5 files changed,
+17
−14
Makefile+1 −0go.mod+3 −1go.sum+2 −6internal/home/credits.go+10 −6internal/home/credits_test.go+1 −1
CI passed — run details
diff --git a/Makefile b/Makefile| index 35d6221..0059c25 100644 |
| --- a/Makefile |
| +++ b/Makefile |
| @@ -1,3 +1,4 @@ |
| +export GOTOOLCHAIN := go1.26.5 |
| export GOPRIVATE := $(GOPRIVATE),amadan.net/oficina/estilo.git |
| private_comma := , |
diff --git a/go.mod b/go.mod| index 2a2c726..5f720d8 100644 |
| --- a/go.mod |
| +++ b/go.mod |
| @@ -2,8 +2,10 @@ module amadan.net/oficina/home |
| go 1.25.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/handoff v0.0.0-20260908102137-481d2d57f489 |
| amadan.net/oficina/home/roster v0.0.0-20260908123429-74dda570e0cf |
| amadan.net/rastrillo/rastrillo v0.26.1-0.20260908075707-29e4491631bd |
diff --git a/go.sum b/go.sum| index ef4f463..5ceb83e 100644 |
| --- a/go.sum |
| +++ b/go.sum |
| @@ -1,11 +1,7 @@ |
| amadan.net/carlos/platform.git/launchctx v0.0.0-20260911135504-fb577f96f7d1 h1:RxwIRojWcVtwSdNAjtdz7y1bxHLh3GUgqT1TrXVKpyM= |
| amadan.net/carlos/platform.git/launchctx v0.0.0-20260911135504-fb577f96f7d1/go.mod h1:6fBmMWgtESLFXZURzu/HyRXM0vyLuo4+XGGdKuZ+wao= |
| -amadan.net/oficina/estilo.git v0.0.0-20260908001419-672a447da335 h1:YogZKYINrPNXRfPedXxOIDbGCMY4ff7yAdohYphEWMg= |
| -amadan.net/oficina/estilo.git v0.0.0-20260908001419-672a447da335/go.mod h1:0R45/vCUAT+kpS7S6K/ZxBdE8f7YxFN4HT3HyDJ3nPY= |
| -amadan.net/oficina/estilo.git v0.0.0-20260911160533-5eea6ef4adc9 h1:yUmgWcVkcifYWkAUZ6jboE26A26r376e/Vv3Gu1w2/g= |
| -amadan.net/oficina/estilo.git v0.0.0-20260911160533-5eea6ef4adc9/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/handoff v0.0.0-20260908102137-481d2d57f489 h1:RPKtyry/71i06o8L+gjAaUyexbmG56kO1YPs601URAM= |
| amadan.net/oficina/home/handoff v0.0.0-20260908102137-481d2d57f489/go.mod h1:YISpzFJ+iMgrM0rUL032OSzsAQbP4/nozvXLCCOcn1k= |
| amadan.net/oficina/home/roster v0.0.0-20260908123429-74dda570e0cf h1:SRKjCUgtk42WwR7VSn+V0eLNk20mfiY8dQmzdw13Sbo= |
diff --git a/internal/home/credits.go b/internal/home/credits.go| index 50ff3e6..1c469ff 100644 |
| --- a/internal/home/credits.go |
| +++ b/internal/home/credits.go |
| @@ -17,14 +17,18 @@ type creditInventory struct { |
| MissingNotices []string `json:"missing_notices"` |
| } |
| +var embeddedCredits = func() creditInventory { |
| + var inventory creditInventory |
| + if err := json.Unmarshal(creditNotices, &inventory); err != nil { |
| + panic(err) |
| + } |
| + return inventory |
| +}() |
| + |
| func (a *App) mountCredits(r chi.Router) { |
| r.Get("/help/open-source", func(w http.ResponseWriter, r *http.Request) { |
| - var inventory creditInventory |
| - if err := json.Unmarshal(creditNotices, &inventory); err != nil { |
| - http.Error(w, "internal error", http.StatusInternalServerError) |
| - return |
| - } |
| - a.render(w, http.StatusOK, "credits.html", credits.PageData{Title: "Open source", Components: inventory.Components}) |
| + |
| + a.render(w, http.StatusOK, "credits.html", credits.PageData{Title: "Open source", MissingNoticeLabel: "No notice file is included in this release.", Components: embeddedCredits.Components}) |
| }) |
| r.Get("/static/credits.css", serveAsset(credits.CSS(), "text/css; charset=utf-8")) |
| } |
diff --git a/internal/home/credits_test.go b/internal/home/credits_test.go| index a640fc1..4a2b08f 100644 |
| --- a/internal/home/credits_test.go |
| +++ b/internal/home/credits_test.go |
| @@ -28,7 +28,7 @@ func TestCreditsArePublicOnKnownHostsAndDoNotStartSignin(t *testing.T) { |
| t.Fatalf("%s credits started authentication: %d", name, response.Code) |
| } |
| body := response.Body.String() |
| - for _, wanted := range []string{"Open source", "estilo-credits", "Go", "modernc.org/sqlite", "gorm.io/gorm", "gormlite/LICENSE", "Permission", "/static/credits.css"} { |
| + for _, wanted := range []string{"No notice file is included in this release.", "Open source", "estilo-credits", "Go", "modernc.org/sqlite", "gorm.io/gorm", "gormlite/LICENSE", "Permission", "/static/credits.css"} { |
| if !strings.Contains(body, wanted) { |
| t.Fatalf("%s credits missing %s", name, wanted) |
| } |