This commit is contained in:
Mateusz Gruszczyński committed 2026-10-04 22:53:33 +02:00
1 parent 174389e5b1
commit e6604e41fc
73 files changed
+1240 -201

No files matched your search

+31
View File
@@ -60,6 +60,9 @@ fn status_payload(state: &App) -> Value {
"custom_pages",
"rate_limit",
"country_access",
"method_policy",
"location_access_policy",
"configuration_history",
"cloudflare_client_ip",
"server_timing",
"static_cookie_cache",
@@ -332,6 +335,34 @@ async fn certificate_inventory(State(state): State<Arc<App>>) -> Json<Value> {
async fn configuration(State(state): State<Arc<App>>) -> Json<crate::config::Envelope> {
Json(state.config.load().envelope.clone())
}
#[derive(Deserialize)]
struct ConfigHistoryQuery {
revision: Option<u64>,
limit: Option<usize>,
}
async fn config_history(
State(state): State<Arc<App>>,
Query(query): Query<ConfigHistoryQuery>,
) -> Result<Json<Value>, ApiError> {
if let Some(revision) = query.revision {
let detail = state
.store
.configuration_revision(revision)
.await
.map_err(auth::internal)?
.ok_or_else(|| ApiError(StatusCode::NOT_FOUND, "configuration revision not found".into()))?;
return Ok(Json(json!({"revision": detail})));
}
let limit = query.limit.unwrap_or(512).clamp(1, 512);
let revisions = state
.store
.configuration_history(limit)
.await
.map_err(auth::internal)?;
Ok(Json(json!({"revisions": revisions})))
}
async fn update(
State(state): State<Arc<App>>,
Extension(session): Extension<Session>,