🔌 one routes! per path in the ai nest (two GETs cannot share one)
Browse files at this commit712ff31f765f7a4b37f604b0c40863b440fc9cf0Parent: 5176550- fix
- 🔌 one routes! per path in the ai nest (two GETs cannot share one)
1 changed file +11 -2
- src/web/ai.rs +11 -2
src/web/ai.rsmodified+11 -2
| @@ -1,5 +1,9 @@ | ||
| 1 | 1 | //! Public discovery for the AI bridge. |
| 2 | 2 | //! |
| 3 | +//! Two reads: the bridge's certificate, which a service needs before it can | |
| 4 | +//! dial in, and the capabilities currently on offer, which a client needs | |
| 5 | +//! before it offers an AI feature it cannot get an answer from. | |
| 6 | +//! | |
| 3 | 7 | //! An AI service needs the bridge's certificate before it can dial in, and the |
| 4 | 8 | //! certificate is regenerated on every boot when no PEM pair is configured. So |
| 5 | 9 | //! it is published here: the service fetches this over HTTP, pins what it gets, |
| @@ -14,6 +18,8 @@ | ||
| 14 | 18 | //! network, put a real certificate in `AI_TLS_CERT`/`AI_TLS_KEY` and distribute |
| 15 | 19 | //! it out of band. |
| 16 | 20 | |
| 21 | +use std::collections::BTreeMap; | |
| 22 | + | |
| 17 | 23 | use axum::Json; |
| 18 | 24 | use axum::extract::State; |
| 19 | 25 | use base64::Engine; |
| @@ -27,10 +33,13 @@ use crate::constant::AI_PROTOCOL; | ||
| 27 | 33 | use crate::error::{AppError, ErrorResponse}; |
| 28 | 34 | use crate::state::AppState; |
| 29 | 35 | use crate::web::CurrentUser; |
| 30 | -use std::collections::BTreeMap; | |
| 31 | 36 | |
| 32 | 37 | pub fn routes() -> OpenApiRouter<AppState> { |
| 33 | - OpenApiRouter::new().routes(routes!(bridge_certificate, capabilities)) | |
| 38 | + // One `routes!` per path: the multi-handler form groups methods under a | |
| 39 | + // single path, so two `get` handlers never share one. | |
| 40 | + OpenApiRouter::new() | |
| 41 | + .routes(routes!(bridge_certificate)) | |
| 42 | + .routes(routes!(capabilities)) | |
| 34 | 43 | } |
| 35 | 44 | |
| 36 | 45 | /// Everything a service needs to reach the bridge, except the shared token |