mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-03-04 23:27:46 +01:00
make the /api/config endpoint restrictive to what it provides. It will only show what is needed for the current code.
This commit is contained in:
@@ -1579,15 +1579,22 @@ async def api_stats(request):
|
||||
return web.json_response(stats)
|
||||
|
||||
|
||||
|
||||
@routes.get("/api/config")
|
||||
async def api_config(request):
|
||||
try:
|
||||
# Return CONFIG as JSON
|
||||
return web.json_response(CONFIG)
|
||||
site = CONFIG.get("site", {})
|
||||
safe_site = {
|
||||
"map_interval": site.get("map_interval", 3), # default 3 if missing
|
||||
"firehose_interval": site.get("firehose_interal", 3) # default 1000 if missing
|
||||
}
|
||||
|
||||
safe_config = {"site": safe_site}
|
||||
|
||||
return web.json_response(safe_config)
|
||||
except Exception as e:
|
||||
return web.json_response({"error": str(e)}, status=500)
|
||||
|
||||
|
||||
@routes.get("/api/edges")
|
||||
async def api_edges(request):
|
||||
edges_set = set()
|
||||
|
||||
Reference in New Issue
Block a user