commit 9bc2429422dff9a8419772928523b61ca9ebf502 Author: didericis Date: Tue May 5 19:15:19 2026 +0000 Initial: Gitea heatmap sidecar with private contributions diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..6446bd7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,9 @@ +/heatmap +/dist/ +*.test +*.out +.env +.envrc +.direnv/ +result +result-* diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4720da2 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +# syntax=docker/dockerfile:1 +FROM golang:1.23-alpine AS build +WORKDIR /src +COPY go.mod go.sum* ./ +RUN go mod download +COPY *.go ./ +RUN CGO_ENABLED=0 GOOS=linux go build -trimpath -ldflags="-s -w" -o /heatmap . + +FROM scratch +COPY --from=build /heatmap /heatmap +COPY --from=build /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ +EXPOSE 8080 +USER 65532:65532 +ENTRYPOINT ["/heatmap"] diff --git a/README.md b/README.md new file mode 100644 index 0000000..03ed44b --- /dev/null +++ b/README.md @@ -0,0 +1,147 @@ +# gitea-heatmap-sidecar + +A tiny HTTP service that exposes daily contribution counts for an allowlisted +Gitea user — **including private repo activity** — for rendering a +GitHub-style heatmap on a public profile page. + +Stock Gitea (and Forgejo) intentionally do not expose private contribution +counts to anonymous viewers. This is a sidecar workaround: read directly from +Gitea's `action` table with a read-only DB user, return per-day counts as +JSON, and let a custom profile template render the squares client-side. + +## What it shows / what it doesn't + +- ✅ Daily counts (the green squares) +- ✅ Hover tooltips with the date and count +- ❌ Repo names, commit messages, branches, file content — none of that ever + leaves the database. Only counts. + +## Architecture + +``` +[anonymous visitor] → GET /didericis (Gitea) + ↓ profile.tmpl override loads + +{{end}}