Files
SenSu/services/web_panel/routes/status.py
T
qinglong dd8a31e29a Fix: proxy API prefix, version from config, remove auth from framework/system endpoints
- Proxy routes now use /SenSu/api/proxy (was missing prefix)
- Projects routes use dynamic prefix
- Version reads from config/framework/base_config.yaml
- Framework/System APIs no longer require auth (public info)
- Proxy init separated from route setup (avoids frozen router error)
- Version updated to v0.6.0
2026-06-11 14:37:28 +08:00

35 lines
1.1 KiB
Python

import time
from aiohttp import web
from ..utils.system_info import SystemInfoCollector
collector = SystemInfoCollector()
def setup_routes(app, prefix=''):
app.router.add_get(f'{prefix}/api/framework', get_framework)
app.router.add_get(f'{prefix}/api/system', get_system)
async def get_framework(req):
sm = req.app.get('service_manager')
if not sm: return web.json_response({"error": "Missing"}, 500)
ps = sm.get_service("plugin")
uptime = time.time() - getattr(sm, 'start_time', time.time())
# Read version from config file
ver = "v0.6.0"
try:
import yaml, os
config_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "config", "framework", "base_config.yaml")
with open(config_path) as f:
cfg = yaml.safe_load(f)
ver = cfg.get("framework", {}).get("version", ver)
except: pass
return web.json_response({
"version": ver,
"uptime": int(uptime),
"plugins": len(ps.plugins) if ps else 0
})
async def get_system(req):
return web.json_response(collector.get_all())