# DIUN Webhook Dashboard A tiny Go web app that receives [DIUN](https://crazymax.dev/diun/) webhook events and shows the latest image updates in a simple UI. - Receives DIUN webhooks at `POST /webhook` - Serves a minimal dashboard at `/` - Exposes a read-only API at `GET /api/updates` - Stores events in memory (ephemeral) ## Quick start ### Run locally (Go 1.26+) ```bash go run . # open http://localhost:8080 ``` ### Docker ```bash docker build -t diun-webhook-dashboard . docker run --rm -p 8080:8080 diun-webhook-dashboard # open http://localhost:8080 ``` ### Docker Compose ```bash docker compose up -d # open http://localhost:8080 ``` ## DIUN configuration example Configure DIUN to send webhooks to this app. Example (YAML): ```yaml notif: webhook: enable: true endpoint: http://your-host-or-ip:8080/webhook ``` Expected JSON payload (simplified): ```json { "image": "library/nginx", "tag": "1.27.0", "status": "new", "time": "2026-02-23T16:00:00Z" } ``` ## API - `POST /webhook` — accept a DIUN event JSON body. - `GET /api/updates` — return the latest events as a JSON object keyed by image name. - `/` — static HTML dashboard. Note: data is only kept in-memory and will be reset on restart. ## Project Structure - `cmd/diunwebhook/` — main application source and tests - `static/` — static assets - `Dockerfile`, `docker-compose.yml`, `go.mod`, `go.sum` — project config/build files ## Development - Code: `main.go` - Static assets: `static/` - Container image: `Dockerfile` ## Production notes - Behind a reverse proxy, ensure the app is reachable at `/webhook` from DIUN. - Persistence is not implemented; hook up a store (e.g., BoltDB/Redis/Postgres) if you need durability. - Consider adding auth, rate limiting, or a secret/token on the webhook endpoint if exposed publicly. ## Testing Run unit tests and check coverage: ```bash go test -v -cover ``` Aim for 80–90% coverage. Coverage below 80% will emit a warning in CI but will not fail the pipeline. ## CI/CD with Gitea Actions A sample Gitea Actions workflow is provided in `.gitea/workflows/ci.yml` to automate build, test, and coverage checks. ## License MIT — see `LICENSE`.