Phase 12: bridge completeness — expanded mapper, request replay, full shaper coverage
Mapper (src/mapper.rs):
- Restructured into ExactRoute + PrefixRoute tables (was a flat match list)
- 38 exact mappings (up from 18): SBC, Draft, FUT Champs, Division Rivals,
Card Upgrades, Notifications, Settings, Trade pile, Club update, Stats, etc.
- 7 prefix-matched routes for path-param endpoints:
/ut/game/fut/draft/{id}[/pick|/abandon] → /draft/sessions/:id[/pick|/abandon]
/ut/game/fut/champs/{id}/result|claim → /fut-champs/:id/result|claim
/ut/game/fut/store/pack/{id}/open → /packs/open/:id
/ut/game/fut/item/{id} DELETE → /collection/:id (quick-sell)
/ut/game/fut/trade/{id} DELETE → /market/listings/:id (cancel)
/ut/game/fut/sbc/set/{id}/submission → /sbc/submit
- map_to_core_with_method() public helper preserves HTTP method for prefix routes
- 19 mapper unit tests (up from 6)
Replay (src/routes/admin.rs):
- POST /_bridge/captures/:id/replay — loads a capture from disk, re-runs it
against Core with original headers+body, returns original vs new response
plus a structured JSON diff for iterative shaper/handler development
Shaper (src/shaper.rs):
- 14 new shaper functions covering every mapped Core path:
collection, cards, objectives, notifications, division, statistics,
sbc, pack-open, draft, fut-champs, chemistry-styles, my-listings
- Prefix dispatch for /packs/open/, /draft/sessions/, /fut-champs/ paths
- All 25 unit tests pass, clippy clean
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+5
-1
@@ -1,6 +1,6 @@
|
||||
use anyhow::Result;
|
||||
use axum::{
|
||||
routing::{any, delete, get},
|
||||
routing::{any, delete, get, post},
|
||||
Router,
|
||||
};
|
||||
use openfut_bridge::{config::Config, proxy::ProxyState, routes};
|
||||
@@ -72,6 +72,10 @@ fn build_router(state: ProxyState) -> Router {
|
||||
"/_bridge/captures/diff",
|
||||
get(routes::admin::get_capture_diff),
|
||||
)
|
||||
.route(
|
||||
"/_bridge/captures/:id/replay",
|
||||
post(routes::admin::post_replay_capture),
|
||||
)
|
||||
.fallback(any(openfut_bridge::proxy::catch_all_handler))
|
||||
.layer(TraceLayer::new_for_http())
|
||||
.layer(CorsLayer::permissive())
|
||||
|
||||
Reference in New Issue
Block a user