清理冗余路由代码,修复首页标题与模板安全

- 简化 http-api/http-tcp/web-toolkit 的 router.py,抽取重复代码
- 修复 ws-api middleware 中间件返回值传递问题
- 修复 web-toolkit template.py 安全漏洞 (eval → AST 验证)
- 将首页标题从 "OSS Runtime" 改为 "Future OSS"
- 更新 README.md 与 static/banner.svg
- 新增 i18n 国际化插件 (骨架)
- 新增 oss/shared/ 共享模块
This commit is contained in:
Falck
2026-04-06 12:40:49 +08:00
parent c881b1b8d1
commit f894e55602
29 changed files with 890 additions and 201 deletions

View File

@@ -29,13 +29,16 @@ class WsMiddlewareChain:
async def run(self, client, message) -> Optional[str]:
"""执行中间件链"""
idx = 0
current_message = message
async def next_fn():
nonlocal idx
async def next_fn(msg=None):
nonlocal idx, current_message
if msg is not None:
current_message = msg
if idx < len(self.middlewares):
mw = self.middlewares[idx]
idx += 1
return await mw.process(client, message, next_fn)
return message
return await mw.process(client, current_message, next_fn)
return current_message
return await next_fn()