beauticode-dsh 1.0.26 → 1.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.zh-CN.md +4 -0
- package/client.js +0 -46
- package/console.js +21 -0
- package/index.mjs +6 -1
- package/package.json +62 -61
- package/readability.js +73 -0
package/README.zh-CN.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
该 Cordis 插件向 DSH Web 和官方 Desktop 注入 beautiCode 浏览器客户端,并提供本机鉴权接口。支持图片、MP4 / MOV、播放位置、静音、摸鱼模式以及清除背景。Web 和 Desktop 使用同一组结构化页面注入;Desktop 的页面请求经原生壳转发,回执由每次 Host 启动生成的页面密钥验证。
|
|
4
4
|
|
|
5
|
+
DSH Web 和 Desktop 启动及普通点击不会自动进入全屏。需要全屏时,在「设置 → 背景 → 全屏显示」中主动开启,按 `Esc` 或点击「退出全屏」退出。
|
|
6
|
+
|
|
5
7
|
## 官方 Desktop
|
|
6
8
|
|
|
7
9
|
先启动 Desktop 一次,让它创建 `desktop` profile,然后从系统托盘明确退出(关闭窗口通常只会隐藏)。可在 Desktop 的插件页面安装 `beauticode-dsh`,或使用 **Desktop 安装的** `dsh` 命令:
|
|
@@ -14,6 +16,8 @@ dsh plugin --profile desktop add beauticode-dsh
|
|
|
14
16
|
|
|
15
17
|
重新打开 Desktop,在「设置」中使用「背景」。Desktop 默认 Host 端口是 `19387`;如果还使用 beautiCode 托盘,将托盘的 `-DshUrl` 指向 `http://127.0.0.1:19387`(若 Desktop profile 改过 `webserver.config.port`,请使用实际端口)。Desktop 插件由 Desktop 自己管理;下方的 `npx beauticode-dsh` 安装器针对 Web profile。
|
|
16
18
|
|
|
19
|
+
「设置 → 背景」默认开启「功能面板不透明」,保证设置、弹层、菜单与消息编辑栏遮住后方内容。关闭后恢复原有透明效果;选择会保存在当前应用的本地偏好中,不受背景阴影、会话阶段或画窗模式影响。
|
|
20
|
+
|
|
17
21
|
## Web
|
|
18
22
|
|
|
19
23
|
装好插件并运行 `dsh web` 后,打开「设置」,左侧导航里会多出一项「背景」:在 Windows 上点击图片或视频会打开系统文件选择器,选好后在页面内命名,背景立即应用并进入已保存主题;也可以清除、开关声音、切换或删除主题,进入全屏把浏览器的标签页和地址栏收起来,以及打开「皮肤中心」安装已审核的社区皮肤。本地导入只在 Node 端保存绝对路径,并通过带 Range 支持的回环媒体服务读取原文件,不复制用户选择的图片或整段视频主文件。Windows 强制使用本地引用;原生选择器不可用时会明确报错,不会静默上传或复制媒体。非 Windows 环境保留兼容上传,并明确提示该模式会保存托管副本。网页控制台没有摸鱼;浅色/深色跟 DSH 自己的外观走。下次打开会恢复上次背景。设置 `BEAUTICODE_SKIN_CENTER` 或填写 `skin-center.json` 后,皮肤中心才会显示远程目录。
|
package/client.js
CHANGED
|
@@ -1861,50 +1861,4 @@ html[data-bc-fish="true"] #root{opacity:0!important;visibility:hidden!important;
|
|
|
1861
1861
|
}).catch(() => {});
|
|
1862
1862
|
}
|
|
1863
1863
|
}, 1_000);
|
|
1864
|
-
|
|
1865
|
-
// Fullscreen by default. A browser only grants fullscreen from inside a user
|
|
1866
|
-
// gesture, so a page cannot open in it; the closest honest reading of
|
|
1867
|
-
// "starts fullscreen" is the first click after load. Typing in the composer
|
|
1868
|
-
// must not count: DSH's main action is a keydown. Escape or the settings row
|
|
1869
|
-
// still exits. Stay armed until the request actually succeeds — a rejected
|
|
1870
|
-
// first gesture used to spend the listener and leave the page windowed.
|
|
1871
|
-
function armFullscreenDefault() {
|
|
1872
|
-
const root = document.documentElement;
|
|
1873
|
-
if (typeof root?.requestFullscreen !== "function" &&
|
|
1874
|
-
typeof root?.webkitRequestFullscreen !== "function") {
|
|
1875
|
-
return;
|
|
1876
|
-
}
|
|
1877
|
-
let spent = false;
|
|
1878
|
-
const enter = () => {
|
|
1879
|
-
if (spent) return;
|
|
1880
|
-
if (document.fullscreenElement || document.webkitFullscreenElement) {
|
|
1881
|
-
spent = true;
|
|
1882
|
-
document.removeEventListener?.("pointerdown", enter, true);
|
|
1883
|
-
return;
|
|
1884
|
-
}
|
|
1885
|
-
for (const name of ["requestFullscreen", "webkitRequestFullscreen"]) {
|
|
1886
|
-
const request = root?.[name];
|
|
1887
|
-
if (typeof request !== "function") continue;
|
|
1888
|
-
let started;
|
|
1889
|
-
try {
|
|
1890
|
-
started = request.call(root, { navigationUI: "hide" });
|
|
1891
|
-
} catch {
|
|
1892
|
-
continue;
|
|
1893
|
-
}
|
|
1894
|
-
Promise.resolve(started).then(
|
|
1895
|
-
() => {
|
|
1896
|
-
spent = true;
|
|
1897
|
-
document.removeEventListener?.("pointerdown", enter, true);
|
|
1898
|
-
},
|
|
1899
|
-
() => {
|
|
1900
|
-
/* gesture rejected — stay armed for the next click */
|
|
1901
|
-
},
|
|
1902
|
-
);
|
|
1903
|
-
return;
|
|
1904
|
-
}
|
|
1905
|
-
};
|
|
1906
|
-
document.addEventListener?.("pointerdown", enter, { capture: true });
|
|
1907
|
-
}
|
|
1908
|
-
|
|
1909
|
-
armFullscreenDefault();
|
|
1910
1864
|
})();
|
package/console.js
CHANGED
|
@@ -131,6 +131,10 @@ div[role="dialog"][aria-modal="true"][data-bc-page="on"] nav button[aria-current
|
|
|
131
131
|
"</div>" +
|
|
132
132
|
'<div class="bc-control"><button type="button" class="bc-btn bc-pill" data-act="fullscreen" aria-pressed="false">进入全屏</button></div></div>' +
|
|
133
133
|
'<div class="bc-row"><div class="bc-row-text">' +
|
|
134
|
+
'<span class="bc-row-title">功能面板不透明</span>' +
|
|
135
|
+
'<span class="bc-row-desc">遮住设置、弹层和消息编辑栏后方的内容</span>' +
|
|
136
|
+
'</div><div class="bc-control"><button type="button" class="bc-btn bc-pill on" data-act="readability" aria-pressed="true">已开</button></div></div>' +
|
|
137
|
+
'<div class="bc-row"><div class="bc-row-text">' +
|
|
134
138
|
'<span class="bc-row-title">背景阴影</span>' +
|
|
135
139
|
'<span class="bc-row-desc">压暗背景,让内容更清楚</span>' +
|
|
136
140
|
"</div>" +
|
|
@@ -210,6 +214,7 @@ div[role="dialog"][aria-modal="true"][data-bc-page="on"] nav button[aria-current
|
|
|
210
214
|
document.body.append(fileInput);
|
|
211
215
|
|
|
212
216
|
const soundBtn = page.querySelector('[data-act="sound"]');
|
|
217
|
+
const readabilityBtn = page.querySelector('[data-act="readability"]');
|
|
213
218
|
const dimSlider = page.querySelector(".bc-dim-slider");
|
|
214
219
|
const dimValue = page.querySelector(".bc-dim-value");
|
|
215
220
|
const dimReset = page.querySelector('[data-act="dim-reset"]');
|
|
@@ -251,6 +256,13 @@ div[role="dialog"][aria-modal="true"][data-bc-page="on"] nav button[aria-current
|
|
|
251
256
|
dimValue.textContent = `${percent}%`;
|
|
252
257
|
}
|
|
253
258
|
|
|
259
|
+
function renderReadability() {
|
|
260
|
+
const enabled = globalThis.BeauticodeReadableSurfaces?.get?.() !== false;
|
|
261
|
+
readabilityBtn.classList.toggle("on", enabled);
|
|
262
|
+
readabilityBtn.textContent = enabled ? "已开" : "已关";
|
|
263
|
+
readabilityBtn.setAttribute("aria-pressed", String(enabled));
|
|
264
|
+
}
|
|
265
|
+
|
|
254
266
|
function isOurs(node) {
|
|
255
267
|
for (let el = node; el; el = el.parentElement ?? null) {
|
|
256
268
|
if (String(el.id || "").startsWith("beauticode-")) return true;
|
|
@@ -323,6 +335,7 @@ div[role="dialog"][aria-modal="true"][data-bc-page="on"] nav button[aria-current
|
|
|
323
335
|
}
|
|
324
336
|
dialogEl.setAttribute("data-bc-page", "on");
|
|
325
337
|
navButton.setAttribute("aria-current", "true");
|
|
338
|
+
renderReadability();
|
|
326
339
|
renderDim();
|
|
327
340
|
renderBlur();
|
|
328
341
|
void refresh();
|
|
@@ -792,6 +805,14 @@ div[role="dialog"][aria-modal="true"][data-bc-page="on"] nav button[aria-current
|
|
|
792
805
|
}
|
|
793
806
|
})();
|
|
794
807
|
});
|
|
808
|
+
readabilityBtn.addEventListener("click", (event) => {
|
|
809
|
+
event.stopPropagation();
|
|
810
|
+
const enabled = globalThis.BeauticodeReadableSurfaces?.get?.() !== false;
|
|
811
|
+
globalThis.BeauticodeReadableSurfaces?.set?.(!enabled);
|
|
812
|
+
renderReadability();
|
|
813
|
+
});
|
|
814
|
+
globalThis.addEventListener?.("beauticode-readability-change", renderReadability);
|
|
815
|
+
renderReadability();
|
|
795
816
|
dimSlider.addEventListener("input", () => {
|
|
796
817
|
const n = Number(dimSlider.value);
|
|
797
818
|
if (!Number.isFinite(n)) return;
|
package/index.mjs
CHANGED
|
@@ -332,7 +332,12 @@ export function apply(ctx, config = {}) {
|
|
|
332
332
|
res.writeHead(405).end();
|
|
333
333
|
return;
|
|
334
334
|
}
|
|
335
|
-
|
|
335
|
+
// Keep one ordered client entry point: readability owns surface
|
|
336
|
+
// preferences; client.js owns the media/transport lifecycle.
|
|
337
|
+
const scripts = await Promise.all(["readability.js", "client.js"].map(
|
|
338
|
+
(file) => fs.readFile(path.join(here, file)),
|
|
339
|
+
));
|
|
340
|
+
const source = Buffer.concat([scripts[0], Buffer.from("\n"), scripts[1]]);
|
|
336
341
|
res.writeHead(200, {
|
|
337
342
|
"content-type": "text/javascript; charset=utf-8",
|
|
338
343
|
"cache-control": "no-store",
|
package/package.json
CHANGED
|
@@ -1,61 +1,62 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "beauticode-dsh",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "Cordis plugin: image/video backgrounds for DeepSeek Harness Web and Desktop.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "./index.mjs",
|
|
7
|
-
"bin": {
|
|
8
|
-
"beauticode-dsh": "bin/beauticode-dsh"
|
|
9
|
-
},
|
|
10
|
-
"exports": {
|
|
11
|
-
".": {
|
|
12
|
-
"import": "./index.mjs"
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
"files": [
|
|
16
|
-
"index.mjs",
|
|
17
|
-
"browser-injection.mjs",
|
|
18
|
-
"transport.js",
|
|
19
|
-
"client.js",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
22
|
-
"gallery
|
|
23
|
-
"
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
-
"
|
|
27
|
-
"
|
|
28
|
-
"
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
"dsh
|
|
47
|
-
"
|
|
48
|
-
"deepseek
|
|
49
|
-
"
|
|
50
|
-
"
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "beauticode-dsh",
|
|
3
|
+
"version": "1.0.28",
|
|
4
|
+
"description": "Cordis plugin: image/video backgrounds for DeepSeek Harness Web and Desktop.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./index.mjs",
|
|
7
|
+
"bin": {
|
|
8
|
+
"beauticode-dsh": "bin/beauticode-dsh"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": "./index.mjs"
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"index.mjs",
|
|
17
|
+
"browser-injection.mjs",
|
|
18
|
+
"transport.js",
|
|
19
|
+
"client.js",
|
|
20
|
+
"readability.js",
|
|
21
|
+
"console.js",
|
|
22
|
+
"gallery.js",
|
|
23
|
+
"gallery-host.mjs",
|
|
24
|
+
"skin-center.json",
|
|
25
|
+
"atmosphere.js",
|
|
26
|
+
"presets.mjs",
|
|
27
|
+
"agent.mjs",
|
|
28
|
+
"control-client.mjs",
|
|
29
|
+
"host-apply.mjs",
|
|
30
|
+
"ui-host.mjs",
|
|
31
|
+
"cli.js",
|
|
32
|
+
"bin/beauticode-dsh",
|
|
33
|
+
"cordis.patch.yml",
|
|
34
|
+
"vendor",
|
|
35
|
+
"themes"
|
|
36
|
+
],
|
|
37
|
+
"dsh": {
|
|
38
|
+
"bundle": {
|
|
39
|
+
"patch": "./cordis.patch.yml"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"keywords": [
|
|
46
|
+
"dsh",
|
|
47
|
+
"dsh-plugin",
|
|
48
|
+
"deepseek",
|
|
49
|
+
"deepseek-harness",
|
|
50
|
+
"background",
|
|
51
|
+
"wallpaper"
|
|
52
|
+
],
|
|
53
|
+
"repository": {
|
|
54
|
+
"type": "git",
|
|
55
|
+
"url": "git+https://github.com/starsstreaming/beautiCode.git",
|
|
56
|
+
"directory": "integrations/deepseek-harness"
|
|
57
|
+
},
|
|
58
|
+
"engines": {
|
|
59
|
+
"node": ">=22"
|
|
60
|
+
},
|
|
61
|
+
"license": "MIT"
|
|
62
|
+
}
|
package/readability.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
(() => {
|
|
2
|
+
"use strict";
|
|
3
|
+
if (globalThis.BeauticodeReadableSurfaces) return;
|
|
4
|
+
|
|
5
|
+
const STORAGE_KEY = "beauticode-readable-surfaces";
|
|
6
|
+
const root = document.documentElement;
|
|
7
|
+
// Only an explicit opt-out disables protection. Missing/corrupt preferences
|
|
8
|
+
// and unavailable storage must not make text behind a panel visible again.
|
|
9
|
+
function readPreference() {
|
|
10
|
+
try {
|
|
11
|
+
return globalThis.localStorage?.getItem(STORAGE_KEY) !== "false";
|
|
12
|
+
} catch {
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
let enabled = readPreference();
|
|
18
|
+
function applyPreference() {
|
|
19
|
+
root.dataset.bcReadableSurfaces = String(enabled);
|
|
20
|
+
globalThis.dispatchEvent?.(new CustomEvent("beauticode-readability-change"));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const style = document.createElement("style");
|
|
24
|
+
style.dataset.beauticodeReadability = "true";
|
|
25
|
+
style.textContent = `
|
|
26
|
+
html[data-bc-active="true"] body{
|
|
27
|
+
--bc-readable-fill:var(--dsw-static-neutral-bluish-800,#232833);
|
|
28
|
+
}
|
|
29
|
+
html[data-bc-active="true"][data-bc-resolved-tone="light"] body{
|
|
30
|
+
--bc-readable-fill:var(--dsw-static-neutral-bluish-00,#fff);
|
|
31
|
+
}
|
|
32
|
+
/* DSH settings are body portals; its sticky composer sits over the transcript.
|
|
33
|
+
Protect the actual surface, rather than keying readability to a conversation
|
|
34
|
+
phase or dim preference. Local aliases also beat gallery's body overrides.
|
|
35
|
+
Semantic roles and data-composer-card are shipped DSH contracts, not hashes. */
|
|
36
|
+
html[data-bc-active="true"]:not([data-bc-readable-surfaces="false"]) :is(
|
|
37
|
+
[role="dialog"],[role="alertdialog"],[role="menu"],[role="listbox"],
|
|
38
|
+
[role="tooltip"],[data-composer-card]
|
|
39
|
+
){
|
|
40
|
+
--dsw-alias-bg-base:var(--bc-readable-fill);
|
|
41
|
+
--dsw-alias-bg-layer-1:var(--bc-readable-fill);
|
|
42
|
+
--dsw-alias-bg-layer-2:var(--bc-readable-fill);
|
|
43
|
+
--dsw-alias-bg-layer-3:var(--bc-readable-fill);
|
|
44
|
+
--dsw-alias-bg-overlay:var(--bc-readable-fill);
|
|
45
|
+
--dsw-specific-input-major:var(--bc-readable-fill);
|
|
46
|
+
--dsw-specific-menu:var(--bc-readable-fill);
|
|
47
|
+
--dsw-alias-tooltip-bg:var(--bc-readable-fill);
|
|
48
|
+
background-color:var(--bc-readable-fill);
|
|
49
|
+
}
|
|
50
|
+
`;
|
|
51
|
+
document.head.append(style);
|
|
52
|
+
applyPreference();
|
|
53
|
+
|
|
54
|
+
globalThis.BeauticodeReadableSurfaces = {
|
|
55
|
+
get: () => enabled,
|
|
56
|
+
set(value) {
|
|
57
|
+
if (typeof value !== "boolean") return enabled;
|
|
58
|
+
enabled = value;
|
|
59
|
+
try {
|
|
60
|
+
globalThis.localStorage?.setItem(STORAGE_KEY, String(enabled));
|
|
61
|
+
} catch {
|
|
62
|
+
// Storage can be denied; the current page still honors the selection.
|
|
63
|
+
}
|
|
64
|
+
applyPreference();
|
|
65
|
+
return enabled;
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
globalThis.addEventListener?.("storage", (event) => {
|
|
69
|
+
if (event.key !== STORAGE_KEY && event.key !== null) return;
|
|
70
|
+
enabled = readPreference();
|
|
71
|
+
applyPreference();
|
|
72
|
+
});
|
|
73
|
+
})();
|