Initial commit: OpenFUT Bridge
FIFA 23 reverse-engineering proxy and integration scaffold. - Catch-all HTTP proxy that captures all incoming FIFA 23 traffic - Known-route mapper (speculative FUT paths → Core API calls) - Placeholder JSON responses for unmapped endpoints - Admin endpoints: GET /_bridge/captures, GET /_bridge/unknown - Capture persistence to captures/*.json for RE analysis - 4 unit tests passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
use axum::{extract::State, Json};
|
||||
use serde_json::{json, Value};
|
||||
|
||||
use crate::{capture::load_all_captures, error::BridgeResult, proxy::ProxyState};
|
||||
|
||||
/// List all captured requests.
|
||||
pub async fn get_captures(State(state): State<ProxyState>) -> BridgeResult<Json<Value>> {
|
||||
let captures = load_all_captures(&state.config.captures_dir)
|
||||
.map_err(crate::error::BridgeError::Internal)?;
|
||||
|
||||
let unknown: Vec<_> = captures
|
||||
.iter()
|
||||
.filter(|c| c.mapped_to_core.is_none())
|
||||
.collect();
|
||||
|
||||
Ok(Json(json!({
|
||||
"total": captures.len(),
|
||||
"unknown_endpoints": unknown.len(),
|
||||
"captures": captures,
|
||||
})))
|
||||
}
|
||||
|
||||
/// List only unknown (unmapped) endpoints.
|
||||
pub async fn get_unknown_endpoints(State(state): State<ProxyState>) -> BridgeResult<Json<Value>> {
|
||||
let captures = load_all_captures(&state.config.captures_dir)
|
||||
.map_err(crate::error::BridgeError::Internal)?;
|
||||
|
||||
let mut seen = std::collections::HashSet::new();
|
||||
let unknown: Vec<Value> = captures
|
||||
.iter()
|
||||
.filter(|c| c.mapped_to_core.is_none())
|
||||
.filter_map(|c| {
|
||||
let key = format!("{} {}", c.method, c.path);
|
||||
if seen.insert(key) {
|
||||
Some(json!({
|
||||
"method": c.method,
|
||||
"path": c.path,
|
||||
"first_seen": c.timestamp,
|
||||
"capture_id": c.id,
|
||||
}))
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.collect();
|
||||
|
||||
Ok(Json(json!({
|
||||
"unknown_endpoint_count": unknown.len(),
|
||||
"endpoints": unknown,
|
||||
})))
|
||||
}
|
||||
Reference in New Issue
Block a user