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
This commit is contained in:
parent
747a808b48
commit
7b7322dbfe
2
app/__init__.py
Normal file
2
app/__init__.py
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
"""scense 应用包(标准 ahserver + rbac,不导出任何自造中间件)。"""
|
||||||
@ -1,12 +1,4 @@
|
|||||||
{
|
{
|
||||||
"http_semantics": {
|
|
||||||
"enabled": true,
|
|
||||||
"notfound": true,
|
|
||||||
"method_not_allowed": true,
|
|
||||||
"bad_request": true,
|
|
||||||
"entry": "app/scense.py",
|
|
||||||
"note": "404/405/400 语义中间件装配开关;由 app/scense.py 的 ahapp_built 钩子读取"
|
|
||||||
},
|
|
||||||
"app": "yuanjing",
|
"app": "yuanjing",
|
||||||
"app_cn": "唤景平台(世界模式)",
|
"app_cn": "唤景平台(世界模式)",
|
||||||
"port": 9380,
|
"port": 9380,
|
||||||
@ -143,7 +135,9 @@
|
|||||||
"leading": "/healthz",
|
"leading": "/healthz",
|
||||||
"registerfunction": "healthz"
|
"registerfunction": "healthz"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"session_max_time": 28800,
|
||||||
|
"session_reissue_time": 7200
|
||||||
},
|
},
|
||||||
"db_password_encoding": "aes-b64(appPublic.aes, key=password_key)",
|
"db_password_encoding": "aes-b64(appPublic.aes, key=password_key)",
|
||||||
"db_password_source": "env/{env}.json db.password(运行时编码,明文不落盘)"
|
"db_password_source": "env/{env}.json db.password(运行时编码,明文不落盘)"
|
||||||
|
|||||||
1
wwwroot/i18n_getmsgs.dspy
Normal file
1
wwwroot/i18n_getmsgs.dspy
Normal file
@ -0,0 +1 @@
|
|||||||
|
return json.dumps({"success": True, "msgs": {}}, ensure_ascii=False)
|
||||||
Loading…
x
Reference in New Issue
Block a user