feat: readoorDict 打包按服务器环境替换词典 APPID 与服务器地址
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
a9e169b00c
commit
11f4035da7
@@ -68,6 +68,16 @@ LEGACY_PROJECT_DEFINITION = {
|
||||
"dingtalk_at": {"at_mobiles": [], "at_mobiles_app_store": []},
|
||||
}
|
||||
|
||||
# 英汉大词典(readoorDict,TARGETTYPE == 2)的服务器地址:Readoor 项目的服务器环境内置这些字段,
|
||||
# 打包时写入 STSConstantsMacro.h 中 TARGETTYPE == 2 段落的同名宏(字段名去掉 DICT_ 前缀即宏名)。
|
||||
READOOR_DICT_SERVER_FIELDS = [
|
||||
{"key": "DICT_SERVERURL", "label": "词典 SERVERURL", "required": False},
|
||||
{"key": "DICT_SERVERHTTPSURL", "label": "词典 SERVERHTTPSURL", "required": False},
|
||||
{"key": "DICT_UCSERVERURL", "label": "词典 UCSERVERURL", "required": False},
|
||||
{"key": "DICT_RECORDSERVERURL", "label": "词典 RECORDSERVERURL", "required": False},
|
||||
{"key": "DICT_LOGSERVERURL", "label": "词典 LOGSERVERURL", "required": False},
|
||||
]
|
||||
|
||||
# 当前请求操作的项目,由 main.py 的中间件按请求头 X-Project 设置;
|
||||
# load_config() 未显式指定项目时使用它,未设置则取第一个项目。
|
||||
PROJECT_HEADER = "X-Project"
|
||||
@@ -109,6 +119,11 @@ def get_definition(project_id: str, project: dict) -> dict:
|
||||
definition["dingtalk_at"] = {**defaults["dingtalk_at"], **(definition.get("dingtalk_at") or {})}
|
||||
if definition["patcher"] not in PATCHERS:
|
||||
definition["patcher"] = PATCHER_GENERIC
|
||||
if definition["patcher"] == PATCHER_READOOR:
|
||||
keys = {field.get("key") for field in definition["server_fields"]}
|
||||
definition["server_fields"] = list(definition["server_fields"]) + [
|
||||
dict(field) for field in READOOR_DICT_SERVER_FIELDS if field["key"] not in keys
|
||||
]
|
||||
return definition
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user