ymq 7b7322dbfe fix(config): 恢复 i18n 链路 + session 时长 + 清 app/__init__.py
独立审查实测发现三个回归(均由 702f274 入口回归引起):

1【阻断】/i18n_getmsgs 500
   702f274 把 startswiths 的 i18n 条目换成了 /healthz,而 bricks 前端
   默认请求 /i18n_getmsgs(i18n.js:19)→ 500,界面文案/语言切换全受影响。
   实测 further:ahserver.globalEnv.i18n() 取 params_kw.lang,而前端传
   language → startswiths 映射本身就不可能工作。
   修复:wwwroot 放标准资源 i18n_getmsgs.dspy(按 language 读
   wwwroot/i18n/<lang>/i18n.json),startswiths 只保留 /healthz。

2【重要】会话时长回落到框架默认 120 秒
   702f274 把 config 写成 ahserver 不认识的 website.session{timeout,...},
   而 ahserver/auth_api.py 读的是 website.session_max_time(默认 120)。
   实测:登录后空闲 135s 再请求 → 401。原配置 28800s。
   修复:补回 session_max_time=28800、session_reissue_time=7200。

3【重要】app/__init__.py 仍 import 5 个已归档中间件
   每次启动 5 条 warning,且 __all__ 宣称导出的符号实测 ImportError。
   修复:清空为纯包标记;顺带移除死配置 http_semantics(新入口无
   ahapp_built 钩子,该块不会被读,且本身是已删中间件的开关)。

实测(重启后):
  /i18n_getmsgs?language=zh 200 | /healthz 200 | /index.ui 200 | login.ui 200
  空口令登录被拒(业务错误信封)| admin123 登录 200 + cookie
  带 cookie 访问受保护端点 200 | 匿名 401
2026-10-28 17:06:25 +08:00

scense 游戏展示模块(元景 W-08)

功能

游戏列表入口 / 点击开始玩(初始化 W-10 世界运行态进入)/ 暂停 / 继续 / 结束结算 / 重新开始 / 分数结果展示 / 分享链接进入 / 玩中交互(点选移动实体触发脚本逻辑)/ 退出保存进度。

数据表

表 作用 关键字段
game_session 游戏会话 status(created/playing/paused/ended), score, level, elapsed_ms, progress_json, share_token
game_result 游戏结果 session_id, score, duration_ms, level, result_json

会话状态机

  • 开始玩:无会话→playing;已有 playing/paused→恢复 playing(续玩)
  • playing ⇄ paused(pause/resume)
  • playing/paused → ended(end 唯一结算出口,写 game_result)
  • 任意状态 → playing(restart 重置分数/关卡)
  • save 保存进度快照(不改变状态)

API 端点(wwwroot/game/api/*.dspy,全部 logined)

文件 功能 功能点
game_list.dspy 游戏列表 + 历史会话/结果 W-08a
game_start.dspy 开始玩(进入运行态) W-08b
game_pause.dspy 暂停 W-08c
game_resume.dspy 继续 W-08d
game_end.dspy 结束结算(写 game_result) W-08e/g
game_restart.dspy 重新开始(重置) W-08f
game_share.dspy 生成/解析分享链接 W-08h
game_save.dspy 保存进度快照 W-08j

前端

  • game/index.ui — bricks 游戏列表入口页
  • game/game_play.html — 全屏游戏页(canvas + HUD + 结算面板 + 交互),验收入口
  • game/game.js — 游戏交互(开始/暂停/继续/结束/重开/分享/保存/点选实体)
  • game/game_list.js — 列表页渲染

依赖

  • W-10 runtime(runtime.js RuntimeEngine,前端运行态,服务端辅助可选)
  • world 模块(游戏世界来源,防御式降级独立模式)
  • sqlor / ahserver / ServerEnv

集成

  1. app/sage.py: from scense.init import load_scense + load_scense() in init()
  2. build.sh 安装循环添加 scense
  3. scripts/load_path.py 注册 RBAC 路径(禁通配符)
  4. global_menu.ui 添加菜单项 {{entire_url('/scense/game/index.ui')}}
  5. 部署目标 /d/scense/scense_app:模块 wwwroot 软链接 + pip install -e
Description
No description provided
Readme 49 KiB