You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
virt/engine/static/index.html

494 lines
69 KiB
HTML

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#101d2c" />
<title>VirtPilot · 虚拟机管理</title>
<link rel="stylesheet" href="/static/styles.css?v=rescue-iso-pool-1" />
<script type="module" src="/static/app.js?v=rescue-iso-pool-1"></script>
</head>
<body>
<div id="boot-screen" class="boot-screen" role="status" aria-live="polite">
<span class="brand-mark" aria-hidden="true"><span></span></span>
<span>正在连接控制面板…</span>
</div>
<main id="database-view" class="setup-layout" hidden>
<div class="setup-intro">
<div class="setup-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<span class="eyebrow light">FIRST RUN SETUP</span>
<h1>先连接数据库,<br />再开始管理。</h1>
<p>面板业务数据保存在 MariaDB 中。只需在首次启用时填写连接信息,无需预先编辑面板配置文件。</p>
<div class="setup-steps"><span class="current">01 · 配置数据库</span><span>02 · 创建初始用户</span><span>03 · 授予管理员权限</span></div>
</div>
<div class="setup-form-side">
<section class="setup-card" aria-labelledby="database-title">
<span class="eyebrow">步骤 01 / 03</span>
<h2 id="database-title">连接 MariaDB</h2>
<p class="muted">请先准备可连接的数据库与账号。连接信息只提交给面板服务,不会保存在浏览器中。</p>
<p class="setup-security-note">请先完成你自己的 HTTPS 反向代理,并核对证书和域名,再输入数据库密码与初始化令牌。</p>
<form id="database-form" class="form-stack">
<label for="database-host">数据库 IP 或主机名</label>
<input id="database-host" name="host" type="text" autocomplete="off" maxlength="253" required placeholder="例如 127.0.0.1" />
<label for="database-port">端口</label>
<input id="database-port" name="port" type="number" min="1" max="65535" value="3306" required />
<label for="database-name">数据库名</label>
<input id="database-name" name="database" type="text" autocomplete="off" maxlength="64" required placeholder="例如 virsh_panel" />
<label for="database-username">数据库用户名</label>
<input id="database-username" name="username" type="text" autocomplete="off" maxlength="128" required />
<label for="database-password">数据库密码</label>
<input id="database-password" name="password" type="password" autocomplete="off" maxlength="1024" required />
<label for="database-token">初始化令牌</label>
<input id="database-token" name="setup_token" type="password" autocomplete="off" maxlength="256" required placeholder="粘贴面板启动终端输出中的令牌" />
<p id="database-error" class="form-error" role="alert" hidden></p>
<button id="database-submit" class="button button-primary setup-submit" type="submit">连接数据库并继续 <span aria-hidden="true">→</span></button>
</form>
<p class="setup-note">数据库需由你预先创建并授权;面板不会自动安装 MariaDB。初始化令牌完成初始用户创建后失效。</p>
</section>
</div>
</main>
<main id="setup-view" class="setup-layout" hidden>
<div class="setup-intro">
<div class="setup-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<span class="eyebrow light">FIRST RUN SETUP</span>
<h1>欢迎使用<br />VirtPilot</h1>
<p>完成数据库连接后先创建初始用户,再由你在数据库中将其 admin 字段改为管理员权限。</p>
<div class="setup-steps"><span>01 · 配置数据库</span><span class="current">02 · 创建初始用户</span><span>03 · 授予管理员权限</span></div>
</div>
<div class="setup-form-side">
<section class="setup-card" aria-labelledby="setup-title">
<span class="eyebrow">步骤 02 / 03</span>
<h2 id="setup-title">创建初始用户</h2>
<p class="muted">使用面板首次启动时在终端输出的一次性初始化令牌。完成后令牌将失效。</p>
<p class="setup-security-note">安全检查:请先完成你自己的 HTTPS 反向代理,并确认浏览器连接的是你信任的证书和域名,再输入令牌、密码或宿主机私钥。</p>
<form id="setup-form" class="form-stack">
<label for="setup-token">初始化令牌</label>
<input id="setup-token" name="token" type="password" autocomplete="off" maxlength="256" required placeholder="粘贴启动终端输出中的令牌" />
<label for="setup-username">初始用户名</label>
<input id="setup-username" name="username" type="text" autocomplete="username" minlength="3" maxlength="32" pattern="[A-Za-z][A-Za-z0-9._-]{2,31}" value="admin" required />
<label for="setup-password">初始用户密码</label>
<input id="setup-password" name="password" type="password" autocomplete="new-password" minlength="12" maxlength="1024" required placeholder="至少 12 个字符" />
<label for="setup-password-confirm">确认密码</label>
<input id="setup-password-confirm" type="password" autocomplete="new-password" minlength="12" maxlength="1024" required placeholder="再次输入密码" />
<p id="setup-error" class="form-error" role="alert" hidden></p>
<button id="setup-submit" class="button button-primary setup-submit" type="submit">创建初始用户 <span aria-hidden="true">→</span></button>
</form>
<p class="setup-note">初始用户默认没有管理员权限。创建后请由你在数据库中将该用户 admin 字段设为 1,并手动补充登录邮箱,再用邮箱登录配置 SMTP 和宿主机。面板账号与宿主机 root 账号相互独立。</p>
</section>
</div>
</main>
<main id="login-view" class="login-layout" hidden>
<div class="login-art" aria-hidden="true">
<div class="login-art-grid"></div>
<div class="login-art-inner">
<div class="login-art-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<div class="login-art-copy">
<span class="eyebrow light">LIBVIRT CONTROL CENTER</span>
<h1>让每一台虚拟机<br />都尽在掌控。</h1>
<p>从一个安全、清晰的界面,管理远端宿主机上的虚拟机。</p>
</div>
<div class="login-art-footer"><span class="online-dot"></span> 远端 libvirt 管理面板</div>
</div>
<div class="art-orbit orbit-one"></div>
<div class="art-orbit orbit-two"></div>
<div class="art-core"><span></span><span></span><span></span></div>
</div>
<div class="login-form-side">
<div id="login-card" class="login-card">
<div class="login-mobile-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<span class="eyebrow">欢迎回来</span>
<h2>登录管理面板</h2>
<p class="muted">使用注册邮箱访问虚拟机控制台。</p>
<form id="login-form" class="form-stack">
<label for="login-email">邮箱</label>
<input id="login-email" name="email" type="email" autocomplete="username" maxlength="254" required autofocus placeholder="输入注册邮箱" />
<label for="login-password">密码</label>
<input id="login-password" name="password" type="password" autocomplete="current-password" maxlength="1024" required placeholder="输入密码" />
<p id="login-error" class="form-error" role="alert" hidden></p>
<p id="login-success" class="register-code-status" role="status" hidden></p>
<button id="login-submit" class="button button-primary login-submit" type="submit">登录面板 <span aria-hidden="true">→</span></button>
</form>
<p class="auth-switch">还没有账号?<button id="show-register-button" type="button">邮箱注册</button></p>
<p class="login-hint">通过 HTTPS 安全访问面板;虚拟机操作将在远端宿主机执行。</p>
</div>
<div id="register-card" class="login-card" hidden>
<div class="login-mobile-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<span class="eyebrow">创建账号</span>
<h2>邮箱注册</h2>
<p class="muted">验证邮箱后创建账号;新账号只能管理自己创建的虚拟机。</p>
<form id="register-form" class="form-stack">
<label for="register-username">用户名</label>
<input id="register-username" type="text" autocomplete="username" minlength="3" maxlength="32" pattern="[A-Za-z][A-Za-z0-9._-]{2,31}" required placeholder="至少 3 个字符" />
<label for="register-email">邮箱</label>
<input id="register-email" type="email" autocomplete="email" maxlength="254" required placeholder="接收验证码的邮箱" />
<label for="register-password">密码</label>
<input id="register-password" type="password" autocomplete="new-password" minlength="12" maxlength="1024" required placeholder="至少 12 个字符" />
<label for="register-password-confirm">确认密码</label>
<input id="register-password-confirm" type="password" autocomplete="new-password" minlength="12" maxlength="1024" required placeholder="再次输入密码" />
<label for="register-code">邮箱验证码</label>
<div class="register-code-row"><input id="register-code" type="text" inputmode="numeric" autocomplete="one-time-code" maxlength="8" required placeholder="输入邮件中的验证码" /><button id="register-code-send" class="button button-outline" type="button">发送验证码</button></div>
<p id="register-code-status" class="register-code-status" role="status" hidden></p>
<p id="register-error" class="form-error" role="alert" hidden></p>
<button id="register-submit" class="button button-primary login-submit" type="submit">验证并注册 <span aria-hidden="true">→</span></button>
</form>
<p class="auth-switch">已有账号?<button id="show-login-button" type="button">返回登录</button></p>
<p class="login-hint">请使用 HTTPS 连接面板,密码和验证码不会写入浏览器存储。</p>
</div>
</div>
</main>
<main id="access-wait-view" class="host-layout" hidden>
<header class="host-topbar"><div class="host-brand"><span class="brand-mark"><span></span></span> VirtPilot</div><div class="host-topbar-actions"><span id="wait-current-user" class="host-user"></span><button id="wait-logout-button" class="button button-ghost small" type="button">退出登录</button></div></header>
<div class="unlock-content"><section class="host-card unlock-card" aria-labelledby="wait-title"><span id="wait-eyebrow" class="eyebrow">ACCOUNT STATUS</span><h1 id="wait-title">等待管理员审核</h1><p id="wait-description" class="muted">邮箱已验证,账号正在等待管理员审核。审核通过后才能创建和管理虚拟机。</p><div class="host-submit-actions"><button id="wait-refresh-button" class="button button-outline" type="button">刷新状态</button><button id="wait-ssh-keys-button" class="button button-primary" type="button">管理我的公钥</button></div></section></div>
</main>
<main id="host-view" class="host-layout" hidden>
<header class="host-topbar">
<div class="host-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<div class="host-topbar-actions"><span id="host-current-user" class="host-user"></span><button id="host-logout-button" class="button button-ghost small" type="button">退出登录</button></div>
</header>
<div class="host-content">
<div class="host-heading"><div><span id="host-step-label" class="eyebrow">步骤 03 / 03</span><h1 id="host-page-title">连接 libvirt 宿主机</h1><p>填入现有的 root SSH 信息,面板将通过 libvirt API 管理远端虚拟机。</p></div><button id="host-update-button" class="button button-outline" type="button">网站更新</button><button id="host-back-button" class="button button-outline" type="button" hidden>返回虚拟机</button></div>
<div class="host-columns">
<section class="host-card" aria-labelledby="host-form-title">
<div class="host-card-heading"><span class="host-card-number">1</span><div><h2 id="host-form-title">SSH 连接信息</h2><p>使用宿主机已有的 root 私钥,不创建额外的系统账号。</p></div></div>
<form id="host-form">
<div class="form-grid">
<div class="field"><label for="host-address">宿主机地址 <span>*</span></label><input id="host-address" name="host" type="text" required maxlength="253" autocomplete="off" placeholder="例如 192.0.2.10" /></div>
<div class="field"><label for="host-port">SSH 端口 <span>*</span></label><input id="host-port" name="port" type="number" min="1" max="65535" value="22" required /></div>
<div class="field"><label for="host-region">虚拟机地区</label><input id="host-region" name="region" type="text" maxlength="64" autocomplete="off" placeholder="例如 中国香港 / 东京 / 洛杉矶" /><small>用于展示这台宿主机上的虚拟机所在地区;留空时显示“未设置”。</small></div>
<div class="field"><label for="host-username">SSH 用户</label><input id="host-username" type="text" value="root" disabled /></div>
<div class="field"><label for="host-storage-pool">虚拟机磁盘目录或存储池名</label><input id="host-storage-pool" name="storage_pool" type="text" maxlength="4096" value="default" required autocomplete="off" placeholder="例如 /home/kvm 或 default" /><small>可直接填写宿主机上的绝对路径,如 /home/kvm;也兼容现有 libvirt 存储池名称。</small></div>
<div class="field"><label for="host-iso-pool">安装 ISO 目录或存储池名</label><input id="host-iso-pool" name="iso_pool" type="text" maxlength="4096" value="iso" required autocomplete="off" placeholder="例如 /home/iso 或 iso" /><small>供创建虚拟机安装系统时选择;填写宿主机上的绝对路径,如 /home/iso,或现有存储池名称。</small></div>
<div class="field"><label for="host-rescue-iso-pool">救援 ISO 目录或存储池名</label><input id="host-rescue-iso-pool" name="rescue_iso_pool" type="text" maxlength="4096" autocomplete="off" placeholder="例如 /home/rescue-iso" /><small>专供上传救援模版使用,不能与安装 ISO 目录相同,也不要通过软链接或绑定挂载指向同一目录。请先在宿主机创建目录;面板只注册已存在的目录,不会自动创建。</small></div>
<div class="field"><label for="host-network">默认虚拟网络或网桥</label><input id="host-network" name="default_network" type="text" maxlength="128" value="default" required autocomplete="off" placeholder="例如 default 或 bridge:br0" /><small>libvirt 虚拟网络填名称;宿主机现有 Linux 网桥 br0 填 bridge:br0。</small></div>
<div class="host-public-pool full" role="group" aria-labelledby="host-public-pool-title">
<div class="host-public-pool-heading"><strong id="host-public-pool-title">公网 IPv4 地址池</strong><small>仅用于云镜像虚拟机;配置后面板只从填写的服务商获配网段自动分配地址。请按真实前缀填写,不要把仅获配的 /28 误填成 /24。</small></div>
<div class="form-grid">
<div class="field"><label for="host-public-pool-cidr">服务商分配的公网网段(/24 至 /30)</label><input id="host-public-pool-cidr" name="public_pool_cidr" type="text" maxlength="18" inputmode="decimal" autocomplete="off" placeholder="例如 123.123.123.112/28" /><small>可填网段或段内地址/前缀,例如 123.123.123.113/28 会保存为 123.123.123.112/28;留空则手动指定公网 IP。</small><small id="host-public-pool-preview" role="status" hidden></small></div>
<div class="field"><label for="host-public-gateway">网关 IPv4</label><input id="host-public-gateway" name="public_gateway" type="text" maxlength="15" inputmode="decimal" autocomplete="off" placeholder="例如 123.123.123.113" /><small>网关不会被分配给虚拟机。</small></div>
<div class="field"><label for="host-public-vm-prefix">虚拟机网卡前缀(可选)</label><input id="host-public-vm-prefix" name="public_vm_prefix" type="number" min="24" max="30" step="1" inputmode="numeric" autocomplete="off" placeholder="默认与地址池前缀相同" /><small>只影响虚拟机内的网络掩码,不扩大可分配 IP 范围。如果你的服务商要求客体使用 /24,而获配地址池是 /28,这里填 24。</small></div>
<div class="field full"><label for="host-public-dns">DNS IPv4</label><input id="host-public-dns" name="public_dns_servers" type="text" maxlength="128" autocomplete="off" placeholder="例如 1.1.1.1, 8.8.8.8" /><small>填写 1 至 4 个 DNS 地址,用逗号或空格分隔。</small></div>
<div class="field full"><label for="host-public-reserved">额外保留的公网 IP(可选)</label><textarea id="host-public-reserved" name="public_reserved_ips" rows="3" maxlength="4096" spellcheck="false" autocomplete="off" placeholder="已有其他用途的地址,每行一个;也可用逗号或空格分隔"></textarea><small>这些地址不会自动分配。请填写面板之外已占用的地址;若宿主机地址填的是域名,也请把宿主机自身的公网 IP 填在这里。</small></div>
</div>
</div>
<div class="field full"><label for="host-private-key">现有 SSH 私钥 <span id="host-key-required-mark">*</span></label><textarea id="host-private-key" name="private_key" rows="5" maxlength="65536" spellcheck="false" autocomplete="off" placeholder="粘贴 -----BEGIN OPENSSH PRIVATE KEY----- 开头的完整内容,或从下方选择文件"></textarea><small id="host-key-hint">仅通过 HTTPS 传输并保存在面板服务器。请确保这把密钥已在宿主机 root 账号上获得授权。</small></div>
<div class="field full"><label for="host-private-key-file">或从本机选择私钥文件</label><input id="host-private-key-file" type="file" /><small id="host-key-file-label">未选择文件;已保存的密钥不会在这里显示。</small></div>
<div class="field full"><label for="host-private-key-passphrase">SSH 私钥口令(如果设置了)</label><input id="host-private-key-passphrase" name="private_key_passphrase" type="password" maxlength="1024" autocomplete="off" spellcheck="false" placeholder="输入用于解锁私钥的口令" /><small id="host-passphrase-hint">保存时会加密写入面板数据库,供重启后自动连接和后台持续采样;面板不会回显口令或写入浏览器存储。</small></div>
</div>
</form>
</section>
<div class="host-side-stack">
<section class="host-card" aria-labelledby="host-fingerprint-title">
<div class="host-card-heading"><span class="host-card-number">2</span><div><h2 id="host-fingerprint-title">核对 SSH 主机指纹</h2><p>先扫描面板看到的公钥,再与宿主机控制台显示的指纹对比。</p></div></div>
<button id="host-scan-button" class="button button-outline" type="button">扫描主机指纹</button>
<div id="host-fingerprint-result" class="fingerprint-result" hidden><span>扫描到的指纹 · <span id="host-key-type"></span></span><code id="host-fingerprint"></code></div>
<p class="host-security-note">请在宿主机 B 的控制台执行 <code>ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub</code> 并逐字核对。当前仅支持 Ed25519 主机密钥;不要仅凭网页显示就信任该指纹。</p>
<label id="host-confirm-row" class="checkbox-row host-confirm" hidden><input id="host-fingerprint-confirm" type="checkbox" /><span><strong>我已通过宿主机控制台独立核对,指纹完全一致</strong><small>主机密钥变更时需要重新核对。</small></span></label>
</section>
<section class="host-card" aria-labelledby="host-connect-title">
<div class="host-card-heading"><span class="host-card-number">3</span><div><h2 id="host-connect-title">测试并保存</h2><p>测试 root SSH、libvirt、存储池和虚拟网络是否可用。</p></div></div>
<p id="host-test-status" class="host-test-status" role="status">尚未测试连接</p>
<p id="host-error" class="form-error" role="alert" hidden></p>
<div class="host-submit-actions"><button id="host-test-button" class="button button-outline" type="button">测试连接</button><button id="host-save-button" class="button button-primary" type="submit" form="host-form">保存并进入面板</button></div>
<p class="host-security-note">root 私钥拥有很高权限。请保护面板管理员密码,仅通过 HTTPS 访问面板,并限制能访问面板的网络范围。</p>
</section>
</div>
</div>
</div>
</main>
<main id="unlock-view" class="host-layout" hidden>
<header class="host-topbar">
<div class="host-brand"><span class="brand-mark"><span></span></span> VirtPilot</div>
<div class="host-topbar-actions"><span id="unlock-current-user" class="host-user"></span><button id="unlock-logout-button" class="button button-ghost small" type="button">退出登录</button></div>
</header>
<div class="unlock-content">
<section class="host-card unlock-card" aria-labelledby="unlock-title">
<span class="eyebrow">HOST KEY LOCKED</span>
<h1 id="unlock-title">解锁宿主机 SSH 私钥</h1>
<p class="muted">宿主机 <strong id="unlock-host-label"></strong> 的私钥尚未自动解锁。请输入口令以恢复连接;若要重启后自动连接,请随后在“宿主机设置”中重新保存口令。</p>
<form id="unlock-form" class="form-stack">
<label for="unlock-passphrase">私钥口令</label>
<input id="unlock-passphrase" type="password" maxlength="1024" autocomplete="off" spellcheck="false" required autofocus placeholder="输入现有私钥口令" />
<p id="unlock-error" class="form-error" role="alert" hidden></p>
<button id="unlock-submit" class="button button-primary unlock-submit" type="submit">解锁并进入面板</button>
</form>
<p class="host-security-note">在这里输入只用于本次解锁;在“宿主机设置”重新保存后,口令会加密写入数据库供后台使用。面板不会将口令写入浏览器存储;请通过 HTTPS 连接面板。</p>
<button id="unlock-settings-button" class="button button-ghost small unlock-settings-button" type="button">修改宿主机设置</button>
<button id="unlock-update-button" class="button button-ghost small unlock-settings-button" type="button">网站更新</button>
</section>
</div>
</main>
<div id="dashboard-view" class="dashboard" hidden>
<aside class="sidebar">
<div class="sidebar-brand"><span class="brand-mark"><span></span></span><span>VirtPilot<small>CONTROL PANEL</small></span></div>
<div class="sidebar-section-label">工作区</div>
<button id="vm-navigation-button" class="sidebar-link sidebar-button active" type="button" aria-current="page"><span class="nav-icon" aria-hidden="true">▦</span> 虚拟机 <span class="nav-arrow" aria-hidden="true">›</span></button>
<button id="ssh-keys-button" class="sidebar-link sidebar-button" type="button"><span class="nav-icon" aria-hidden="true">⌑</span> 公钥管理 <span class="nav-arrow" aria-hidden="true">›</span></button>
<button id="template-settings-button" class="sidebar-link sidebar-button" type="button"><span class="nav-icon" aria-hidden="true">◈</span> 云镜像模板 <span class="nav-arrow" aria-hidden="true">›</span></button>
<button id="rescue-templates-button" class="sidebar-link sidebar-button" type="button"><span class="nav-icon" aria-hidden="true">✚</span> 救援模版 <span class="nav-arrow" aria-hidden="true">›</span></button>
<button id="host-settings-button" class="sidebar-link sidebar-button" type="button"><span class="nav-icon" aria-hidden="true">⌁</span> 宿主机设置 <span class="nav-arrow" aria-hidden="true">›</span></button>
<button id="update-settings-button" class="sidebar-link sidebar-button" type="button"><span class="nav-icon" aria-hidden="true">↻</span> 网站更新 <span class="nav-arrow" aria-hidden="true">›</span></button>
<button id="smtp-settings-button" class="sidebar-link sidebar-button" type="button"><span class="nav-icon" aria-hidden="true">✉</span> 邮件与用户 <span class="nav-arrow" aria-hidden="true">›</span></button>
<div class="sidebar-bottom">
<div class="host-panel"><div class="host-panel-icon" aria-hidden="true">⌁</div><div><strong>远端宿主机</strong><span id="host-connection-label">连接中…</span></div><span id="host-connection-dot" class="connection-dot"></span></div>
<div class="sidebar-caption">Powered by libvirt</div>
</div>
</aside>
<div class="main-area">
<header class="topbar">
<div class="breadcrumb">工作区 <span>/</span> <strong id="breadcrumb-current">虚拟机</strong></div>
<div class="topbar-right"><details id="admin-menu" class="admin-menu"><summary>菜单 <span aria-hidden="true">▾</span></summary><div class="admin-menu-options"><button id="vm-navigation-mobile-button" class="button button-ghost small" type="button">虚拟机</button><button id="ssh-keys-mobile-button" class="button button-ghost small" type="button">公钥管理</button><button id="template-settings-mobile-button" class="button button-ghost small" type="button">云镜像模板</button><button id="rescue-templates-mobile-button" class="button button-ghost small" type="button">救援模版</button><button id="host-settings-mobile-button" class="button button-ghost small" type="button">宿主机设置</button><button id="update-settings-mobile-button" class="button button-ghost small" type="button">网站更新</button><button id="smtp-settings-mobile-button" class="button button-ghost small" type="button">邮件与用户</button></div></details><span class="topbar-user"><span class="avatar" aria-hidden="true">A</span><span id="current-username">用户</span></span><button id="logout-button" class="button button-ghost small" type="button">退出登录</button></div>
</header>
<main class="content">
<div id="vm-workspace">
<div id="vm-list-view">
<div class="page-heading"><div><span class="eyebrow">VIRTUAL MACHINES</span><h1 id="vm-list-title" tabindex="-1">虚拟机管理</h1><p>查看虚拟机信息;点击名称进入管理页面执行操作。</p></div><div class="heading-actions"><button id="refresh-button" class="button button-outline" type="button"><span aria-hidden="true">↻</span> 刷新</button><button id="create-button" class="button button-primary" type="button"><span aria-hidden="true">+</span> 创建虚拟机</button></div></div>
<div id="resource-warning" class="resource-warning" role="alert" hidden></div>
<div class="overview-grid" aria-label="虚拟机概览">
<section class="stat-card"><div class="stat-top"><span>虚拟机总数</span><span class="stat-icon total" aria-hidden="true">▦</span></div><strong id="stat-total">—</strong><small>当前宿主机</small></section>
<section class="stat-card"><div class="stat-top"><span>运行中</span><span class="stat-icon running" aria-hidden="true">▶</span></div><strong id="stat-running">—</strong><small><span class="tiny-dot green"></span> 正在提供服务</small></section>
<section class="stat-card"><div class="stat-top"><span>已关机</span><span class="stat-icon stopped" aria-hidden="true">⏻</span></div><strong id="stat-stopped">—</strong><small>可随时启动</small></section>
</div>
<section class="inventory-panel" aria-labelledby="inventory-title">
<div class="panel-heading"><div><h2 id="inventory-title">虚拟机列表</h2><p id="inventory-count">正在加载…</p></div><div class="panel-tools"><label class="search-box"><span aria-hidden="true">⌕</span><span class="sr-only">搜索虚拟机</span><input id="search-input" type="search" placeholder="搜索名称、地区、系统或 IP" /></label><select id="state-filter" aria-label="按状态筛选"><option value="all">全部状态</option><option value="running">运行中</option><option value="stopped">已关机</option><option value="other">其他状态</option></select></div></div>
<div class="table-scroll"><table class="vm-table"><thead><tr><th>虚拟机</th><th>状态</th><th>地区</th><th>系统 / 安装镜像</th><th>已配置公网 IP</th><th>规格</th><th>磁盘</th></tr></thead><tbody id="vm-table-body"></tbody></table></div>
<div id="empty-state" class="empty-state" hidden><div class="empty-icon" aria-hidden="true">▦</div><h3 id="empty-title">还没有虚拟机</h3><p id="empty-description">点击右上角“创建虚拟机”开始。</p></div>
</section>
<div class="footer-note">状态每 15 秒自动更新 · 操作会发送至远端 libvirt 宿主机</div>
</div>
<section id="vm-detail-view" class="vm-detail-view" aria-labelledby="vm-detail-name" hidden>
<button id="vm-detail-back-button" class="button button-ghost vm-detail-back" type="button">← 返回虚拟机列表</button>
<div class="page-heading vm-detail-heading"><div><span class="eyebrow">VIRTUAL MACHINE DETAILS</span><h1 id="vm-detail-name" tabindex="-1">虚拟机</h1><p class="vm-detail-summary"><span><span class="sr-only">服务器 IP:</span><strong id="vm-detail-header-ip">未获取</strong></span><span><span class="sr-only">区域:</span><strong id="vm-detail-header-region">未设置</strong></span><span><strong id="vm-detail-header-created-at">未记录</strong></span></p></div><div class="heading-actions"><span id="vm-detail-state" class="state-pill other">未知</span><button id="vm-detail-refresh-button" class="button button-outline" type="button"><span aria-hidden="true">↻</span> 刷新</button></div></div>
<div class="vm-detail-grid">
<section class="inventory-panel vm-detail-panel" aria-labelledby="vm-detail-info-title"><div class="panel-heading"><div><h2 id="vm-detail-info-title">虚拟机信息</h2><p>状态和配置每 15 秒自动更新;IP 是面板记录的配置,不代表系统已联网。</p></div></div><dl class="vm-detail-facts">
<div><dt>地区</dt><dd id="vm-detail-region">未设置</dd></div><div><dt id="vm-detail-os-label">系统</dt><dd id="vm-detail-os">未识别</dd></div>
<div><dt>已配置公网 IP</dt><dd class="vm-detail-inline"><span id="vm-detail-ip">未获取</span><button id="vm-detail-ip-copy" class="vm-copy-icon" type="button" aria-label="复制公网 IP" title="复制公网 IP" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/></svg></button></dd></div><div><dt>计算规格</dt><dd id="vm-detail-spec">—</dd></div>
<div><dt>硬盘大小</dt><dd id="vm-detail-disk">—</dd></div>
<div><dt>SSH 登录名</dt><dd id="vm-detail-ssh-user">未记录</dd></div>
<div class="vm-detail-credential-row"><dt>面板记录的初始 root 密码</dt><dd class="vm-detail-inline"><code id="vm-detail-root-password" class="vm-detail-secret">未记录</code>
<button id="vm-detail-password-reveal" class="vm-copy-icon vm-credential-icon" type="button" aria-label="查看初始 root 密码" title="查看初始 root 密码" aria-controls="vm-detail-root-password" aria-pressed="false" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><path d="M2.3 12S5.8 6.5 12 6.5s9.7 5.5 9.7 5.5-3.5 5.5-9.7 5.5S2.3 12 2.3 12Z"/><circle cx="12" cy="12" r="2.6"/><path class="vm-eye-slash" d="M3 3 21 21"/></svg></button>
<button id="vm-detail-password-copy" class="vm-copy-icon vm-credential-icon" type="button" aria-label="复制初始 root 密码" title="复制初始 root 密码" hidden><svg viewBox="0 0 24 24" aria-hidden="true"><rect x="8" y="8" width="12" height="12" rx="2"/><path d="M16 8V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v8a2 2 0 0 0 2 2h2"/></svg></button>
</dd></div>
</dl></section>
<div class="vm-detail-operations"><section class="inventory-panel vm-detail-panel" aria-labelledby="vm-detail-actions-title"><div class="panel-heading"><div><h2 id="vm-detail-actions-title">日常操作</h2><p>在这里管理这台虚拟机的电源和控制台。</p></div></div><div id="vm-detail-primary-actions" class="vm-detail-actions"></div></section>
<section class="inventory-panel vm-detail-panel vm-danger-panel" aria-labelledby="vm-detail-danger-title"><div class="panel-heading"><div><h2 id="vm-detail-danger-title">维护与危险操作</h2><p>救援会先预挂载 ISO,再尝试正常关机并开机;强制断电可能丢失未保存的数据,重装或删除会清除数据。</p></div></div><div id="vm-detail-danger-actions" class="vm-detail-actions"></div></section></div>
</div>
<section class="vm-metrics" aria-labelledby="vm-metrics-title">
<div class="vm-metrics-heading"><div><span class="eyebrow">PERFORMANCE HISTORY</span><h2 id="vm-metrics-title">性能监控</h2><p>每分钟采样并自动刷新,历史数据最长保留 30 天;长时间范围会聚合,较长的采样缺口留空。</p></div><label class="vm-metrics-range-control" for="vm-metrics-range">时间范围 <select id="vm-metrics-range"><option value="1h">最近 1 小时</option><option value="24h" selected>最近 24 小时</option><option value="7d">最近 7 天</option><option value="30d">最近 30 天</option></select></label></div>
<p id="vm-metrics-status" class="vm-metrics-status" role="status">选择虚拟机后加载监控数据。</p>
<div class="vm-metrics-grid">
<section class="vm-metric-card" aria-labelledby="vm-metric-cpu-title"><div class="vm-metric-card-heading"><span class="vm-metric-icon cpu" aria-hidden="true">◴</span><div><h3 id="vm-metric-cpu-title">CPU 使用率</h3><p id="vm-metric-cpu-summary">—</p></div></div><div id="vm-metric-cpu-plot" class="vm-metric-plot"></div><div class="vm-metric-legend"><span><i class="vm-metric-swatch cpu"></i>使用率</span></div></section>
<section class="vm-metric-card" aria-labelledby="vm-metric-memory-title"><div class="vm-metric-card-heading"><span class="vm-metric-icon memory" aria-hidden="true">▤</span><div><h3 id="vm-metric-memory-title">内存用量</h3><p id="vm-metric-memory-summary">—</p></div></div><div id="vm-metric-memory-plot" class="vm-metric-plot"></div><div class="vm-metric-legend"><span><i class="vm-metric-swatch memory"></i>已使用(估算)</span><span><i class="vm-metric-swatch memory-total"></i>总量</span></div></section>
<section class="vm-metric-card" aria-labelledby="vm-metric-disk-title"><div class="vm-metric-card-heading"><span class="vm-metric-icon disk" aria-hidden="true">▥</span><div><h3 id="vm-metric-disk-title">磁盘 I/O</h3><p id="vm-metric-disk-summary">—</p></div></div><div id="vm-metric-disk-plot" class="vm-metric-plot"></div><div class="vm-metric-legend"><span><i class="vm-metric-swatch disk-read"></i>读取</span><span><i class="vm-metric-swatch disk-write"></i>写入</span></div></section>
<section class="vm-metric-card" aria-labelledby="vm-metric-network-title"><div class="vm-metric-card-heading"><span class="vm-metric-icon network" aria-hidden="true">⇄</span><div><h3 id="vm-metric-network-title">网络速率</h3><p id="vm-metric-network-summary">—</p></div></div><div id="vm-metric-network-plot" class="vm-metric-plot"></div><div class="vm-metric-legend"><span><i class="vm-metric-swatch network-rx"></i>接收</span><span><i class="vm-metric-swatch network-tx"></i>发送</span></div></section>
</div>
<p class="vm-metrics-footnote">磁盘 I/O 为每秒读写量,仅统计 libvirt 提供计数的设备;网络收发为虚拟机视角的每秒速率,不代表套餐带宽上限。内存已用量为估算值,取决于虚拟机是否提供气球驱动统计。</p>
</section>
</section>
<section id="create-view" class="workspace-form-page" aria-labelledby="create-title" hidden>
<button id="create-back" class="button button-ghost workspace-form-back" type="button">← 返回虚拟机列表</button>
<div class="page-heading workspace-form-heading"><div><span class="eyebrow">NEW VIRTUAL MACHINE</span><h1 id="create-title" tabindex="-1">创建虚拟机</h1><p>选择 ISO 安装,或从云镜像模板直接创建系统。</p></div></div>
<form id="create-form" class="inventory-panel workspace-form-card">
<div class="workspace-form-body">
<fieldset class="create-source-picker"><legend>系统来源</legend><label><input type="radio" name="source" value="iso" checked /><span><strong>ISO 安装</strong><small>通过 VNC 安装系统</small></span></label><label><input type="radio" name="source" value="cloud" /><span><strong>公网云镜像</strong><small>自动或手动配置公网 IP 后直接开机</small></span></label></fieldset>
<div class="form-grid">
<div class="field full"><label for="vm-name">名称 <span>*</span></label><input id="vm-name" name="name" type="text" required minlength="1" maxlength="63" pattern="[a-zA-Z0-9][a-zA-Z0-9._-]*" autocomplete="off" placeholder="例如 web-prod-01" /><small>使用英文字母、数字、点、下划线或连字符。</small></div>
<div class="field"><label for="vm-vcpu">vCPU <span>*</span></label><div class="input-suffix"><input id="vm-vcpu" name="vcpu" type="number" min="1" max="64" value="2" required /><span>核</span></div></div>
<div class="field"><label for="vm-memory">内存 <span>*</span></label><div class="input-suffix"><input id="vm-memory" name="memory_mib" type="number" min="512" max="262144" step="1" value="2048" required /><span>MiB</span></div></div>
<div class="field"><label for="vm-disk">系统盘 <span>*</span></label><div class="input-suffix"><input id="vm-disk" name="disk_gib" type="number" min="1" max="4096" value="20" required /><span>GiB</span></div></div>
<div class="field"><label for="vm-network">虚拟网络或网桥 <span>*</span></label><select id="vm-network" name="network" required><option value="">正在加载网络…</option></select></div>
<div class="field full" id="vm-iso-field"><label for="vm-iso">安装 ISO <span>*</span></label><select id="vm-iso" name="iso" required><option value="">正在加载镜像…</option></select><small>镜像来自宿主机允许使用的 ISO 目录。</small></div>
<div class="field full" id="vm-template-field" hidden><span id="vm-template-label" class="template-field-label">系统镜像 <span>*</span></span><input id="vm-template" name="template_id" type="hidden" value="" disabled /><div id="vm-template-catalog" class="template-catalog" role="group" aria-labelledby="vm-template-label" aria-describedby="vm-template-hint" aria-required="true"></div><small id="vm-template-hint">点击系统图标下方的箭头展开版本,再选择已导入的镜像;模板需支持 cloud-init。</small></div>
<div class="cloud-fields full" id="vm-cloud-fields" hidden>
<div class="cloud-fields-heading"><strong>公网网络配置</strong><small>仅支持已配置的 Linux 网桥,例如 bridge:br0;上游网络还需允许虚拟机的 MAC 地址。</small></div>
<div id="vm-auto-public-pool" class="vm-auto-public-pool" role="status" hidden><strong>自动分配公网 IP</strong><span id="vm-auto-public-pool-description">创建时将从宿主机地址池中选择未使用的 IP,并自动写入网关和 DNS。</span></div>
<div class="form-grid" id="vm-manual-public-network">
<div class="field"><label for="vm-public-ip-cidr">公网 IPv4/CIDR <span>*</span></label><input id="vm-public-ip-cidr" name="public_ip_cidr" type="text" maxlength="18" inputmode="decimal" autocomplete="off" placeholder="填写服务商分配的公网 IP/28" disabled /><small>填写具体 IP 和前缀长度,不是网段地址。</small></div>
<div class="field"><label for="vm-gateway">同网段网关 IPv4 <span>*</span></label><input id="vm-gateway" name="gateway" type="text" maxlength="15" inputmode="decimal" autocomplete="off" placeholder="填写服务商提供的网关" disabled /></div>
<div class="field full"><label for="vm-dns">DNS IPv4 <span>*</span></label><input id="vm-dns" name="dns_servers" type="text" maxlength="128" autocomplete="off" placeholder="例如 1.1.1.1, 8.8.8.8" disabled /><small>多个地址用逗号或空格分隔。</small></div>
</div>
<div class="form-grid vm-cloud-auth-fields">
<div class="field full"><span class="ssh-key-picker-title">SSH 公钥(可选)</span><div id="vm-guest-ssh-key-cards" class="ssh-key-picker" role="group" aria-label="创建虚拟机时选择 SSH 公钥"></div><small>只显示你在“公钥管理”中添加的公钥;再次点击已选公钥可取消。填写密码时可与公钥同时使用。</small><button id="vm-open-ssh-keys" class="ssh-key-picker-manage" type="button">管理我的公钥</button></div>
<div class="field full" id="vm-root-password-field"><label for="vm-root-password">初始 root 密码(可选)</label><input id="vm-root-password" name="root_password" type="password" maxlength="256" autocomplete="new-password" spellcheck="false" aria-describedby="vm-root-password-hint" placeholder="可自行设置,留空时自动生成强密码" disabled /><small id="vm-root-password-hint" aria-live="polite">留空时自动生成强密码,即使选择了 SSH 公钥;自行设置需至少 12 个字符,包含大写字母、小写字母和符号。</small></div>
</div>
</div>
</div><div id="create-iso-tip" class="form-tip"><span aria-hidden="true">ⓘ</span><p>创建后会自动开机,可通过 VNC 安装系统。安装程序首次重启时虚拟机会先停机;之后在面板点“开机”,将从硬盘启动且不再挂载 ISO。</p></div><div id="create-cloud-tip" class="form-tip" hidden><span aria-hidden="true">ⓘ</span><p>云镜像首次启动由 cloud-init 写入静态 IP、DNS 和 root 登录凭据,无需 VNC 安装。可同时使用已保存的 SSH 公钥和 root 密码;密码留空时,即使选择了公钥也会自动生成强密码。初始密码可在虚拟机详情页查看。</p></div><p id="create-error" class="form-error" role="alert" hidden></p></div>
<div class="workspace-form-actions"><button id="create-submit" class="button button-primary" type="submit">创建并启动</button></div>
</form>
</section>
<section id="reinstall-view" class="workspace-form-page" aria-labelledby="reinstall-title" hidden>
<button id="reinstall-back" class="button button-ghost workspace-form-back" type="button">← 返回虚拟机详情</button>
<div class="page-heading workspace-form-heading"><div><span class="eyebrow danger-text">REINSTALL SYSTEM</span><h1 id="reinstall-title" tabindex="-1">重装云镜像系统</h1><p id="reinstall-subtitle">保留原有公网网络参数,重新创建系统盘。</p></div></div>
<form id="reinstall-form" class="inventory-panel workspace-form-card">
<div class="workspace-form-body">
<div id="reinstall-fields">
<p class="reinstall-warning"><strong>重装将永久清除原系统盘中的全部数据。</strong>面板会先请求虚拟机正常关机;若关机超时,重装会停止,不会强制断电。libvirt/QEMU 报告虚拟机已从新盘启动后,原系统盘将自动删除。这个“启动”不保证客户机系统、网络或 SSH 已经可用,请确认模板和网络配置。</p>
<p class="reinstall-network">沿用首次创建的公网网络信息:<strong id="reinstall-public-ip"></strong>。网桥、MAC、网关和 DNS 也会保持原配置。</p>
<div class="form-grid">
<div class="field full"><span id="reinstall-template-label" class="template-field-label">重装镜像 <span>*</span></span><input id="reinstall-template" name="template_id" type="hidden" value="" /><div id="reinstall-template-catalog" class="template-catalog" role="group" aria-labelledby="reinstall-template-label" aria-describedby="reinstall-template-hint" aria-required="true"></div><small id="reinstall-template-hint">点击系统图标下方的箭头展开版本,选择当前宿主机已导入的云镜像。</small></div>
<div class="field full"><span class="ssh-key-picker-title">SSH 公钥(可选)</span><div id="reinstall-ssh-key-cards" class="ssh-key-picker" role="group" aria-label="重装系统时选择 SSH 公钥"></div><small>直接选择“公钥管理”中保存的公钥;再次点击已选公钥可取消。填写密码时可与公钥同时使用。</small><button id="reinstall-open-ssh-keys" class="ssh-key-picker-manage" type="button">管理我的公钥</button></div>
<div class="field full" id="reinstall-root-password-field"><label for="reinstall-root-password">初始 root 密码(可选)</label><input id="reinstall-root-password" name="root_password" type="password" maxlength="256" autocomplete="new-password" spellcheck="false" aria-describedby="reinstall-root-password-hint" placeholder="可自行设置,留空时按公钥选择决定" /><small id="reinstall-root-password-hint" aria-live="polite">不选公钥且留空时自动生成强密码;自行设置需至少 12 个字符,包含大写字母、小写字母和符号。</small></div>
<div class="field full"><label for="reinstall-confirm-name">输入虚拟机名称以确认删除旧系统盘 <span>*</span></label><input id="reinstall-confirm-name" name="confirmation_name" type="text" required autocomplete="off" spellcheck="false" placeholder="请输入完整的虚拟机名称" /><small id="reinstall-confirm-hint"></small></div>
</div>
</div>
<div id="reinstall-progress" class="reinstall-progress" role="status" aria-live="polite" hidden><span class="console-spinner" aria-hidden="true"></span><div><strong>正在重装,请保持此页面打开</strong><p id="reinstall-phase">准备重装任务…</p><small>刷新此标签页后会自动恢复任务;如有初始密码,将加密保存在面板数据库中。</small></div></div>
<div id="reinstall-result" class="reinstall-result" role="status" aria-live="polite" hidden><h3 id="reinstall-result-title"></h3><p id="reinstall-result-message"></p><div id="reinstall-password-box" class="reinstall-password-box" hidden><span>新系统的 root 初始密码</span><div><code id="reinstall-generated-password"></code><button id="reinstall-copy-password" class="button button-outline small" type="button">复制</button></div><small>请先保存到安全位置,再点击“已保存密码,完成”。页面中的明文届时会清除,面板记录的初始密码仍可在虚拟机详情页按需查看。</small></div><p id="reinstall-result-warning" class="reinstall-result-warning" hidden></p></div>
<p id="reinstall-error" class="form-error" role="alert" hidden></p>
</div>
<div class="workspace-form-actions"><button id="reinstall-cancel" class="button button-outline" type="button">取消</button><button id="reinstall-submit" class="button button-danger" type="submit">确认重装并删除旧盘</button><button id="reinstall-forget" class="button button-outline" type="button" hidden>放弃恢复任务</button><button id="reinstall-retry" class="button button-outline" type="button" hidden>重新查询任务</button><button id="reinstall-done" class="button button-primary" type="button" hidden>完成</button></div>
</form>
</section>
<section id="rescue-view" class="workspace-form-page" aria-labelledby="rescue-title" hidden>
<button id="rescue-back" class="button button-ghost workspace-form-back" type="button">← 返回虚拟机详情</button>
<div class="page-heading workspace-form-heading"><div><span class="eyebrow danger-text">EMERGENCY RESCUE</span><h1 id="rescue-title" tabindex="-1">紧急救援</h1><p id="rescue-subtitle">选择救援 ISO 并启动救援环境。</p></div></div>
<section class="inventory-panel workspace-form-card" aria-labelledby="rescue-status-title">
<div class="workspace-form-body">
<h2 id="rescue-status-title">当前救援状态</h2><p id="rescue-status" class="rescue-status" role="status" aria-live="polite">正在检查虚拟机状态…</p>
<p class="reinstall-warning"><strong>救援操作会中断服务。</strong>面板先将救援 ISO 预挂载为下一次完整开机的启动介质,再请求正常关机并开机。若正常关机失败或超时,只有救援页显示“已预挂载”时,才能确认风险后点击“强制重启进入救援”:这会强制断电并冷启动,可能丢失未保存数据。也可返回详情页,手动“强制断电”后再“开机”。若预挂载未成功,请先核查错误,切勿直接强制重启。普通“强制重置”不保证读取新保存的启动配置。退出救援会卸载 ISO 并恢复原系统启动;若退出时关机超时,可通过救援系统的 VNC 控制台手动关机,待显示“已关机”后重试退出。面板不会自动强制断电,也不会删除或格式化原系统盘。</p>
<p class="rescue-login-note">救援系统的登录方式和密码由该 ISO 自身决定;面板不会注入原虚拟机的 root 密码或 SSH 公钥。通常请先通过 VNC 控制台操作。</p>
<form id="rescue-form" class="form-stack">
<span id="rescue-template-label" class="template-field-label">救援模版 <span>*</span></span><input id="rescue-template-id" type="hidden" value="" /><div id="rescue-template-cards" class="rescue-template-cards" role="group" aria-labelledby="rescue-template-label"></div>
<label for="rescue-confirm-name">输入虚拟机名称确认 <span>*</span></label><input id="rescue-confirm-name" type="text" required autocomplete="off" spellcheck="false" placeholder="请输入完整的虚拟机名称" /><small id="rescue-confirm-hint"></small>
<p id="rescue-error" class="form-error" role="alert" hidden></p>
<div class="rescue-actions"><button id="rescue-submit" class="button button-danger" type="submit">加载救援镜像并重启</button><button id="rescue-force-start" class="button button-danger" type="button" hidden>强制重启进入救援</button><button id="rescue-exit" class="button button-outline" type="button" hidden>退出救援并重启原系统</button></div>
</form>
</div>
</section>
</section>
</div>
<div id="ssh-keys-workspace" hidden>
<div class="page-heading"><div><span class="eyebrow">ACCOUNT SSH KEYS</span><h1>公钥管理</h1><p>保存自己的 SSH 公钥,创建云镜像虚拟机时直接选择。每个用户只能管理自己的公钥。</p></div><button id="ssh-keys-back-button" class="button button-outline" type="button">返回虚拟机</button></div>
<div class="ssh-keys-grid">
<section class="host-card" aria-labelledby="ssh-key-add-title">
<div class="host-card-heading"><span class="host-card-number">+</span><div><h2 id="ssh-key-add-title">导入公钥</h2><p>仅粘贴单行 OpenSSH 公钥;不要上传私钥或填写私钥口令。</p></div></div>
<form id="ssh-key-form" class="form-stack">
<label for="ssh-key-name">公钥名称</label><input id="ssh-key-name" type="text" maxlength="80" required autocomplete="off" placeholder="例如 我的电脑" />
<label for="ssh-key-public-key">OpenSSH 公钥</label><textarea id="ssh-key-public-key" maxlength="16384" rows="5" required spellcheck="false" autocomplete="off" autocapitalize="off" placeholder="ssh-ed25519 AAAA…"></textarea>
<label for="ssh-key-file">或选择本地 .pub 文件</label><input id="ssh-key-file" type="file" accept=".pub,text/plain" aria-describedby="ssh-key-file-hint" /><small id="ssh-key-file-hint" class="ssh-key-file-hint">仅在浏览器读取文件内容;不会上传私钥文件。</small>
<p id="ssh-key-form-error" class="form-error" role="alert" hidden></p>
<button id="ssh-key-save-button" class="button button-primary" type="submit">保存公钥</button>
</form>
</section>
<section class="host-card" aria-labelledby="ssh-key-list-title">
<div class="host-card-heading"><span class="host-card-number">⌑</span><div><h2 id="ssh-key-list-title">我的公钥</h2><p>公钥不会向其他用户显示;删除后,不影响已经创建的虚拟机。</p></div></div>
<p id="ssh-keys-list-error" class="form-error" role="alert" hidden></p>
<div id="ssh-keys-list" class="ssh-keys-list" aria-live="polite"><p class="muted">正在加载…</p></div>
</section>
</div>
</div>
<div id="template-workspace" hidden>
<div class="page-heading"><div><span class="eyebrow">CLOUD IMAGE CATALOG</span><h1>云镜像模板</h1><p>仅管理员可以导入官方云镜像和修改模板名称;用户创建虚拟机时选择已导入的版本。</p></div><button id="template-back-button" class="button button-outline" type="button">返回虚拟机</button></div>
<div class="template-admin-grid">
<section class="host-card" aria-labelledby="template-import-title">
<div class="host-card-heading"><span class="host-card-number">+</span><div><h2 id="template-import-title">导入云镜像</h2><p>从受支持发行版的官方镜像站下载;可选择使用发布方 SHA-256 校验。</p></div></div>
<form id="template-import-form" class="form-stack" novalidate>
<label for="template-name">模板名称</label><input id="template-name" type="text" maxlength="64" required autocomplete="off" placeholder="例如 AlmaLinux 10 Cloud" />
<label for="template-url">云镜像下载地址</label><input id="template-url" type="url" inputmode="url" maxlength="2048" required autocomplete="off" placeholder="粘贴官方云镜像完整 HTTPS 文件地址" /><small class="template-field-help">支持 AlmaLinux 8/9/10、Debian 11/12/13、CentOS Stream 9/10 和 Ubuntu 20.04/22.04/24.04/25.04/25.10/26.04 官方 x86_64 云镜像;Ubuntu 官方 qcow2 内容的 .img 文件也可导入。</small>
<label for="template-sha256">镜像 SHA-256 校验值(可选)</label><input id="template-sha256" type="text" maxlength="64" spellcheck="false" autocomplete="off" placeholder="可留空;填写时必须为 64 位十六进制" /><small class="template-field-help">留空时面板仍会计算并保存实际 SHA-256;填写后会在导入前核对。</small>
<p id="template-import-status" class="template-import-status" role="status" hidden></p><p id="template-import-error" class="form-error" role="alert" hidden></p><button id="template-import-button" class="button button-primary" type="submit">导入模板</button>
</form>
</section>
<section class="host-card" aria-labelledby="template-list-title">
<div class="host-card-heading"><span class="host-card-number">◈</span><div><h2 id="template-list-title">已导入模板</h2><p>修改名称不会改变镜像文件或已创建虚拟机的系统。</p></div></div>
<p id="template-list-error" class="form-error" role="alert" hidden></p>
<div id="template-admin-list" class="template-admin-list" aria-live="polite"><p class="muted">正在加载…</p></div>
</section>
</div>
</div>
<div id="rescue-templates-workspace" hidden>
<div class="page-heading"><div><span class="eyebrow">RESCUE IMAGE CATALOG</span><h1>救援模版</h1><p>仅管理员上传救援 ISO;虚拟机所有者可在详情页选择已导入的镜像。</p></div><button id="rescue-templates-back" class="button button-outline" type="button">返回虚拟机</button></div>
<div class="template-admin-grid">
<section class="host-card" aria-labelledby="rescue-template-upload-title"><div class="host-card-heading"><span class="host-card-number">+</span><div><h2 id="rescue-template-upload-title">上传救援 ISO</h2><p>文件将上传到面板并导入宿主机单独配置的救援 ISO 目录,不会出现在创建虚拟机的安装 ISO 列表中;上传期间请保持页面打开。</p></div></div>
<p id="rescue-directory-note" class="rescue-directory-note" role="status" hidden></p>
<form id="rescue-template-upload-form" class="form-stack" novalidate>
<label for="rescue-template-name">模版名称</label><input id="rescue-template-name" type="text" maxlength="64" required autocomplete="off" placeholder="例如 AlmaLinux Rescue" />
<label for="rescue-template-file">救援 ISO 文件</label><input id="rescue-template-file" type="file" accept=".iso,application/x-iso9660-image,application/octet-stream" required /><small class="template-field-help">只接受 ISO;文件最大 8 GiB。请确认来源可信、启动模式兼容目标 VM 的 BIOS/UEFI,并保证宿主机有足够空间。</small>
<p id="rescue-template-upload-status" class="template-import-status" role="status" hidden></p><p id="rescue-template-upload-error" class="form-error" role="alert" hidden></p><button id="rescue-template-upload-button" class="button button-primary" type="submit">上传并导入</button>
</form>
</section>
<section class="host-card" aria-labelledby="rescue-template-list-title"><div class="host-card-heading"><span class="host-card-number">✚</span><div><h2 id="rescue-template-list-title">已上传模版</h2><p>删除模版前,请确认没有虚拟机正在使用。</p></div></div><p id="rescue-template-list-error" class="form-error" role="alert" hidden></p><div id="rescue-template-list" class="template-admin-list" aria-live="polite"><p class="muted">正在加载…</p></div></section>
</div>
</div>
<div id="update-workspace" hidden>
<div class="page-heading"><div><span class="eyebrow">PANEL UPDATE</span><h1>网站更新</h1><p>从当前项目的私有 Gitea 仓库检查并安装新版本。</p></div><button id="update-back-button" class="button button-outline" type="button">返回虚拟机</button></div>
<div class="update-grid">
<section class="host-card" aria-labelledby="update-repository-title">
<div class="host-card-heading"><span class="host-card-number">1</span><div><h2 id="update-repository-title">更新来源</h2><p>这一版固定使用当前项目仓库的 main 分支;只需设置私有仓库访问令牌。</p></div></div>
<form id="update-settings-form" class="form-stack">
<label for="update-repository-url">仓库地址</label>
<input id="update-repository-url" type="url" value="https://g.luoli.live/root/virt.git" readonly aria-readonly="true" />
<label for="update-branch">更新分支</label>
<input id="update-branch" type="text" value="main" readonly aria-readonly="true" />
<label for="update-access-token">Gitea 访问令牌</label>
<input id="update-access-token" type="password" autocomplete="off" maxlength="4096" placeholder="填写具有仓库读取权限的令牌" />
<small id="update-token-hint" class="field-hint">令牌需要仓库读取权限。保存后不会回显,也不会写入浏览器存储。</small>
<p id="update-settings-error" class="form-error" role="alert" hidden></p>
<button id="update-settings-submit" class="button button-primary" type="submit">保存访问令牌</button>
</form>
</section>
<section class="host-card" aria-labelledby="update-run-title">
<div class="host-card-heading"><span class="host-card-number">2</span><div><h2 id="update-run-title">检查并更新</h2><p>先检查可用版本,确认后再执行更新。</p></div></div>
<div class="update-versions"><div><span>当前版本</span><strong id="update-current-version">—</strong></div><div><span>仓库版本</span><strong id="update-latest-version">—</strong></div></div>
<p id="update-status" class="host-test-status" role="status">尚未检查更新。</p>
<p id="update-action-error" class="form-error" role="alert" hidden></p>
<div class="host-submit-actions"><button id="update-check-button" class="button button-outline" type="button">检查更新</button><button id="update-apply-button" class="button button-primary" type="button" disabled>一键更新</button></div>
<p class="host-security-note">更新可能短暂中断面板服务。请先备份数据库及面板数据目录,并确保有服务端控制台可用于恢复。</p>
</section>
</div>
</div>
<div id="smtp-workspace" hidden>
<div class="page-heading"><div><span class="eyebrow">ADMIN SETTINGS</span><h1>邮件与用户审核</h1><p>配置注册验证码的 SMTP 发信服务器,并审核新注册用户。</p></div><button id="smtp-back-button" class="button button-outline" type="button">返回虚拟机</button></div>
<section class="host-card smtp-card" aria-labelledby="smtp-title">
<div class="host-card-heading"><span class="host-card-number">✉</span><div><h2 id="smtp-title">SMTP 连接信息</h2><p>凭据在服务端加密保存;已保存密码不会在页面回显。</p></div></div>
<form id="smtp-settings-form" class="form-grid">
<div class="field"><label for="smtp-host">SMTP 服务器 <span>*</span></label><input id="smtp-host" type="text" autocomplete="off" maxlength="253" required placeholder="例如 smtp.example.com" /></div>
<div class="field"><label for="smtp-port">端口 <span>*</span></label><input id="smtp-port" type="number" min="1" max="65535" value="465" required /></div>
<div class="field"><label for="smtp-tls-mode">加密方式 <span>*</span></label><select id="smtp-tls-mode" required><option value="ssl">SSL / TLS</option><option value="starttls">STARTTLS</option><option value="none">无加密</option></select></div>
<div class="field"><label for="smtp-username">SMTP 用户名</label><input id="smtp-username" type="text" autocomplete="off" maxlength="254" placeholder="发信账号" /></div>
<div class="field full"><label for="smtp-password">SMTP 密码</label><input id="smtp-password" type="password" autocomplete="new-password" maxlength="1024" placeholder="填写 SMTP 密码或应用专用密码" /><small id="smtp-password-hint">保存后不会回显,也不会写入浏览器存储。</small></div>
<div class="field full"><label for="smtp-from-address">发件人邮箱 <span>*</span></label><input id="smtp-from-address" type="email" autocomplete="off" maxlength="254" required placeholder="例如 noreply@example.com" /></div>
<p id="smtp-error" class="form-error full" role="alert" hidden></p>
<p id="smtp-status" class="smtp-status full" role="status" hidden></p>
<div class="field full"><button id="smtp-save-button" class="button button-primary" type="submit">保存邮件设置</button></div>
</form>
</section>
<section class="host-card smtp-card" aria-labelledby="pending-users-title">
<div class="host-card-heading"><span class="host-card-number">✓</span><div><h2 id="pending-users-title">待审核用户</h2><p>邮箱已验证的用户仍需管理员审核,审核通过后才能使用虚拟机功能。</p></div></div>
<p id="pending-users-error" class="form-error" role="alert" hidden></p>
<div id="pending-users-list" class="pending-users-list" aria-live="polite"><p class="muted">正在加载…</p></div>
</section>
</div>
</main>
</div>
</div>
<div id="delete-modal" class="modal-backdrop" hidden>
<section class="modal narrow-modal" role="dialog" aria-modal="true" aria-labelledby="delete-title">
<div class="modal-header"><div><span class="eyebrow danger-text">DESTRUCTIVE ACTION</span><h2 id="delete-title">删除虚拟机</h2></div><button class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div>
<form id="delete-form"><div class="modal-body"><p class="delete-copy">确定删除 <strong id="delete-vm-name"></strong> 吗?虚拟机定义将被移除,此操作不可撤销。</p><label class="checkbox-row"><input id="delete-disks" type="checkbox" /><span><strong>同时删除虚拟磁盘</strong><small>勾选后,磁盘数据也会永久删除。</small></span></label><p id="delete-error" class="form-error" role="alert" hidden></p></div><div class="modal-footer"><button class="button button-outline" type="button" data-close-modal>取消</button><button id="delete-submit" class="button button-danger" type="submit">确认删除</button></div></form>
</section>
</div>
<div id="confirm-modal" class="modal-backdrop" hidden>
<section class="modal narrow-modal" role="dialog" aria-modal="true" aria-labelledby="confirm-title"><div class="modal-header"><div><span class="eyebrow danger-text">POWER ACTION</span><h2 id="confirm-title">确认操作</h2></div><button class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div><div class="modal-body"><p id="confirm-message" class="delete-copy"></p><p id="confirm-error" class="form-error" role="alert" hidden></p></div><div class="modal-footer"><button class="button button-outline" type="button" data-close-modal>取消</button><button id="confirm-submit" class="button button-danger" type="button">确认操作</button></div></section>
</div>
<div id="console-modal" class="modal-backdrop console-backdrop" hidden>
<section class="modal console-modal" role="dialog" aria-modal="true" aria-labelledby="console-title"><div class="console-toolbar"><div><span class="eyebrow">VNC CONSOLE</span><h2 id="console-title">虚拟机控制台</h2><p id="console-status">正在连接…</p></div><div class="console-tools"><button id="console-cad" class="button button-outline small" type="button" disabled>发送 Ctrl+Alt+Del</button><button id="console-fullscreen" class="button button-outline small" type="button">全屏</button><button class="icon-button" type="button" data-close-modal aria-label="关闭">×</button></div></div><div id="console-stage" class="console-stage"><div id="console-placeholder" class="console-placeholder"><span class="console-spinner" aria-hidden="true"></span><span>正在连接到虚拟机画面…</span></div></div><form id="console-password-form" class="console-password" hidden><label for="console-password">VNC 密码</label><input id="console-password" type="password" autocomplete="off" required /><button class="button button-primary small" type="submit">连接</button></form></section>
</div>
<div id="toast-region" class="toast-region" aria-live="polite"></div>
</body>
</html>