mirror of
https://github.com/TommyFang2077/dsh-desktop.git
synced 2026-08-17 09:06:36 +08:00
Add README, plugin citations, and multi-platform release CI.
Ship screenshots and third-party notices for the desktop shell, and package Windows, macOS, deb, rpm, and Flatpak from GitHub Releases. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
52
ui/app.js
Normal file
52
ui/app.js
Normal file
@@ -0,0 +1,52 @@
|
||||
const statusEl = document.getElementById("status");
|
||||
const spinner = document.getElementById("spinner");
|
||||
const retry = document.getElementById("retry");
|
||||
const detail = document.getElementById("detail");
|
||||
|
||||
function tauri() {
|
||||
return window.__TAURI__;
|
||||
}
|
||||
|
||||
function setStatus(message, kind) {
|
||||
statusEl.textContent = message;
|
||||
const failed = kind === "error";
|
||||
spinner.hidden = failed;
|
||||
retry.hidden = !failed;
|
||||
if (!failed) {
|
||||
detail.hidden = true;
|
||||
detail.textContent = "";
|
||||
}
|
||||
}
|
||||
|
||||
async function boot() {
|
||||
const api = tauri();
|
||||
if (!api) {
|
||||
setStatus("桌面接口未就绪", "error");
|
||||
return;
|
||||
}
|
||||
await api.event.listen("status", function (event) {
|
||||
setStatus(event.payload.message || "正在启动…", "ok");
|
||||
});
|
||||
await api.event.listen("error", function (event) {
|
||||
setStatus(event.payload.message || "启动失败", "error");
|
||||
if (event.payload.detail) {
|
||||
detail.hidden = false;
|
||||
detail.textContent = event.payload.detail;
|
||||
}
|
||||
});
|
||||
await api.event.listen("ready", function (event) {
|
||||
if (event.payload && event.payload.url) {
|
||||
window.location.replace(event.payload.url);
|
||||
}
|
||||
});
|
||||
retry.addEventListener("click", function () {
|
||||
setStatus("正在重新启动…", "ok");
|
||||
api.core.invoke("restart");
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", boot);
|
||||
} else {
|
||||
boot();
|
||||
}
|
||||
BIN
ui/icon.png
Normal file
BIN
ui/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 17 KiB |
22
ui/index.html
Normal file
22
ui/index.html
Normal file
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>DeepSeek Harness</title>
|
||||
<link rel="stylesheet" href="styles.css" />
|
||||
</head>
|
||||
<body>
|
||||
<main class="stage">
|
||||
<section class="hero">
|
||||
<img class="mark" src="icon.png" alt="" />
|
||||
<h1>DeepSeek Harness</h1>
|
||||
<p id="status">正在启动…</p>
|
||||
<div class="ring" id="spinner" aria-hidden="true"></div>
|
||||
<button type="button" class="pill" id="retry" hidden>重试</button>
|
||||
<pre id="detail" hidden></pre>
|
||||
</section>
|
||||
</main>
|
||||
<script src="app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
168
ui/inject/chrome.js
Normal file
168
ui/inject/chrome.js
Normal file
@@ -0,0 +1,168 @@
|
||||
(function () {
|
||||
if (window.__dshDesktopChrome) return;
|
||||
window.__dshDesktopChrome = true;
|
||||
|
||||
const css = `
|
||||
:root { --dsh-desktop-titlebar-h: 36px; }
|
||||
html.dsh-desktop-offset {
|
||||
box-sizing: border-box !important;
|
||||
padding-top: var(--dsh-desktop-titlebar-h);
|
||||
}
|
||||
#dsh-desktop-titlebar {
|
||||
position: fixed; top: 0; left: 0; right: 0; height: var(--dsh-desktop-titlebar-h);
|
||||
z-index: 2147483646; display: flex; align-items: center;
|
||||
padding: 0 12px; box-sizing: border-box;
|
||||
background: rgba(246, 246, 248, 0.72);
|
||||
-webkit-backdrop-filter: saturate(180%) blur(20px);
|
||||
backdrop-filter: saturate(180%) blur(20px);
|
||||
border-bottom: 0.5px solid rgba(0, 0, 0, 0.06);
|
||||
user-select: none; -webkit-user-select: none;
|
||||
}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
#dsh-desktop-titlebar {
|
||||
background: rgba(28, 28, 30, 0.72);
|
||||
border-bottom-color: rgba(255, 255, 255, 0.08);
|
||||
}
|
||||
#dsh-desktop-titlebar .more { color: rgba(255,255,255,0.45); }
|
||||
#dsh-desktop-titlebar .menu {
|
||||
background: rgba(44, 44, 46, 0.96);
|
||||
box-shadow: 0 8px 28px rgba(0,0,0,0.45);
|
||||
}
|
||||
#dsh-desktop-titlebar .menu button { color: #f5f5f7; }
|
||||
#dsh-desktop-titlebar .menu button:hover { background: rgba(255,255,255,0.08); }
|
||||
}
|
||||
#dsh-desktop-titlebar .traffic {
|
||||
display: flex; gap: 8px; align-items: center; height: 100%;
|
||||
}
|
||||
#dsh-desktop-titlebar .tl {
|
||||
width: 12px; height: 12px; min-width: 12px; min-height: 12px;
|
||||
max-width: 12px; max-height: 12px; flex: none; overflow: hidden;
|
||||
box-sizing: border-box; border-radius: 50%; border: 0;
|
||||
padding: 0; margin: 0; display: grid; place-items: center; cursor: default;
|
||||
position: relative;
|
||||
}
|
||||
#dsh-desktop-titlebar .tl.close { background: #ff5f57; }
|
||||
#dsh-desktop-titlebar .tl.min { background: #febc2e; }
|
||||
#dsh-desktop-titlebar .tl.zoom { background: #28c840; }
|
||||
#dsh-desktop-titlebar .tl::after {
|
||||
content: ""; font-size: 9px; line-height: 1; font-weight: 700;
|
||||
color: rgba(0,0,0,0.55); opacity: 0;
|
||||
}
|
||||
#dsh-desktop-titlebar .traffic:hover .tl.close::after { content: "×"; opacity: 1; }
|
||||
#dsh-desktop-titlebar .traffic:hover .tl.min::after { content: "–"; opacity: 1; }
|
||||
#dsh-desktop-titlebar .traffic:hover .tl.zoom::after { content: "+"; opacity: 1; }
|
||||
#dsh-desktop-titlebar .drag { flex: 1; height: 100%; }
|
||||
#dsh-desktop-titlebar .more {
|
||||
appearance: none; border: 0; background: transparent;
|
||||
color: rgba(0,0,0,0.35); font-size: 15px; letter-spacing: 0.08em;
|
||||
width: 28px; height: 20px; border-radius: 6px; cursor: default;
|
||||
}
|
||||
#dsh-desktop-titlebar .more:hover { background: rgba(0,0,0,0.06); color: rgba(0,0,0,0.7); }
|
||||
#dsh-desktop-titlebar .menu {
|
||||
position: absolute; top: calc(var(--dsh-desktop-titlebar-h) + 2px); left: 8px; min-width: 168px;
|
||||
padding: 4px; border-radius: 10px;
|
||||
background: rgba(255,255,255,0.96);
|
||||
box-shadow: 0 8px 28px rgba(0,0,0,0.16);
|
||||
display: none; flex-direction: column;
|
||||
}
|
||||
#dsh-desktop-titlebar .menu.open { display: flex; }
|
||||
#dsh-desktop-titlebar .menu button {
|
||||
appearance: none; border: 0; background: transparent;
|
||||
text-align: left; padding: 7px 10px; border-radius: 6px;
|
||||
font: 13px/1.3 -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
|
||||
color: #1d1d1f; cursor: default;
|
||||
}
|
||||
#dsh-desktop-titlebar .menu button:hover { background: rgba(0,0,0,0.05); }
|
||||
#dsh-desktop-titlebar .menu button:disabled { opacity: 0.35; }
|
||||
`;
|
||||
|
||||
function api() {
|
||||
return window.__TAURI__ || null;
|
||||
}
|
||||
|
||||
function inject() {
|
||||
if (document.getElementById("dsh-desktop-titlebar")) return;
|
||||
const style = document.createElement("style");
|
||||
style.textContent = css;
|
||||
document.documentElement.appendChild(style);
|
||||
|
||||
const bar = document.createElement("header");
|
||||
bar.id = "dsh-desktop-titlebar";
|
||||
bar.innerHTML =
|
||||
'<button class="more" type="button" aria-label="更多">•••</button>' +
|
||||
'<div class="menu">' +
|
||||
'<button type="button" data-cmd="restart">重新启动</button>' +
|
||||
'<button type="button" data-cmd="open_in_browser">在浏览器中打开</button>' +
|
||||
"</div>" +
|
||||
'<div class="drag" data-tauri-drag-region></div>' +
|
||||
'<div class="traffic">' +
|
||||
'<button class="tl min" data-win="minimize" aria-label="最小化"></button>' +
|
||||
'<button class="tl zoom" data-win="zoom" aria-label="缩放"></button>' +
|
||||
'<button class="tl close" data-win="close" aria-label="关闭"></button>' +
|
||||
"</div>";
|
||||
document.documentElement.appendChild(bar);
|
||||
if (/^(127\.0\.0\.1|localhost|\[::1\])$/.test(location.hostname)) {
|
||||
document.documentElement.classList.add("dsh-desktop-offset");
|
||||
}
|
||||
|
||||
const menu = bar.querySelector(".menu");
|
||||
const more = bar.querySelector(".more");
|
||||
more.addEventListener("click", function (e) {
|
||||
e.stopPropagation();
|
||||
menu.classList.toggle("open");
|
||||
});
|
||||
document.addEventListener("click", function () {
|
||||
menu.classList.remove("open");
|
||||
});
|
||||
|
||||
bar.addEventListener("dblclick", function (e) {
|
||||
if (e.target.closest(".tl, .more, .menu")) return;
|
||||
const t = api();
|
||||
if (t && t.window) t.window.getCurrentWindow().toggleMaximize();
|
||||
});
|
||||
|
||||
bar.addEventListener("click", function (e) {
|
||||
const t = api();
|
||||
const winBtn = e.target.closest("[data-win]");
|
||||
if (winBtn && t && t.window) {
|
||||
const w = t.window.getCurrentWindow();
|
||||
const act = winBtn.getAttribute("data-win");
|
||||
if (act === "close") w.close();
|
||||
else if (act === "minimize") w.minimize();
|
||||
else if (act === "zoom") w.toggleMaximize();
|
||||
return;
|
||||
}
|
||||
const cmd = e.target.closest("[data-cmd]");
|
||||
if (cmd && t && t.core) {
|
||||
menu.classList.remove("open");
|
||||
t.core.invoke(cmd.getAttribute("data-cmd"));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", inject);
|
||||
} else {
|
||||
inject();
|
||||
}
|
||||
|
||||
const harness = /^(127\.0\.0\.1|localhost|\[::1\])$/.test(location.hostname);
|
||||
if (harness && location.protocol.indexOf("http") === 0) {
|
||||
document.addEventListener("paste", async function (e) {
|
||||
const t = api();
|
||||
if (!t || !t.core) return;
|
||||
try {
|
||||
const items = e.clipboardData ? Array.from(e.clipboardData.items) : [];
|
||||
if (items.some(function (item) { return item.kind === "file" && item.getAsFile(); })) {
|
||||
return;
|
||||
}
|
||||
const files = await t.core.invoke("read_clipboard_images");
|
||||
if (files && files.length) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
if (window.__dshDesktopPasteFiles) window.__dshDesktopPasteFiles(files);
|
||||
}
|
||||
} catch (err) {}
|
||||
}, true);
|
||||
}
|
||||
})();
|
||||
35
ui/inject/hide-twins.js
Normal file
35
ui/inject/hide-twins.js
Normal file
@@ -0,0 +1,35 @@
|
||||
(function () {
|
||||
const SUFFIX = " (modlens vision)";
|
||||
function textOf(el) {
|
||||
return (el.textContent || "").replace(/\s+/g, " ").trim();
|
||||
}
|
||||
function hideTwins(root) {
|
||||
const nodes = root.querySelectorAll("button, [role='menuitem'], [role='option'], [role='group'], h1, h2, h3, h4, span, div, p");
|
||||
const visionBases = new Set();
|
||||
for (const el of nodes) {
|
||||
if (el.childElementCount > 3) continue;
|
||||
const t = textOf(el);
|
||||
if (t.endsWith(SUFFIX) && t.length > SUFFIX.length) {
|
||||
visionBases.add(t.slice(0, -SUFFIX.length));
|
||||
}
|
||||
}
|
||||
if (visionBases.size === 0) return;
|
||||
for (const el of nodes) {
|
||||
if (el.childElementCount > 3) continue;
|
||||
const t = textOf(el);
|
||||
if (!visionBases.has(t)) continue;
|
||||
const row = el.closest("[role='group'], [role='menuitem'], li, section") || el;
|
||||
if (row && row.style.display !== "none") row.style.display = "none";
|
||||
}
|
||||
}
|
||||
const run = function () {
|
||||
try { hideTwins(document.body); } catch (e) {}
|
||||
};
|
||||
if (document.readyState === "loading") {
|
||||
document.addEventListener("DOMContentLoaded", run);
|
||||
} else {
|
||||
run();
|
||||
}
|
||||
const obs = new MutationObserver(run);
|
||||
obs.observe(document.documentElement, { childList: true, subtree: true });
|
||||
})();
|
||||
45
ui/inject/ingest.js
Normal file
45
ui/inject/ingest.js
Normal file
@@ -0,0 +1,45 @@
|
||||
(function () {
|
||||
const IMAGE_PATH = /^(?:file:\/\/|(?:\/|\.{1,2}\/)).+\.(?:png|jpe?g|gif|webp|bmp|tiff?)$/i;
|
||||
function looksLikeImagePath(text) {
|
||||
const first = (text || "").trim().split(/\s+/, 1)[0] || "";
|
||||
return IMAGE_PATH.test(first);
|
||||
}
|
||||
document.addEventListener("paste", function (e) {
|
||||
try {
|
||||
const items = Array.from(e.clipboardData ? e.clipboardData.items : []);
|
||||
const files = items.filter(function (item) { return item.kind === "file"; })
|
||||
.map(function (item) { return item.getAsFile(); })
|
||||
.filter(Boolean);
|
||||
if (files.length > 0) return;
|
||||
const text = e.clipboardData ? (e.clipboardData.getData("text/plain") || "") : "";
|
||||
const uris = e.clipboardData ? (e.clipboardData.getData("text/uri-list") || "") : "";
|
||||
if (looksLikeImagePath(text) || looksLikeImagePath(uris)) {
|
||||
e.preventDefault();
|
||||
e.stopImmediatePropagation();
|
||||
}
|
||||
} catch (err) {}
|
||||
}, true);
|
||||
|
||||
window.__dshDesktopPasteFiles = function (items) {
|
||||
try {
|
||||
const dt = new DataTransfer();
|
||||
for (const item of items) {
|
||||
const bin = atob(item.b64);
|
||||
const bytes = new Uint8Array(bin.length);
|
||||
for (let i = 0; i < bin.length; i++) bytes[i] = bin.charCodeAt(i);
|
||||
dt.items.add(new File([bytes], item.name, { type: item.type }));
|
||||
}
|
||||
const drop = new DragEvent("drop", {
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
dataTransfer: dt
|
||||
});
|
||||
try {
|
||||
Object.defineProperty(drop, "dataTransfer", { value: dt, configurable: true });
|
||||
} catch (e) {}
|
||||
document.dispatchEvent(drop);
|
||||
} catch (err) {
|
||||
console.error("dsh-desktop paste image failed", err);
|
||||
}
|
||||
};
|
||||
})();
|
||||
114
ui/styles.css
Normal file
114
ui/styles.css
Normal file
@@ -0,0 +1,114 @@
|
||||
:root {
|
||||
color-scheme: light dark;
|
||||
--bg: #f5f5f7;
|
||||
--text: #1d1d1f;
|
||||
--muted: #86868b;
|
||||
--accent: #0071e3;
|
||||
--card: rgba(255, 255, 255, 0.64);
|
||||
}
|
||||
|
||||
@media (prefers-color-scheme: dark) {
|
||||
:root {
|
||||
--bg: #000000;
|
||||
--text: #f5f5f7;
|
||||
--muted: #86868b;
|
||||
--accent: #0a84ff;
|
||||
--card: rgba(28, 28, 30, 0.72);
|
||||
}
|
||||
}
|
||||
|
||||
* { box-sizing: border-box; }
|
||||
|
||||
html, body {
|
||||
margin: 0;
|
||||
min-height: 100%;
|
||||
background: var(--bg);
|
||||
color: var(--text);
|
||||
font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display",
|
||||
"Helvetica Neue", system-ui, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
}
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
.stage {
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 72px 32px 48px;
|
||||
}
|
||||
|
||||
.hero {
|
||||
width: min(420px, 100%);
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.mark {
|
||||
display: block;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
margin: 0 auto 22px;
|
||||
border-radius: 18px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
h1 {
|
||||
margin: 0;
|
||||
font-size: 28px;
|
||||
font-weight: 600;
|
||||
letter-spacing: -0.03em;
|
||||
}
|
||||
|
||||
#status {
|
||||
margin: 10px 0 0;
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
line-height: 1.5;
|
||||
min-height: 1.5em;
|
||||
}
|
||||
|
||||
.ring {
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
margin: 28px auto 0;
|
||||
border-radius: 50%;
|
||||
border: 1.5px solid rgba(134, 134, 139, 0.28);
|
||||
border-top-color: var(--text);
|
||||
animation: spin 0.8s linear infinite;
|
||||
}
|
||||
|
||||
.ring[hidden] { display: none; }
|
||||
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
|
||||
.pill {
|
||||
margin-top: 28px;
|
||||
appearance: none;
|
||||
border: 0;
|
||||
border-radius: 980px;
|
||||
background: var(--accent);
|
||||
color: #fff;
|
||||
font: 600 13px/1 -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
|
||||
padding: 9px 18px;
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
.pill[hidden] { display: none; }
|
||||
|
||||
#detail {
|
||||
margin: 22px 0 0;
|
||||
text-align: left;
|
||||
max-height: 180px;
|
||||
overflow: auto;
|
||||
padding: 12px 14px;
|
||||
border-radius: 12px;
|
||||
background: var(--card);
|
||||
color: var(--muted);
|
||||
font: 11px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
#detail[hidden] { display: none; }
|
||||
Reference in New Issue
Block a user