feat: UDP data forwarding to multiple downstream devices
- DataForwarder class in listener: sends raw packets to all enabled targets - REST API: GET/PUT /api/forward for managing targets - Settings page: add/remove/edit forward targets with host/port/name/enabled - Status endpoint includes forward_active count - Config persisted in data/config.json via forward_targets array
This commit is contained in:
@@ -31,6 +31,7 @@ async def get_status():
|
||||
"packet_count": telemetry_listener.packet_count,
|
||||
"last_packet_time": telemetry_listener.last_packet_time,
|
||||
"selected_game_id": cfg.get("selected_game_id"),
|
||||
"forward_active": telemetry_listener.forwarder.active,
|
||||
"latest_data": latest.to_dict() if latest else None,
|
||||
}
|
||||
|
||||
@@ -310,3 +311,21 @@ async def api_export_game_plugin(plugin_id: str):
|
||||
async def api_reload_game_plugins():
|
||||
game_plugin_manager.reload()
|
||||
return {"ok": True, "count": len(game_plugin_manager.list_all())}
|
||||
|
||||
|
||||
# ---- Data Forwarding ----
|
||||
@router.get("/forward")
|
||||
async def api_list_forward_targets():
|
||||
cfg = get_config()
|
||||
return cfg.get("forward_targets", [])
|
||||
|
||||
|
||||
@router.put("/forward")
|
||||
async def api_update_forward_targets(data: dict[str, Any]):
|
||||
targets = data.get("targets", [])
|
||||
cfg = get_config()
|
||||
cfg["forward_targets"] = targets
|
||||
from config.settings import save_config
|
||||
save_config(cfg)
|
||||
telemetry_listener.forwarder.reload_targets()
|
||||
return {"ok": True, "active": telemetry_listener.forwarder.active}
|
||||
|
||||
Reference in New Issue
Block a user