scense/app/__init__.py
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

3 lines
111 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# -*- coding: utf-8 -*-
"""scense 应用包(标准 ahserver + rbac,不导出任何自造中间件)。"""