add indexing jobs, parsers, and search APIs

This commit is contained in:
2026-03-05 15:05:34 +01:00
parent 88db9805b5
commit 6eaf2ba5dc
17 changed files with 1548 additions and 46 deletions

View File

@@ -32,6 +32,18 @@ pub async fn require_admin(
Ok(next.run(req).await)
}
pub async fn require_read(
State(state): State<AppState>,
mut req: Request,
next: Next,
) -> Result<Response, ApiError> {
let token = bearer_token(&req).ok_or_else(|| ApiError::unauthorized("missing bearer token"))?;
let scope = authenticate(&state, token).await?;
req.extensions_mut().insert(scope);
Ok(next.run(req).await)
}
fn bearer_token(req: &Request) -> Option<&str> {
req.headers()
.get(AUTHORIZATION)