dsh-clean-desktop-shell 0.1.5 → 0.1.6
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/electron/update.js +32 -4
- package/package.json +1 -1
- package/version.txt +1 -1
package/electron/update.js
CHANGED
|
@@ -10,11 +10,27 @@
|
|
|
10
10
|
* this project does not have yet).
|
|
11
11
|
*/
|
|
12
12
|
import { app, shell, dialog } from 'electron'
|
|
13
|
+
import { readFileSync } from 'node:fs'
|
|
14
|
+
import { dirname, join } from 'node:path'
|
|
15
|
+
import { fileURLToPath } from 'node:url'
|
|
13
16
|
import { showProgress, setProgress, closeProgress } from './progress.js'
|
|
17
|
+
import { loadConfig } from './config.js'
|
|
14
18
|
|
|
15
19
|
const REPO_URL = 'https://github.com/Icather/dsh-clean-desktop-shell'
|
|
16
20
|
const RELEASES_API = 'https://api.github.com/repos/Icather/dsh-clean-desktop-shell/releases/latest'
|
|
17
21
|
|
|
22
|
+
// Plugin (bare-runtime) mode has no app bundle, so app.getVersion() returns
|
|
23
|
+
// the Electron runtime version (e.g. 33.4.11). Read the plugin's own version
|
|
24
|
+
// from its package.json instead.
|
|
25
|
+
const PKG_ROOT = dirname(dirname(fileURLToPath(import.meta.url)))
|
|
26
|
+
const PKG_VERSION = (() => {
|
|
27
|
+
try {
|
|
28
|
+
return JSON.parse(readFileSync(join(PKG_ROOT, 'package.json'), 'utf8')).version
|
|
29
|
+
} catch {
|
|
30
|
+
return null
|
|
31
|
+
}
|
|
32
|
+
})()
|
|
33
|
+
|
|
18
34
|
let autoUpdater = null
|
|
19
35
|
let updaterPromise = null
|
|
20
36
|
|
|
@@ -111,17 +127,20 @@ export async function checkForUpdatesAuto() {
|
|
|
111
127
|
|
|
112
128
|
// Manual path (macOS / dev mode): compare versions, offer GitHub page.
|
|
113
129
|
const r = await checkForUpdate()
|
|
130
|
+
const isPlugin = !app.isPackaged
|
|
114
131
|
if (r.hasUpdate) {
|
|
115
132
|
const choice = dialog.showMessageBoxSync({
|
|
116
133
|
type: 'info',
|
|
117
134
|
title: '发现新版本',
|
|
118
135
|
message: `当前版本 ${r.current},最新版本 ${r.latest}。`,
|
|
119
|
-
detail:
|
|
120
|
-
|
|
136
|
+
detail: isPlugin
|
|
137
|
+
? '插件形态请到 DSH 网页的「设置 → 插件市场 → 已安装」里点「更新」,完成后按提示重启即可生效。'
|
|
138
|
+
: 'macOS 自动更新需要代码签名,当前请前往 GitHub Releases 手动下载。',
|
|
139
|
+
buttons: isPlugin ? ['打开 DSH 网页', '稍后'] : ['前往下载', '取消'],
|
|
121
140
|
defaultId: 0,
|
|
122
141
|
cancelId: 1,
|
|
123
142
|
})
|
|
124
|
-
if (choice === 0) openUrl(r.url)
|
|
143
|
+
if (choice === 0) openUrl(isPlugin ? loadConfig().targetUrl : r.url)
|
|
125
144
|
} else if (r.latest) {
|
|
126
145
|
dialog.showMessageBoxSync({
|
|
127
146
|
type: 'info',
|
|
@@ -144,6 +163,15 @@ function parseVersion(v) {
|
|
|
144
163
|
return m ? [Number(m[1]), Number(m[2]), Number(m[3])] : null
|
|
145
164
|
}
|
|
146
165
|
|
|
166
|
+
/**
|
|
167
|
+
* Current app version. Packaged builds carry it in the exe; a bare runtime
|
|
168
|
+
* (plugin mode) must read the plugin package.json — app.getVersion() would
|
|
169
|
+
* report the Electron runtime version there.
|
|
170
|
+
*/
|
|
171
|
+
function currentVersion() {
|
|
172
|
+
return app.isPackaged ? app.getVersion() : PKG_VERSION || app.getVersion()
|
|
173
|
+
}
|
|
174
|
+
|
|
147
175
|
/** True when a is strictly newer than b. */
|
|
148
176
|
function isNewer(a, b) {
|
|
149
177
|
if (!a || !b) return false
|
|
@@ -158,7 +186,7 @@ function isNewer(a, b) {
|
|
|
158
186
|
* @returns {{ hasUpdate: boolean, latest?: string, current: string, url: string }}
|
|
159
187
|
*/
|
|
160
188
|
export async function checkForUpdate() {
|
|
161
|
-
const current =
|
|
189
|
+
const current = currentVersion()
|
|
162
190
|
let latest = null
|
|
163
191
|
let tag = null
|
|
164
192
|
let url = REPO_URL
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-clean-desktop-shell",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.6",
|
|
4
4
|
"description": "Clean desktop shell for DeepSeek Harness (DSH) as a DSH plugin — wraps your web profile in a native window, tray-managed backend, offline auto-reconnect, zero visual changes. DSH 插件形态的纯净桌面壳:复用现有 web profile,托盘管理后端,零视觉改造。",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
package/version.txt
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.6
|