Shared state

This commit is contained in:
Andras Schmelczer 2026-03-17 21:08:32 +00:00
parent 53fff3efaa
commit 15fa09430b
25 changed files with 174 additions and 215 deletions

View file

@ -1,12 +1,13 @@
use std::sync::Arc;
use axum::extract::State;
use axum::http::header::HeaderValue;
use axum::http::{header, HeaderMap, StatusCode, Uri};
use axum::response::IntoResponse;
use metrics::histogram;
use tracing::{info, warn};
use crate::state::AppState;
use crate::state::{AppState, SharedState};
/// Fetch a JPEG screenshot from the screenshot service.
/// Used by both the `/api/screenshot` proxy and the xlsx export.
@ -39,10 +40,11 @@ pub async fn fetch_screenshot_bytes(
}
pub async fn get_screenshot(
state: Arc<AppState>,
State(shared): State<Arc<SharedState>>,
headers: HeaderMap,
uri: Uri,
) -> impl IntoResponse {
let state = shared.load_state();
let qs = uri.query().unwrap_or_default();
let auth = headers.get(header::AUTHORIZATION);
let is_og = qs.contains("og=1");