Commit graph

4 commits

Author SHA1 Message Date
Florian
290f9be7b9 fix+perf: corrections de revue (currentEcheance, dayOfYear, SWR, last-good, doc apikey)
- vigilance: currentEcheance basée sur productDatetime (jour calme renvoyait J1 à tort)
- normales: dayOfYear extrait en Europe/Paris pour 'now' (UTC mélangeait les jours après minuit)
- meteofrance-auth + CLAUDE.md: header `apikey:` documenté correctement (pas Authorization Bearer)
- cache: SWR — envelope {v, fu}, hard TTL = ttl*6, refresh background avec lock anti-stampede
- vigilance: snapshot last-good (TTL 30j) écrit à chaque fetch, fallback final si MF+ODS KO
- vigilance: nettoyage variable url morte dans fetchOpendatasoft

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 18:58:03 +02:00
Florian
5fbbec4902 fix(mf): utiliser header apikey: au lieu de Bearer (API Key longue durée)
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run
Le portail-api.meteofrance.fr utilise 2 mécanismes d auth différents :
- Token OAuth2 court (1h) → header Authorization: Bearer <token>
- API Key longue durée    → header apikey: <key>

On utilise la 2e, donc switch du header.

+ data-sources/Bulletin_Vigilance_swagger.json (gitignored mais utile en local
  pour préparer le switch Opendatasoft → Vigilance officielle Météo France).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 00:32:33 +02:00
Florian
a849977fcc refactor(mf): API Key longue durée au lieu d OAuth2 client_credentials
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run
Le portail Météo France ne propose pas le flow client_credentials gratuit
(seulement token OAuth2 court 1h, pas viable, ou API Key longue durée).
On simplifie : un seul env METEOFRANCE_API_KEY → Authorization: Bearer.

- lib/meteofrance-auth.ts : suppression du cache token + flow refresh
- .env.tmpl : ref unique vers vault Infra/Météo France API/api_key
- vault item recréé avec api_key (hidden) + created_at + expires_at
- CLAUDE.md projet : section rotation API key

L onglet 24 h n apparaît qu une fois api_key non vide dans le vault.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 00:25:54 +02:00
Florian
2c4d91ce2f feat: graph T° interactif + widget iframe + MF auth + E2E Playwright
Some checks are pending
Deploy info-canicule / deploy (push) Waiting to run
Graph T° (TemperatureChartInteractive.astro) :
- Onglets 24 h / 7 j / 30 j (toggle JS, séries serialisées au SSR)
- Hover vertical line + tooltip valeurs
- Overlay normales mois en pointillé (TX orange, TN bleu)
- Onglet 24 h dispo seulement si l'API MF a répondu (best-effort)

Météo France OAuth2 (lib/meteofrance-auth.ts + observations.ts) :
- client_credentials avec refresh auto, cache token Valkey
- Fallback METEOFRANCE_STATIC_TOKEN pour debug
- /synop endpoint pour 24h horaires par station SYNOP du dept
- Mapping dept → station SYNOP la plus proche (src/data/stations-synop.json)
- En attente de creds : SDK skip silencieusement, l'onglet 24h n'apparaît pas

Widget iframe (/embed/dept/[code] + /embed doc) :
- Layout minimal sans header/footer global
- Réutilisable via iframe avec une ligne
- Page /embed avec snippet copier-coller + aperçu live

Tests E2E Playwright (tests/e2e/) :
- home (carte 96 paths, tooltip dept, navigation)
- api (health, vigilance, vigilance/dept)
- departement (tabs période, DROM notice, 404)
- static pages (a-propos, mentions, dependances, soutenir, conseils, embed)
- embed widget (rendu minimal, headers X-Frame OK)
- 20+ tests, run via pnpm test:e2e (live) ou test:e2e:local

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 00:14:05 +02:00