Add exercise numbers, image uploads, version display, session resume, and training sparklines

- Exercise number (UF#): optional field on exercises, displayed in cards, training, and sets
- Import training plan numbers via migration 005 (UPDATE by name)
- Exercise images: JPG upload with multi-image support per exercise (migration 006)
- Version endpoint (GET /api/v1/version) with ldflags injection in Makefile and Dockerfile
- Version displayed on settings page
- Session resume: GET /api/v1/sessions/active endpoint, auto-resume on training page load
- Block new session while one is active (409 Conflict)
- e1RM sparkline chart per exercise during training (Epley formula)
- Fix CORS: add X-User-ID to allowed headers

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Christoph K.
2026-03-27 08:37:29 +01:00
parent 833ad04a6f
commit 063aa67615
32 changed files with 1457 additions and 32 deletions

View File

@@ -12,6 +12,9 @@ import (
"krafttrainer/static"
)
// Version wird beim Build per ldflags gesetzt.
var Version = "dev"
func main() {
// Datenbank initialisieren
s, err := store.New("krafttrainer.db")
@@ -30,6 +33,13 @@ func main() {
mux := http.NewServeMux()
h := handler.New(s)
h.RegisterRoutes(mux)
h.RegisterImageRoutes(mux)
// Version-Endpoint
mux.HandleFunc("GET /api/v1/version", func(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
w.Write([]byte(`{"version":"` + Version + `"}`))
})
// SPA-Fallback: statische Dateien aus embed.FS servieren
mux.Handle("/", spaHandler(static.FS))