feat: initial commit — antigravity proxy with MITM, standalone LS, and snapshot tooling

This commit is contained in:
Nikketryhard
2026-02-14 02:24:35 -06:00
commit d5e7f09225
30 changed files with 9980 additions and 0 deletions

36
src/api/util.rs Normal file
View File

@@ -0,0 +1,36 @@
//! Shared utilities for API handlers.
use axum::{
http::StatusCode,
response::{sse::Event, IntoResponse, Json},
};
use std::time::{SystemTime, UNIX_EPOCH};
use super::types::{ErrorDetail, ErrorResponse};
pub(crate) fn err_response(
status: StatusCode,
message: String,
error_type: &str,
) -> axum::response::Response {
let body = ErrorResponse {
error: ErrorDetail {
message,
error_type: error_type.to_string(),
},
};
(status, Json(body)).into_response()
}
pub(crate) fn now_unix() -> u64 {
SystemTime::now()
.duration_since(UNIX_EPOCH)
.unwrap_or_default()
.as_secs()
}
pub(crate) fn responses_sse_event(event_type: &str, data: serde_json::Value) -> Event {
Event::default()
.event(event_type)
.data(serde_json::to_string(&data).unwrap())
}