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
This commit is contained in:
qinglong
2026-06-11 14:37:28 +08:00
parent 6918ee6514
commit dd8a31e29a
8 changed files with 27 additions and 22 deletions
+15 -8
View File
@@ -1,25 +1,32 @@
import time
from aiohttp import web
from ..utils.auth import panel_auth
from ..utils.system_info import SystemInfoCollector
collector = SystemInfoCollector()
def setup_routes(app, prefix=''):
app.router.add_get(f'{prefix}/api/framework', panel_auth(get_framework))
app.router.add_get(f'{prefix}/api/system', panel_auth(get_system))
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")
# 🟢 修复:使用 sm.start_time 属性
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": "Alpha_0.2.0",
"uptime": int(uptime), # 取整秒
"version": ver,
"uptime": int(uptime),
"plugins": len(ps.plugins) if ps else 0
})