Compare commits

...
Author SHA1 Message Date
Nwflower 48e75ca665 release: v0.2.5
Release Reims-Go / release (push) Canceled after 0s
2026-11-29 03:01:20 -07:00
Nwflower 9c8a75448d feat(ui,runtime): split Engine/Settings tabs, add footer telemetry, and fix GitCode alpha detection 2026-11-29 03:00:26 -07:00
Nwflower 3b26f6117f refactor: move GUI App layer into internal/app 2026-11-29 02:49:49 -07:00
Nwflower f5ec733230 chore: sync Wails model bindings and add Star History to README 2026-11-29 02:47:39 -07:00
Nwflower 7641a7c948 feat(ui): polish macOS Tahoe shell layout, typography, and motion
Align the Wails desktop shell with the macOS Tahoe visual design:
- Add bundled open-source Inter Variable (Latin) and multi-weight CJK font mapping tuned for Windows DirectWrite readability
- Refine VMPage with compact Studio Display stand, 2x3 icon spec card, inline telemetry meters, single-row Connection list, numbered install guide, and one-click tech summary copy
- Move LogPanel to full-width status bar with ambient WHPX status and pointer-captured vertical resize handle
- Upgrade HostView tiles, InstallersPage skeletons/empty state, system theme detection, and unified Segmented/Switch primitives
- Refine translucent chrome surfaces, GPU scaleX meters/progress, toast swipe/enter motion, and reduced-motion/transparency/contrast support
2026-11-29 02:46:13 -07:00
57 changed files with 2126 additions and 1298 deletions

No files matched your search

+16
View File
@@ -2,6 +2,22 @@
本文件只记录 Reims-Go 桌面应用的变化。便携运行时(`runtime-*`)的版本另见 [Releases](https://github.com/Nwflower/Reims-Go/releases)。
## v0.2.5 — 2026-11-29
### 新功能
- 运行时下载与更新检查新增 GitCode 国内镜像源,默认自动优先 GitHub 并在不可达时自动切换 GitCode。
- 桌面外壳视觉与交互升级:精简 VM 主页为 Studio Display 预览、2×3 图标规格卡、单行连接分组与可一键复制的技术信息;支持日志抽屉顶部拖拽调整高度。
- 侧栏「宿主与运行时」改称「内核」,将应用配置拆分为独立「设置」标签页(新增浅色 / 深色 / 跟随系统外观切换)。
- 底部状态栏空闲时实时展示宿主机内存占用百分比、可用内存、数据盘剩余空间与运行中虚拟机数量。
### 优化与修复
- 内嵌开源 Inter Variable 字体并按 Windows DirectWrite 特性显式映射多字重中文字体栈,修复默认字重偏轻与中英文混排断层问题。
- 修复 GitCode API 将 alpha 运行时预发布返回为 `prerelease=false` 导致稳定通道误报新版本的问题。
- 遵循 Windows 系统代理配置并在 GitHub API 触发限流时自动回退网页解析,下载检查失败时提供一键重试。
- 按实际图形后端(`reims-vgpu` / `vmware-svga`)显示准确的虚拟机窗口快捷键提示。
## v0.2.4 — 2026-11-29
### 新功能
+12
View File
@@ -138,3 +138,15 @@ reims-go vm start macos-tahoe | Out-Host # 启动虚拟机(交给托盘
## 友情链接
- [LINUX DO](https://linux.do/) — 新的理想型社区
<br />
## Star History
<a href="https://www.star-history.com/#Nwflower/Reims-Go&Date">
<picture>
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=Nwflower/Reims-Go&type=Date&theme=dark" />
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=Nwflower/Reims-Go&type=Date" />
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=Nwflower/Reims-Go&type=Date" />
</picture>
</a>
+3 -4
View File
@@ -91,7 +91,7 @@ flowchart TB
- 指定了 `--data-root` 的 `vm start` 仍在命令进程里启动,没有剪贴板和共享目录,Win10 上客体重启后不会自动拉起。
- 单实例:同一用户只运行一个界面进程。再次双击会把已有窗口调到前台。`wails dev` 构建用另一个锁名(`internal/cli/instance_id_dev.go`),不会和已安装的 Reims-Go 互相抢。
- 命令行模式与 Windows 子系统:`reims-go.exe` 是 GUI 子系统程序。命令行模式会保留调用方传入的句柄(管道、文件),缺失的才用 `AttachConsole` 接回父进程控制台(`console_windows.go`)。所以 Agent、脚本、管道调用都能正常拿到输出和退出码;在交互式 PowerShell / cmd 里,提示符会先返回,要等命令结束需加 `| Out-Host`。
- GUI 的其余编排仍在根目录的 `App`(`app.go`)和各个 `*_flow.go` 里:CoW 派生(`clone_flow.go`)、磁盘扩容与回收(`disk_flow.go`)、运行监视与里程碑日志(`vm_monitor.go`)。
- GUI 的其余编排在 `internal/app` 的 `App`(`app.go`)和各个 `*_flow.go` 里:CoW 派生(`clone_flow.go`)、磁盘扩容与回收(`disk_flow.go`)、运行监视与里程碑日志(`vm_monitor.go`)。
- **CoW 派生**:先 `qemu-img create -f qcow2 -F qcow2 -b <golden> <overlay>`,再 `reims-ctl create --disk <overlay> --disk-mode in-place`,原盘不改。真机上从派生盘启动**待验证**。
- **SSH**:只展示 `reims-ctl` 的 `--ssh-port` 转发端口,没有命令执行通道。
@@ -99,9 +99,9 @@ flowchart TB
```text
reims-go/
├── main.go # 唯一入口:无参数启动 Wails 界面,带子命令走 internal/cli
├── window_launch.go # 界面处理 --background / --start-vm 与第二次启动
├── main.go # 唯一入口:无参数启动 Wails 界面,带子命令走 internal/cli(附 console_*.go)
├── internal/
│ ├── app/ # GUI 编排层与 Wails 绑定(App、*_flow.go、tasks.go、vm_monitor.go、window_launch.go)
│ ├── cli/ # 命令行模式:子命令、把 vm start 交给界面进程
│ ├── config/ # reims-go.json(含 locale: zh-CN|en-US、DataRoot、P-Core 开关)
│ ├── i18n/ # Go 端中英双语消息字典与结构化错误码
@@ -117,7 +117,6 @@ reims-go/
│ ├── thumb/ # 把截屏缩小成 JPEG
│ ├── tray/ # 系统托盘
│ └── version/ # 版本号与更新检查
├── *.go # GUI 的 App 与各 *_flow.go 编排(package main)
├── frontend/ # Wails 前端(轻量 React + Vite + TypeScript + zh-CN/en-US i18n)
├── patches/ # 上游临时补丁队列(合入即退役)
├── scripts/
+2 -1
View File
@@ -1,7 +1,7 @@
{
"name": "reims-go-frontend",
"private": true,
"version": "0.2.4",
"version": "0.2.5",
"type": "module",
"scripts": {
"dev": "vite",
@@ -9,6 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"@fontsource-variable/inter": "^5.3.0",
"@radix-ui/react-alert-dialog": "^1.2.1",
"@radix-ui/react-dialog": "^1.3.1",
"@radix-ui/react-dropdown-menu": "^2.2.1",
+1 -1
View File
@@ -1 +1 @@
3e62bdadbba688cfaff4397370fad1e2
64168eba4b0b33765a8a7ffa2b52319b
+8
View File
@@ -8,6 +8,9 @@ importers:
.:
dependencies:
'@fontsource-variable/inter':
specifier: ^5.3.0
version: 5.3.0
'@radix-ui/react-alert-dialog':
specifier: ^1.2.1
version: 1.2.1(@types/react-dom@19.3.0(@types/react@19.3.3))(@types/react@19.3.3)(react-dom@19.3.1(react@19.3.1))(react@19.3.1)
@@ -305,6 +308,9 @@ packages:
'@floating-ui/utils@0.2.12':
resolution: {integrity: sha512-HpCo8tmWzLVad5s2d19EhAz5zqrrQ6s69qd6moPMQvkOuSwDT1YgRfWSVuc4ennqrgv3OHppiOGMQ7oC13yIww==}
'@fontsource-variable/inter@5.3.0':
resolution: {integrity: sha512-OupL48va4JNofb97w6NYeF9S7W/kHNKM0Er8Dem5nqi4jeOLrVJDoE8tZEpnMJmtkvNbB1EIPPwHcdkF6b1oUA==}
'@jridgewell/gen-mapping@0.3.13':
resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==}
@@ -1293,6 +1299,8 @@ snapshots:
'@floating-ui/utils@0.2.12': {}
'@fontsource-variable/inter@5.3.0': {}
'@jridgewell/gen-mapping@0.3.13':
dependencies:
'@jridgewell/sourcemap-codec': 1.6.0
+87 -40
View File
@@ -6,10 +6,11 @@ import { CloneDialog } from './components/CloneDialog'
import { OnlineRecoveryDialog } from './components/OnlineRecoveryDialog'
import { SendTextDialog } from './components/SendTextDialog'
import { HostView } from './components/HostView'
import { AppSettingsPage, ThemeMode } from './components/AppSettingsPage'
import { LogPanel, LogTab } from './components/LogPanel'
import { SettingsModal } from './components/SettingsModal'
import { Setup } from './components/Setup'
import { HOST_ID, INSTALLERS_ID, Sidebar } from './components/Sidebar'
import { HOST_ID, INSTALLERS_ID, SETTINGS_ID, Sidebar } from './components/Sidebar'
import { InstallersPage } from './components/InstallersPage'
import { VMAction, VMPage } from './components/VMPage'
import { I18nKey, t } from './i18n'
@@ -17,7 +18,7 @@ import { defaultGuestLang, recommendedMemoryGB, recommendedResolution } from './
import { LogLine, appendLog } from './lib/logs'
import { currentTask, upsertTask } from './lib/tasks'
import { AppState, CachedInstaller, CreateOpts, Locale, RuntimeSource, Task, VMDetail, VMStats } from './types'
import { TooltipProvider } from './ui/controls'
import { Tip, TooltipProvider } from './ui/controls'
import { Toaster, useToasts } from './ui/toast'
import { api, events } from './wails'
import { WindowMinimise, WindowToggleMaximise } from '../wailsjs/runtime/runtime'
@@ -59,15 +60,40 @@ export const App: React.FC = () => {
const [sendTextTarget, setSendTextTarget] = useState<string | null>(null)
const [busy, setBusy] = useState<Record<string, VMAction>>({})
const [loadError, setLoadError] = useState('')
const [theme, setTheme] = useState<'light' | 'dark'>(() => {
try { return localStorage.getItem('reims-go-theme') === 'dark' ? 'dark' : 'light' } catch { return 'light' }
const [themeMode, setThemeModeState] = useState<ThemeMode>(() => {
try {
const saved = localStorage.getItem('reims-go-theme')
if (saved === 'dark' || saved === 'light') return saved
} catch {}
return 'system'
})
const [sysDark, setSysDark] = useState<boolean>(() =>
typeof window !== 'undefined' && !!window.matchMedia?.('(prefers-color-scheme: dark)').matches,
)
const theme: 'light' | 'dark' = themeMode === 'system' ? (sysDark ? 'dark' : 'light') : themeMode
useEffect(() => {
document.documentElement.dataset.theme = theme
try { localStorage.setItem('reims-go-theme', theme) } catch {}
}, [theme])
useEffect(() => {
const mq = window.matchMedia?.('(prefers-color-scheme: dark)')
if (!mq) return
const onChange = (e: MediaQueryListEvent) => setSysDark(e.matches)
mq.addEventListener('change', onChange)
return () => mq.removeEventListener('change', onChange)
}, [])
const setThemeMode = (mode: ThemeMode) => {
setThemeModeState(mode)
try {
if (mode === 'system') localStorage.removeItem('reims-go-theme')
else localStorage.setItem('reims-go-theme', mode)
} catch {}
}
const toggleTheme = () => setThemeMode(theme === 'light' ? 'dark' : 'light')
const [logsOpen, setLogsOpen] = useState(false)
const [logTab, setLogTab] = useState<LogTab>('app')
const [logLines, setLogLines] = useState<LogLine[]>([])
@@ -89,7 +115,7 @@ export const App: React.FC = () => {
setState(s)
setLoadError('')
setSelected((cur) => {
if (cur === HOST_ID || cur === INSTALLERS_ID) return cur
if (cur === HOST_ID || cur === INSTALLERS_ID || cur === SETTINGS_ID) return cur
if ((s.vms ?? []).some((v) => v.name === cur)) return cur
return s.vms && s.vms.length > 0 ? s.vms[0].name : HOST_ID
})
@@ -117,11 +143,18 @@ export const App: React.FC = () => {
setTaskMap((prev) => (list ?? []).reduce(upsertTask, prev))
}).catch(() => {})
const offTask = events.onTask((task) => onTaskRef.current(task))
return () => { offState(); offLog(); offTask() }
// Keep host telemetry (memory load, free disk) fresh while the window is visible.
const hostTimer = window.setInterval(() => {
if (!document.hidden) void refresh()
}, 10000)
return () => { offState(); offLog(); offTask(); window.clearInterval(hostTimer) }
}, [refresh])
const vms = state?.vms ?? []
const selectedVM = selected !== HOST_ID ? vms.find((v) => v.name === selected) : undefined
const runningVMCount = vms.filter((v) => (state?.transitions[v.name] ?? v.state) === 'running').length
const selectedVM = selected !== HOST_ID && selected !== INSTALLERS_ID && selected !== SETTINGS_ID
? vms.find((v) => v.name === selected)
: undefined
useEffect(() => {
if (!selectedVM) { setDetail(null); setVmStats(null); return }
@@ -467,19 +500,20 @@ export const App: React.FC = () => {
Reims-Go
</div>
<div className="titlebar-right" onDoubleClick={(e) => e.stopPropagation()}>
<button
type="button"
className="theme-toggle"
aria-label={theme === 'light' ? 'Dark mode' : 'Light mode'}
title={theme === 'light' ? '切换深色外观' : '切换浅色外观'}
onClick={() => setTheme((cur) => (cur === 'light' ? 'dark' : 'light'))}
>
{theme === 'light' ? <Moon size={14} /> : <Sun size={14} />}
</button>
<Tip label={tr(theme === 'light' ? 'themeSwitchDark' : 'themeSwitchLight')}>
<button
type="button"
className="theme-toggle"
aria-label={tr(theme === 'light' ? 'themeSwitchDark' : 'themeSwitchLight')}
onClick={toggleTheme}
>
{theme === 'light' ? <Moon size={14} aria-hidden="true" /> : <Sun size={14} aria-hidden="true" />}
</button>
</Tip>
<div className="win-controls">
<button type="button" className="win-btn" aria-label={tr('minimize')} onClick={() => WindowMinimise()}><Minus size={14} /></button>
<button type="button" className="win-btn" aria-label={tr('maximize')} onClick={() => WindowToggleMaximise()}><Square size={12} /></button>
<button type="button" className="win-btn close" aria-label={tr('closeWindow')} onClick={() => api.RequestClose()}><X size={15} /></button>
<button type="button" className="win-btn" aria-label={tr('minimize')} onClick={() => WindowMinimise()}><Minus size={14} aria-hidden="true" /></button>
<button type="button" className="win-btn" aria-label={tr('maximize')} onClick={() => WindowToggleMaximise()}><Square size={12} aria-hidden="true" /></button>
<button type="button" className="win-btn close" aria-label={tr('closeWindow')} onClick={() => api.RequestClose()}><X size={15} aria-hidden="true" /></button>
</div>
</div>
</header>
@@ -568,13 +602,22 @@ export const App: React.FC = () => {
.catch((e) => fail(tr('failGuestTools'), e))
}}
/>
) : selected === SETTINGS_ID ? (
<AppSettingsPage
state={state}
locale={locale}
themeMode={themeMode}
onThemeMode={setThemeMode}
onSetLocale={setLang}
onRefresh={refresh}
onError={fail}
/>
) : (
<HostView
state={state}
locale={locale}
onRefresh={refresh}
onError={fail}
onSetLocale={setLang}
runtimeTask={runtimeTask}
onChannel={setChannel}
onSource={setSource}
@@ -583,29 +626,33 @@ export const App: React.FC = () => {
/>
)}
</div>
<LogPanel
locale={locale}
open={logsOpen}
onToggle={toggleLogs}
tab={selectedVM ? logTab : 'app'}
onTab={(tab) => { setLogTab(tab); if (tab === 'serial') loadSerial(); if (tab === 'qemu') loadQemu() }}
lines={logLines}
unseenErrors={unseenErrors}
onClear={() => setLogLines([])}
serialText={serialLog}
qemuText={qemuLog}
showSerial={!!selectedVM}
onRefreshSerial={() => loadSerial()}
onRefreshQemu={() => loadQemu()}
task={activeTask}
runningTasks={runningTasks}
onCancelTask={cancelTask}
/>
</main>
</div>
)}
{!showSetup && (
<LogPanel
locale={locale}
open={logsOpen}
onToggle={toggleLogs}
tab={selectedVM ? logTab : 'app'}
onTab={(tab) => { setLogTab(tab); if (tab === 'serial') loadSerial(); if (tab === 'qemu') loadQemu() }}
lines={logLines}
unseenErrors={unseenErrors}
onClear={() => setLogLines([])}
serialText={serialLog}
qemuText={qemuLog}
showSerial={!!selectedVM}
onRefreshSerial={() => loadSerial()}
onRefreshQemu={() => loadQemu()}
task={activeTask}
runningTasks={runningTasks}
onCancelTask={cancelTask}
host={state?.host}
runningVMs={runningVMCount}
/>
)}
{showWizard && state && (
<CreateWizard
locale={locale}
+191
View File
@@ -0,0 +1,191 @@
import { Download } from 'lucide-react'
import React, { useEffect, useState } from 'react'
import { I18nKey, t } from '../i18n'
import { findOptimization, optBadgeClass, optStatusLabel } from '../lib/optimizations'
import { AppState, AppUpdateInfo, Locale } from '../types'
import { Button } from '../ui/controls'
import { Segmented, Switch } from '../ui/settings'
import { api } from '../wails'
export type ThemeMode = 'light' | 'dark' | 'system'
interface Props {
state: AppState
locale: Locale
themeMode: ThemeMode
onThemeMode: (mode: ThemeMode) => void
onSetLocale: (l: Locale) => void
onRefresh: () => void
onError: (title: string, e: unknown) => void
}
export const AppSettingsPage: React.FC<Props> = ({
state, locale, themeMode, onThemeMode, onSetLocale, onRefresh, onError,
}) => {
const tr = (k: I18nKey, v?: Record<string, string | number>) => t(locale, k, v)
const { host, config, optimizations } = state
const [appUpdate, setAppUpdate] = useState<AppUpdateInfo | null>(null)
const [checkingUpdate, setCheckingUpdate] = useState(false)
const [updateErr, setUpdateErr] = useState('')
const pcoreOpt = findOptimization(optimizations, 'pcore_pin')
const runUpdateCheck = async (force: boolean) => {
setCheckingUpdate(true)
setUpdateErr('')
try {
const info = await api.CheckAppUpdate(force)
setAppUpdate(info)
} catch (e) {
setUpdateErr(String(e).replace(/^Error:\s*/, ''))
} finally {
setCheckingUpdate(false)
}
}
useEffect(() => {
void runUpdateCheck(false)
}, [])
const guard = (fn: () => Promise<unknown>) => async () => {
try {
await fn()
onRefresh()
} catch (e) {
onError(tr('failGeneric'), e)
}
}
const pickDataRoot = guard(async () => {
const dir = await api.PickDirectory(tr('hostDataRoot'))
if (dir) await api.SetDataRoot(dir)
})
return (
<div className="page">
<header className="page-head">
<div className="page-title"><h1>{tr('sidebarSettings')}</h1></div>
</header>
<section className="section">
<div className="section-title">{tr('settingsGeneral')}</div>
<div className="list">
<div className="row">
<div className="row-main">
<div className="row-title">{tr('hostDataRoot')}</div>
<div className="row-sub mono">{config.data_root}</div>
</div>
<div className="row-right"><Button onClick={pickDataRoot}>{tr('choose')}</Button></div>
</div>
<div className="row">
<div className="row-main">
<div className="row-title">
{tr('autoPinPCores')}
<span className={`badge ${optBadgeClass(pcoreOpt?.status)}`}>
{optStatusLabel(locale, pcoreOpt?.status)}
</span>
</div>
<div className="row-sub">
{pcoreOpt?.supported
? tr('optPCoreSub', { detail: pcoreOpt.detail ?? `${host.p_core_count}P+${host.e_core_count}E` })
: tr('optPCoreUnavailable')}
</div>
</div>
<div className="row-right">
<Switch
label={tr('autoPinPCores')}
disabled={!pcoreOpt?.supported}
checked={!!pcoreOpt?.supported && config.auto_pin_pcores}
onChange={(checked) => guard(() => api.SetAutoPinPCores(checked))()}
/>
</div>
</div>
<div className="row">
<div className="row-main">
<div className="row-title">{tr('minimizeToTray')}</div>
<div className="row-sub">{tr('minimizeToTraySub')}</div>
</div>
<div className="row-right">
<Switch
label={tr('minimizeToTray')}
checked={config.minimize_to_tray !== false}
onChange={(checked) => guard(() => api.SetMinimizeToTray(checked))()}
/>
</div>
</div>
</div>
</section>
<section className="section">
<div className="section-title">{tr('settingsAppearance')}</div>
<div className="list">
<div className="row">
<div className="row-main"><div className="row-title">{tr('themeLabel')}</div></div>
<div className="row-right">
<Segmented
label={tr('themeLabel')}
value={themeMode}
onChange={onThemeMode}
options={[
{ value: 'light', label: tr('themeLight') },
{ value: 'dark', label: tr('themeDark') },
{ value: 'system', label: tr('themeSystem') },
]}
/>
</div>
</div>
<div className="row">
<div className="row-main"><div className="row-title">{tr('language')}</div></div>
<div className="row-right">
<Segmented
label={tr('language')}
value={locale}
onChange={onSetLocale}
options={[
{ value: 'zh-CN', label: '中文' },
{ value: 'en-US', label: 'English' },
]}
/>
</div>
</div>
</div>
</section>
<section className="section">
<div className="section-title">{tr('settingsAbout')}</div>
<div className="list">
<div className="row">
<div className="row-main">
<div className="row-title">
{tr('appVersionTitle')} <span className="mono">{state.app_version ?? appUpdate?.current ?? 'v0.2.2'}</span>
{appUpdate && !appUpdate.has_update && (
<span className="badge badge-ok">{tr('appUpToDate')}</span>
)}
</div>
{appUpdate?.has_update ? (
<div className="row-sub">{tr('appUpdateAvailable', { v: appUpdate.latest })}</div>
) : updateErr ? (
<div className="row-sub" title={updateErr}>{tr('appUpdateLookupFailed')}</div>
) : null}
</div>
<div className="row-right">
{appUpdate?.has_update && (appUpdate.page_url || appUpdate.download_url) ? (
<Button
variant="primary"
icon={<Download size={14} aria-hidden="true" />}
onClick={() => guard(() => api.OpenURL(appUpdate.page_url || appUpdate.download_url || ''))()}
>
{tr('appDownloadUpdate')}
</Button>
) : (
<Button busy={checkingUpdate} onClick={() => void runUpdateCheck(true)}>
{tr('appCheckUpdate')}
</Button>
)}
</div>
</div>
</div>
</section>
</div>
)
}
+3 -1
View File
@@ -24,12 +24,14 @@ export const CloneDialog: React.FC<Props> = ({ locale, sourceName, defaultCloneN
<Alert.Description className="dialog-desc">
{t(locale, 'cloneDesc')}
</Alert.Description>
<div className="field" style={{ marginTop: 10 }}>
<div className="field field-spaced">
<label className="field-label" htmlFor="clone-name">{t(locale, 'cloneNameLabel')}</label>
<input
id="clone-name"
className="input mono"
value={cloneName}
spellCheck={false}
autoComplete="off"
onChange={(e) => setCloneName(e.target.value)}
onKeyDown={(e) => { if (e.key === 'Enter' && trimmed) onConfirm(trimmed) }}
autoFocus
+23 -131
View File
@@ -1,8 +1,8 @@
import { Cpu, Download, HardDrive, MemoryStick, RefreshCw, ShieldCheck } from 'lucide-react'
import React, { useEffect, useState } from 'react'
import { Cpu, HardDrive, MemoryStick, RefreshCw, ShieldCheck } from 'lucide-react'
import React, { useState } from 'react'
import { I18nKey, t } from '../i18n'
import { findOptimization, kernelIrqchipHint, optBadgeClass, optStatusLabel } from '../lib/optimizations'
import { AppState, AppUpdateInfo, Locale, RuntimeSource, Task } from '../types'
import { AppState, Locale, RuntimeSource, Task } from '../types'
import { Button, IconButton } from '../ui/controls'
import { api } from '../wails'
import { RuntimeOnline } from './RuntimeOnline'
@@ -12,7 +12,6 @@ interface Props {
locale: Locale
onRefresh: () => void
onError: (title: string, e: unknown) => void
onSetLocale: (l: Locale) => void
runtimeTask: Task | null
onChannel: (alpha: boolean) => void
onSource: (source: RuntimeSource) => void
@@ -20,33 +19,12 @@ interface Props {
onCancelTask: (id: string) => void
}
export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, onSetLocale, runtimeTask, onChannel, onSource, onInstallRuntime, onCancelTask }) => {
export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, runtimeTask, onChannel, onSource, onInstallRuntime, onCancelTask }) => {
const [importing, setImporting] = useState(false)
const [enabling, setEnabling] = useState(false)
const [openingSched, setOpeningSched] = useState(false)
const [appUpdate, setAppUpdate] = useState<AppUpdateInfo | null>(null)
const [checkingUpdate, setCheckingUpdate] = useState(false)
const [updateErr, setUpdateErr] = useState('')
const { host, config, runtimes, optimizations } = state
const tr = (k: I18nKey, v?: Record<string, string | number>) => t(locale, k, v)
const runUpdateCheck = async (force: boolean) => {
setCheckingUpdate(true)
setUpdateErr('')
try {
const info = await api.CheckAppUpdate(force)
setAppUpdate(info)
} catch (e) {
setUpdateErr(String(e).replace(/^Error:\s*/, ''))
} finally {
setCheckingUpdate(false)
}
}
useEffect(() => {
void runUpdateCheck(false)
}, [])
const pcoreOpt = findOptimization(optimizations, 'pcore_pin')
const irqOpt = findOptimization(optimizations, 'kernel_irqchip')
const rebootOpt = findOptimization(optimizations, 'cold_reboot')
const gpuOpt = findOptimization(optimizations, 'discrete_gpu')
@@ -81,11 +59,6 @@ export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, o
setOpeningSched(false)
}
const pickDataRoot = guard(async () => {
const dir = await api.PickDirectory(tr('hostDataRoot'))
if (dir) await api.SetDataRoot(dir)
})
const importRuntime = async () => {
setImporting(true)
await guard(async () => {
@@ -111,7 +84,10 @@ export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, o
<div className="tiles">
<div className="tile">
<div className="tile-head"><ShieldCheck size={14} /> {tr('whpxTitle')}</div>
<div className="tile-head">
<span className={`tile-icon ${whpx.tone}`} aria-hidden="true"><ShieldCheck size={13} /></span>
{tr('whpxTitle')}
</div>
<div className={`tile-value ${whpx.tone}`}>{whpx.short}</div>
{host.whpx === 'missing' ? (
<Button variant="primary" className="tile-action" busy={enabling} onClick={enableWHPX}>{tr('enableWHPX')}</Button>
@@ -120,16 +96,28 @@ export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, o
) : null}
</div>
<div className="tile">
<div className="tile-head"><Cpu size={14} /> {tr('hostCPU')}</div>
<div className="tile-head">
<span className="tile-icon accent" aria-hidden="true"><Cpu size={13} /></span>
{tr('hostCPU')}
</div>
<div className="tile-value">{tr('hostCoresThreads', { c: host.physical_cores, t: host.logical_cpus })}</div>
{host.p_core_count > 0 && host.e_core_count > 0 && (
<div className="tile-sub">{host.p_core_count}P + {host.e_core_count}E</div>
)}
</div>
<div className="tile">
<div className="tile-head"><MemoryStick size={14} /> {tr('hostRAM')}</div>
<div className="tile-head">
<span className="tile-icon accent" aria-hidden="true"><MemoryStick size={13} /></span>
{tr('hostRAM')}
</div>
<div className="tile-value">{tr('hostRAMAvail', { n: host.avail_ram_gb.toFixed(1) })}</div>
<div className="tile-sub">{tr('hostRAMTotal', { n: host.total_ram_gb.toFixed(1) })}</div>
</div>
<div className="tile">
<div className="tile-head"><HardDrive size={14} /> {tr('hostDisk')}</div>
<div className="tile-head">
<span className="tile-icon" aria-hidden="true"><HardDrive size={13} /></span>
{tr('hostDisk')}
</div>
<div className="tile-value">{host.free_disk_gb.toFixed(0)} GB</div>
</div>
</div>
@@ -167,102 +155,6 @@ export const HostView: React.FC<Props> = ({ state, locale, onRefresh, onError, o
</div>
</section>
<section className="section">
<div className="section-title">{tr('settings')}</div>
<div className="list">
<div className="row">
<div className="row-main">
<div className="row-title">{tr('hostDataRoot')}</div>
<div className="row-sub mono">{config.data_root}</div>
</div>
<div className="row-right"><Button onClick={pickDataRoot}>{tr('choose')}</Button></div>
</div>
<div className="row">
<div className="row-main">
<div className="row-title">
{tr('autoPinPCores')}
<span className={`badge ${optBadgeClass(pcoreOpt?.status)}`}>
{optStatusLabel(locale, pcoreOpt?.status)}
</span>
</div>
<div className="row-sub">
{pcoreOpt?.supported
? tr('optPCoreSub', { detail: pcoreOpt.detail ?? `${host.p_core_count}P+${host.e_core_count}E` })
: tr('optPCoreUnavailable')}
</div>
</div>
<div className="row-right">
<label className="switch">
<input
type="checkbox"
aria-label={tr('autoPinPCores')}
disabled={!pcoreOpt?.supported}
checked={!!pcoreOpt?.supported && config.auto_pin_pcores}
onChange={(e) => guard(() => api.SetAutoPinPCores(e.target.checked))()}
/>
<span className="slider" />
</label>
</div>
</div>
<div className="row">
<div className="row-main">
<div className="row-title">{tr('minimizeToTray')}</div>
<div className="row-sub">{tr('minimizeToTraySub')}</div>
</div>
<div className="row-right">
<label className="switch">
<input
type="checkbox"
aria-label={tr('minimizeToTray')}
checked={config.minimize_to_tray !== false}
onChange={(e) => guard(() => api.SetMinimizeToTray(e.target.checked))()}
/>
<span className="slider" />
</label>
</div>
</div>
<div className="row">
<div className="row-main"><div className="row-title">{tr('language')}</div></div>
<div className="row-right">
<div className="segmented" role="group" aria-label={tr('language')}>
<button type="button" aria-pressed={locale === 'zh-CN'} onClick={() => onSetLocale('zh-CN')}>中文</button>
<button type="button" aria-pressed={locale === 'en-US'} onClick={() => onSetLocale('en-US')}>English</button>
</div>
</div>
</div>
<div className="row">
<div className="row-main">
<div className="row-title">
{tr('appVersionTitle')} <span className="mono">{state.app_version ?? appUpdate?.current ?? 'v0.2.2'}</span>
{appUpdate && !appUpdate.has_update && (
<span className="badge badge-ok">{tr('appUpToDate')}</span>
)}
</div>
{appUpdate?.has_update ? (
<div className="row-sub">{tr('appUpdateAvailable', { v: appUpdate.latest })}</div>
) : updateErr ? (
<div className="row-sub" title={updateErr}>{tr('appUpdateLookupFailed')}</div>
) : null}
</div>
<div className="row-right">
{appUpdate?.has_update && (appUpdate.page_url || appUpdate.download_url) ? (
<Button
variant="primary"
icon={<Download size={14} />}
onClick={() => guard(() => api.OpenURL(appUpdate.page_url || appUpdate.download_url || ''))()}
>
{tr('appDownloadUpdate')}
</Button>
) : (
<Button busy={checkingUpdate} onClick={() => void runUpdateCheck(true)}>
{tr('appCheckUpdate')}
</Button>
)}
</div>
</div>
</div>
</section>
<section className="section">
<div className="section-title">{tr('hostOptimizations')}</div>
<div className="list">
+46 -13
View File
@@ -1,4 +1,4 @@
import { Download, LoaderCircle, Pause, Plus, RefreshCw, Trash } from 'lucide-react'
import { AlertTriangle, Download, LoaderCircle, Package, Pause, Plus, RefreshCw, Trash } from 'lucide-react'
import React, { useEffect, useState } from 'react'
import { I18nKey, t } from '../i18n'
import { taskDetail } from '../lib/tasks'
@@ -65,12 +65,30 @@ export const InstallersPage: React.FC<Props> = ({ locale, host, tasks, onCreateW
const progress = (task: Task) => (
<span className="task-inline row-sub">
<LoaderCircle size={14} className="spin" />
{task.percent >= 0 && <span className="progress"><div style={{ width: `${task.percent}%` }} /></span>}
<LoaderCircle size={14} className="spin" aria-hidden="true" />
{task.percent >= 0 && (
<span className="progress" aria-hidden="true">
<span className="progress-fill" style={{ transform: `scaleX(${Math.max(0, Math.min(1, task.percent / 100))})` }} />
</span>
)}
<span>{task.percent >= 0 ? `${Math.floor(task.percent)}%` : ''} {taskDetail(task)}</span>
</span>
)
const skeleton = (rows: number, label?: string) => (
<div className="skeleton-list" role="status" aria-label={label}>
{Array.from({ length: rows }).map((_, i) => (
<div className="skeleton-row" key={i} aria-hidden="true">
<div className="skeleton-stack">
<div className="skeleton-bar w-title" />
<div className="skeleton-bar w-sub" />
</div>
<div className="skeleton-bar w-btn" />
</div>
))}
</div>
)
return (
<div className="page">
<header className="page-head">
@@ -82,12 +100,16 @@ export const InstallersPage: React.FC<Props> = ({ locale, host, tasks, onCreateW
<section className="section">
<div className="section-title">{tr('installersDownloaded')}</div>
{cached === null ? (
skeleton(2, tr('installersDownloaded'))
) : cached.length === 0 ? (
<div className="empty-panel">
<Package size={22} aria-hidden="true" />
<span>{tr('installersEmpty')}</span>
</div>
) : (
<div className="list">
{cached === null ? (
<div className="row"><span className="row-sub">…</span></div>
) : cached.length === 0 ? (
<div className="row"><span className="row-sub">{tr('installersEmpty')}</span></div>
) : cached.map((c) => {
{cached.map((c) => {
const task = c.version ? running(c.version) : undefined
return (
<div className="row" key={c.name}>
@@ -126,16 +148,26 @@ export const InstallersPage: React.FC<Props> = ({ locale, host, tasks, onCreateW
)
})}
</div>
)}
</section>
<section className="section">
<div className="section-title">{tr('installersAvailable')}</div>
{releasesErr ? (
<div className="notice notice-error" role="alert">
<span className="notice-main">
<AlertTriangle size={15} className="notice-icon" aria-hidden="true" />
<span>{tr('offlineListFailed')}:{releasesErr}</span>
</span>
</div>
) : releases === null ? (
<>
{skeleton(3, tr('offlineLoading'))}
<span className="hint">{tr('offlineLoading')}</span>
</>
) : (
<div className="list">
{releasesErr ? (
<div className="row"><span className="row-sub">{tr('offlineListFailed')}:{releasesErr}</span></div>
) : releases === null ? (
<div className="row"><span className="row-sub">{tr('offlineLoading')}</span></div>
) : releases.map((r) => {
{releases.map((r) => {
const task = running(r.version)
const done = isDownloaded(r.version)
const short = !done && !task && host.free_disk_gb > 0 && host.free_disk_gb * 1e9 < needBytes(r)
@@ -166,6 +198,7 @@ export const InstallersPage: React.FC<Props> = ({ locale, host, tasks, onCreateW
)
})}
</div>
)}
<span className="hint">{tr('installersHint')}</span>
</section>
</div>
+130 -19
View File
@@ -1,9 +1,9 @@
import { ArrowDown, ChevronDown, ChevronUp, Eraser, LoaderCircle, Pause, RefreshCw } from 'lucide-react'
import { ArrowDown, ChevronDown, ChevronUp, Eraser, HardDrive, LoaderCircle, MemoryStick, Pause, RefreshCw } from 'lucide-react'
import React, { useLayoutEffect, useRef, useState } from 'react'
import { t } from '../i18n'
import { LogLine } from '../lib/logs'
import { taskDetail, taskTitle } from '../lib/tasks'
import { Locale, Task } from '../types'
import { HostReport, Locale, Task } from '../types'
import { Button, IconButton, Tip } from '../ui/controls'
export type LogTab = 'app' | 'serial' | 'qemu'
@@ -25,6 +25,8 @@ interface Props {
task: Task | null
runningTasks: number
onCancelTask: (id: string) => void
host?: HostReport
runningVMs?: number
}
/** Sticks to the bottom until the user scrolls up; offers "jump to latest" then. */
@@ -50,29 +52,95 @@ function useStickToBottom(dep: unknown, active: boolean) {
return { ref, stuck, onScroll, jump }
}
const LOG_HEIGHT_KEY = 'reims-go-log-height'
const DEFAULT_LOG_HEIGHT = 240
const MIN_LOG_HEIGHT = 120
const MAX_LOG_HEIGHT = 520
export const LogPanel: React.FC<Props> = ({
locale, open, onToggle, tab, onTab, lines, unseenErrors, onClear, serialText, qemuText, showSerial, onRefreshSerial, onRefreshQemu,
task, runningTasks, onCancelTask,
task, runningTasks, onCancelTask, host, runningVMs = 0,
}) => {
const tr = (k: Parameters<typeof t>[1]) => t(locale, k)
const tr = (k: Parameters<typeof t>[1], v?: Record<string, string | number>) => t(locale, k, v)
const content = tab === 'app' ? lines : tab === 'serial' ? serialText : qemuText
const { ref, stuck, onScroll, jump } = useStickToBottom(content, open)
const memPct = host
? Math.max(0, Math.min(100, host.memory_load_pct > 0
? host.memory_load_pct
: host.total_ram_gb > 0
? Math.round(((host.total_ram_gb - host.avail_ram_gb) / host.total_ram_gb) * 100)
: 0))
: 0
const usedMemGB = host && host.total_ram_gb > 0 ? Math.max(0, host.total_ram_gb - host.avail_ram_gb) : 0
const memTone = memPct >= 90 ? ' high' : memPct >= 80 ? ' warn' : ''
const lowDisk = !!host && host.free_disk_gb > 0 && host.free_disk_gb < 30
const [height, setHeight] = useState<number>(() => {
try {
const saved = Number(localStorage.getItem(LOG_HEIGHT_KEY))
if (Number.isFinite(saved) && saved >= MIN_LOG_HEIGHT && saved <= MAX_LOG_HEIGHT) return saved
} catch {}
return DEFAULT_LOG_HEIGHT
})
const [dragging, setDragging] = useState(false)
const dragRef = useRef<{ startY: number; startH: number } | null>(null)
const onResizeDown = (e: React.PointerEvent<HTMLDivElement>) => {
e.preventDefault()
e.currentTarget.setPointerCapture(e.pointerId)
dragRef.current = { startY: e.clientY, startH: height }
setDragging(true)
}
const onResizeMove = (e: React.PointerEvent<HTMLDivElement>) => {
if (!dragRef.current) return
const next = Math.min(MAX_LOG_HEIGHT, Math.max(MIN_LOG_HEIGHT, Math.round(dragRef.current.startH + (dragRef.current.startY - e.clientY))))
setHeight(next)
}
const onResizeUp = (e: React.PointerEvent<HTMLDivElement>) => {
if (!dragRef.current) return
dragRef.current = null
setDragging(false)
if (e.currentTarget.hasPointerCapture(e.pointerId)) e.currentTarget.releasePointerCapture(e.pointerId)
try { localStorage.setItem(LOG_HEIGHT_KEY, String(height)) } catch {}
}
return (
<div className="logs">
{open && (
<div
className="log-resize-handle"
role="separator"
aria-orientation="horizontal"
aria-label={tr('resizeLogPanel')}
data-dragging={dragging}
onPointerDown={onResizeDown}
onPointerMove={onResizeMove}
onPointerUp={onResizeUp}
onPointerCancel={onResizeUp}
onDoubleClick={() => {
setHeight(DEFAULT_LOG_HEIGHT)
try { localStorage.setItem(LOG_HEIGHT_KEY, String(DEFAULT_LOG_HEIGHT)) } catch {}
}}
>
<span className="log-resize-pill" aria-hidden="true" />
</div>
)}
<div className="logbar">
{task && (
{task ? (
<>
<Tip label={[task.step, taskDetail(task)].filter(Boolean).join(' · ') || taskTitle(locale, task)} side="top">
<span className="task" tabIndex={0}>
<LoaderCircle size={14} className="spin" />
<LoaderCircle size={14} className="spin" aria-hidden="true" />
<span className="task-label">
{runningTasks > 1 ? t(locale, 'tasksRunning', { n: runningTasks }) : taskTitle(locale, task)}
</span>
{task.percent >= 0 && (
<>
<span className="progress" aria-hidden="true"><div style={{ width: `${task.percent}%` }} /></span>
<span>{Math.floor(task.percent)}%</span>
<span className="progress" aria-hidden="true">
<span className="progress-fill" style={{ transform: `scaleX(${Math.max(0, Math.min(1, task.percent / 100))})` }} />
</span>
<span className="task-pct">{Math.floor(task.percent)}%</span>
</>
)}
</span>
@@ -81,7 +149,47 @@ export const LogPanel: React.FC<Props> = ({
<IconButton small tipSide="top" label={tr('pauseDownload')} icon={<Pause size={14} />} onClick={() => onCancelTask(task.id)} />
)}
</>
)}
) : host ? (
<div className="status-telemetry">
{host.total_ram_gb > 0 && (
<Tip
side="top"
label={tr('footerMemTip', {
used: usedMemGB.toFixed(1),
total: host.total_ram_gb.toFixed(1),
avail: host.avail_ram_gb.toFixed(1),
})}
>
<span className={`status-metric${memTone}`} tabIndex={0}>
<MemoryStick size={12} aria-hidden="true" />
<span>{tr('footerMem', { pct: memPct })}</span>
<span className="status-mini-bar" aria-hidden="true">
<span className={`status-mini-fill${memTone}`} style={{ transform: `scaleX(${memPct / 100})` }} />
</span>
<span className="status-metric-dim">({tr('footerMemAvail', { avail: host.avail_ram_gb.toFixed(1) })})</span>
</span>
</Tip>
)}
{host.free_disk_gb > 0 && (
<>
<span className="status-sep" aria-hidden="true">·</span>
<span className={`status-metric${lowDisk ? ' warn' : ''}`}>
<HardDrive size={12} aria-hidden="true" />
<span>{tr('footerDisk', { gb: host.free_disk_gb.toFixed(0) })}</span>
</span>
</>
)}
{runningVMs > 0 && (
<>
<span className="status-sep" aria-hidden="true">·</span>
<span className="status-metric ok">
<span className="status status-running" aria-hidden="true" />
<span>{tr('footerRunningVMs', { n: runningVMs })}</span>
</span>
</>
)}
</div>
) : null}
<span className="spacer" />
{open && (
<div className="tabs" role="tablist">
@@ -110,20 +218,23 @@ export const LogPanel: React.FC<Props> = ({
<IconButton small tipSide="top" label={tr('refresh')} icon={<RefreshCw size={14} />} onClick={onRefreshQemu} />
)}
{!open && unseenErrors > 0 && <span className="badge badge-error" aria-hidden="true">{unseenErrors}</span>}
<IconButton
small
tipSide="top"
label={open ? tr('collapseLogs') : tr('expandLogs')}
shortcut="Ctrl+L"
icon={open ? <ChevronDown size={16} /> : <ChevronUp size={16} />}
onClick={onToggle}
aria-expanded={open}
/>
<Tip label={open ? tr('collapseLogs') : tr('expandLogs')} shortcut="Ctrl+L" side="top">
<button
type="button"
className="log-toggle-btn"
onClick={onToggle}
aria-expanded={open}
aria-label={open ? tr('collapseLogs') : tr('expandLogs')}
>
<span>{tr('logButton')}</span>
{open ? <ChevronDown size={14} aria-hidden="true" /> : <ChevronUp size={14} aria-hidden="true" />}
</button>
</Tip>
</div>
{open && (
<div className="logs-body-wrap">
<div className="logs-body" ref={ref} onScroll={onScroll} role="log" aria-live="off">
<div className="logs-body" style={{ height }} ref={ref} onScroll={onScroll} role="log" aria-live="off">
{tab === 'app'
? (lines.length === 0
? <span className="muted">{tr('logsEmpty')}</span>
+17 -23
View File
@@ -4,6 +4,7 @@ import { I18nKey, t } from '../i18n'
import { taskDetail } from '../lib/tasks'
import { InstalledRuntime, Locale, RemoteRuntime, RuntimeSource, Task } from '../types'
import { Button, IconButton } from '../ui/controls'
import { Segmented, Switch } from '../ui/settings'
import { api } from '../wails'
interface Props {
@@ -58,8 +59,12 @@ export const RuntimeOnline: React.FC<Props> = ({ locale, channel, source, instal
if (running && task) {
sub = (
<div className="row-sub task-inline">
<LoaderCircle size={14} className="spin" />
{task.percent >= 0 && <span className="progress"><div style={{ width: `${task.percent}%` }} /></span>}
<LoaderCircle size={14} className="spin" aria-hidden="true" />
{task.percent >= 0 && (
<span className="progress" aria-hidden="true">
<span className="progress-fill" style={{ transform: `scaleX(${Math.max(0, Math.min(1, task.percent / 100))})` }} />
</span>
)}
<span>{task.percent >= 0 ? `${Math.floor(task.percent)}%` : ''} {taskDetail(task)}</span>
</div>
)
@@ -116,18 +121,15 @@ export const RuntimeOnline: React.FC<Props> = ({ locale, channel, source, instal
<div className="row-sub">{tr('runtimeSourceHint')}</div>
</div>
<div className="row-right">
<div className="segmented" role="group" aria-label={tr('runtimeSource')}>
{(['auto', 'github', 'gitcode'] as RuntimeSource[]).map((s) => (
<button
key={s}
type="button"
aria-pressed={source === s}
onClick={() => onSource(s)}
>
{tr(`runtimeSource_${s}` as I18nKey)}
</button>
))}
</div>
<Segmented
label={tr('runtimeSource')}
value={source}
onChange={onSource}
options={(['auto', 'github', 'gitcode'] as RuntimeSource[]).map((s) => ({
value: s,
label: tr(`runtimeSource_${s}` as I18nKey),
}))}
/>
</div>
</div>
<div className="row">
@@ -136,15 +138,7 @@ export const RuntimeOnline: React.FC<Props> = ({ locale, channel, source, instal
<div className="row-sub">{tr('runtimeAlphaHint')}</div>
</div>
<div className="row-right">
<label className="switch">
<input
type="checkbox"
aria-label={tr('runtimeAlpha')}
checked={channel === 'alpha'}
onChange={(e) => onChannel(e.target.checked)}
/>
<span className="slider" />
</label>
<Switch label={tr('runtimeAlpha')} checked={channel === 'alpha'} onChange={onChannel} />
</div>
</div>
</>
+2 -3
View File
@@ -25,11 +25,10 @@ export const SendTextDialog: React.FC<Props> = ({ locale, vmName, guestToolsConn
<Alert.Description className="dialog-desc">
{t(locale, guestToolsConnected ? 'sendTextDesc' : 'sendTextDescNoGT')}
</Alert.Description>
<div className="field" style={{ marginTop: 10 }}>
<div className="field field-spaced">
<textarea
className="input"
className="input textarea"
rows={4}
style={{ height: 'auto', minHeight: 88, resize: 'vertical', padding: '8px 10px', lineHeight: 1.5 }}
placeholder={t(locale, 'sendTextPlaceholder')}
value={text}
onChange={(e) => setText(e.target.value)}
+4 -3
View File
@@ -588,10 +588,11 @@ export const SettingsModal: React.FC<Props> = ({ locale, detail, stats, host, op
</div>
<div className="hstack">
<input
className="input mono"
style={{ maxWidth: 140 }}
className="input mono input-compact"
aria-label={tr('diskResizeTitle')}
value={resizeInput}
spellCheck={false}
autoComplete="off"
disabled={running || !!diskOpBusy}
onChange={(e) => setResizeInput(e.target.value)}
placeholder="+64G / 256G"
@@ -608,7 +609,7 @@ export const SettingsModal: React.FC<Props> = ({ locale, detail, stats, host, op
{resizeResult && (
<div className="notice">
<div>{tr('diskResizeDone', { size: formatBytes(resizeResult.new_virtual_bytes) })}</div>
<div className="cmd-line" style={{ marginTop: 6 }}>
<div className="cmd-line cmd-line-spaced">
<code>{resizeResult.guest_expand_cmd}</code>
{onCopy && (
<IconButton small label={tr('copy')} icon={<Copy size={14} />} onClick={() => onCopy(resizeResult.guest_expand_cmd)} />
+12 -4
View File
@@ -3,6 +3,7 @@ import React, { useEffect, useState } from 'react'
import { I18nKey, t } from '../i18n'
import { AppState, DataRootCheck, DataRootChoice, Locale, RuntimeSource, Task } from '../types'
import { Button } from '../ui/controls'
import { Segmented } from '../ui/settings'
import { recommendedMemoryGB, shortGPUName } from '../lib/format'
import { api } from '../wails'
import { RuntimeOnline } from './RuntimeOnline'
@@ -121,6 +122,8 @@ const FolderStep: React.FC<StepProps> = ({ locale, tr, onLocale, onFolderDone, o
aria-label={tr('setupOther')}
value={custom}
placeholder="D:\VMs\reims-go"
spellCheck={false}
autoComplete="off"
autoFocus
onFocus={() => custom && setSelected(custom)}
onChange={(e) => { setCustom(e.target.value); setSelected(e.target.value.trim()) }}
@@ -139,10 +142,15 @@ const FolderStep: React.FC<StepProps> = ({ locale, tr, onLocale, onFolderDone, o
<div className="hint">{tr('setupFree', { n: check.free_gb.toFixed(0) })}</div>
)}
<div className="setup-foot">
<div className="segmented" role="group" aria-label={tr('language')}>
<button type="button" aria-pressed={locale === 'zh-CN'} onClick={() => onLocale('zh-CN')}>中文</button>
<button type="button" aria-pressed={locale === 'en-US'} onClick={() => onLocale('en-US')}>English</button>
</div>
<Segmented
label={tr('language')}
value={locale}
onChange={onLocale}
options={[
{ value: 'zh-CN', label: '中文' },
{ value: 'en-US', label: 'English' },
]}
/>
<Button variant="primary" busy={busy} disabled={!selected || !!check?.error} onClick={next}>{tr('setupContinue')}</Button>
</div>
</>
+12 -2
View File
@@ -1,4 +1,4 @@
import { Cpu, Download, Monitor, Plus } from 'lucide-react'
import { Cpu, Download, Monitor, Plus, Settings } from 'lucide-react'
import React, { useRef } from 'react'
import { I18nKey, t } from '../i18n'
import { Locale, VMListItem } from '../types'
@@ -6,6 +6,7 @@ import { IconButton, StatusShape, Tip, statusKind } from '../ui/controls'
export const HOST_ID = '__host__'
export const INSTALLERS_ID = '__installers__'
export const SETTINGS_ID = '__settings__'
interface Props {
locale: Locale
@@ -21,7 +22,7 @@ interface Props {
export const Sidebar: React.FC<Props> = ({ locale, vms, transitions, selected, hostReady, onSelect, onNew, downloading }) => {
const listRef = useRef<HTMLDivElement>(null)
const ids = [...vms.map((v) => v.name), INSTALLERS_ID, HOST_ID]
const ids = [...vms.map((v) => v.name), INSTALLERS_ID, HOST_ID, SETTINGS_ID]
// Listbox keyboard model: ↑/↓/Home/End move selection and focus together.
const onKeyDown = (e: React.KeyboardEvent) => {
@@ -80,6 +81,7 @@ export const Sidebar: React.FC<Props> = ({ locale, vms, transitions, selected, h
return item(vm.name, vm.name, <Monitor size={13} />, 'nav-icon-vm', t(locale, `state_${st}` as I18nKey), statusKind(st))
})}
<div className="sidebar-sep" role="presentation" />
<div className="sidebar-section-label" aria-hidden="true">{t(locale, 'sidebarSystem')}</div>
{item(
INSTALLERS_ID,
t(locale, 'sidebarInstallers'),
@@ -96,6 +98,14 @@ export const Sidebar: React.FC<Props> = ({ locale, vms, transitions, selected, h
t(locale, hostReady ? 'hostReady' : 'hostNeedsAction'),
hostReady ? 'running' : 'warn',
)}
{item(
SETTINGS_ID,
t(locale, 'sidebarSettings'),
<Settings size={13} />,
'nav-icon-settings',
'',
null,
)}
</div>
</aside>
</div>
+130 -93
View File
@@ -29,11 +29,11 @@ import {
} from 'lucide-react'
import React, { useEffect, useRef, useState } from 'react'
import { I18nKey, t } from '../i18n'
import { controllerLabel, formatBytes, formatMemory, formatUptime, graphicsLabel, guestLangLabel, splitLangLabel, sshCommand } from '../lib/format'
import { controllerLabel, formatBytes, formatDiskUsage, formatMemory, formatUptime, graphicsLabel, guestLangLabel, splitLangLabel, sshCommand } from '../lib/format'
import { HostReport, Locale, PendingChange, VMDetail, VMStats, VMThumbnail } from '../types'
import { api } from '../wails'
import { Button, IconButton, StatusShape, Tip, statusKind } from '../ui/controls'
import { SetGroup, SetRow, Switch } from '../ui/settings'
import { Switch } from '../ui/settings'
export type VMAction =
| 'start'
@@ -186,20 +186,23 @@ export const VMPage: React.FC<Props> = ({
// Each fact is said once (docs/ui-audit.md H1); raw upstream values live in
// "Technical details" at the bottom.
const diskUsed = !!stats && stats.disk_virtual_bytes > 0 && stats.disk_actual_bytes > 0
const specs: { label: string; value: string; icon: React.ReactNode }[] = detail
const specs: { label: string; value: string; full?: string; icon: React.ReactNode }[] = detail
? [
{ label: tr('factCPU'), value: tr('cores', { n: detail.cpus }), icon: <Cpu size={14} aria-hidden="true" /> },
{ label: tr('factMemory'), value: formatMemory(detail.memory), icon: <MemoryStick size={14} aria-hidden="true" /> },
{ label: tr('factGraphics'), value: graphicsLabel(locale, detail, host) + (detail.displays > 1 ? ` × ${detail.displays}` : ''), icon: <Monitor size={14} aria-hidden="true" /> },
{ label: tr('factCPU'), value: tr('cores', { n: detail.cpus }), icon: <Cpu size={15} aria-hidden="true" /> },
{ label: tr('factMemory'), value: formatMemory(detail.memory), icon: <MemoryStick size={15} aria-hidden="true" /> },
{ label: tr('factGraphics'), value: graphicsLabel(locale, detail, host) + (detail.displays > 1 ? ` × ${detail.displays}` : ''), icon: <Monitor size={15} aria-hidden="true" /> },
{
label: tr('factDisk'),
value: diskUsed && stats
? tr('specDiskUsage', { ctl: controllerLabel(detail.disk_controller), used: formatBytes(stats.disk_actual_bytes), max: formatBytes(stats.disk_virtual_bytes) })
? `${controllerLabel(detail.disk_controller)} · ${formatDiskUsage(stats.disk_actual_bytes, stats.disk_virtual_bytes)}`
: controllerLabel(detail.disk_controller),
icon: <HardDrive size={14} aria-hidden="true" />,
full: diskUsed && stats
? tr('specDiskUsage', { ctl: controllerLabel(detail.disk_controller), used: formatBytes(stats.disk_actual_bytes), max: formatBytes(stats.disk_virtual_bytes) })
: undefined,
icon: <HardDrive size={15} aria-hidden="true" />,
},
{ label: tr('fieldNetwork'), value: detail.network ? (detail.ssh_port > 0 ? `NAT · SSH ${detail.ssh_port}` : 'NAT') : tr('off'), icon: <Network size={14} aria-hidden="true" /> },
...(detail.guest_lang ? [{ label: tr('specLang'), value: splitLangLabel('', guestLangLabel(locale, detail.guest_lang)).label, icon: <Globe size={14} aria-hidden="true" /> }] : []),
{ label: tr('fieldNetwork'), value: detail.network ? (detail.ssh_port > 0 ? `NAT · SSH ${detail.ssh_port}` : 'NAT') : tr('off'), icon: <Network size={15} aria-hidden="true" /> },
...(detail.guest_lang ? [{ label: tr('specLang'), value: splitLangLabel('', guestLangLabel(locale, detail.guest_lang)).label, icon: <Globe size={15} aria-hidden="true" /> }] : []),
]
: []
@@ -251,31 +254,36 @@ export const VMPage: React.FC<Props> = ({
</section>
{specs.length > 0 && (
<dl className="vm-spec-grid">
<div className="vm-spec-card" role="list">
{specs.map((s) => (
<div className="vm-spec-item" key={s.label}>
<span className="vm-spec-icon">{s.icon}</span>
<span className="vm-spec-meta">
<dt className="vm-spec-label">{s.label}</dt>
<dd className="vm-spec-val" title={s.value}>{s.value}</dd>
</span>
</div>
<Tip key={s.label} label={s.full ? `${s.label}:${s.full}` : `${s.label}:${s.value}`}>
<div className="vm-spec-cell" role="listitem">
<span className="vm-spec-icon">{s.icon}</span>
<span className="vm-spec-val">{s.value}</span>
</div>
</Tip>
))}
</dl>
</div>
)}
{running && stats && (
<div className="vm-telemetry-card">
<div className="vm-meter">
<span className="vm-meter-label"><Cpu size={13} aria-hidden="true" />{tr('statsCPU')}</span>
<span className="vm-meter-value">{Math.round(cpuPct)}%</span>
<div className="vm-meter-head">
<span>{tr('statsCPU')}</span>
<span className="muted">·</span>
<span>{Math.round(cpuPct)}%</span>
</div>
<div className="resource-meter" aria-hidden="true">
<span className={`meter-fill${meterTone(cpuPct)}`} style={{ transform: `scaleX(${cpuPct / 100})` }} />
</div>
</div>
<div className="vm-meter">
<span className="vm-meter-label"><MemoryStick size={13} aria-hidden="true" />{tr('statsMemory')}</span>
<span className="vm-meter-value">{stats.memory_rss_bytes > 0 ? formatBytes(stats.memory_rss_bytes) : '—'}</span>
<div className="vm-meter-head">
<span>{tr('statsMemory')}</span>
<span className="muted">·</span>
<span>{stats.memory_rss_bytes > 0 ? formatBytes(stats.memory_rss_bytes) : '—'}</span>
</div>
<div className="resource-meter" aria-hidden="true">
<span className={`meter-fill${meterTone(memPct)}`} style={{ transform: `scaleX(${memPct / 100})` }} />
</div>
@@ -453,71 +461,97 @@ export const VMPage: React.FC<Props> = ({
? [tr('guestToolsConnected'), gtMountMode === 'webdav' ? tr('guestToolsModeWebDAV') : gtMountMode === 'sync' ? tr('guestToolsModeSync') : ''].filter(Boolean).join(' · ')
: detail.guest_tools_configured ? tr('guestToolsReady') : tr('gtNotInstalledDesc')
return (
<SetGroup title={tr('connGroup')}>
{detail.ssh_port > 0 && (
<SetRow
title="SSH"
desc={<code className="inline-code">{sshCommand(detail.ssh_port)}</code>}
control={<IconButton small label={tr('copy')} icon={<Copy size={14} />} onClick={() => onCopy(sshCommand(detail.ssh_port))} />}
/>
)}
{tools && (
<SetRow
title={tr('guestToolsTitle')}
desc={needsUpgrade ? <span className="warn-text">{tr('guestToolsUpgradeHint')}</span> : gtStatus}
control={detail.guest_tools_attached ? (
<Button busy={busyAction === 'detachGuestTools'} disabled={busy} onClick={() => onAction('detachGuestTools')}>
{tr('detachGuestTools')}
</Button>
) : (
<Button
variant={detail.guest_tools_configured ? 'secondary' : 'primary'}
icon={<Disc size={14} />}
busy={busyAction === 'attachGuestTools'}
disabled={busy}
onClick={() => onAction('attachGuestTools')}
>
{tr('attachGuestTools')}
</Button>
)}
/>
)}
{tools && detail.guest_tools_attached && (
<SetRow
title={tr('gtInstallCmd')}
desc={<code className="inline-code">{GUEST_TOOLS_INSTALL_CMD}</code>}
control={
<div className="hstack">
<IconButton small label={tr('copy')} icon={<Copy size={14} />} onClick={() => onCopy(GUEST_TOOLS_INSTALL_CMD)} />
{running && (
<IconButton small label={tr('typeIntoVM')} icon={<Keyboard size={14} />} busy={busyAction === 'type'} disabled={busy} onClick={() => onTypeText(GUEST_TOOLS_INSTALL_CMD)} />
<section className="section">
<div className="section-title">{tr('connGroup')}</div>
<div className="conn-list">
{detail.ssh_port > 0 && (
<div className="conn-row">
<div className="conn-main">
<span className="conn-title">SSH</span>
</div>
<div className="conn-ctrl">
<div className="ssh-pill">
<code>{sshCommand(detail.ssh_port)}</code>
<IconButton small label={tr('copy')} icon={<Copy size={13} />} onClick={() => onCopy(sshCommand(detail.ssh_port))} />
</div>
</div>
</div>
)}
{tools && (
<div className="conn-row">
<div className="conn-main">
<span className="conn-title">{tr('guestToolsTitle')}</span>
<span className="conn-dot" aria-hidden="true">·</span>
<span className={`conn-meta${needsUpgrade ? ' warn-text' : ''}`} title={needsUpgrade ? tr('guestToolsUpgradeHint') : gtStatus}>
{needsUpgrade ? tr('guestToolsUpgradeHint') : gtStatus}
</span>
</div>
<div className="conn-ctrl">
{detail.guest_tools_attached ? (
<Button busy={busyAction === 'detachGuestTools'} disabled={busy} onClick={() => onAction('detachGuestTools')}>
{tr('detachGuestTools')}
</Button>
) : (
<Button
variant={detail.guest_tools_configured ? 'secondary' : 'primary'}
icon={<Disc size={13} aria-hidden="true" />}
busy={busyAction === 'attachGuestTools'}
disabled={busy}
onClick={() => onAction('attachGuestTools')}
>
{tr('attachGuestTools')}
</Button>
)}
</div>
}
/>
)}
{tools && (
<SetRow
title={tr('sharedFolder')}
desc="~/Desktop/ReimsShare"
control={
<div className="hstack">
<Button icon={<Upload size={14} />} disabled={busy} onClick={onDeliverFile}>{tr('deliverFileShort')}</Button>
<Button icon={<FolderOpen size={14} />} disabled={busy} onClick={() => onAction('openSharedFolder')}>{tr('openShort')}</Button>
</div>
)}
{tools && detail.guest_tools_attached && (
<div className="conn-row">
<div className="conn-main">
<span className="conn-title">{tr('gtInstallCmd')}</span>
</div>
}
/>
)}
{tools && (
<SetRow
title={tr('guestToolsPreventSleep')}
desc={gtSleepActive
? <span className="ok-text"><Activity size={11} aria-hidden="true" /> {tr('guestToolsSleepActive')}</span>
: tr('guestToolsPreventSleepSub')}
control={<Switch label={tr('guestToolsPreventSleep')} checked={!!detail.guest_tools_prevent_sleep} onChange={onTogglePreventSleep} />}
/>
)}
</SetGroup>
<div className="conn-ctrl">
<div className="ssh-pill">
<code>{GUEST_TOOLS_INSTALL_CMD}</code>
<IconButton small label={tr('copy')} icon={<Copy size={13} />} onClick={() => onCopy(GUEST_TOOLS_INSTALL_CMD)} />
{running && (
<IconButton small label={tr('typeIntoVM')} icon={<Keyboard size={13} />} busy={busyAction === 'type'} disabled={busy} onClick={() => onTypeText(GUEST_TOOLS_INSTALL_CMD)} />
)}
</div>
</div>
</div>
)}
{tools && (
<div className="conn-row">
<div className="conn-main">
<span className="conn-title">{tr('sharedFolder')}</span>
<span className="conn-dot" aria-hidden="true">·</span>
<span className="conn-meta mono" title="~/Desktop/ReimsShare">~/Desktop/ReimsShare</span>
</div>
<div className="conn-ctrl">
<Button icon={<Upload size={13} aria-hidden="true" />} disabled={busy} onClick={onDeliverFile}>{tr('deliverFileShort')}</Button>
<Button icon={<FolderOpen size={13} aria-hidden="true" />} disabled={busy} onClick={() => onAction('openSharedFolder')}>{tr('openShort')}</Button>
</div>
</div>
)}
{tools && (
<div className="conn-row">
<div className="conn-main">
<span className="conn-title">{tr('guestToolsPreventSleep')}</span>
{gtSleepActive && (
<>
<span className="conn-dot" aria-hidden="true">·</span>
<span className="conn-meta ok-text"><Activity size={12} aria-hidden="true" /> {tr('guestToolsSleepActive')}</span>
</>
)}
</div>
<div className="conn-ctrl">
<Switch label={tr('guestToolsPreventSleep')} checked={!!detail.guest_tools_prevent_sleep} onChange={onTogglePreventSleep} />
</div>
</div>
)}
</div>
</section>
)
})()}
@@ -577,14 +611,17 @@ const VMScreen: React.FC<{ thumb: VMThumbnail | null; running: boolean; startLab
)
}
return (
<div className={`vm-screen${running ? ' is-live' : ' is-idle'}`} style={under ? { backgroundImage: `url(${under})` } : undefined}>
<img key={thumb?.captured_at} className="vm-screen-img" src={shown} alt="" draggable={false} />
{running && <span className="vm-screen-live" aria-hidden="true" />}
{onStart && (
<button type="button" className="vm-screen-play" aria-label={startLabel} onClick={onStart}>
<Play size={22} fill="currentColor" aria-hidden="true" />
</button>
)}
<div className="vm-display-unit">
<div className={`vm-screen${running ? ' is-live' : ' is-idle'}`} style={under ? { backgroundImage: `url(${under})` } : undefined}>
<img key={thumb?.captured_at} className="vm-screen-img" src={shown} alt="" draggable={false} />
{running && <span className="vm-screen-live" aria-hidden="true" />}
{onStart && (
<button type="button" className="vm-screen-play" aria-label={startLabel} onClick={onStart}>
<Play size={18} fill="currentColor" aria-hidden="true" />
</button>
)}
</div>
<div className="vm-display-stand" aria-hidden="true" />
</div>
)
}
+42 -4
View File
@@ -6,7 +6,9 @@ const dict = {
'zh-CN': {
// Shell
sidebarVMs: '虚拟机',
sidebarHost: '宿主与运行时',
sidebarSystem: '系统',
sidebarHost: '内核',
sidebarSettings: '设置',
sidebarInstallers: '安装包',
installersTitle: '安装包',
installersDownloaded: '已下载',
@@ -28,6 +30,23 @@ const dict = {
minimize: '最小化',
maximize: '最大化',
closeWindow: '关闭',
themeSwitchDark: '切换深色外观',
themeSwitchLight: '切换浅色外观',
copyTechInfo: '复制技术信息',
resizeLogPanel: '拖动调整日志高度',
logButton: '日志',
footerMem: '内存 {pct}%',
footerMemAvail: '可用 {avail} GB',
footerMemTip: '系统内存:已用 {used} GB / 共 {total} GB(可用 {avail} GB)',
footerDisk: '磁盘可用 {gb} GB',
footerRunningVMs: '{n} 台运行中',
settingsGeneral: '常规',
settingsAppearance: '外观与语言',
settingsAbout: '关于',
themeLabel: '外观',
themeLight: '浅色',
themeDark: '深色',
themeSystem: '跟随系统',
// Actions
newVM: '新建虚拟机',
@@ -238,7 +257,7 @@ const dict = {
onlineRecoveryTitle: '拉取在线恢复镜像?',
onlineRecoveryDesc: '本地没有恢复镜像。要从 Apple 下载约 1 GB 的恢复镜像并挂载到「{name}」吗?',
onlineRecoveryConfirm: '拉取并挂载(约 1 GB)',
noRuntimeAlert: '先在「宿主与运行时」导入运行时包',
noRuntimeAlert: '先在「内核」导入运行时包',
// Host
hostRuntime: '运行时',
@@ -533,7 +552,9 @@ const dict = {
},
'en-US': {
sidebarVMs: 'Virtual machines',
sidebarHost: 'Host & runtime',
sidebarSystem: 'System',
sidebarHost: 'Engine',
sidebarSettings: 'Settings',
sidebarInstallers: 'Installers',
installersTitle: 'Installers',
installersDownloaded: 'Downloaded',
@@ -555,6 +576,23 @@ const dict = {
minimize: 'Minimize',
maximize: 'Maximize',
closeWindow: 'Close',
themeSwitchDark: 'Switch to dark appearance',
themeSwitchLight: 'Switch to light appearance',
copyTechInfo: 'Copy technical details',
resizeLogPanel: 'Drag to resize log panel',
logButton: 'Logs',
footerMem: 'Memory {pct}%',
footerMemAvail: '{avail} GB free',
footerMemTip: 'System memory: {used} GB used / {total} GB total ({avail} GB free)',
footerDisk: 'Disk {gb} GB free',
footerRunningVMs: '{n} running',
settingsGeneral: 'General',
settingsAppearance: 'Appearance & language',
settingsAbout: 'About',
themeLabel: 'Appearance',
themeLight: 'Light',
themeDark: 'Dark',
themeSystem: 'System',
newVM: 'New virtual machine',
start: 'Start',
@@ -757,7 +795,7 @@ const dict = {
onlineRecoveryTitle: 'Download online recovery image?',
onlineRecoveryDesc: 'No recovery image is on this PC. Download Apple’s recovery image (about 1 GB) and attach it to “{name}”?',
onlineRecoveryConfirm: 'Download & attach (~1 GB)',
noRuntimeAlert: 'Import a runtime under Host & runtime first',
noRuntimeAlert: 'Import a runtime under Engine first',
hostRuntime: 'Runtime',
hostGPUs: 'Graphics cards',
+13
View File
@@ -118,6 +118,19 @@ export function formatBytes(bytes: number): string {
return `${v.toFixed(digits)} ${units[i]}`
}
/** Compact "54 / 128 GB" when both are gigabytes, falling back to full units. */
export function formatDiskUsage(actual: number, virtual: number): string {
const GiB = 1024 ** 3
if (actual >= GiB && virtual >= GiB && virtual < 1024 * GiB) {
const a = actual / GiB
const v = virtual / GiB
const aStr = a >= 10 ? Math.round(a).toString() : a.toFixed(1)
const vStr = Math.round(v).toString()
return `${aStr} / ${vStr} GB`
}
return `${formatBytes(actual)} / ${formatBytes(virtual)}`
}
export function formatUptime(sec: number, locale: Locale): string {
if (!sec || sec <= 0) return '—'
const h = Math.floor(sec / 3600)
File diff suppressed because it is too large. Load diff
+157 -48
View File
@@ -1,25 +1,69 @@
/* Design tokens — macOS Tahoe System Settings aesthetic (Light default, Dark optional). */
/* Bundled open-source Inter Variable (SIL OFL 1.1, Latin ~47 KB) — optical twin of Apple SF Pro. */
@font-face {
font-family: "ReimsSans";
font-style: normal;
font-display: swap;
font-weight: 100 900;
src: url("@fontsource-variable/inter/files/inter-latin-wght-normal.woff2") format("woff2-variations");
unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
/* Map installed PingFang SC / HarmonyOS Sans SC / MiSans / Noto Sans SC / Source Han Sans CN
explicitly across weights. On Windows DirectWrite, PingFang SC Regular renders overly thin
compared to macOS Retina CoreText, so body weights (400–550) map to Medium for balanced ink. */
@font-face {
font-family: "ReimsCJK";
font-style: normal;
font-weight: 400 550;
src:
local("PingFang SC Medium"), local("PingFangSC-Medium"),
local("HarmonyOS Sans SC"), local("HarmonyOS_Sans_SC"),
local("MiSans Regular"), local("MiSans"),
local("Noto Sans SC Medium"), local("NotoSansSC-Medium"),
local("Noto Sans SC"), local("NotoSansSC-Regular"),
local("Source Han Sans CN Medium"), local("SourceHanSansCN-Medium"),
local("Source Han Sans CN Regular"), local("SourceHanSansCN-Regular");
unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF, U+F900-FAFF;
}
@font-face {
font-family: "ReimsCJK";
font-style: normal;
font-weight: 560 900;
src:
local("PingFang SC Semibold"), local("PingFangSC-Semibold"),
local("PingFang SC Bold"), local("PingFangSC-Bold"),
local("HarmonyOS Sans SC Bold"), local("HarmonyOS_Sans_SC_Bold"),
local("MiSans Demibold"), local("MiSans Semibold"), local("MiSans Bold"),
local("Noto Sans SC SemiBold"), local("NotoSansSC-SemiBold"), local("Noto Sans SC Bold"),
local("Source Han Sans CN Bold"), local("SourceHanSansCN-Bold");
unicode-range: U+2E80-9FFF, U+3000-303F, U+FF00-FFEF, U+F900-FAFF;
}
/* Design tokens — macOS Tahoe aesthetic with Windows platform craft (Light default, Dark & System supported). */
:root {
color-scheme: light;
/* Type */
--font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", system-ui, sans-serif;
--font-mono: "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
/* Typography */
--font-sans: "ReimsSans", "ReimsCJK", "PingFang SC Medium", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Noto Sans SC", "Source Han Sans CN", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", "Microsoft YaHei UI", system-ui, sans-serif;
--font-mono: "SF Mono", "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
--fs-11: 11px;
--fs-12: 12px;
--fs-13: 13px;
--fs-14: 14px;
--fs-15: 15px;
--fs-16: 16px;
--fs-20: 20px;
--fs-24: 24px;
--fw-regular: 400;
--fw-medium: 500;
--fw-strong: 600;
--fw-regular: 450;
--fw-medium: 540;
--fw-strong: 640;
/* Spacing (4px grid) */
--sp-1: 4px;
--sp-2: 8px;
--sp-3: 12px;
--sp-4: 16px;
--sp-5: 20px;
--sp-6: 24px;
--sp-8: 32px;
@@ -32,88 +76,112 @@
/* Surfaces (macOS Tahoe Light) */
--surface-0: #ffffff;
--surface-canvas: #ffffff;
--surface-sidebar: linear-gradient(180deg, #eff5fc 0%, #eaf2fa 100%);
--surface-sidebar-border: rgba(15, 23, 42, 0.07);
--surface-sidebar-shadow: 0 2px 14px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.8);
--surface-chrome: rgba(255, 255, 255, 0.88);
--surface-sidebar-rail: linear-gradient(180deg, #e7f0fa 0%, #dde8f7 100%);
--surface-sidebar: linear-gradient(180deg, rgba(255, 255, 255, 0.80) 0%, rgba(247, 250, 255, 0.72) 100%);
--surface-sidebar-border: rgba(255, 255, 255, 0.90);
--surface-sidebar-shadow: 0 4px 18px rgba(15, 35, 70, 0.065), 0 0 0 1px rgba(15, 23, 42, 0.06);
--surface-chrome: linear-gradient(180deg, #eff4fb 0%, #e8f0fa 100%);
--surface-statusbar: #eef3fa;
--surface-1: #f5f6f8;
--surface-card-elevated: #ffffff;
--surface-2: rgba(255, 255, 255, 0.96);
--surface-2: rgba(255, 255, 255, 0.94);
--surface-input: #ffffff;
--surface-hover: rgba(15, 23, 42, 0.05);
--surface-active: rgba(15, 23, 42, 0.09);
--border: rgba(15, 23, 42, 0.075);
--surface-hover: rgba(15, 23, 42, 0.048);
--surface-active: rgba(15, 23, 42, 0.085);
--border: rgba(15, 23, 42, 0.08);
--border-strong: rgba(15, 23, 42, 0.14);
--highlight-top: inset 0 1px 0 rgba(255, 255, 255, 0.85);
--scrim: rgba(15, 23, 42, 0.28);
--shadow-btn: 0 1px 2px rgba(15, 23, 42, 0.06);
--shadow-overlay: 0 20px 56px rgba(15, 23, 42, 0.18), 0 0 0 1px rgba(15, 23, 42, 0.06);
--shadow-btn: 0 1px 2px rgba(15, 23, 42, 0.06), inset 0 1px 0 rgba(255, 255, 255, 0.7);
--shadow-card: 0 1px 2px rgba(15, 23, 42, 0.025);
--shadow-overlay: 0 22px 58px rgba(15, 23, 42, 0.18), 0 4px 14px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.06);
--blur-chrome: blur(20px) saturate(180%);
--blur-overlay: blur(18px) saturate(165%);
/* Text */
--text: #1d1d1f;
--text-2: #515154;
--text-3: #86868b;
--text-2: #424247;
--text-3: #6e6e73;
--text-code: #2c2c30;
/* Semantics (Apple System Colours) */
--accent: #007aff;
--accent-hover: #006be6;
--accent-text: #ffffff;
--accent-soft: rgba(0, 122, 255, 0.12);
--accent-soft: rgba(0, 122, 255, 0.11);
--accent-soft-text: #0066d6;
--focus-ring: 0 0 0 3px rgba(0, 122, 255, 0.3);
--focus-ring: 0 0 0 3px rgba(0, 122, 255, 0.30);
--status-running: #28cd41;
--status-busy: #ff9f0a;
--status-error: #ff3b30;
--status-idle: #aeaeb2;
--ok-soft: rgba(40, 205, 65, 0.13);
--ok-text: #188c2c;
--warn-soft: rgba(255, 159, 10, 0.14);
--warn-text: #a86200;
--danger: #ff3b30;
--danger-soft: rgba(255, 59, 48, 0.10);
--danger-border: rgba(255, 59, 48, 0.28);
--danger-text: #d70015;
--notice-soft: rgba(255, 159, 10, 0.11);
--notice-border: rgba(255, 159, 10, 0.32);
--notice-soft: rgba(255, 159, 10, 0.10);
--notice-border: rgba(255, 159, 10, 0.28);
/* Motion */
--dur-fast: 120ms;
--dur: 200ms;
--seg-thumb: #ffffff;
/* Motion (emil-design-eng & apple-design curves) */
--ease-out: cubic-bezier(0.23, 1, 0.32, 1);
--ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
--ease-spring: cubic-bezier(0.32, 0.72, 0, 1);
--dur-press: 100ms;
--dur-fast: 130ms;
--dur: 180ms;
--dur-modal: 220ms;
--dur-toast: 280ms;
/* Layout */
--titlebar-h: 42px;
--logbar-h: 32px;
--sidebar-w: 244px;
--page-max: 700px;
--sidebar-w: 248px;
--page-max: 632px;
}
:root[data-theme="dark"] {
color-scheme: dark;
--surface-0: #1e1e22;
--surface-canvas: #1e1e22;
--surface-sidebar: linear-gradient(180deg, #27282e 0%, #23242a 100%);
--surface-sidebar-border: rgba(255, 255, 255, 0.08);
--surface-sidebar-shadow: 0 4px 18px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.06);
--surface-chrome: rgba(28, 28, 32, 0.92);
--surface-1: rgba(255, 255, 255, 0.05);
--surface-card-elevated: rgba(255, 255, 255, 0.07);
--surface-2: #2b2c32;
--surface-0: #1b1c20;
--surface-canvas: #1d1e23;
--surface-sidebar-rail: #17181c;
--surface-sidebar: linear-gradient(180deg, rgba(40, 41, 48, 0.94) 0%, rgba(34, 35, 41, 0.92) 100%);
--surface-sidebar-border: rgba(255, 255, 255, 0.09);
--surface-sidebar-shadow: 0 6px 22px rgba(0, 0, 0, 0.36), inset 0 1px 0 rgba(255, 255, 255, 0.08);
--surface-chrome: linear-gradient(180deg, #212228 0%, #1c1d22 100%);
--surface-statusbar: #18191e;
--surface-1: rgba(255, 255, 255, 0.048);
--surface-card-elevated: rgba(255, 255, 255, 0.075);
--surface-2: rgba(42, 43, 50, 0.94);
--surface-input: rgba(0, 0, 0, 0.28);
--surface-hover: rgba(255, 255, 255, 0.07);
--surface-hover: rgba(255, 255, 255, 0.075);
--surface-active: rgba(255, 255, 255, 0.12);
--border: rgba(255, 255, 255, 0.09);
--border: rgba(255, 255, 255, 0.085);
--border-strong: rgba(255, 255, 255, 0.16);
--scrim: rgba(0, 0, 0, 0.55);
--shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.28);
--shadow-overlay: 0 24px 64px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.08);
--highlight-top: inset 0 1px 0 rgba(255, 255, 255, 0.08);
--scrim: rgba(0, 0, 0, 0.56);
--shadow-btn: 0 1px 2px rgba(0, 0, 0, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.06);
--shadow-card: 0 1px 3px rgba(0, 0, 0, 0.18);
--shadow-overlay: 0 26px 68px rgba(0, 0, 0, 0.58), 0 0 0 1px rgba(255, 255, 255, 0.09);
--text: #f5f5f7;
--text-2: #b4b4bc;
--text-3: #86868e;
--text-2: #c2c2ca;
--text-3: #92929c;
--text-code: #d4d6e0;
--accent: #0a84ff;
--accent-hover: #2492ff;
--accent-text: #ffffff;
--accent-soft: rgba(10, 132, 255, 0.22);
--accent-soft: rgba(10, 132, 255, 0.20);
--accent-soft-text: #64b0ff;
--focus-ring: 0 0 0 3px rgba(10, 132, 255, 0.45);
@@ -122,16 +190,57 @@
--status-error: #ff453a;
--status-idle: #6e6e76;
--ok-soft: rgba(48, 209, 88, 0.16);
--ok-text: #30d158;
--warn-soft: rgba(255, 214, 10, 0.15);
--warn-text: #ffd60a;
--danger: #ff453a;
--danger-soft: rgba(255, 69, 58, 0.16);
--danger-soft: rgba(255, 69, 58, 0.15);
--danger-border: rgba(255, 69, 58, 0.34);
--danger-text: #ff8b83;
--notice-soft: rgba(255, 214, 10, 0.11);
--notice-border: rgba(255, 214, 10, 0.30);
--notice-soft: rgba(255, 214, 10, 0.10);
--notice-border: rgba(255, 214, 10, 0.28);
--seg-thumb: #555760;
}
@media (prefers-reduced-motion: reduce) {
:root {
--dur-press: 0ms;
--dur-fast: 0ms;
--dur: 0ms;
--dur-modal: 0ms;
--dur-toast: 0ms;
}
}
@media (prefers-reduced-transparency: reduce) {
:root {
--surface-chrome: #ffffff;
--surface-2: #ffffff;
--surface-sidebar: #eef3fa;
--blur-chrome: none;
--blur-overlay: none;
}
:root[data-theme="dark"] {
--surface-chrome: #1b1c20;
--surface-2: #2a2b32;
--surface-sidebar: #24252b;
}
}
@media (prefers-contrast: more) {
:root {
--border: rgba(15, 23, 42, 0.20);
--border-strong: rgba(15, 23, 42, 0.34);
--text-2: #3a3a3d;
--text-3: #5a5a5f;
}
:root[data-theme="dark"] {
--border: rgba(255, 255, 255, 0.20);
--border-strong: rgba(255, 255, 255, 0.34);
--text-2: #d2d2da;
--text-3: #a6a6b0;
}
}
+12 -12
View File
@@ -1,7 +1,7 @@
// Backend types come from the Wails-generated models (wailsjs/go/models.ts,
// regenerated by `wails dev` / `wails build`). This file only adds what Go
// cannot say: string unions, and `| null` for slices Go may send as nil.
import { config, host, installer, main, reims, runtime, version } from '../wailsjs/go/models'
import { app, config, host, installer, reims, runtime, version } from '../wailsjs/go/models'
/** A generated class as a plain data shape (no convertValues helper). */
type Model<T> = Omit<T, 'convertValues'>
@@ -50,9 +50,9 @@ export type VMListItem = Model<reims.VMListItem> & {
state: 'running' | 'stopped' | 'broken'
}
export type PendingChange = main.PendingChange
export type PendingChange = app.PendingChange
export type AppState = Omit<Model<main.AppState>, 'config' | 'host' | 'optimizations' | 'runtimes' | 'active_runtime' | 'vms'> & {
export type AppState = Omit<Model<app.AppState>, 'config' | 'host' | 'optimizations' | 'runtimes' | 'active_runtime' | 'vms'> & {
config: Config
host: HostReport
optimizations?: Optimization[]
@@ -63,10 +63,10 @@ export type AppState = Omit<Model<main.AppState>, 'config' | 'host' | 'optimizat
export type AppUpdateInfo = version.UpdateInfo
export type VMDetail = reims.VMDetail
export type VMStats = main.VMStats
export type DriveShareSettings = Model<main.DriveShareSettings>
/** One frame of a VM's screen (thumbnail_flow.go). Empty data_url: none yet. */
export type VMThumbnail = main.VMThumbnail
export type VMStats = app.VMStats
export type DriveShareSettings = Model<app.DriveShareSettings>
/** One frame of a VM's screen (internal/app/thumbnail_flow.go). Empty data_url: none yet. */
export type VMThumbnail = app.VMThumbnail
export type ValidationIssue = reims.ValidationIssue
export type DiskResizeResult = reims.DiskResizeResult
export type DiskCompactResult = reims.DiskCompactResult
@@ -86,8 +86,8 @@ export type CreateOpts = Model<reims.CreateOpts> & {
export type TaskStatus = 'running' | 'done' | 'failed' | 'canceled'
/** A tracked long-running job pushed as "reims:task" (tasks.go). */
export type Task = Model<main.Task> & {
/** A tracked long-running job pushed as "reims:task" (internal/app/tasks.go). */
export type Task = Model<app.Task> & {
kind: 'installer-download' | 'vm-create' | string
status: TaskStatus
}
@@ -100,10 +100,10 @@ export type CachedInstaller = Model<installer.Cached> & {
kind: 'offline' | 'online' | 'ipsw' | 'other'
}
export type DataRootChoice = main.DataRootChoice
export type DataRootCheck = main.DataRootCheck
export type DataRootChoice = app.DataRootChoice
export type DataRootCheck = app.DataRootCheck
/** A "reims:log" event (app.go emitLog); not a Go struct, so not generated. */
/** A "reims:log" event (internal/app/app.go emitLog); not a Go struct, so not generated. */
export interface LogEntry {
ts: string
source: string
+2 -2
View File
@@ -44,7 +44,7 @@ export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
aria-busy={busy || undefined}
{...rest}
>
{busy ? <LoaderCircle size={14} className="spin" /> : icon}
{busy ? <LoaderCircle size={14} className="spin" aria-hidden="true" /> : icon}
{children}
</button>
),
@@ -73,7 +73,7 @@ export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
aria-busy={busy || undefined}
{...rest}
>
{busy ? <LoaderCircle size={16} className="spin" /> : icon}
{busy ? <LoaderCircle size={16} className="spin" aria-hidden="true" /> : icon}
</button>
</Tip>
),
+2 -2
View File
@@ -1,7 +1,7 @@
// Backend calls are the Wails-generated bindings (wailsjs/go/main/App). Only
// Backend calls are the Wails-generated bindings (wailsjs/go/app/App). Only
// the calls whose results carry the unions or nil slices added in types.ts are
// re-typed here; everything else passes through unchanged.
import * as Go from '../wailsjs/go/main/App'
import * as Go from '../wailsjs/go/app/App'
import { EventsOn } from '../wailsjs/runtime/runtime'
import type { AppState, CachedInstaller, DataRootChoice, LogEntry, RemoteRuntime, Task } from './types'
@@ -2,7 +2,7 @@
// This file is automatically generated. DO NOT EDIT
import {reims} from '../models';
import {version} from '../models';
import {main} from '../models';
import {app} from '../models';
import {runtime} from '../models';
import {installer} from '../models';
@@ -16,7 +16,7 @@ export function CancelTask(arg1:string):Promise<void>;
export function CheckAppUpdate(arg1:boolean):Promise<version.UpdateInfo>;
export function CheckDataRoot(arg1:string):Promise<main.DataRootCheck>;
export function CheckDataRoot(arg1:string):Promise<app.DataRootCheck>;
export function CloneVMCoW(arg1:string,arg2:string):Promise<void>;
@@ -50,17 +50,17 @@ export function ExportDiagnostics(arg1:string):Promise<string>;
export function FinishInstall(arg1:string):Promise<void>;
export function GetState():Promise<main.AppState>;
export function GetState():Promise<app.AppState>;
export function GetTasks():Promise<Array<main.Task>>;
export function GetTasks():Promise<Array<app.Task>>;
export function GetVMDetail(arg1:string):Promise<reims.VMDetail>;
export function GetVMDriveShareSettings(arg1:string):Promise<main.DriveShareSettings>;
export function GetVMDriveShareSettings(arg1:string):Promise<app.DriveShareSettings>;
export function GetVMStats(arg1:string):Promise<main.VMStats>;
export function GetVMStats(arg1:string):Promise<app.VMStats>;
export function GetVMThumbnail(arg1:string):Promise<main.VMThumbnail>;
export function GetVMThumbnail(arg1:string):Promise<app.VMThumbnail>;
export function InstallRuntimeArchive(arg1:string):Promise<runtime.Installed>;
@@ -110,7 +110,7 @@ export function SetRuntimeChannel(arg1:string):Promise<void>;
export function SetRuntimeSource(arg1:string):Promise<void>;
export function SetVMDriveShareSettings(arg1:string,arg2:boolean,arg3:Array<string>):Promise<main.DriveShareSettings>;
export function SetVMDriveShareSettings(arg1:string,arg2:boolean,arg3:Array<string>):Promise<app.DriveShareSettings>;
export function ShowMainWindow():Promise<void>;
@@ -118,7 +118,7 @@ export function StartVM(arg1:string):Promise<void>;
export function StopVM(arg1:string,arg2:boolean):Promise<void>;
export function SuggestDataRoots():Promise<Array<main.DataRootChoice>>;
export function SuggestDataRoots():Promise<Array<app.DataRootChoice>>;
export function ToggleBorderless(arg1:string,arg2:boolean):Promise<void>;
+259
View File
@@ -0,0 +1,259 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function ApplyVMSettings(arg1) {
return window['go']['app']['App']['ApplyVMSettings'](arg1);
}
export function AttachGuestTools(arg1) {
return window['go']['app']['App']['AttachGuestTools'](arg1);
}
export function AttachInstaller(arg1, arg2) {
return window['go']['app']['App']['AttachInstaller'](arg1, arg2);
}
export function CancelTask(arg1) {
return window['go']['app']['App']['CancelTask'](arg1);
}
export function CheckAppUpdate(arg1) {
return window['go']['app']['App']['CheckAppUpdate'](arg1);
}
export function CheckDataRoot(arg1) {
return window['go']['app']['App']['CheckDataRoot'](arg1);
}
export function CloneVMCoW(arg1, arg2) {
return window['go']['app']['App']['CloneVMCoW'](arg1, arg2);
}
export function CompactVMDisk(arg1) {
return window['go']['app']['App']['CompactVMDisk'](arg1);
}
export function CompleteSetup(arg1) {
return window['go']['app']['App']['CompleteSetup'](arg1);
}
export function CreateVM(arg1) {
return window['go']['app']['App']['CreateVM'](arg1);
}
export function DeleteInstaller(arg1) {
return window['go']['app']['App']['DeleteInstaller'](arg1);
}
export function DeleteVM(arg1, arg2) {
return window['go']['app']['App']['DeleteVM'](arg1, arg2);
}
export function DeliverFileToGuest(arg1) {
return window['go']['app']['App']['DeliverFileToGuest'](arg1);
}
export function DetachGuestTools(arg1) {
return window['go']['app']['App']['DetachGuestTools'](arg1);
}
export function DismissTask(arg1) {
return window['go']['app']['App']['DismissTask'](arg1);
}
export function DownloadAndAttachOnlineRecovery(arg1, arg2) {
return window['go']['app']['App']['DownloadAndAttachOnlineRecovery'](arg1, arg2);
}
export function DownloadInstaller(arg1) {
return window['go']['app']['App']['DownloadInstaller'](arg1);
}
export function EjectInstaller(arg1) {
return window['go']['app']['App']['EjectInstaller'](arg1);
}
export function EnableWHPX() {
return window['go']['app']['App']['EnableWHPX']();
}
export function EnterRecovery(arg1) {
return window['go']['app']['App']['EnterRecovery'](arg1);
}
export function ExportDiagnostics(arg1) {
return window['go']['app']['App']['ExportDiagnostics'](arg1);
}
export function FinishInstall(arg1) {
return window['go']['app']['App']['FinishInstall'](arg1);
}
export function GetState() {
return window['go']['app']['App']['GetState']();
}
export function GetTasks() {
return window['go']['app']['App']['GetTasks']();
}
export function GetVMDetail(arg1) {
return window['go']['app']['App']['GetVMDetail'](arg1);
}
export function GetVMDriveShareSettings(arg1) {
return window['go']['app']['App']['GetVMDriveShareSettings'](arg1);
}
export function GetVMStats(arg1) {
return window['go']['app']['App']['GetVMStats'](arg1);
}
export function GetVMThumbnail(arg1) {
return window['go']['app']['App']['GetVMThumbnail'](arg1);
}
export function InstallRuntimeArchive(arg1) {
return window['go']['app']['App']['InstallRuntimeArchive'](arg1);
}
export function InstallRuntimeOnline(arg1) {
return window['go']['app']['App']['InstallRuntimeOnline'](arg1);
}
export function ListInstallers() {
return window['go']['app']['App']['ListInstallers']();
}
export function ListOfflineReleases() {
return window['go']['app']['App']['ListOfflineReleases']();
}
export function ListRemoteRuntimes() {
return window['go']['app']['App']['ListRemoteRuntimes']();
}
export function OpenProcessorScheduling() {
return window['go']['app']['App']['OpenProcessorScheduling']();
}
export function OpenSharedFolder(arg1) {
return window['go']['app']['App']['OpenSharedFolder'](arg1);
}
export function OpenURL(arg1) {
return window['go']['app']['App']['OpenURL'](arg1);
}
export function OpenVMFolder(arg1) {
return window['go']['app']['App']['OpenVMFolder'](arg1);
}
export function PickDirectory(arg1) {
return window['go']['app']['App']['PickDirectory'](arg1);
}
export function PickFile(arg1, arg2) {
return window['go']['app']['App']['PickFile'](arg1, arg2);
}
export function PreviewCreate(arg1) {
return window['go']['app']['App']['PreviewCreate'](arg1);
}
export function QuitApp() {
return window['go']['app']['App']['QuitApp']();
}
export function ReadVMLogs(arg1, arg2) {
return window['go']['app']['App']['ReadVMLogs'](arg1, arg2);
}
export function RequestClose() {
return window['go']['app']['App']['RequestClose']();
}
export function ResizeVMDisk(arg1, arg2) {
return window['go']['app']['App']['ResizeVMDisk'](arg1, arg2);
}
export function RestartVM(arg1) {
return window['go']['app']['App']['RestartVM'](arg1);
}
export function SetAutoPinPCores(arg1) {
return window['go']['app']['App']['SetAutoPinPCores'](arg1);
}
export function SetDataRoot(arg1) {
return window['go']['app']['App']['SetDataRoot'](arg1);
}
export function SetGuestPreventSleep(arg1, arg2) {
return window['go']['app']['App']['SetGuestPreventSleep'](arg1, arg2);
}
export function SetLocale(arg1) {
return window['go']['app']['App']['SetLocale'](arg1);
}
export function SetMinimizeToTray(arg1) {
return window['go']['app']['App']['SetMinimizeToTray'](arg1);
}
export function SetRuntimeChannel(arg1) {
return window['go']['app']['App']['SetRuntimeChannel'](arg1);
}
export function SetRuntimeSource(arg1) {
return window['go']['app']['App']['SetRuntimeSource'](arg1);
}
export function SetVMDriveShareSettings(arg1, arg2, arg3) {
return window['go']['app']['App']['SetVMDriveShareSettings'](arg1, arg2, arg3);
}
export function ShowMainWindow() {
return window['go']['app']['App']['ShowMainWindow']();
}
export function StartVM(arg1) {
return window['go']['app']['App']['StartVM'](arg1);
}
export function StopVM(arg1, arg2) {
return window['go']['app']['App']['StopVM'](arg1, arg2);
}
export function SuggestDataRoots() {
return window['go']['app']['App']['SuggestDataRoots']();
}
export function ToggleBorderless(arg1, arg2) {
return window['go']['app']['App']['ToggleBorderless'](arg1, arg2);
}
export function TypeClipboard(arg1) {
return window['go']['app']['App']['TypeClipboard'](arg1);
}
export function TypeText(arg1, arg2) {
return window['go']['app']['App']['TypeText'](arg1, arg2);
}
export function UpgradeDiskToNVMe(arg1) {
return window['go']['app']['App']['UpgradeDiskToNVMe'](arg1);
}
export function UseRuntime(arg1) {
return window['go']['app']['App']['UseRuntime'](arg1);
}
export function ValidateCreate(arg1) {
return window['go']['app']['App']['ValidateCreate'](arg1);
}
export function ValidateSet(arg1) {
return window['go']['app']['App']['ValidateSet'](arg1);
}
-259
View File
@@ -1,259 +0,0 @@
// @ts-check
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT
export function ApplyVMSettings(arg1) {
return window['go']['main']['App']['ApplyVMSettings'](arg1);
}
export function AttachGuestTools(arg1) {
return window['go']['main']['App']['AttachGuestTools'](arg1);
}
export function AttachInstaller(arg1, arg2) {
return window['go']['main']['App']['AttachInstaller'](arg1, arg2);
}
export function CancelTask(arg1) {
return window['go']['main']['App']['CancelTask'](arg1);
}
export function CheckAppUpdate(arg1) {
return window['go']['main']['App']['CheckAppUpdate'](arg1);
}
export function CheckDataRoot(arg1) {
return window['go']['main']['App']['CheckDataRoot'](arg1);
}
export function CloneVMCoW(arg1, arg2) {
return window['go']['main']['App']['CloneVMCoW'](arg1, arg2);
}
export function CompactVMDisk(arg1) {
return window['go']['main']['App']['CompactVMDisk'](arg1);
}
export function CompleteSetup(arg1) {
return window['go']['main']['App']['CompleteSetup'](arg1);
}
export function CreateVM(arg1) {
return window['go']['main']['App']['CreateVM'](arg1);
}
export function DeleteInstaller(arg1) {
return window['go']['main']['App']['DeleteInstaller'](arg1);
}
export function DeleteVM(arg1, arg2) {
return window['go']['main']['App']['DeleteVM'](arg1, arg2);
}
export function DeliverFileToGuest(arg1) {
return window['go']['main']['App']['DeliverFileToGuest'](arg1);
}
export function DetachGuestTools(arg1) {
return window['go']['main']['App']['DetachGuestTools'](arg1);
}
export function DismissTask(arg1) {
return window['go']['main']['App']['DismissTask'](arg1);
}
export function DownloadAndAttachOnlineRecovery(arg1, arg2) {
return window['go']['main']['App']['DownloadAndAttachOnlineRecovery'](arg1, arg2);
}
export function DownloadInstaller(arg1) {
return window['go']['main']['App']['DownloadInstaller'](arg1);
}
export function EjectInstaller(arg1) {
return window['go']['main']['App']['EjectInstaller'](arg1);
}
export function EnableWHPX() {
return window['go']['main']['App']['EnableWHPX']();
}
export function EnterRecovery(arg1) {
return window['go']['main']['App']['EnterRecovery'](arg1);
}
export function ExportDiagnostics(arg1) {
return window['go']['main']['App']['ExportDiagnostics'](arg1);
}
export function FinishInstall(arg1) {
return window['go']['main']['App']['FinishInstall'](arg1);
}
export function GetState() {
return window['go']['main']['App']['GetState']();
}
export function GetTasks() {
return window['go']['main']['App']['GetTasks']();
}
export function GetVMDetail(arg1) {
return window['go']['main']['App']['GetVMDetail'](arg1);
}
export function GetVMDriveShareSettings(arg1) {
return window['go']['main']['App']['GetVMDriveShareSettings'](arg1);
}
export function GetVMStats(arg1) {
return window['go']['main']['App']['GetVMStats'](arg1);
}
export function GetVMThumbnail(arg1) {
return window['go']['main']['App']['GetVMThumbnail'](arg1);
}
export function InstallRuntimeArchive(arg1) {
return window['go']['main']['App']['InstallRuntimeArchive'](arg1);
}
export function InstallRuntimeOnline(arg1) {
return window['go']['main']['App']['InstallRuntimeOnline'](arg1);
}
export function ListInstallers() {
return window['go']['main']['App']['ListInstallers']();
}
export function ListOfflineReleases() {
return window['go']['main']['App']['ListOfflineReleases']();
}
export function ListRemoteRuntimes() {
return window['go']['main']['App']['ListRemoteRuntimes']();
}
export function OpenProcessorScheduling() {
return window['go']['main']['App']['OpenProcessorScheduling']();
}
export function OpenSharedFolder(arg1) {
return window['go']['main']['App']['OpenSharedFolder'](arg1);
}
export function OpenURL(arg1) {
return window['go']['main']['App']['OpenURL'](arg1);
}
export function OpenVMFolder(arg1) {
return window['go']['main']['App']['OpenVMFolder'](arg1);
}
export function PickDirectory(arg1) {
return window['go']['main']['App']['PickDirectory'](arg1);
}
export function PickFile(arg1, arg2) {
return window['go']['main']['App']['PickFile'](arg1, arg2);
}
export function PreviewCreate(arg1) {
return window['go']['main']['App']['PreviewCreate'](arg1);
}
export function QuitApp() {
return window['go']['main']['App']['QuitApp']();
}
export function ReadVMLogs(arg1, arg2) {
return window['go']['main']['App']['ReadVMLogs'](arg1, arg2);
}
export function RequestClose() {
return window['go']['main']['App']['RequestClose']();
}
export function ResizeVMDisk(arg1, arg2) {
return window['go']['main']['App']['ResizeVMDisk'](arg1, arg2);
}
export function RestartVM(arg1) {
return window['go']['main']['App']['RestartVM'](arg1);
}
export function SetAutoPinPCores(arg1) {
return window['go']['main']['App']['SetAutoPinPCores'](arg1);
}
export function SetDataRoot(arg1) {
return window['go']['main']['App']['SetDataRoot'](arg1);
}
export function SetGuestPreventSleep(arg1, arg2) {
return window['go']['main']['App']['SetGuestPreventSleep'](arg1, arg2);
}
export function SetLocale(arg1) {
return window['go']['main']['App']['SetLocale'](arg1);
}
export function SetMinimizeToTray(arg1) {
return window['go']['main']['App']['SetMinimizeToTray'](arg1);
}
export function SetRuntimeChannel(arg1) {
return window['go']['main']['App']['SetRuntimeChannel'](arg1);
}
export function SetRuntimeSource(arg1) {
return window['go']['main']['App']['SetRuntimeSource'](arg1);
}
export function SetVMDriveShareSettings(arg1, arg2, arg3) {
return window['go']['main']['App']['SetVMDriveShareSettings'](arg1, arg2, arg3);
}
export function ShowMainWindow() {
return window['go']['main']['App']['ShowMainWindow']();
}
export function StartVM(arg1) {
return window['go']['main']['App']['StartVM'](arg1);
}
export function StopVM(arg1, arg2) {
return window['go']['main']['App']['StopVM'](arg1, arg2);
}
export function SuggestDataRoots() {
return window['go']['main']['App']['SuggestDataRoots']();
}
export function ToggleBorderless(arg1, arg2) {
return window['go']['main']['App']['ToggleBorderless'](arg1, arg2);
}
export function TypeClipboard(arg1) {
return window['go']['main']['App']['TypeClipboard'](arg1);
}
export function TypeText(arg1, arg2) {
return window['go']['main']['App']['TypeText'](arg1, arg2);
}
export function UpgradeDiskToNVMe(arg1) {
return window['go']['main']['App']['UpgradeDiskToNVMe'](arg1);
}
export function UseRuntime(arg1) {
return window['go']['main']['App']['UseRuntime'](arg1);
}
export function ValidateCreate(arg1) {
return window['go']['main']['App']['ValidateCreate'](arg1);
}
export function ValidateSet(arg1) {
return window['go']['main']['App']['ValidateSet'](arg1);
}
+261 -257
View File
@@ -1,3 +1,260 @@
export namespace app {
export class AppState {
config?: config.Config;
host: host.Report;
optimizations: host.Optimization[];
runtimes: runtime.Installed[];
active_runtime?: runtime.Installed;
vms: reims.VMListItem[];
transitions: Record<string, string>;
pending_changes: Record<string, Array<PendingChange>>;
needs_setup: boolean;
app_version: string;
static createFrom(source: any = {}) {
return new AppState(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.config = this.convertValues(source["config"], config.Config);
this.host = this.convertValues(source["host"], host.Report);
this.optimizations = this.convertValues(source["optimizations"], host.Optimization);
this.runtimes = this.convertValues(source["runtimes"], runtime.Installed);
this.active_runtime = this.convertValues(source["active_runtime"], runtime.Installed);
this.vms = this.convertValues(source["vms"], reims.VMListItem);
this.transitions = source["transitions"];
this.pending_changes = this.convertValues(source["pending_changes"], Array<PendingChange>, true);
this.needs_setup = source["needs_setup"];
this.app_version = source["app_version"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class DataRootCheck {
path: string;
free_gb: number;
system: boolean;
external: boolean;
has_config: boolean;
error?: string;
static createFrom(source: any = {}) {
return new DataRootCheck(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.free_gb = source["free_gb"];
this.system = source["system"];
this.external = source["external"];
this.has_config = source["has_config"];
this.error = source["error"];
}
}
export class DataRootChoice {
path: string;
free_gb: number;
system: boolean;
external: boolean;
recommended: boolean;
static createFrom(source: any = {}) {
return new DataRootChoice(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.free_gb = source["free_gb"];
this.system = source["system"];
this.external = source["external"];
this.recommended = source["recommended"];
}
}
export class DriveShareInfo {
drive: string;
root: string;
selected: boolean;
system: boolean;
static createFrom(source: any = {}) {
return new DriveShareInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.drive = source["drive"];
this.root = source["root"];
this.selected = source["selected"];
this.system = source["system"];
}
}
export class DriveShareSettings {
enabled: boolean;
read_only: boolean;
required_agent_version: number;
drives: DriveShareInfo[];
static createFrom(source: any = {}) {
return new DriveShareSettings(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.enabled = source["enabled"];
this.read_only = source["read_only"];
this.required_agent_version = source["required_agent_version"];
this.drives = this.convertValues(source["drives"], DriveShareInfo);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class PendingChange {
field: string;
from: string;
to: string;
static createFrom(source: any = {}) {
return new PendingChange(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.field = source["field"];
this.from = source["from"];
this.to = source["to"];
}
}
export class Task {
id: string;
kind: string;
subject: string;
vm?: string;
step: string;
done: number;
total: number;
percent: number;
rate: number;
status: string;
error?: string;
result?: string;
cancelable: boolean;
started_at: number;
updated_at: number;
static createFrom(source: any = {}) {
return new Task(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.kind = source["kind"];
this.subject = source["subject"];
this.vm = source["vm"];
this.step = source["step"];
this.done = source["done"];
this.total = source["total"];
this.percent = source["percent"];
this.rate = source["rate"];
this.status = source["status"];
this.error = source["error"];
this.result = source["result"];
this.cancelable = source["cancelable"];
this.started_at = source["started_at"];
this.updated_at = source["updated_at"];
}
}
export class VMStats {
name: string;
running: boolean;
pid?: number;
cpu_percent: number;
memory_rss_bytes: number;
memory_private_bytes: number;
disk_actual_bytes: number;
disk_virtual_bytes: number;
disk_format?: string;
uptime_seconds: number;
guest_tools_connected: boolean;
guest_tools_mount_mode?: string;
guest_tools_sleep_guard: boolean;
static createFrom(source: any = {}) {
return new VMStats(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.running = source["running"];
this.pid = source["pid"];
this.cpu_percent = source["cpu_percent"];
this.memory_rss_bytes = source["memory_rss_bytes"];
this.memory_private_bytes = source["memory_private_bytes"];
this.disk_actual_bytes = source["disk_actual_bytes"];
this.disk_virtual_bytes = source["disk_virtual_bytes"];
this.disk_format = source["disk_format"];
this.uptime_seconds = source["uptime_seconds"];
this.guest_tools_connected = source["guest_tools_connected"];
this.guest_tools_mount_mode = source["guest_tools_mount_mode"];
this.guest_tools_sleep_guard = source["guest_tools_sleep_guard"];
}
}
export class VMThumbnail {
data_url: string;
captured_at: number;
live: boolean;
static createFrom(source: any = {}) {
return new VMThumbnail(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.data_url = source["data_url"];
this.captured_at = source["captured_at"];
this.live = source["live"];
}
}
}
export namespace config {
export class Config {
@@ -7,6 +264,7 @@ export namespace config {
auto_pin_pcores: boolean;
default_gpu?: string;
runtime_channel?: string;
runtime_source?: string;
minimize_to_tray?: boolean;
static createFrom(source: any = {}) {
@@ -21,6 +279,7 @@ export namespace config {
this.auto_pin_pcores = source["auto_pin_pcores"];
this.default_gpu = source["default_gpu"];
this.runtime_channel = source["runtime_channel"];
this.runtime_source = source["runtime_source"];
this.minimize_to_tray = source["minimize_to_tray"];
}
}
@@ -305,263 +564,6 @@ export namespace installer {
}
export namespace main {
export class AppState {
config?: config.Config;
host: host.Report;
optimizations: host.Optimization[];
runtimes: runtime.Installed[];
active_runtime?: runtime.Installed;
vms: reims.VMListItem[];
transitions: Record<string, string>;
pending_changes: Record<string, Array<PendingChange>>;
needs_setup: boolean;
app_version: string;
static createFrom(source: any = {}) {
return new AppState(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.config = this.convertValues(source["config"], config.Config);
this.host = this.convertValues(source["host"], host.Report);
this.optimizations = this.convertValues(source["optimizations"], host.Optimization);
this.runtimes = this.convertValues(source["runtimes"], runtime.Installed);
this.active_runtime = this.convertValues(source["active_runtime"], runtime.Installed);
this.vms = this.convertValues(source["vms"], reims.VMListItem);
this.transitions = source["transitions"];
this.pending_changes = this.convertValues(source["pending_changes"], Array<PendingChange>, true);
this.needs_setup = source["needs_setup"];
this.app_version = source["app_version"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class DataRootCheck {
path: string;
free_gb: number;
system: boolean;
external: boolean;
has_config: boolean;
error?: string;
static createFrom(source: any = {}) {
return new DataRootCheck(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.free_gb = source["free_gb"];
this.system = source["system"];
this.external = source["external"];
this.has_config = source["has_config"];
this.error = source["error"];
}
}
export class DataRootChoice {
path: string;
free_gb: number;
system: boolean;
external: boolean;
recommended: boolean;
static createFrom(source: any = {}) {
return new DataRootChoice(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.path = source["path"];
this.free_gb = source["free_gb"];
this.system = source["system"];
this.external = source["external"];
this.recommended = source["recommended"];
}
}
export class DriveShareInfo {
drive: string;
root: string;
selected: boolean;
system: boolean;
static createFrom(source: any = {}) {
return new DriveShareInfo(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.drive = source["drive"];
this.root = source["root"];
this.selected = source["selected"];
this.system = source["system"];
}
}
export class DriveShareSettings {
enabled: boolean;
read_only: boolean;
required_agent_version: number;
drives: DriveShareInfo[];
static createFrom(source: any = {}) {
return new DriveShareSettings(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.enabled = source["enabled"];
this.read_only = source["read_only"];
this.required_agent_version = source["required_agent_version"];
this.drives = this.convertValues(source["drives"], DriveShareInfo);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class PendingChange {
field: string;
from: string;
to: string;
static createFrom(source: any = {}) {
return new PendingChange(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.field = source["field"];
this.from = source["from"];
this.to = source["to"];
}
}
export class Task {
id: string;
kind: string;
subject: string;
vm?: string;
step: string;
done: number;
total: number;
percent: number;
rate: number;
status: string;
error?: string;
result?: string;
cancelable: boolean;
started_at: number;
updated_at: number;
static createFrom(source: any = {}) {
return new Task(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.kind = source["kind"];
this.subject = source["subject"];
this.vm = source["vm"];
this.step = source["step"];
this.done = source["done"];
this.total = source["total"];
this.percent = source["percent"];
this.rate = source["rate"];
this.status = source["status"];
this.error = source["error"];
this.result = source["result"];
this.cancelable = source["cancelable"];
this.started_at = source["started_at"];
this.updated_at = source["updated_at"];
}
}
export class VMStats {
name: string;
running: boolean;
pid?: number;
cpu_percent: number;
memory_rss_bytes: number;
memory_private_bytes: number;
disk_actual_bytes: number;
disk_virtual_bytes: number;
disk_format?: string;
uptime_seconds: number;
guest_tools_connected: boolean;
guest_tools_mount_mode?: string;
guest_tools_sleep_guard: boolean;
static createFrom(source: any = {}) {
return new VMStats(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.name = source["name"];
this.running = source["running"];
this.pid = source["pid"];
this.cpu_percent = source["cpu_percent"];
this.memory_rss_bytes = source["memory_rss_bytes"];
this.memory_private_bytes = source["memory_private_bytes"];
this.disk_actual_bytes = source["disk_actual_bytes"];
this.disk_virtual_bytes = source["disk_virtual_bytes"];
this.disk_format = source["disk_format"];
this.uptime_seconds = source["uptime_seconds"];
this.guest_tools_connected = source["guest_tools_connected"];
this.guest_tools_mount_mode = source["guest_tools_mount_mode"];
this.guest_tools_sleep_guard = source["guest_tools_sleep_guard"];
}
}
export class VMThumbnail {
data_url: string;
captured_at: number;
live: boolean;
static createFrom(source: any = {}) {
return new VMThumbnail(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.data_url = source["data_url"];
this.captured_at = source["captured_at"];
this.live = source["live"];
}
}
}
export namespace reims {
export class CreateOpts {
@@ -959,6 +961,7 @@ export namespace runtime {
commit: string;
tag: string;
channel: string;
source?: string;
published_at: string;
page_url: string;
archive_name: string;
@@ -977,6 +980,7 @@ export namespace runtime {
this.commit = source["commit"];
this.tag = source["tag"];
this.channel = source["channel"];
this.source = source["source"];
this.published_at = source["published_at"];
this.page_url = source["page_url"];
this.archive_name = source["archive_name"];
+23 -4
View File
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
@@ -22,6 +22,7 @@ import (
"github.com/Nwflower/reims-go/internal/tray"
"github.com/Nwflower/reims-go/internal/version"
"github.com/Nwflower/reims-go/internal/vmstart"
"github.com/wailsapp/wails/v2/pkg/options"
wailsRuntime "github.com/wailsapp/wails/v2/pkg/runtime"
)
@@ -71,17 +72,29 @@ type App struct {
recentLogs []string
needsSetup bool
launch cli.WindowArgs // flags this window was started with (window_launch.go)
trayIcon []byte // embedded PNG passed in from package main
logCaptures map[string][]*logCapture // emitLog source → captures (window_launch.go)
}
func NewApp() *App {
// Lifecycle exposes Wails lifecycle callbacks without exporting them as
// frontend-bound methods on *App.
type Lifecycle struct {
OnStartup func(context.Context)
OnBeforeClose func(context.Context) bool
OnShutdown func(context.Context)
OnSecondInstanceLaunch func(options.SecondInstanceData)
}
func New(trayIcon []byte, launch cli.WindowArgs) (*App, Lifecycle) {
cfg, needsSetup, err := config.Resolve()
if err != nil {
cfg = config.Default()
}
return &App{
a := &App{
cfg: cfg,
needsSetup: needsSetup,
launch: launch,
trayIcon: trayIcon,
transitions: make(map[string]string),
pendingChanges: make(map[string][]PendingChange),
rebootWatchers: make(map[string]rebootWatcherEntry),
@@ -89,6 +102,12 @@ func NewApp() *App {
diskPaths: make(map[string]cachedDiskPath),
procSamples: make(map[string]host.ProcessSample),
}
return a, Lifecycle{
OnStartup: a.startup,
OnBeforeClose: a.beforeClose,
OnShutdown: a.shutdown,
OnSecondInstanceLaunch: a.onSecondInstance,
}
}
func (a *App) startup(ctx context.Context) {
@@ -534,7 +553,7 @@ func (a *App) QuitApp() {
}
func (a *App) startTray() {
mgr, err := tray.Start(trayIconPNG, "Reims-Go", tray.Callbacks{
mgr, err := tray.Start(a.trayIcon, "Reims-Go", tray.Callbacks{
OnShow: func() {
a.ShowMainWindow()
},
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
import (
"fmt"
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
@@ -1,4 +1,4 @@
package main
package app
import (
"archive/zip"
@@ -1,4 +1,4 @@
package main
package app
import (
"archive/zip"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
@@ -1,4 +1,4 @@
package main
package app
import (
"fmt"
@@ -1,4 +1,4 @@
package main
package app
import (
"testing"
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
@@ -1,4 +1,4 @@
package main
package app
// Finishing an offline install (roadmap M2.3): take the installer out and turn
// the network back on, which an offline install keeps off so its installer
@@ -1,4 +1,4 @@
package main
package app
// Wails bindings for offline installers (roadmap M1.3). The download manager
// page (M2.2) builds on these; downloads report through tasks (tasks.go).
@@ -1,4 +1,4 @@
package main
package app
import (
"github.com/Nwflower/reims-go/internal/driver/reims"
@@ -1,4 +1,4 @@
package main
package app
// Online runtime install from GitHub Releases (internal/runtime/remote.go).
// Downloads run as "runtime-install" tasks, so progress shows in the status bar.
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
// First launch: the user picks the data folder before anything else is written
// (runtimes, VMs, installers and caches all live under it).
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
// Long-running work (installer downloads, VM creation) is tracked as tasks and
// pushed to the frontend as "reims:task" events (docs/ui-redesign.md §6 B1), so
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
@@ -1,4 +1,4 @@
package main
package app
// VM screen thumbnails for the VM page (docs/ui-audit.md): while a VM runs,
// grab one frame over its QMP socket (`screendump`), shrink it to a small
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
// "Paste as keystrokes": type the host's clipboard (or a given text) into a
// running VM as US-layout key presses over its QMP socket. QEMU here has no
+1 -1
View File
@@ -1,4 +1,4 @@
package main
package app
import (
"context"
@@ -1,4 +1,4 @@
package main
package app
import (
"strings"
@@ -1,4 +1,4 @@
package main
package app
// What the desktop window does with cli.WindowArgs: from its own launch
// (`reims-go --background --start-vm=…`) or from a later `reims-go` run
@@ -1,4 +1,4 @@
package main
package app
import (
"fmt"
+16 -3
View File
@@ -177,6 +177,7 @@ type Remote struct {
type ghRelease struct {
TagName string `json:"tag_name"`
Name string `json:"name"`
Draft bool `json:"draft"`
Prerelease bool `json:"prerelease"`
PublishedAt string `json:"published_at"`
@@ -185,6 +186,18 @@ type ghRelease struct {
Assets []ghAsset `json:"assets"`
}
// isAlphaRelease treats either an explicit prerelease flag or an "(alpha)" /
// "(candidate)" marker in the release title as alpha. GitCode API v5 currently
// returns prerelease=false even when created with prerelease=true, while
// preserving the mirrored GitHub release title.
func isAlphaRelease(prerelease bool, name string) bool {
if prerelease {
return true
}
lower := strings.ToLower(name)
return strings.Contains(lower, "(alpha)") || strings.Contains(lower, "(candidate)")
}
type ghAsset struct {
Name string `json:"name"`
Size int64 `json:"size"`
@@ -310,7 +323,7 @@ func (s Source) listRemoteSingle(ctx context.Context, includeAlpha bool) ([]Remo
PageURL: pageURL,
Channel: ChannelStable,
}
if r.Prerelease {
if isAlphaRelease(r.Prerelease, r.Name) {
rem.Channel = ChannelAlpha
}
for _, a := range r.Assets {
@@ -428,10 +441,10 @@ func (s Source) listRemoteWeb(ctx context.Context, includeAlpha bool) ([]Remote,
tagURL := fmt.Sprintf("%s/%s/releases/tag/%s", web, s.Repo, tag)
channel := ChannelStable
if tagHTML, err := s.fetchText(ctx, tagURL, "text/html"); err == nil {
if rePrereleaseBadge.MatchString(tagHTML) {
if isAlphaRelease(rePrereleaseBadge.MatchString(tagHTML), e.Title) {
channel = ChannelAlpha
}
} else if strings.Contains(strings.ToLower(e.Title), "(alpha)") {
} else if isAlphaRelease(false, e.Title) {
channel = ChannelAlpha
}
if channel == ChannelAlpha && !includeAlpha {
+18 -5
View File
@@ -309,14 +309,20 @@ func TestListRemoteAutoFallsBackToGitCode(t *testing.T) {
http.NotFound(w, r)
return
}
// Matches real GitCode API v5 shape: created_at (+08:00), no published_at or html_url.
// Matches real GitCode API v5 shape: created_at (+08:00), no published_at or html_url,
// and prerelease=false even on mirrored alpha prereleases whose title carries "(alpha)".
fmt.Fprintf(w, `[
{"tag_name":"runtime-3731afd","prerelease":false,"created_at":"2026-11-28T19:03:04+08:00","assets":[
{"tag_name":"runtime-3731afd-p2","name":"Portable Runtime runtime-3731afd-p2 (alpha)","prerelease":false,"created_at":"2026-11-29T17:39:03+08:00","assets":[
{"name":"reims-runtime-win-x64-3731afd-p2.tar.zst","size":169000000,"browser_download_url":"%s/dl/rt-p2"},
{"name":"reims-runtime-src-3731afd-p2.tar.zst","size":500,"browser_download_url":"%s/dl/src-p2"},
{"name":"SHA256SUMS.txt","size":100,"browser_download_url":"%s/dl/sums-p2"}
]},
{"tag_name":"runtime-3731afd","name":"Runtime 3731afd","prerelease":false,"created_at":"2026-11-28T19:03:04+08:00","assets":[
{"name":"reims-runtime-win-x64-3731afd.tar.zst","size":168000000,"browser_download_url":"%s/dl/rt"},
{"name":"reims-runtime-src-3731afd.tar.zst","size":500,"browser_download_url":"%s/dl/src"},
{"name":"SHA256SUMS.txt","size":100,"browser_download_url":"%s/dl/sums"}
]}
]`, gcSrv.URL, gcSrv.URL, gcSrv.URL)
]`, gcSrv.URL, gcSrv.URL, gcSrv.URL, gcSrv.URL, gcSrv.URL, gcSrv.URL)
}))
defer gcSrv.Close()
@@ -337,7 +343,14 @@ func TestListRemoteAutoFallsBackToGitCode(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if len(list) != 1 || list[0].Commit != "3731afd" || list[0].Source != SourceGitCode || list[0].PageURL != "https://gitcode.com/o/r/releases/tag/runtime-3731afd" {
t.Fatalf("gitcode fallback = %+v", list)
if len(list) != 1 || list[0].Commit != "3731afd" || list[0].Channel != ChannelStable || list[0].Source != SourceGitCode || list[0].PageURL != "https://gitcode.com/o/r/releases/tag/runtime-3731afd" {
t.Fatalf("gitcode fallback stable = %+v", list)
}
all, err := src.ListRemote(context.Background(), true)
if err != nil {
t.Fatal(err)
}
if len(all) != 2 || all[0].Commit != "3731afd-p2" || all[0].Channel != ChannelAlpha {
t.Fatalf("gitcode fallback with alpha = %+v", all)
}
}
+2 -2
View File
@@ -16,8 +16,8 @@ import (
// Version is the current Reims-Go release version. Release builds may override
// it at link time with:
//
// -ldflags "-X github.com/Nwflower/reims-go/internal/version.Version=v0.2.4"
var Version = "v0.2.4"
// -ldflags "-X github.com/Nwflower/reims-go/internal/version.Version=v0.2.5"
var Version = "v0.2.5"
const (
DefaultReleasesRepo = "Nwflower/Reims-Go"
+7 -7
View File
@@ -4,6 +4,7 @@ import (
"embed"
"os"
"github.com/Nwflower/reims-go/internal/app"
"github.com/Nwflower/reims-go/internal/cli"
"github.com/wailsapp/wails/v2"
@@ -26,8 +27,7 @@ func main() {
}
launch, _ := cli.ParseWindowArgs(args)
app := NewApp()
app.launch = launch
desktopApp, hooks := app.New(trayIconPNG, launch)
err := wails.Run(&options.App{
Title: "Reims-Go",
StartHidden: launch.Background,
@@ -35,7 +35,7 @@ func main() {
// start` handing a VM over — goes to the running one instead.
SingleInstanceLock: &options.SingleInstanceLock{
UniqueId: cli.InstanceID,
OnSecondInstanceLaunch: app.onSecondInstance,
OnSecondInstanceLaunch: hooks.OnSecondInstanceLaunch,
},
Width: 1120,
Height: 740,
@@ -56,11 +56,11 @@ func main() {
DarkModeBorder: windows.RGB(58, 58, 62),
},
},
OnStartup: app.startup,
OnBeforeClose: app.beforeClose,
OnShutdown: app.shutdown,
OnStartup: hooks.OnStartup,
OnBeforeClose: hooks.OnBeforeClose,
OnShutdown: hooks.OnShutdown,
Bind: []any{
app,
desktopApp,
},
})
if err != nil {