unigateway 1.3.0

Lightweight, local-first LLM gateway for developers. A stable, single-binary unified entry point for all your AI tools and models.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::sync::Arc;

use axum::http::HeaderMap;

use crate::admin::AdminState;

pub(crate) async fn is_admin_authorized(state: &Arc<AdminState>, headers: &HeaderMap) -> bool {
    if !state.admin_token().is_empty() {
        let token = headers
            .get("x-admin-token")
            .and_then(|v| v.to_str().ok())
            .unwrap_or_default();
        return token == state.admin_token();
    }
    true
}