For users uploading:

- POST /api/upload now returns text/event-stream instead of JSON
  - Per-file progress events stream back as each file is processed: ↓ 3/47 (6%) — morning_ride.fit
  - Final done event shows the summary: "12 added, 35 duplicates"
  - The Vite proxy is configured to stream this properly (no buffering)

  For the admin:
  - New GET /api/admin/jobs endpoint (admin-only) returns the list of active upload jobs, each with
  user, started_at, total, done, current (filename being processed)
  - A pulsing amber badge appears in the nav bar for admins when any user has an active upload running
   — it shows e.g. "2 uploads running" with a tooltip listing each user's progress (@alice: 12/50
  files)
  - Polls every 5 seconds, disappears automatically when all jobs finish
This commit is contained in:
Davide Scaini
2026-04-11 08:33:21 +02:00
parent 01db4eb9ae
commit 82830222ba
4 changed files with 302 additions and 153 deletions
+4 -3
View File
@@ -25,10 +25,11 @@ export default defineConfig({
// In production nginx handles this — same pattern, no code change needed.
server: {
proxy: {
// SSE response to a POST — Vite's default proxy buffers the full body before
// forwarding, which breaks streaming and can cause EPIPE on long uploads.
// Both /api/upload and /api/upload/strava-zip return SSE streams in response
// to POST requests. Vite's default proxy buffers the full body before forwarding,
// which breaks streaming and causes EPIPE on long uploads.
// selfHandleResponse + manual pipe sends chunks as they arrive.
'/api/upload/strava-zip': {
'/api/upload': {
target: serveTarget,
changeOrigin: true,
selfHandleResponse: true,