mirror of
https://github.com/pyMC-dev/pyMC_Repeater.git
synced 2026-11-03 11:52:22 +01:00
fix(repeater): delegate sensor endpoints from StatsApp to APIEndpoints
CherryPy mounts StatsApp at / but sensor endpoints are on APIEndpoints. Add @cherrypy.expose delegation methods so /sensors_types, /sensors_config, /sensors_config_update, and /sensors_read resolve correctly instead of falling through to the SPA catch-all.
This commit is contained in:
1 parent
bd561e8f8e
commit
4958cbf8e9
1 file changed
+30
@@ -491,6 +491,35 @@ class StatsApp:
|
||||
logger.error(f"Error serving index.html: {e}")
|
||||
raise cherrypy.HTTPError(500, "Internal server error")
|
||||
|
||||
# ============================================================================
|
||||
# Sensor Manager endpoint delegation (APIEndpoints methods → StatsApp)
|
||||
# ============================================================================
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def sensors_types(self):
|
||||
"""Delegate to APIEndpoints.sensors_types()."""
|
||||
return self.api.sensors_types()
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def sensors_config(self):
|
||||
"""Delegate to APIEndpoints.sensors_config()."""
|
||||
return self.api.sensors_config()
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
@cherrypy.tools.json_in()
|
||||
def sensors_config_update(self):
|
||||
"""Delegate to APIEndpoints.sensors_config_update()."""
|
||||
return self.api.sensors_config_update()
|
||||
|
||||
@cherrypy.expose
|
||||
@cherrypy.tools.json_out()
|
||||
def sensors_read(self):
|
||||
"""Delegate to APIEndpoints.sensors_read()."""
|
||||
return self.api.sensors_read()
|
||||
|
||||
@cherrypy.expose
|
||||
def default(self, *args, **kwargs):
|
||||
"""Handle client-side routing - serve index.html for all non-API routes."""
|
||||
@@ -499,6 +528,7 @@ class StatsApp:
|
||||
if cherrypy.request.method == "OPTIONS":
|
||||
return ""
|
||||
|
||||
|
||||
# Application UI plugins: /plugins/{id}/...
|
||||
if args and args[0] == "plugins":
|
||||
if len(args) < 2:
|
||||
|
||||
Reference in new issue
Block a user