better-dsh-pet 0.2.2 → 0.2.3
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.md +2 -4
- package/package.json +1 -1
- package/runtime/electron-helper/main.js +6 -0
- package/scripts/ensure-electron.mjs +23 -8
package/README.md
CHANGED
|
@@ -21,11 +21,9 @@
|
|
|
21
21
|
|
|
22
22
|
## 🎬 视频推广
|
|
23
23
|
|
|
24
|
-
> 📹
|
|
24
|
+
> 📹 点击观看 better-dsh-pet 演示视频:
|
|
25
25
|
>
|
|
26
|
-
>
|
|
27
|
-
> [▶️ 点击观看 better-dsh-pet 演示视频](https://www.bilibili.com/video/你的视频ID)
|
|
28
|
-
> ```
|
|
26
|
+
> [▶️ B站:一行命令,把大肥鱼放到桌面](https://www.bilibili.com/video/BV1YH8h6WEvi)
|
|
29
27
|
|
|
30
28
|
---
|
|
31
29
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "better-dsh-pet",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "A desktop-native pet bubble driven by DeepSeek Harness session events: transparent always-on-top Electron window, status-aware animations, balance, pomodoro, roast, and DSH settings card.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"dsh",
|
|
@@ -64,6 +64,7 @@ function createWindow() {
|
|
|
64
64
|
height,
|
|
65
65
|
x: area.x,
|
|
66
66
|
y: area.y,
|
|
67
|
+
show: false,
|
|
67
68
|
useContentSize: true,
|
|
68
69
|
transparent: true,
|
|
69
70
|
frame: false,
|
|
@@ -76,9 +77,14 @@ function createWindow() {
|
|
|
76
77
|
contextIsolation: true,
|
|
77
78
|
nodeIntegration: false,
|
|
78
79
|
sandbox: false,
|
|
80
|
+
paintWhenInitiallyHidden: false,
|
|
79
81
|
},
|
|
80
82
|
})
|
|
81
83
|
|
|
84
|
+
mainWindow.once('ready-to-show', () => {
|
|
85
|
+
mainWindow.show()
|
|
86
|
+
})
|
|
87
|
+
|
|
82
88
|
mainWindow.setAlwaysOnTop(true, 'screen-saver')
|
|
83
89
|
mainWindow.setVisibleOnAllWorkspaces(true, { visibleOnFullScreen: true })
|
|
84
90
|
setClickThrough(true)
|
|
@@ -26,6 +26,14 @@ const VERSION = process.env.DSH_PET_ELECTRON_VERSION || '43.3.0'
|
|
|
26
26
|
const MIRROR = process.env.DSH_PET_ELECTRON_MIRROR || 'https://npmmirror.com/mirrors/electron/'
|
|
27
27
|
const TARGET_DIR = resolve(HOME, 'electron')
|
|
28
28
|
const EXE = join(TARGET_DIR, 'electron.exe')
|
|
29
|
+
const REQUIRED_FILES = [
|
|
30
|
+
'electron.exe',
|
|
31
|
+
'icudtl.dat',
|
|
32
|
+
'resources.pak',
|
|
33
|
+
'snapshot_blob.bin',
|
|
34
|
+
'chrome_100_percent.pak',
|
|
35
|
+
'v8_context_snapshot.bin',
|
|
36
|
+
]
|
|
29
37
|
|
|
30
38
|
async function download(url, dest) {
|
|
31
39
|
const response = await fetch(url, { redirect: 'follow' })
|
|
@@ -39,14 +47,21 @@ function extractZip(zipPath, targetDir) {
|
|
|
39
47
|
mkdirSync(targetDir, { recursive: true })
|
|
40
48
|
// Windows 自带 tar(bsdtar)可以直接解压 zip;失败时退回 PowerShell Expand-Archive。
|
|
41
49
|
const tar = spawnSync('tar', ['-xf', zipPath, '-C', targetDir], { stdio: 'inherit' })
|
|
42
|
-
if (tar.status
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
+
if (tar.status !== 0) {
|
|
51
|
+
const ps = spawnSync('powershell', [
|
|
52
|
+
'-NoProfile',
|
|
53
|
+
'-Command',
|
|
54
|
+
`Expand-Archive -LiteralPath '${zipPath}' -DestinationPath '${targetDir}' -Force`,
|
|
55
|
+
], { stdio: 'inherit' })
|
|
56
|
+
if (ps.status !== 0) {
|
|
57
|
+
throw new Error('failed to extract Electron zip')
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
// 校验关键文件是否完整;不完整说明下载/解压失败,清理后重试。
|
|
61
|
+
const missing = REQUIRED_FILES.filter((name) => !existsSync(join(targetDir, name)))
|
|
62
|
+
if (missing.length > 0) {
|
|
63
|
+
rmSync(targetDir, { recursive: true, force: true })
|
|
64
|
+
throw new Error(`Electron zip incomplete, missing: ${missing.join(', ')}`)
|
|
50
65
|
}
|
|
51
66
|
}
|
|
52
67
|
|