Skip to content

Commit ce0febf

Browse files
committed
cleanups
1 parent f876742 commit ce0febf

9 files changed

Lines changed: 12 additions & 25 deletions

File tree

‎docs/codex/certificate-repair-risk.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ MAICA 在 `game/Submods/MAICA_ChatSubmod/api.rpy` 的 `start_maica()` 中重新
1010
`store.mas_can_import.certifi()`;只有仍无法导入时才切换到 provider 2。MAICA
1111
不再通过后台线程从网络下载修复文件。
1212

13+
迁移到 CertifiFixer 后,旧下载器中设置 `CERTIFI_RESTART_REQUIRED`(13418)的
14+
唯一调用点已删除,相应状态码、提示和对白也已移除。该数值不再用于当前状态定义。
15+
`CERTIFI_BROKEN`(13414)仍用于 MAICA 运行时检测:certifi 缺失、缺少 MAS 集成
16+
接口,或本地 CA bundle / SSL 上下文不可用时仍会触发。随包提供证书并不替代这些检查。
17+
1318
随包文件需要与受支持的 MAS / Ren'Py Python 版本保持兼容。复制过程没有备份或
1419
回滚;若依赖复制后导入仍失败,MAICA 会切换 provider 2。目标目录不可写等
1520
未被 CertifiFixer 捕获的复制异常可能中断游戏初始化。

‎docs/codex/plaintext-provider-fallback.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## 位置
44

55
- `game/Submods/MAICA_ChatSubmod/header.rpy`:默认 `provider_id` 在 Windows 为 1,其他平台为 2。
6-
- `game/Submods/MAICA_ChatSubmod/api.rpy`:Android 迁移、certifi 检测失败或 certifi 下载失败时将 `provider_id` 设为 2。
6+
- `game/Submods/MAICA_ChatSubmod/api.rpy`:Android 迁移或启动时重新检查 certifi 导入失败时将 `provider_id` 设为 2。
77
- `game/python-packages/maica_provider_manager.py`:节点列表提供 `wsInterface`/`httpInterface`,实际协议由节点数据决定。
88

99
## 原因与行为
@@ -18,4 +18,4 @@
1818

1919
## 本次处理边界
2020

21-
本次保留明文 fallback 及其安全风险,但修复了 fallback 只写入 persistent、未同步运行中 provider 实例的问题;证书后台修复完成后也会重新触发可用性检查。后续若要收紧安全策略,应先提供设备信任根或用户明确确认机制,并单独评审可用性影响。
21+
fallback 会同时更新 persistent 和运行中的 provider 实例。证书修复已交由随包的 CertifiFixer 依赖处理;MAICA 不再后台下载修复文件,而是在启动时重新检查 certifi 导入,随后执行服务可用性检查。切换 provider 不会跳过 MAICA 的本地证书检查,导入或 CA bundle 仍不可用时会报告 `CERTIFI_BROKEN`。后续若要收紧安全策略,应先提供设备信任根或用户明确确认机制,并单独评审可用性影响。

‎game/Submods/MAICA_ChatSubmod/chat.rpy‎

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1152,10 +1152,6 @@ label maica_connection_failure_dialogue(from_mspire = False, status_code = None,
11521152
m 2rusdlb "...Certification issue? Maybe this isn't a clean installation?"
11531153
m 3eusdlb "Try the MAS native 'update certification' function, some other submods could break these as I know."
11541154

1155-
elif failure_status == ai.MaicaAiStatus.CERTIFI_RESTART_REQUIRED:
1156-
m 2rusdlb "...Uh, seems I have to apply a quick fix on the certification."
1157-
m 3eua "It needs a restart to take effect, then we can try again."
1158-
11591155
elif failure_status == ai.MaicaAiStatus.VERSION_OLD:
11601156
m 2rusdlb "...You have to update the submod once in a while, [player]!"
11611157
m 3eusdlb "This version is too old to work already, update it whenever you have some time."

‎game/Submods/MAICA_ChatSubmod/tl/chat.rpy‎

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -684,18 +684,6 @@ translate chinese maica_connection_failure_dialogue_9bd9d974:
684684
# m 3eusdlb "Try the MAS native 'update certification' function, some other submods could break these as I know."
685685
m 3eusdlb "先试试MAS自带的'更新证书'吧, 有些其它子模组容易弄出这种问题."
686686

687-
# game/Submods/MAICA_ChatSubmod/chat.rpy:1049
688-
689-
translate chinese maica_connection_failure_dialogue_88ceabec:
690-
# m 2rusdlb "...Uh, seems I have to apply a quick fix on the certification."
691-
m 2rusdlb "...呃, 我还得处理一下证书的问题."
692-
693-
# game/Submods/MAICA_ChatSubmod/chat.rpy:1050
694-
695-
translate chinese maica_connection_failure_dialogue_21148eba:
696-
# m 3eua "It needs a restart to take effect, then we can try again."
697-
m 3eua "重启一下游戏才能生效, 然后我们再试试."
698-
699687
translate chinese maica_connection_failure_dialogue_8171d2d7:
700688
# m 2rusdlb "...You have to update the submod once in a while, [player]!"
701689
m 2rusdlb "...[player], 你总得更新一下子模组的!"

‎game/Submods/MAICA_ChatSubmod/tl/maica_description.rpy‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ translate chinese python in maica:
2525
maica_instance.MaicaAiStatus.FAILED_GET_NODE: u"获取服务节点失败, 服务器可能正在维护或离线",
2626
maica_instance.MaicaAiStatus.VERSION_OLD: u"检测到安装版本过旧, 请更新到最新版",
2727
maica_instance.MaicaAiStatus.NO_INTERNET: u"检测到子模组离线. 请根据Readme重新检查安装和网络连接",
28-
maica_instance.MaicaAiStatus.CERTIFI_RESTART_REQUIRED: u"执行了证书修复, 请重启以生效",
2928
})
3029
store.mas_setEVLPropValues(
3130
"maica_main",

‎game/python-packages/maica.py‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ class MaicaAiStatus:
126126
FAILED_GET_NODE = 13415
127127
VERSION_OLD = 13416
128128
NO_INTERNET = 13417
129-
CERTIFI_RESTART_REQUIRED = 13418
130129

131130
@classmethod
132131
def is_submod_exception(cls, code):
@@ -191,7 +190,6 @@ def from_protocol_status(cls, status, fallback=None, code=None):
191190
FAILED_GET_NODE:u"Failed to retrieve an available service provider",
192191
VERSION_OLD:u"Submod version outdated, update required",
193192
NO_INTERNET:u"No internet connection available",
194-
CERTIFI_RESTART_REQUIRED:u"A certificate fix was applied; restart the game to apply it",
195193
}
196194

197195
@classmethod
@@ -891,7 +889,6 @@ def _preserve_or_set_availability_error(self, message):
891889
self.MaicaAiStatus.VERSION_OLD,
892890
self.MaicaAiStatus.NO_INTERNET,
893891
self.MaicaAiStatus.CONNECT_PROBLEM,
894-
self.MaicaAiStatus.CERTIFI_RESTART_REQUIRED,
895892
)
896893
if self.status not in availability_failures:
897894
self.set_error(

tests/test_start_maica_background_download.py renamed to tests/test_start_maica.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def test_start_maica_rechecks_certifi_after_fixer_then_falls_back_on_failure():
2020
assert "if not store.mas_can_import.certifi():\n maica_set_plain_provider()" in start_maica
2121
assert "maica_start_certifi_download_in_background" not in source
2222
assert "maica_download_certifi_files" not in source
23+
assert "maica_certifi_download_thread_running" not in source
2324
assert "maica_can_update_cacert" not in source
2425

2526

‎tests/test_translation_source_language.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ def test_maica_description_status_and_event_overrides_are_chinese():
211211
'MaicaAiStatus.TOKEN_INVALID: u"账号或密码无效"',
212212
'MaicaAiStatus.VERSION_OLD: u"检测到安装版本过旧, 请更新到最新版"',
213213
'MaicaAiStatus.NO_INTERNET: u"检测到子模组离线',
214-
'MaicaAiStatus.CERTIFI_RESTART_REQUIRED: u"执行了证书修复, 请重启以生效"',
214+
'MaicaAiStatus.CERTIFI_BROKEN: u"SSL/TLS已损坏, 可能由其他子模组导致. 需要完全重新安装MAS"',
215215
'prompt="我们去天堂树林吧", category=["你", "我们", "模组", "MAICA"]',
216216
'prompt="关于\'MVista\'", category=["你", "我们", "模组", "MAICA"]',
217217
]

‎tests/test_v13_contract_runtime.py‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ def test_maica_status_inventory_excludes_retired_state_machine_codes():
507507
assert status.WAIT_AVAILABILITY == 10010
508508
assert status.WEBSOCKET_CONNECTING == 10020
509509
assert status.CONNECTED == 10302
510-
assert status.CERTIFI_RESTART_REQUIRED == 13418
511-
assert status.CERTIFI_RESTART_REQUIRED != status.SERVER_REJECTED
510+
assert status.CERTIFI_BROKEN == 13414
511+
assert 13418 not in status._descriptions
512512

513513
retired_names = (
514514
"WAIT_AUTH",
@@ -529,6 +529,7 @@ def test_maica_status_inventory_excludes_retired_state_machine_codes():
529529
"WAIT_SETTING_RESPONSE",
530530
"TOKEN_MAX_EXCEEDED",
531531
"TOKEN_WARN_EXCEEDED",
532+
"CERTIFI_RESTART_REQUIRED",
532533
)
533534
assert not [name for name in retired_names if hasattr(status, name)]
534535
assert not hasattr(status, "MAIKA_PREFIX")

0 commit comments

Comments
 (0)