diff --git a/changes/clone-ssh-port-forward.json b/changes/clone-ssh-port-forward.json new file mode 100644 index 0000000..50248d5 --- /dev/null +++ b/changes/clone-ssh-port-forward.json @@ -0,0 +1,7 @@ +{ + "group": "fixes", + "order": 0, + "authors": ["Nwflower"], + "zh": "修复克隆虚拟机没有主机 SSH 端口转发的问题。源虚拟机开启端口转发时,克隆出的虚拟机现在会占用源端口之后的一个空闲端口,因此 MCP 临时会话与克隆上的 SSH 相关工具(`guest_exec`、`guest_wait_ready`、`test_run` 等)可以正常连接客体。源虚拟机未开启转发时克隆仍不开启。", + "en": "Fix cloned VMs having no host SSH port forward. When the source VM forwards SSH, a clone now takes the next free port after the source port, so SSH-based guest tools such as `guest_exec`, `guest_wait_ready`, and `test_run` work on MCP temporary sessions and other clones. A source without forwarding still yields a clone without one." +} diff --git a/changes/clone-unlock-uses-source-settings.json b/changes/clone-unlock-uses-source-settings.json new file mode 100644 index 0000000..d088cf3 --- /dev/null +++ b/changes/clone-unlock-uses-source-settings.json @@ -0,0 +1,7 @@ +{ + "group": "fixes", + "order": 0, + "authors": ["Nwflower"], + "zh": "修复 MCP 临时克隆无法自动输入登录密码、SSH 用户名常为空的问题。克隆不保存自己的虚拟机设置,现在它读取 `login_password` 和 `username` 时会回退到来源虚拟机,且仅在来源虚拟机仍开启「允许 AI 访问」时生效;撤销来源的授权后克隆立即失去回退。密码不会复制进克隆,克隆销毁后不留存副本。虚拟机未保存登录密码时,解锁会提示去 MCP 服务设置里填写,而不是返回内部错误。", + "en": "Fix MCP temporary clones failing to type the login password and often reporting an empty SSH username. A clone keeps no VM settings of its own, so reads of `login_password` and `username` now fall back to the source VM, and only while the source still allows AI access; revoking access on the source removes the fallback immediately. The password is never copied into the clone, so disposing it leaves no copy behind. When a VM has no saved login password, unlock now asks you to set it in the MCP Service settings instead of returning an internal error." +} diff --git a/changes/dedupe-vulkan-gpu-entries.json b/changes/dedupe-vulkan-gpu-entries.json new file mode 100644 index 0000000..2a473aa --- /dev/null +++ b/changes/dedupe-vulkan-gpu-entries.json @@ -0,0 +1,7 @@ +{ + "group": "fixes", + "order": 0, + "authors": ["Nwflower"], + "zh": "修复宿主机存在多份 Vulkan ICD 驱动清单时,内核页重复显示同一块显卡且缺失驱动版本号的问题。", + "en": "Deduplicate repeated Vulkan physical device entries on the Runtime page when multiple ICD manifests are registered for the same GPU." +} diff --git a/changes/relocate-vm-registry-on-data-root-switch.json b/changes/relocate-vm-registry-on-data-root-switch.json new file mode 100644 index 0000000..d74b559 --- /dev/null +++ b/changes/relocate-vm-registry-on-data-root-switch.json @@ -0,0 +1,7 @@ +{ + "group": "fixes", + "order": 0, + "authors": ["Nwflower"], + "zh": "修复手动移动数据目录并在设置或首启界面重新选择新目录后,因虚拟机注册表保留旧路径导致无法启动虚拟机的问题。", + "en": "Fix VMs failing to start after moving the data folder and reselecting its new location by updating stale paths in the VM registry." +} diff --git a/changes/ui-polish-update-cache-and-speed.json b/changes/ui-polish-update-cache-and-speed.json new file mode 100644 index 0000000..01b93c1 --- /dev/null +++ b/changes/ui-polish-update-cache-and-speed.json @@ -0,0 +1,7 @@ +{ + "group": "improvements", + "order": 0, + "authors": ["Nwflower"], + "zh": "下载速度低于 1 MB/s 时改以 KB/s 显示,精简关于页与更新通道文案,默认同步宿主机内存规格并将外观与语言设置分组置顶,更新检查按通道缓存 5 分钟且切换通道时不再禁用控件。", + "en": "Display download speeds below 1 MB/s in KB/s, tighten About page and update channel copy, sync host memory SMBIOS specs by default and move Appearance & language to the top of Settings, cache update checks per channel for 5 minutes, and keep the update channel selector interactive while switching." +} diff --git a/frontend/scripts/test-tasks.mjs b/frontend/scripts/test-tasks.mjs index cfdc483..28f5f47 100644 --- a/frontend/scripts/test-tasks.mjs +++ b/frontend/scripts/test-tasks.mjs @@ -2,7 +2,7 @@ import assert from 'node:assert/strict' import test from 'node:test' import { loadTestModule } from './load-test-module.mjs' -const { currentTask, findActiveOfflineTask, pruneFinishedTasks, upsertTask } = +const { currentTask, findActiveOfflineTask, pruneFinishedTasks, taskDetail, upsertTask } = await loadTestModule(`export * from './lib/tasks'`) const task = (id, overrides = {}) => ({ @@ -33,3 +33,10 @@ test('one installer download represents the VM creations waiting for it', () => primary: download, waitingVMs: ['vm one'], matchedIDs: ['download', 'vm'], }) }) + +test('taskDetail formats download speeds under 1 MB/s in KB/s', () => { + assert.equal(taskDetail(task('slow', { done: 5e6, total: 50e6, rate: 512e3 })), '5 MB / 50 MB · 512 KB/s') + assert.equal(taskDetail(task('tiny', { done: 1e6, total: 10e6, rate: 200 })), '1 MB / 10 MB · 1 KB/s') + assert.equal(taskDetail(task('fast', { done: 2e9, total: 10e9, rate: 12.5e6 })), '2.0 GB / 10.0 GB · 12.5 MB/s') + assert.equal(taskDetail(task('gig', { done: 2e9, total: 10e9, rate: 1.2e9 })), '2.0 GB / 10.0 GB · 1.2 GB/s') +}) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index 26b8852..b79ab96 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -516,13 +516,40 @@ export const App: React.FC = () => { const setChannel = (alpha: boolean) => { api.SetRuntimeChannel(alpha ? 'alpha' : 'stable').then(() => refresh()).catch((e) => fail(tr('failGeneric'), e)) } + const appChannelSeqRef = useRef(0) + const appChannelPendingRef = useRef<'stable' | 'alpha' | 'dev' | null>(null) + const appChannelFlushRef = useRef | null>(null) const appUpdateChannel = state?.config.app_update_channel === 'alpha' || state?.config.app_update_channel === 'dev' ? state.config.app_update_channel : 'stable' const setAppUpdateChannel = async (ch: 'stable' | 'alpha' | 'dev') => { - await api.SetAppUpdateChannel(ch) - await refresh() - await update.recheck() + const seq = ++appChannelSeqRef.current + setState((prev) => (prev ? { ...prev, config: { ...prev.config, app_update_channel: ch } } : prev)) + appChannelPendingRef.current = ch + if (!appChannelFlushRef.current) { + appChannelFlushRef.current = (async () => { + while (appChannelPendingRef.current !== null) { + const target = appChannelPendingRef.current + appChannelPendingRef.current = null + await api.SetAppUpdateChannel(target) + } + })().finally(() => { + appChannelFlushRef.current = null + }) + } + try { + await appChannelFlushRef.current + } catch (e) { + if (appChannelSeqRef.current === seq) { + appChannelPendingRef.current = null + void refresh() + throw e + } + return + } + if (appChannelSeqRef.current !== seq) return + await update.recheck(false) + if (appChannelSeqRef.current === seq) void refresh() } const cancelTask = (id: string) => { api.CancelTask(id).catch((e) => fail(tr('failGeneric'), e)) } diff --git a/frontend/src/components/AboutPage.tsx b/frontend/src/components/AboutPage.tsx index 73e5684..38efb9a 100644 --- a/frontend/src/components/AboutPage.tsx +++ b/frontend/src/components/AboutPage.tsx @@ -43,7 +43,6 @@ export const AboutPage: React.FC = ({ }) => { const tr = (k: I18nKey, v?: Record) => t(locale, k, v) const [checkingUpdate, setCheckingUpdate] = useState(false) - const [switchingChannel, setSwitchingChannel] = useState(false) const [updateErr, setUpdateErr] = useState('') const [qqInstalled, setQQInstalled] = useState(null) const [openingQQ, setOpeningQQ] = useState(false) @@ -128,54 +127,53 @@ export const AboutPage: React.FC = ({ } const handleChannelChange = async (next: AppUpdateChannel) => { - if (next === appUpdateChannel || switchingChannel) return - setSwitchingChannel(true) + if (next === appUpdateChannel) return setUpdateErr('') try { await onAppUpdateChannel(next) } catch (e) { setUpdateErr(String(e).replace(/^Error:\s*/, '')) - } finally { - setSwitchingChannel(false) } } - const version = appVersion ?? appUpdate?.current ?? '' + const visibleUpdate = appUpdate && (!appUpdate.channel || appUpdate.channel === appUpdateChannel) ? appUpdate : null + const visiblePhase: UpdatePhase = visibleUpdate ? updatePhase : 'none' + const version = appVersion ?? visibleUpdate?.current ?? '' const pct = updateTask && updateTask.percent >= 0 ? Math.round(updateTask.percent) : null - const updateAvailableKey: I18nKey = appUpdate?.channel === 'dev' + const updateAvailableKey: I18nKey = visibleUpdate?.channel === 'dev' ? 'appUpdateAvailableDev' - : appUpdate?.channel === 'alpha' + : visibleUpdate?.channel === 'alpha' ? 'appUpdateAvailableAlpha' : 'appUpdateAvailable' let updateSub: React.ReactNode = null - if (updatePhase === 'downloading') { + if (visiblePhase === 'downloading') { updateSub = ( <> -
{tr('updateDownloadingSub', { v: appUpdate?.latest ?? '' })}{updateTask && taskDetail(updateTask) ? ` · ${taskDetail(updateTask)}` : ''}
+
{tr('updateDownloadingSub', { v: visibleUpdate?.latest ?? '' })}{updateTask && taskDetail(updateTask) ? ` · ${taskDetail(updateTask)}` : ''}