diff --git a/.gitignore b/.gitignore index 65ebe5f..b5d5740 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,7 @@ -node_modules/ -dist/ -.env -data/ -*.db -__pycache__/ -.DS_Store +node_modules/ +dist/ +.env +data/ +*.db +__pycache__/ +.DS_Store diff --git a/Dockerfile b/Dockerfile index bb173d1..70010a5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -44,13 +44,4 @@ ENV PORT=3001 # JWT_SECRET doit être injecté via variable d'environnement au runtime HEALTHCHECK --interval=30s --timeout=10s --start-period=20s --retries=3 \ - CMD wget -qO- http://localhost:3001/api/health || exit 1 - -EXPOSE 3001 - -# Volume pour SQLite DB + uploads (persistant entre les redémarrages) -VOLUME ["/app/data"] - -# ts-node --transpile-only : contourne les erreurs de compilation tsc -# (dist/index.js produit par tsc est tronqué sur certains environnements Alpine) -CMD ["node_modules/.bin/ts-node", "--transpile-only", "src/index.ts"] + CMD wget -qO- http://localhost: \ No newline at end of file diff --git a/backend/package.json b/backend/package.json index a66a735..1a52f02 100644 --- a/backend/package.json +++ b/backend/package.json @@ -34,6 +34,4 @@ "@types/uuid": "^10.0.0", "drizzle-kit": "^0.22.7", "ts-node-dev": "^2.0.0", - "typescript": "^5.4.5" - } -} + "typescript": "^5.4 \ No newline at end of file diff --git a/backend/src/index.ts b/backend/src/index.ts index 932fdc5..429aa4f 100644 --- a/backend/src/index.ts +++ b/backend/src/index.ts @@ -47,13 +47,15 @@ app.use('/api/export', exportRouter) // ─── Serve Frontend (production) ───────────────────────────────────────────── const publicDir = path.join(__dirname, '..', 'public') if (fs.existsSync(publicDir)) { - app.use(express.static(publicDir)) - app.get('*', (_req, res) => res.sendFile(path.join(publicDir, 'index.html'))) -} + // Service worker — jamais mis en cache (sinon l'ancien SW continue après déploiement) + app.get('/sw.js', (_req, res) => { + res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') + res.setHeader('Pragma', 'no-cache') + res.setHeader('Expires', '0') + res.sendFile(path.join(publicDir, 'sw.js')) + }) -// ─── Start ──────────────────────────────────────────────────────────────────── -app.listen(PORT, () => { - console.log(`✓ ShootTracker backend → http://localhost:${PORT}`) - console.log(` Uploads : ${UPLOADS_DIR}`) - console.log(` AI : ${process.env.AI_SERVICE_URL || 'http://localhost:8000'}`) -}) + // Manifeste PWA — pas de cache long + app.get(/\.webmanifest$/, (_req, res, next) => { + res.setHeader('Cache-Control', 'no-cache, no-store, must-revalidate') + res.set \ No newline at end of file diff --git a/backend/src/routes/export.ts b/backend/src/routes/export.ts index b58f384..9e9a2fb 100644 --- a/backend/src/routes/export.ts +++ b/backend/src/routes/export.ts @@ -168,5 +168,4 @@ exportRouter.get('/excel', (req: AuthRequest, res) => { const filename = `shoottracker_${format(new Date(), 'yyyy-MM-dd')}.xlsx` res.setHeader('Content-Type', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet') res.setHeader('Content-Disposition', `attachment; filename="${filename}"`) - res.send(XLSX.write(wb, { type: 'buffer', bookType: 'xlsx' })) -}) + res.send(XLSX.write(wb, { type: 'buffer', bookType: \ No newline at end of file diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 8b918f5..dbf3fd5 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -16,4 +16,3 @@ }, "include": ["src/**/*"], "exclude": ["node_modules", "dist"] -} diff --git a/docker-compose.yml b/docker-compose.yml index 904fdc0..ddd2cec 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -56,13 +56,4 @@ services: - yolo_models:/root/.config/Ultralytics healthcheck: test: ["CMD", "wget", "-qO-", "http://localhost:8000/health"] - interval: 30s - timeout: 15s - retries: 3 - start_period: 60s - -volumes: - shoottracker_data: - driver: local - yolo_models: - driver: local + interval: \ No newline at end of file diff --git a/frontend/package.json b/frontend/package.json index afec696..643fbdb 100644 Binary files a/frontend/package.json and b/frontend/package.json differ diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index f6ff403..448279a 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -25,12 +25,13 @@ export default defineConfig({ }, workbox: { globPatterns: ['**/*.{js,css,html,ico,png,svg,woff2}'], + cleanupOutdatedCaches: true, runtimeCaching: [ { urlPattern: /^\/api\/.*/i, handler: 'NetworkFirst', options: { - cacheName: 'api-cache', + cacheName: 'shoottracker-api-cache', expiration: { maxEntries: 50, maxAgeSeconds: 60 * 5 }, networkTimeoutSeconds: 10, } @@ -46,8 +47,4 @@ export default defineConfig({ '/uploads': { target: 'http://localhost:3001', changeOrigin: true } } }, - build: { - outDir: 'dist', - sourcemap: false - } -}) + build: \ No newline at end of file