Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.en.md
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ Double-click `ModAVD.exe` in the package root: it starts a local server that lis
- `prepare` downloads, unpacks, verifies file by file against the `modavd-manifest.json` in the package, and stages the result; instances can be running;
- `install` runs `prepare` first if needed, then swaps in `sdk\emulator` and the other files in the package. All instances, the manager (including one left in the tray) and MCP clients must be closed first; if any program is using the files, it changes nothing (exit code 5), and the staged new version is kept so the next run can swap it in directly;
- `recover` finishes or rolls back a swap that was left unfinished last time (it also runs first at the start of every step).
- The update source is chosen in the manager's "Settings": GitHub (the latest Release of `ModAVD/ModAVD`; only the changed files are fetched with HTTP Range requests and the rest is copied from the root, falling back to the full package, with the reason in `notices`, when the server does not serve ranges, more than 40% of the package or 3000 files changed, or the fetched data or the assembled result fails its checks) or MirrorChyan (downloads need a CDK, and it can provide delta packages; on errors it downloads from GitHub instead and says so in the result's `notices`). The CDK is encrypted with Windows DPAPI and stored in `%LOCALAPPDATA%\ModAVD\update-settings.json`; only this Windows user can decrypt it, and it is not written to logs and does not appear on the command line or in API responses.
- The update source is chosen in the manager's "Settings": GitHub (the latest Release of `ModAVD/ModAVD`; only the changed files are fetched with HTTP Range requests and the rest is copied from the root, falling back to the full package, with the reason in `notices`, when the server does not serve ranges, more than 40% of the package or 3000 files changed, or the fetched data or the assembled result fails its checks) or MirrorChyan (downloads need a CDK, and it can provide delta packages; on errors it downloads from GitHub instead and says so in the result's `notices`). The optional GitHub token is used for GitHub version checks and downloads in the manager and CLI. The CDK and token are encrypted with Windows DPAPI and stored in `%LOCALAPPDATA%\ModAVD\update-settings.json`; only this Windows user can decrypt it, and the values stay out of logs, command-line arguments and API responses.
- Settings the caller passes for one run (`status`, `check`, `prepare` and `install` accept them, `recover` does not; they only override "Settings", are never saved, and `source` / `cdk_set` in the result report what was in effect):
- `--source github|mirrorchyan`: the update source for this run.
- `--cdk-dpapi <base64>`: the MirrorChyan CDK for this run. The value is the base64 of a blob the caller encrypted with Windows DPAPI: `CryptProtectData` of the UTF-8 CDK, without entropy, current-user or machine scope. modavd decrypts it and checks it with the same rules as "Settings" (at most 256 bytes after trimming, no spaces, tabs, line breaks or `&?#=`). Not base64, not decryptable or not a valid CDK is `invalid_argument` (exit code 2), and the error quotes neither the blob nor the CDK; on other platforms it is `unsupported`. An empty value (`--cdk-dpapi ""`, or only blanks) means no CDK for this run, even when one is saved.
Expand All @@ -381,7 +381,7 @@ Double-click `ModAVD.exe` in the package root: it starts a local server that lis
- `downloading` has no such line: the first line when the download stage begins already carries the real `percent` and bytes, then about one line every 2 seconds, and the line of the finished download is always there.
- Not printed with `--quiet` (progress is info level). Without `--json` the human-readable text is unchanged. stdout still carries only the final result line.
- "Update" in "Settings" downloads, verifies and stages the package while instances can start, stop and be created. Once prepared, it refuses new instance operations. Unfinished jobs or settings writes, creation in progress, or another program using this root's modavd cause the update to stop before shutting down any instance. The stage stays for retry. Otherwise it shuts down running instances normally and starts `tools\modavd.exe update install --after-pid <manager pid> --reopen <manager executable> [--reopen-arg ARG]...`. The manager exits after the CLI confirms ownership. A duplicate launch during handoff displays an update notice and exits. A stale record after a crash cannot block the next launch. The CLI revalidates the newer stage and installs it without another remote check, then reopens the manager with its original arguments. The result in `.update\manager-results\<ID>.json` belongs to that restart and is shown once. Failed installation also reopens the manager and retains a valid stage. CLI output goes to `logs\modavd-update.log`. `--after-pid`, `--reopen`, `--reopen-arg` and `--handoff-id` are manager options for `install` only.
- On macOS, update settings and component download sources use `~/Library/Application Support/ModAVD/update-settings.json` and `components-settings.json`. The CDK is encrypted with AES-GCM using a random wrapping key kept in the current user's Keychain. A locked or unauthorized Keychain makes saving fail without plaintext storage; copying the settings to another user or device does not transfer that key.
- On macOS, update settings and component download sources use `~/Library/Application Support/ModAVD/update-settings.json` and `components-settings.json`. The CDK and GitHub token are encrypted with AES-GCM using a random wrapping key kept in the current user's Keychain. A locked or unauthorized Keychain makes saving fail without plaintext storage; copying the settings to another user or device does not transfer that key.
- Native Apple Silicon builds accept `modavd update prepare --package /path/update.zip --sha256 <64-digit digest from a trusted independent source>`, followed by offline `modavd update install` or `recover`. Packages must follow the [macOS update contract](internal/update/MACOS.en.md); ARM64 Mach-O, code signature integrity, modes and symlinks are checked, with at least 20 GiB free space retained. Signature verification does not establish publisher identity. Native transactions are separate from the Windows/AUTO-MAS journal. Remote checks return `update_unavailable` when no compatible macOS release asset exists; release packaging is a later stage.
- Only files from the package are swapped: `avd\`, `mas-avd.json` (only `components.emulator` is changed and an `updateHistory` entry is recorded), `sdk\platform-tools`, `sdk\system-images`, `logs\` and so on are never touched; `sdk\emulator` is replaced as a whole. A root folder that sets `sdkRoot` in `mas-avd.json` is not updated.
- `--automas-version` is the version of the calling AUTO-MAS: if the first line of the new version's announcement requires a higher AUTO-MAS, it does not install.
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ Apple Silicon macOS 可运行 `ModAVD` 管理器;`ModAVD.app` 放在包根目
- `prepare` 下载、解包、按包里的 `modavd-manifest.json` 逐文件核对、暂存好,实例开着也行;
- `install` 需要时先 `prepare`,再换上 `sdk\emulator` 和包里的其他文件。要先关掉所有实例、管理器(包括托盘里的)和 MCP 客户端,有程序在用就什么都不动(退出码 5),暂存的新版留着,下次直接换;
- `recover` 补完或退回上次没做完的换上(每一步开始前也会先做)。
- 更新源在管理器的「设置」里选:GitHub(`ModAVD/ModAVD` 的最新 Release;先按区间只下变了的文件、没变的从本地复制,服务器不认 Range、变了的超过整包 40% 或 3000 个文件、取回的数据或拼好后的清单核对不过时改下整包,原因写进 `notices`)或 Mirror 酱(填了 CDK 才能下载,能拿到增量包;出错时改从 GitHub 下,并在结果的 `notices` 里写明)。CDK 用 Windows DPAPI 加密存在 `%LOCALAPPDATA%\ModAVD\update-settings.json`,只有这个 Windows 用户能解开,不写日志、不出现在命令行和接口返回里。
- 更新源在管理器的「设置」里选:GitHub(`ModAVD/ModAVD` 的最新 Release;先按区间只下变了的文件、没变的从本地复制,服务器不认 Range、变了的超过整包 40% 或 3000 个文件、取回的数据或拼好后的清单核对不过时改下整包,原因写进 `notices`)或 Mirror 酱(填了 CDK 才能下载,能拿到增量包;出错时改从 GitHub 下,并在结果的 `notices` 里写明)。GitHub token 可留空,填好后用于管理器和命令行的 GitHub 版本查询及下载。CDK 和 token 用 Windows DPAPI 加密存在 `%LOCALAPPDATA%\ModAVD\update-settings.json`,只有这个 Windows 用户能解开,不写日志、不出现在命令行和接口返回里。
- 调用方传这一次的设置(`status`、`check`、`prepare`、`install` 都可以带,`recover` 不带;只盖过「设置」里的,不保存,`status` 等结果里的 `source`、`cdk_set` 是这次生效的):
- `--source github|mirrorchyan`:这次用的更新源。
- `--cdk-dpapi <base64>`:这次用的 Mirror 酱 CDK。值是调用方用 Windows DPAPI 加密好的密文的 base64:`CryptProtectData` 加密 UTF-8 的 CDK,不带 entropy,当前用户或本机作用域都行。modavd 解开后按和「设置」一样的规则检查(去掉首尾空白后不超过 256 个字节,不含空格、制表符、换行和 `&?#=`)。不是 base64、解不开、格式不对都是 `invalid_argument`(退出码 2),错误里不带密文和 CDK;不是 Windows 是 `unsupported`。给空串(`--cdk-dpapi ""`,或只有空白)表示这次不用 CDK,「设置」里存了也不用。
Expand All @@ -384,7 +384,7 @@ Apple Silicon macOS 可运行 `ModAVD` 管理器;`ModAVD.app` 放在包根目
- `downloading` 没有这样的一行:进入下载阶段的第一行就带真实的 `percent` 和字节数,之后约 2 秒一行,下完那行一定有。
- `--quiet` 时不出(进度是 info 级)。不带 `--json` 时照旧是人看的文字。stdout 仍然只有最后一行结果。
- 管理器「设置」里点「更新」:先下载、核对、暂存,期间可以开机、关机和新建。准备完成后不再接收实例操作;还有任务或设置修改没做完、有实例正在新建,或者其他程序在用这个根目录的 modavd 时,一台实例都不关,保留暂存、提示处理后重试。全部通过才正常关掉运行中的实例,交给 `tools\modavd.exe update install --after-pid <管理器 pid> --reopen <管理器程序> [--reopen-arg 参数]...`,确认命令行接手后管理器退出。交接期间再次打开会提示正在更新并退出;异常退出留下的交接记录不会挡住下次启动。命令行重新核对较新暂存后直接换包,不重复查远端,再按原来的参数打开管理器。本次结果存进 `.update\manager-results\<ID>.json`,只交给对应启动的管理器、提示一次。换不上也重新打开,有效暂存留着,下次不用重下。命令行输出在 `logs\modavd-update.log`。`--after-pid`、`--reopen`、`--reopen-arg`、`--handoff-id` 只和 `install` 一起用,是给管理器用的。
- macOS 的更新设置和组件下载源分别保存在 `~/Library/Application Support/ModAVD/update-settings.json` 和 `components-settings.json`。CDK 使用 AES-GCM 加密,随机包装密钥留在当前用户的 Keychain;钥匙串锁定或未授权时保存失败,不会降级为明文存储。复制设置文件到其他用户或设备不会同时转移密钥。
- macOS 的更新设置和组件下载源分别保存在 `~/Library/Application Support/ModAVD/update-settings.json` 和 `components-settings.json`。CDK 和 GitHub token 使用 AES-GCM 加密,随机包装密钥留在当前用户的 Keychain;钥匙串锁定或未授权时保存失败,不会降级为明文存储。复制设置文件到其他用户或设备不会同时转移密钥。
- Apple Silicon 原生构建可用 `modavd update prepare --package /path/update.zip --sha256 <可信渠道取得的64位摘要>` 暂存本地包,再用 `modavd update install` 离线安装;`recover` 也可离线补完或恢复。包须符合 [macOS 更新包协议](internal/update/MACOS.md),核对 ARM64 Mach-O、代码签名完整性、模式和符号链接,并保留至少 20 GiB 可用空间。签名核对不代表发布者身份可信,SHA256 必须独立取得。原生事务与 Windows/AUTO-MAS 状态隔离;尚无符合协议的 macOS 发布资产时,远端检查返回 `update_unavailable`。发布打包流程由后续阶段接入。
- 只换包里的文件:`avd\`、`mas-avd.json`(只改 `components.emulator` 并记一条 `updateHistory`)、`sdk\platform-tools`、`sdk\system-images`、`logs\` 等一律不碰;`sdk\emulator` 整个换掉。根目录在 `mas-avd.json` 里设了 `sdkRoot` 的不更新。
- `--automas-version` 是调用方 AUTO-MAS 的版本:新版的公告第一行要求更高的 AUTO-MAS 时不装。
Expand Down
2 changes: 2 additions & 0 deletions changelog.d/428.feat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
设置页集中显示版本和更新进度,支持加密保存 GitHub token。
Settings shows update versions and progress and supports saving an encrypted GitHub token.
2 changes: 1 addition & 1 deletion internal/i18n/locales/en/ui.json
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,6 @@
"补全组件": "fetching components",
"补全组件必须明确同意许可协议": "Fetching components requires explicitly accepting the license agreement",
"补全组件要带上看过的许可协议的 license_sha256": "Fetching components requires the license_sha256 of the license agreement you read",
"要给 source 或 cdk": "source or cdk is required",
"规则挂不上:%v;名单里的应用现在直连": "The rules could not be applied: %v; apps on the list connect directly now",
"规则没挂上:名单里的应用现在直连": "The rules were not applied: apps on the list connect directly now",
"规则缺了几条,正在补上": "Some rules are missing; adding them",
Expand Down Expand Up @@ -303,5 +302,6 @@
"页面文件没有打包进程序": "The page files are not bundled into the program",
"(%d 个还没装)": " (%d not installed yet)",
"(UDP 不通)": " (UDP unreachable)",
"请提供要修改的更新设置": "Provide an update setting to change",
"缺少有效的按键方案版本号": "A valid keymap revision is required"
}
5 changes: 5 additions & 0 deletions internal/i18n/locales/en/update.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@
"从 Mirror 酱下载全量包 %v": "Download full package %v from MirrorChyan",
"从 Mirror 酱下载增量包(%s → %s)": "Download delta package from MirrorChyan (%s -> %s)",
"保存更新设置失败": "Failed to save update settings",
"正在保存更新设置,请稍后再试": "Update settings are being saved. Try again shortly",
"GitHub token 的格式不对": "Invalid GitHub token format",
"GitHub token 无效或已过期": "The GitHub token is invalid or has expired",
"到设置里替换或清除 GitHub token": "Replace or clear the GitHub token in Settings",
"加密 GitHub token 失败": "Could not encrypt the GitHub token",
"保存更新设置失败: %v": "Failed to save update settings: %v",
"关掉这个根目录的所有管理器窗口(托盘里的也退出),再运行 tools\\modavd.exe update install;上次换到一半的,运行 tools\\modavd.exe update recover": "Close all manager windows of this root folder (also exit the one in the tray), then run tools\\modavd.exe update install; if a swap was left half done, run tools\\modavd.exe update recover",
"准备好的版本不比装着的新": "The prepared version is not newer than the installed one",
Expand Down
Loading
Loading