add pymc console endpoints and ui

This commit is contained in:
Lloyd
2026-01-02 16:35:18 +00:00
parent 7d4a779939
commit 8b8edb9929
6 changed files with 327 additions and 266 deletions
+1
View File
@@ -728,6 +728,7 @@ class RepeaterHandler(BaseHandler):
"direct_tx_delay_factor": delays_config.get("direct_tx_delay_factor", 0.5),
"rx_delay_base": delays_config.get("rx_delay_base", 0.0),
},
"web": self.config.get("web", {}), # Include web configuration
},
"public_key": None,
}
+60
View File
@@ -599,6 +599,66 @@ class APIEndpoints:
logger.error(f"Error updating duty cycle config: {e}")
return self._error(str(e))
@cherrypy.expose
@cherrypy.tools.json_out()
def check_pymc_console(self):
"""Check if PyMC Console directory exists."""
self._set_cors_headers()
if cherrypy.request.method == "OPTIONS":
return ""
try:
pymc_console_path = '/opt/pymc_console/web/html'
exists = os.path.isdir(pymc_console_path)
return self._success({
"exists": exists,
"path": pymc_console_path
})
except Exception as e:
logger.error(f"Error checking PyMC Console directory: {e}")
return self._error(str(e))
@cherrypy.expose
@cherrypy.tools.json_out()
@cherrypy.tools.json_in()
def update_web_config(self):
"""Update web configuration (CORS, frontend path) using ConfigManager."""
self._set_cors_headers()
if cherrypy.request.method == "OPTIONS":
return ""
try:
self._require_post()
updates = cherrypy.request.json or {}
if not updates:
return self._error("No configuration updates provided")
# Use ConfigManager to update and save configuration
# Web changes (CORS, web_path) don't require live update
result = self.config_manager.update_and_save(
updates=updates,
live_update=False
)
if result.get("success"):
logger.info(f"Web configuration updated: {list(updates.keys())}")
return self._success({
"persisted": result.get("saved", False),
"message": "Web configuration saved successfully. Restart required for changes to take effect."
})
else:
return self._error(result.get("error", "Failed to update web configuration"))
except cherrypy.HTTPError:
raise
except Exception as e:
logger.error(f"Error updating web config: {e}")
return self._error(str(e))
@cherrypy.expose
@cherrypy.tools.json_out()
@cherrypy.tools.json_in()
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -8,8 +8,8 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;500;600;700&display=swap" rel="stylesheet">
<script type="module" crossorigin src="/assets/index-BAQsJZnI.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-B5977VlB.css">
<script type="module" crossorigin src="/assets/index-CTGOZYs8.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-cuiYbziQ.css">
</head>
<body>
<div id="app"></div>