Files
paliad/internal/handlers/changelog.go
m 460736ad1e refactor(t-paliad-092): rename Go module path patholo → paliad
F-6 from t-paliad-074 architecture audit. The Gitea repo was renamed
m/patholo → mAi/paliad → m/paliad, but go.mod still declared
`mgit.msbls.de/m/patholo` and every internal import echoed the
pre-rebrand name.

Sweep:
- go.mod: module path → mgit.msbls.de/m/paliad
- All *.go files: imports rewritten via sed
- README.md, docs/design-kanzlai-integration.md: mAi/paliad → m/paliad
- Frontend issue-reference comments (mAi/paliad#N → m/paliad#N) in
  i18n.ts, theme.ts, sidebar.ts, app.ts, Sidebar.tsx, PWAHead.tsx,
  global.css

Verified: go build/vet/test ./... clean, bun run build clean,
no remaining mgit.msbls.de/m/patholo or mAi/paliad references
outside docs that intentionally describe the rename history.
2026-04-30 16:46:31 +02:00

32 lines
1.2 KiB
Go

package handlers
import (
"net/http"
"mgit.msbls.de/m/paliad/internal/changelog"
)
// handleChangelogPage serves the static /changelog HTML shell. The entries
// are fetched client-side via /api/changelog.
func handleChangelogPage(w http.ResponseWriter, r *http.Request) {
http.ServeFile(w, r, "dist/changelog.html")
}
// handleChangelogAPI returns every entry, newest first.
func handleChangelogAPI(w http.ResponseWriter, r *http.Request) {
writeJSON(w, http.StatusOK, changelog.All())
}
// handleChangelogUnseenCount returns how many entries are newer than the
// ?since=<ISO timestamp> query parameter. Missing / empty since is treated
// as "never seen" so the badge shows on a user's very first session.
//
// ISO 8601 timestamps compare correctly as strings against YYYY-MM-DD
// entry dates (a timestamp for 2026-04-22T10:00:00Z sorts after the date
// "2026-04-22", which is what we want — same-day entries posted at 00:00
// are considered seen by mid-day callers).
func handleChangelogUnseenCount(w http.ResponseWriter, r *http.Request) {
since := r.URL.Query().Get("since")
writeJSON(w, http.StatusOK, map[string]int{"count": changelog.UnseenCount(since)})
}