Files
msime-windows/engine/contracts/webview
Lu Fan(SonnyCalcr) 4375d80414 feat: 支持导入自定义辅助码,内置“加加”更名为“拼音加加” (#477)
* feat(engine): 支持 helpcodes/custom 下的自定义辅助码

custom 目录里的每个 .txt 都是一套方案,方案名为 custom/<文件名>。
文件开头的 "# name:" / "# name_en:" 注释给出中英文显示名,缺省用文件名;
兼容 BOM、CRLF 和全角冒号。方案名不能跳出 custom 目录。

* feat(engine): WebView 契约新增 openHelpcodeDirectory

设置页请求打开自定义辅助码目录,仅允许 settings 页发送。同步 ui-html/webview2/shared。

* feat(server): 设置页列出自定义辅助码并可打开其目录

配置快照带上 helpcode.custom_schemas 与 helpcode.custom_directory,每次都会重新扫描;
方案文件被删除或改名后回退到 lantian。两个设置宿主都会处理 openHelpcodeDirectory。

* feat(ui-html): 辅助码设置显示拼音加加与自定义方案

内置方案“加加”改名为“拼音加加”。自定义方案追加在内置方案之后;新增说明区,
提供“打开目录”和“刷新方案”两个按钮,刷新完成后弹出提示。

* feat(installer): 升级与迁移数据目录时保留自定义辅助码

升级清理时只清掉 helpcodes 里的内置表,保留 custom 子目录;更换数据目录时一并迁移;
安装时建出 helpcodes\custom。
2026-09-26 20:21:55 +08:00
..

WebView messages

messages.json owns the message envelope, payload shape, and allowed sender windows. Change it here, run python3 generate.py, and re-sync the copy under ui-html/ in the same commit. The generated TypeScript union and embedded C++ schema must pass generate.py --check. runtime.js and validator.h implement the documented schema subset and run the same fixtures.json compatibility cases. The standalone CMake test requires Boost.JSON; the input engine itself does not acquire that dependency.

New messages carry protocolVersion: 1. A missing version is accepted as legacy v1 for existing skins; an explicit unknown version, unknown message, invalid payload, or message sent from the wrong window is rejected before dispatch. This is envelope validation, not a replacement for domain checks such as dictionary key validation, allowed configuration values, or the host's HTTPS URL policy.

ui-html/scripts/sync-contracts.py materializes these bindings into ui-html/webview2/shared and checks byte equality; CI runs it with --check, which now compares against this directory directly rather than against a pinned submodule. Settings imports the typed serializer and checks incoming messages. Classic candidate, toolbar and menu pages load the same runtime from the host's https://msime-contracts/ virtual mapping; packaging must include webview2/shared.

Server-to-page candidate rendering currently uses the existing view functions; this contract covers WebMessage actions and settings responses. Candidate view model ownership is documented separately from transport envelopes.