Commit Graph
5 Commits
Author SHA1 Message Date
Arnaud Dartois e49b0d73aa feat(c cameras): enforce camera-level access filtering in GetCamerasBySite and GetCamera (#179) 2026-08-30 10:09:25 +02:00
Arnaud Dartois f54bb596af feat(cameras): activer/désactiver une caméra depuis la liste (toggle status) (#151)
## Résumé

Ajoute un bouton toggle (play/stop) dans chaque tuile de la liste des caméras pour activer/désactiver une caméra directement depuis la vue liste, sans passer par la page détail.

## Changements

### API
- **`POST /api/cameras/{id}/toggle-status`** — endpoint dédié qui bascule entre `Online` et `Disabled`
- `ToggleCameraStatusCommand` + handler (Application layer)
- `ToggleCameraStatusAsync` dans `HeimdallApiClient`

### UI
- **`CameraTile.razor`** — bouton toggle ajouté (play/stop) entre View et Snapshot
- **`CamerasPage.razor`** — callback `OnToggleStatus` câblé + snackbar feedback
- **`CameraDetail.razor`** — migré vers le nouvel endpoint dédié (au lieu de `UpdateCameraAsync` avec status)

### Tests
- 4 unit tests (`ToggleCameraStatusCommandTests`)
- 2 integration tests (toggle + 404)
- Fix bUnit `CameraDetailTests` (mock PUT → POST)

## Closes
- Issue #59

Reviewed-on: https://forgejo.tordais.cc/nonobis/Heimdall/pulls/151
2026-08-19 22:38:34 +02:00
Arnaud Dartois 22ebcaf73a fix(web): 401 au premier rendu — cookie propagé aux appels API internes (Fixes #23)
Symptôme : après F5 sur une page authentifiée, les appels API des pages
(api/stats, api/agents…) renvoyaient 401 jusqu'à la connexion du circuit
Blazor. Cause : au rendu initial, AuthState est peuplé depuis le cookie
(AccessToken null → pas de Bearer) et le HttpClient serveur n'envoie pas
le cookie navigateur ; les contrôleurs n'acceptaient que JwtBearer.

Correctif :
- SameOriginHttpMessageHandler : propage le cookie d'authentification du
  HttpContext courant vers la requête interne quand aucun Bearer n'est
  posé (le Bearer du circuit prend le relais ensuite).
- Contrôleurs API humains : AuthenticationSchemes = 'JwtBearer,Cookies'
  (77 occurrences) — le cookie porte les mêmes claims de rôle/permission
  que le JWT.
- Vérifié en réel : F5 /dashboard → plus de snackbar 401, console propre,
  api/agents validé et 200 côté serveur. 182 tests Web verts.
2026-08-11 08:32:41 +02:00
Arnaud Dartois 1d1ac8387e feat(cqrs): update controllers, add AutoMapper profiles, SignalR notifications, Hangfire config
- 13 controllers migrated from service DI to IMediator dispatch
- 11 AutoMapper mapping profiles (Sites, Cameras, Auth, Users, Agents, Events, Assignments, Settings, Groups, Persons, Discovery)
- SignalR notifications bridged via MediatR INotificationHandler
- Hangfire config moved from Program.cs to Infrastructure/BackgroundJobs
- 0 build errors, 0 warnings
2026-07-22 19:54:55 +00:00
Arnaud Dartois 562aabdfc8 feat(api+web): merge REST API and Blazor UI into single process
Previously the API (heimdall-central) and Blazor UI (heimdall-web) ran as
separate containers with the Blazor Server making internal HTTP calls to
the API. This caused the Blazor circuit to disconnect when the API was
unreachable (network error → "Une erreur réseau est survenue").

Now both serve from the same .NET process on the same port:
- All 16 API controllers, ExceptionFilter, and SignalR hubs integrated
  into Heimdall.Web
- JWT auth, CORS, rate limiting configured in the unified Program.cs
- Dockerfile.central entrypoint runs web/Heimdall.Web.dll
- docker-compose simplified: heimdall-central service removed
- CI publishes heimdall-web image instead of heimdall-central

Also fixes timezone validation on Alpine/tzdata-less environments
and enables FluentValidation auto-validation in the API project.
2026-07-20 10:30:01 +00:00