feat: add mainland-reachable desktop distribution

This commit is contained in:
2026-08-16 23:00:54 +08:00
parent e8eeb4ac72
commit a3e1f11e85
42 changed files with 3661 additions and 191 deletions

View File

@@ -2,6 +2,10 @@ const statusEl = document.getElementById("status");
const spinner = document.getElementById("spinner");
const retry = document.getElementById("retry");
const detail = document.getElementById("detail");
const updatePanel = document.getElementById("update-panel");
const updateNotes = document.getElementById("update-notes");
const installUpdate = document.getElementById("install-update");
const skipUpdate = document.getElementById("skip-update");
function tauri() {
return window.__TAURI__;
@@ -18,6 +22,13 @@ function setStatus(message, kind) {
}
}
function continueBoot(api) {
updatePanel.hidden = true;
spinner.hidden = false;
setStatus("正在启动…", "ok");
return api.core.invoke("skip_shell_update");
}
async function boot() {
const api = tauri();
if (!api) {
@@ -39,10 +50,42 @@ async function boot() {
window.location.replace(event.payload.url);
}
});
await api.event.listen("shell-update-progress", function (event) {
const progress = event.payload || {};
const suffix = typeof progress.percent === "number" ? ` ${progress.percent}%` : "";
setStatus(`正在下载更新…${suffix}`, "ok");
});
retry.addEventListener("click", function () {
setStatus("正在重新启动…", "ok");
api.core.invoke("restart");
});
skipUpdate.addEventListener("click", function () {
continueBoot(api);
});
installUpdate.addEventListener("click", async function () {
installUpdate.disabled = true;
skipUpdate.disabled = true;
spinner.hidden = false;
setStatus("正在准备签名更新…", "ok");
try {
await api.core.invoke("install_shell_update");
} catch (error) {
installUpdate.disabled = false;
skipUpdate.disabled = false;
spinner.hidden = true;
statusEl.textContent = `更新失败:${String(error)}`;
}
});
const update = await api.core.invoke("check_shell_update");
if (update) {
spinner.hidden = true;
retry.hidden = true;
statusEl.textContent = `发现壳更新 ${update.version}`;
updateNotes.textContent = update.notes || "更新包已经签名,安装前会在本机完成校验。";
updatePanel.hidden = false;
}
}
if (document.readyState === "loading") {

View File

@@ -13,6 +13,13 @@
<h1>DeepSeek Harness</h1>
<p id="status">正在启动…</p>
<div class="ring" id="spinner" aria-hidden="true"></div>
<section id="update-panel" class="update-panel" hidden>
<p id="update-notes"></p>
<div class="update-actions">
<button type="button" class="pill" id="install-update">下载并安装</button>
<button type="button" class="pill secondary" id="skip-update">稍后</button>
</div>
</section>
<button type="button" class="pill" id="retry" hidden>重试</button>
<pre id="detail" hidden></pre>
</section>

View File

@@ -98,6 +98,40 @@ h1 {
.pill[hidden] { display: none; }
.pill.secondary {
background: var(--card);
color: var(--text);
}
.pill:disabled { opacity: 0.55; }
.update-panel {
margin-top: 20px;
padding: 16px;
border-radius: 14px;
background: var(--card);
}
.update-panel[hidden] { display: none; }
#update-notes {
max-height: 120px;
margin: 0;
overflow: auto;
color: var(--muted);
font-size: 12px;
line-height: 1.5;
white-space: pre-wrap;
}
.update-actions {
display: flex;
justify-content: center;
gap: 8px;
}
.update-actions .pill { margin-top: 16px; }
#detail {
margin: 22px 0 0;
text-align: left;