dsh-snowbreak-heimdall 3.8.6 → 3.9.9
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/SHA256SUMS.txt +74 -74
- package/lib/client.js +1 -0
- package/lib/index.js +128 -14
- package/package.json +1 -1
package/SHA256SUMS.txt
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\app-512.png
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\favicon-dark.svg
|
|
7
|
-
065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\
|
|
8
|
-
80f6d9cc7230a5529ec9290a75605e1b6918ad4eb80c0fce80aad9f9a3165e0e *assets\icons\icon-192.png
|
|
9
|
-
a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\icon-512.png
|
|
10
|
-
38335ecc7668f2c682f05c735f0f595ccd6ffed04949f5c5cdd8ec7e24c11382 *assets\icons\icon-maskable-512.png
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
5df2fdd499cea77f8dde1efcf9fd842a6e939cacbc24cf5ec39b4622c30ed2e4 *assets\previews\progress-winforms-complete.png
|
|
26
|
-
b4019a637dc144f90d50336960a4e83531cf87ff94d1951dc0671ece70c333a5 *assets\previews\progress-winforms-restore.png
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
8978acd5618d9148ca20804d823af6decb0b20af4569b39e8a641f559277db0c *TEST-REPORT.md
|
|
66
|
-
73ac5fa42ee7de25615deb7315de7e2609f76b52e636b6a03397c7203bf17bc2 *tools\build_assets.py
|
|
67
|
-
a8c0badcd2e0cac12cf03528a892c51ec1e6cbde0352ebfb5d5243cbe1f59f8e *tools\build_client.py
|
|
68
|
-
920b32904514c1429d05dfe9e645f1e04fbbef95b4f1e6cfd14bdb2ffdce4e72 *tools\test_lock.py
|
|
69
|
-
528b0820dd2418d521cea0fe0a710daaba20236cf4649eded241c855d345975b *tools\test_progress_launch.py
|
|
70
|
-
385915673000e558bdd070effb6b1054f63c316adc73e54877d3477641948e20 *tools\test_progress_ps1.py
|
|
71
|
-
f8572e5d28ef412700689bc02e94ece4ff68561d6c2749d2e1640c44967d02e6 *tools\test_progress_ps1_complete.py
|
|
72
|
-
365e2e848090ff97ffc97197654e8a004bd2e13f9b216618fdee394ac016cf79 *vendor\rcedit\LICENSE
|
|
73
|
-
3e7801db1a5edbec91b49a24a094aad776cb4515488ea5a4ca2289c400eade2a *vendor\rcedit\rcedit-x64.exe
|
|
74
|
-
d081051be5dad8854b894236fc273d631abf2b7556b94b277aa6bf782c44c56b *vendor\rcedit\README.md
|
|
1
|
+
8118e8d77764cb0bd998e280489e9408d27167d50a0dcdd4790a50536ba2f7a6 *assets\icons\app.ico
|
|
2
|
+
a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\app-512.png
|
|
3
|
+
d0bf225aef010c9f3079414a48974b6d9f44cc20b0bf6158ea68373ec3292269 *assets\icons\apple-touch-icon.png
|
|
4
|
+
e6d98ef38fec73d647fb7dd2c33019fd71ecbb15b8236d2dbe3ab8e9d85da162 *assets\icons\app-light-512.png
|
|
5
|
+
065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\favicon.svg
|
|
6
|
+
065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\favicon-dark.svg
|
|
7
|
+
065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *assets\icons\icon.svg
|
|
8
|
+
80f6d9cc7230a5529ec9290a75605e1b6918ad4eb80c0fce80aad9f9a3165e0e *assets\icons\icon-192.png
|
|
9
|
+
a25ca614de2cbbcfa871dedd62cf712f7b3b85f944167c5c3bdbcfd661f369da *assets\icons\icon-512.png
|
|
10
|
+
38335ecc7668f2c682f05c735f0f595ccd6ffed04949f5c5cdd8ec7e24c11382 *assets\icons\icon-maskable-512.png
|
|
11
|
+
7d0cac53f595eeb723e2ec145305d9bc4d432f76d313924bd821a3f1f02ba853 *assets\icons\res-icon.png
|
|
12
|
+
7f8ab651531a32f8d6d50bd76cd350087b135d98d8fd9964adcc3308d80b62a0 *assets\icons\tray.ico
|
|
13
|
+
f97fb8cb96c579159c4b5d6d1b0f1a767ead9895b71cfaa5aaa7c4248a3938ad *assets\previews\assets\hm-mark-blue.png
|
|
14
|
+
add4e78e5c7ea2f70ba07d43d2fe0635125986ec92e060248fad9d449be57577 *assets\previews\brand-fix.png
|
|
15
|
+
67ba14dca5fff5fa144aa7986db3cf9d76afe5a64bcaf8d0c20e0ed44c9e5b06 *assets\previews\exe-icon-test.png
|
|
16
|
+
bc0c3ed8efb73fd6aff7bee802bb1f1f1e550add77576b03cccdb56f8d8d7131 *assets\previews\loading-dark.html
|
|
17
|
+
d0fc1230f9cc1fd444b4e41c13dd3a654c138b9ae78e2a4b7e06e21274ba54c9 *assets\previews\loading-dark.png
|
|
18
|
+
aad4dc763d5379e44e17207ae5d287be3708220b8e990e618c778ee6cc7c58c5 *assets\previews\loading-fallback.html
|
|
19
|
+
cc37692d24488d74ddcc480b8c82cb932102b10bb9f087baf395ee2bb15a7d5d *assets\previews\loading-fallback.png
|
|
20
|
+
d370d25590c2acd93a7113aabbef54c779d74d624bebbe1e7a86835c3cab6f37 *assets\previews\loading-handoff.html
|
|
21
|
+
6442d8fd5ab7046f7f39d2f9900d414997e5defdf9d8eff525c20925f947ae2e *assets\previews\loading-light.html
|
|
22
|
+
ea2a6dc80e61bd90cbb29f98eeeeff8bc9a803cdc2d9ec207aba665619db4164 *assets\previews\loading-light.png
|
|
23
|
+
633f757eaebbd7ae353a6a9a2a221d5c49ea7f0b3265a2bd1dc4d75546603141 *assets\previews\mask-test.png
|
|
24
|
+
09128405ece6b38aa94b7e206f698d57ca50531b459ab14962662b9ffcbcadec *assets\previews\progress-winforms.png
|
|
25
|
+
5df2fdd499cea77f8dde1efcf9fd842a6e939cacbc24cf5ec39b4622c30ed2e4 *assets\previews\progress-winforms-complete.png
|
|
26
|
+
b4019a637dc144f90d50336960a4e83531cf87ff94d1951dc0671ece70c333a5 *assets\previews\progress-winforms-restore.png
|
|
27
|
+
cd204b8ccd9107f9af140a41e78f963d8c41c61cf41b51834199643693dac9be *assets\previews\ui-chrome.html
|
|
28
|
+
b5f2ff21b67a6a0c178d251af49331319eb42e9e140e279e391edda30112bf47 *assets\previews\ui-chrome.png
|
|
29
|
+
3ebaa8c085365385745ec2ceac437970a146581487c89ae4e4b4e4e15a5c5ec5 *assets\source\brand-client.js
|
|
30
|
+
12ea3ea272ae13b66f2875c42d466053516588057bb90775499e0fdb575fe624 *assets\source\client-template.js
|
|
31
|
+
54fc8e9c7394fc84dad497500021784d639d835bfa7e10abe39f04ab7f21f584 *assets\source\confirm-mark.png
|
|
32
|
+
59ffbf2123896606757c7fc1520c26345603a28e29748dbbcf656b13d501c094 *assets\source\extras.css
|
|
33
|
+
8c0e66cc1e814bd17eeaeecb30a0fe518c9cbedc2c2e1f75175e35b206f0586c *assets\source\extras.js
|
|
34
|
+
f97fb8cb96c579159c4b5d6d1b0f1a767ead9895b71cfaa5aaa7c4248a3938ad *assets\source\hm-mark-blue.png
|
|
35
|
+
aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\hm-mark-ink.png
|
|
36
|
+
1591f7b426d79f71440d4d9c93518de14c88d5b69610beea03a2ecac5c3ac958 *assets\source\hm-mark-light.png
|
|
37
|
+
0d46d6fd3a5b4d176641e328e747be7047cafa7213d8db1ec73540e57a23f1bb *assets\source\loading.css
|
|
38
|
+
78517dec7ed709162702e2424198b4b1a7e0c33895685b5efd42fc03d43f644e *assets\source\loading.html
|
|
39
|
+
9926df428efeceb92b3242b2c21025cae84ceade8734d258ba67a2c231c0fddd *assets\source\logo.webp
|
|
40
|
+
0a2e1c9c2a82487f414aaa68dbc01a59d9b1bbec973732bb32d08d90cc2ea982 *assets\source\mark-alpha.png
|
|
41
|
+
ff37ef4ee56454e42d2d47cdbbdc634c6b0b34e43817d4139ef7831b049714ec *assets\source\mark-color.png
|
|
42
|
+
105b2913a0232daf52793edf7531b27b1fa2830aa861d1e6c97e60e4f5bbd7d7 *assets\source\progress.ps1
|
|
43
|
+
6192be869b419b415ca5b44955e5e10cf84bbf1513cf358874f1fdb7116128a3 *assets\source\restart-confirm.ps1
|
|
44
|
+
e81ba1bccb95c4e3923b0140cc0615a5e92234777057eb2be614e7211de93965 *assets\source\shell.css
|
|
45
|
+
a5f5c45ca84c4d834d45d0a197aab76ca05fe05b0c1134077e75aeceb5ccde12 *assets\source\shell.js
|
|
46
|
+
f39417379634fd601613323bf56c0226bf135a41e153b90929627edc89b1edfe *assets\source\update.css
|
|
47
|
+
36225c50dd0e7f5042548eddf6414b3e68ec6bba042caeb386e71973090a2f86 *assets\source\watermark-soft.png
|
|
48
|
+
c8b835b1cb7c2fe3cb53288fbc7d1a28f7cefb3eac0d7574e3a5c0ea684ae22f *assets\source\welcome.css
|
|
49
|
+
e2985ac72a36a9dd9982a41e9587368b2a06afebf7fb50468d5b1c299bad94a2 *assets\source\welcome-brand.svg
|
|
50
|
+
aef34c1fed4a009a78955f5316b999bbd157fd082d7441d34852d32f0a481c28 *assets\source\welcome-mark-ink.png
|
|
51
|
+
1591f7b426d79f71440d4d9c93518de14c88d5b69610beea03a2ecac5c3ac958 *assets\source\welcome-mark-light.png
|
|
52
|
+
2a0b4b9c68d5f4b87bb8fbb768a1933c40394fe4e6f23c144fae88052ebe4a02 *cordis.patch.yml
|
|
53
|
+
065af22a9be00dc76ce08bc647814d33da2779e937db6c5fa4ea0dcb8c65caa9 *icon.svg
|
|
54
|
+
bcb1d6e0762ab2b3bca86cb7cc17c194fdf76c2c3e44c4bcba81869bc5c4b42f *lib\client.js
|
|
55
|
+
70fc214943a863b9f3694b06440dbb2b9d156c0791eb1124dad7deb76095ae63 *lib\index.js
|
|
56
|
+
0794a24c333ef529e56c6eb7b1dee62f4f5b8da1c56fe001885824ce2a3f8b2f *LICENSE
|
|
57
|
+
de949631618eb48bf5cd6c06698a28214c8e9cb4bca23d298cd89462f4fb260e *locale\en.json
|
|
58
|
+
e931cfb8c9b64aa4e01363e603537afee392e8309fe07daaff3e07e028ab8010 *locale\zh.json
|
|
59
|
+
63ad0386682d7818b634f658c51b8f3bfa26806ed3b835e4f96baf59d04802c4 *package.json
|
|
60
|
+
b39651c3299516bbae0a6844290425c2310085f2a7691edfbc04c4b832eb9e70 *patch\__pycache__\asar.cpython-314.pyc
|
|
61
|
+
46e365afb82f22ca4071b2571ad7981be7f308f9196d8b4ffcefc0f15dba869c *patch\__pycache__\patcher.cpython-314.pyc
|
|
62
|
+
8fa6aff9fa2ab7eb11cc813c7ed9cda2b9ae7757c039aad8d71d5b56b5b683d9 *patch\asar.py
|
|
63
|
+
7136d4b1bcc2c7f9d964f3b20891417f35523d25d601a6881577761a9e7bd495 *patch\patcher.py
|
|
64
|
+
2d68fa209103641bc66b301586a1ab32df0fc7cad06a830eda1c73cfd90da979 *README.md
|
|
65
|
+
8978acd5618d9148ca20804d823af6decb0b20af4569b39e8a641f559277db0c *TEST-REPORT.md
|
|
66
|
+
73ac5fa42ee7de25615deb7315de7e2609f76b52e636b6a03397c7203bf17bc2 *tools\build_assets.py
|
|
67
|
+
a8c0badcd2e0cac12cf03528a892c51ec1e6cbde0352ebfb5d5243cbe1f59f8e *tools\build_client.py
|
|
68
|
+
920b32904514c1429d05dfe9e645f1e04fbbef95b4f1e6cfd14bdb2ffdce4e72 *tools\test_lock.py
|
|
69
|
+
528b0820dd2418d521cea0fe0a710daaba20236cf4649eded241c855d345975b *tools\test_progress_launch.py
|
|
70
|
+
385915673000e558bdd070effb6b1054f63c316adc73e54877d3477641948e20 *tools\test_progress_ps1.py
|
|
71
|
+
f8572e5d28ef412700689bc02e94ece4ff68561d6c2749d2e1640c44967d02e6 *tools\test_progress_ps1_complete.py
|
|
72
|
+
365e2e848090ff97ffc97197654e8a004bd2e13f9b216618fdee394ac016cf79 *vendor\rcedit\LICENSE
|
|
73
|
+
3e7801db1a5edbec91b49a24a094aad776cb4515488ea5a4ca2289c400eade2a *vendor\rcedit\rcedit-x64.exe
|
|
74
|
+
d081051be5dad8854b894236fc273d631abf2b7556b94b277aa6bf782c44c56b *vendor\rcedit\README.md
|
package/lib/client.js
CHANGED
package/lib/index.js
CHANGED
|
@@ -18,7 +18,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
18
18
|
const requireFromHere = createRequire(import.meta.url);
|
|
19
19
|
|
|
20
20
|
const ROOT = path.dirname(path.dirname(fileURLToPath(import.meta.url)));
|
|
21
|
-
const VERSION = '3.
|
|
21
|
+
const VERSION = '3.9.9';
|
|
22
22
|
let restartPrompted = false;
|
|
23
23
|
const INSTALL = path.join(process.env.LOCALAPPDATA || '', 'Programs', 'DeepSeek Harness');
|
|
24
24
|
const DEFAULT_RESOURCES = process.env.HEIMDALL_RESOURCES
|
|
@@ -129,6 +129,10 @@ function buildStatus() {
|
|
|
129
129
|
hashError,
|
|
130
130
|
report: state.report || null,
|
|
131
131
|
warnings: Array.isArray(state.warnings) ? state.warnings : [],
|
|
132
|
+
failure: state.failure || null,
|
|
133
|
+
pythonRuntime: fs.existsSync(path.join(RUNTIME, 'python', 'pythonw.exe'))
|
|
134
|
+
? path.join(RUNTIME, 'python')
|
|
135
|
+
: findPythonSource(),
|
|
132
136
|
checkedAt: new Date().toISOString(),
|
|
133
137
|
};
|
|
134
138
|
}
|
|
@@ -211,7 +215,7 @@ function registerRoutes(ctx) {
|
|
|
211
215
|
const disposers = [
|
|
212
216
|
server.register({ kind: 'exact', path: '/api/heimdall/status', handler: handleStatus }),
|
|
213
217
|
server.register({ kind: 'exact', path: '/api/heimdall/apply', handler: handleApply }),
|
|
214
|
-
|
|
218
|
+
server.register({ kind: 'exact', path: '/api/heimdall/restore', handler: handleRestore }),
|
|
215
219
|
];
|
|
216
220
|
routesRegistered = true;
|
|
217
221
|
log('terminal status route registered');
|
|
@@ -282,9 +286,39 @@ function copyTree(source, destination, filter) {
|
|
|
282
286
|
}
|
|
283
287
|
}
|
|
284
288
|
|
|
285
|
-
|
|
289
|
+
// The desktop installer always carries a primary runtime payload under
|
|
290
|
+
// resources\*. The copy in the DSH home only appears after the SDK python tool
|
|
291
|
+
// has run once, so a fresh machine has the packaged payload and nothing else.
|
|
292
|
+
export function pythonSources(resources = RESOURCES) {
|
|
286
293
|
const home = process.env.DSH_HOME || path.join(os.homedir(), '.dsh');
|
|
287
|
-
|
|
294
|
+
const list = [];
|
|
295
|
+
const push = (dir) => {
|
|
296
|
+
if (!dir) return;
|
|
297
|
+
const normalized = path.normalize(dir);
|
|
298
|
+
if (!list.includes(normalized)) list.push(normalized);
|
|
299
|
+
};
|
|
300
|
+
const override = process.env.DSH_PRIMARY_RUNTIME;
|
|
301
|
+
if (override) {
|
|
302
|
+
push(path.join(override, 'dependencies', 'python'));
|
|
303
|
+
push(path.join(override, 'python'));
|
|
304
|
+
}
|
|
305
|
+
for (const root of [path.join(resources, 'runtime'), path.join(resources, 'primary-runtime')]) {
|
|
306
|
+
try {
|
|
307
|
+
for (const entry of fs.readdirSync(root, { withFileTypes: true })) {
|
|
308
|
+
if (entry.isDirectory()) push(path.join(root, entry.name, 'dependencies', 'python'));
|
|
309
|
+
}
|
|
310
|
+
} catch (_) { /* this build ships the payload elsewhere */ }
|
|
311
|
+
push(path.join(root, 'dependencies', 'python'));
|
|
312
|
+
}
|
|
313
|
+
push(path.join(home, 'dsh-runtimes', 'dsh-primary-runtime', 'dependencies', 'python'));
|
|
314
|
+
return list;
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
function findPythonSource() {
|
|
318
|
+
for (const candidate of pythonSources()) {
|
|
319
|
+
if (fs.existsSync(path.join(candidate, 'pythonw.exe'))) return candidate;
|
|
320
|
+
}
|
|
321
|
+
return null;
|
|
288
322
|
}
|
|
289
323
|
|
|
290
324
|
function ensurePython() {
|
|
@@ -292,10 +326,11 @@ function ensurePython() {
|
|
|
292
326
|
const pythonw = path.join(dest, 'pythonw.exe');
|
|
293
327
|
if (fs.existsSync(pythonw)) return pythonw;
|
|
294
328
|
const source = findPythonSource();
|
|
295
|
-
if (!
|
|
296
|
-
log('bundled python runtime unavailable');
|
|
329
|
+
if (!source) {
|
|
330
|
+
log('bundled python runtime unavailable; looked in: ' + pythonSources().join(' | '));
|
|
297
331
|
return null;
|
|
298
332
|
}
|
|
333
|
+
log('staging python runtime from ' + source);
|
|
299
334
|
fs.mkdirSync(dest, { recursive: true });
|
|
300
335
|
for (const name of fs.readdirSync(source)) {
|
|
301
336
|
if (!/^(python|pythonw|python3|python312|vcruntime.*)\.(exe|dll)$/i.test(name)) continue;
|
|
@@ -369,6 +404,47 @@ function writeRecovery(pythonw) {
|
|
|
369
404
|
}
|
|
370
405
|
}
|
|
371
406
|
|
|
407
|
+
// A silent failure is the worst outcome: the plugin is installed, the user
|
|
408
|
+
// restarts, and the window looks exactly the same. Say it out loud instead.
|
|
409
|
+
function reportSetupFailure(error) {
|
|
410
|
+
try {
|
|
411
|
+
const marker = path.join(STATE_DIR, 'setup-failed.pid');
|
|
412
|
+
if (fs.existsSync(marker) && fs.readFileSync(marker, 'utf8').trim() === String(process.pid)) return;
|
|
413
|
+
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
414
|
+
fs.writeFileSync(marker, String(process.pid), 'utf8');
|
|
415
|
+
writeState({ failure: String((error && error.message) || error || 'unknown') });
|
|
416
|
+
const state = readState();
|
|
417
|
+
const patched = state.status === 'patched';
|
|
418
|
+
const text = [
|
|
419
|
+
patched ? '源码层还在,但这次同步没有启动。' : '源码层没有写入,界面不会有任何变化。',
|
|
420
|
+
'',
|
|
421
|
+
'原因:' + String((error && error.message) || error || 'unknown'),
|
|
422
|
+
'',
|
|
423
|
+
'这台机器上查过的运行时路径:',
|
|
424
|
+
pythonSources().join('\r\n'),
|
|
425
|
+
'',
|
|
426
|
+
'日志:' + LOG,
|
|
427
|
+
'',
|
|
428
|
+
'把 host.log 发给作者即可定位。',
|
|
429
|
+
].join('\r\n');
|
|
430
|
+
const script = 'Add-Type -AssemblyName PresentationFramework; '
|
|
431
|
+
+ '[System.Windows.MessageBox]::Show(' + psQuote(text)
|
|
432
|
+
+ ", '海姆达尔终端 // 源码层接入失败', 'OK', 'Warning') | Out-Null";
|
|
433
|
+
const encoded = Buffer.from(script, 'utf16le').toString('base64');
|
|
434
|
+
const powershell = path.join(
|
|
435
|
+
process.env.SystemRoot || 'C:\\Windows',
|
|
436
|
+
'System32', 'WindowsPowerShell', 'v1.0', 'powershell.exe',
|
|
437
|
+
);
|
|
438
|
+
const child = spawn(powershell, [
|
|
439
|
+
'-NoProfile', '-STA', '-WindowStyle', 'Hidden', '-EncodedCommand', encoded,
|
|
440
|
+
], { detached: true, stdio: 'ignore', windowsHide: true });
|
|
441
|
+
child.unref();
|
|
442
|
+
log('setup failure reported to the user');
|
|
443
|
+
} catch (failure) {
|
|
444
|
+
log('setup failure dialog failed: ' + failure.message);
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
|
|
372
448
|
function arm(autoRestart = false) {
|
|
373
449
|
try {
|
|
374
450
|
const pythonw = stageRuntime();
|
|
@@ -416,8 +492,10 @@ function arm(autoRestart = false) {
|
|
|
416
492
|
});
|
|
417
493
|
child.unref();
|
|
418
494
|
log('one-shot source helper armed');
|
|
495
|
+
writeState({ failure: null });
|
|
419
496
|
} catch (error) {
|
|
420
497
|
log('arm failed: ' + error.message);
|
|
498
|
+
reportSetupFailure(error);
|
|
421
499
|
}
|
|
422
500
|
}
|
|
423
501
|
|
|
@@ -529,6 +607,12 @@ function writeRestartScript() {
|
|
|
529
607
|
const appExe = path.join(path.dirname(RESOURCES), 'DeepSeek Harness.exe');
|
|
530
608
|
const script = [
|
|
531
609
|
"$ErrorActionPreference = 'SilentlyContinue'",
|
|
610
|
+
'$statePath = ' + psQuote(statePath),
|
|
611
|
+
// Snapshot the state timestamp first: a reapply leaves an old "patched"
|
|
612
|
+
// document behind, so waiting for the word alone relaunches DSH in the
|
|
613
|
+
// middle of the restore/apply pass.
|
|
614
|
+
'$marker = 0',
|
|
615
|
+
'if (Test-Path -LiteralPath $statePath) { $marker = (Get-Item -LiteralPath $statePath).LastWriteTimeUtc.Ticks }',
|
|
532
616
|
'Start-Sleep -Seconds 3',
|
|
533
617
|
"$name = 'DeepSeek Harness'",
|
|
534
618
|
'$procs = Get-Process -Name $name',
|
|
@@ -538,21 +622,22 @@ function writeRestartScript() {
|
|
|
538
622
|
'if ($procs) { $procs | Stop-Process -Force }',
|
|
539
623
|
'$deadline = (Get-Date).AddSeconds(180)',
|
|
540
624
|
'while ((Get-Date) -lt $deadline) {',
|
|
541
|
-
' Start-Sleep -Seconds
|
|
542
|
-
' if (Test-Path -LiteralPath
|
|
625
|
+
' Start-Sleep -Seconds 1',
|
|
626
|
+
' if (Test-Path -LiteralPath $statePath) {',
|
|
543
627
|
' try {',
|
|
544
|
-
' $
|
|
545
|
-
|
|
628
|
+
' $ticks = (Get-Item -LiteralPath $statePath).LastWriteTimeUtc.Ticks',
|
|
629
|
+
' $s = Get-Content -LiteralPath $statePath -Raw | ConvertFrom-Json',
|
|
630
|
+
' if ($ticks -gt $marker -and -not ($s.reapply -eq $true) -and ($s.status -eq ' + psQuote('patched')
|
|
631
|
+
+ ' -or $s.status -eq ' + psQuote('original') + ')) { break }',
|
|
546
632
|
' } catch {}',
|
|
547
633
|
' }',
|
|
548
634
|
'}',
|
|
549
|
-
'Start-Sleep -Seconds
|
|
635
|
+
'Start-Sleep -Seconds 3',
|
|
550
636
|
'if (-not (Get-Process -Name $name)) { Start-Process -FilePath ' + psQuote(appExe) + ' }',
|
|
551
637
|
'',
|
|
552
638
|
].join('\r\n');
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
return file;
|
|
639
|
+
fs.writeFileSync(path.join(STATE_DIR, 'restart-dsh.ps1'), '\ufeff' + script, 'utf8');
|
|
640
|
+
return path.join(STATE_DIR, 'restart-dsh.ps1');
|
|
556
641
|
} catch (error) {
|
|
557
642
|
log('auto restart script failed: ' + error.message);
|
|
558
643
|
return null;
|
|
@@ -618,6 +703,33 @@ function askRestartConfirmation(restartScript, mode = 'apply') {
|
|
|
618
703
|
}
|
|
619
704
|
}
|
|
620
705
|
|
|
706
|
+
// A DSH auto-update replaces app.asar under the skin. The plugin still believes
|
|
707
|
+
// it is applied, so the user restarts, sees plain DSH and reports "nothing
|
|
708
|
+
// happened". Compare the archive once, after startup, and queue a rebuild.
|
|
709
|
+
function watchArchive() {
|
|
710
|
+
const timer = setTimeout(() => {
|
|
711
|
+
try {
|
|
712
|
+
const state = readState();
|
|
713
|
+
if (state.status !== 'patched') return;
|
|
714
|
+
if (!fs.existsSync(TARGET)) return;
|
|
715
|
+
const current = sha256File(TARGET);
|
|
716
|
+
if (current === state.patchedSha256) return;
|
|
717
|
+
if (current === state.originalSha256) {
|
|
718
|
+
log('archive is the pristine build again; skin is gone');
|
|
719
|
+
writeState({ status: 'original', warnings: ['官方 asar 已恢复(DSH 更新或手动还原)'] });
|
|
720
|
+
return;
|
|
721
|
+
}
|
|
722
|
+
log('archive changed underneath the skin; reapply queued');
|
|
723
|
+
writeState({ reapply: true });
|
|
724
|
+
arm(true);
|
|
725
|
+
askRestartConfirmation(writeRestartScript());
|
|
726
|
+
} catch (error) {
|
|
727
|
+
log('archive watch failed: ' + error.message);
|
|
728
|
+
}
|
|
729
|
+
}, 8000);
|
|
730
|
+
if (typeof timer.unref === 'function') timer.unref();
|
|
731
|
+
}
|
|
732
|
+
|
|
621
733
|
export function apply(ctx) {
|
|
622
734
|
try {
|
|
623
735
|
fs.mkdirSync(STATE_DIR, { recursive: true });
|
|
@@ -640,6 +752,7 @@ export function apply(ctx) {
|
|
|
640
752
|
arm(false);
|
|
641
753
|
}
|
|
642
754
|
registerRoutes(ctx);
|
|
755
|
+
watchArchive();
|
|
643
756
|
if (ctx && typeof ctx.effect === 'function') {
|
|
644
757
|
const loadedAt = Date.now();
|
|
645
758
|
ctx.effect(() => () => {
|
|
@@ -668,5 +781,6 @@ export function apply(ctx) {
|
|
|
668
781
|
}
|
|
669
782
|
} catch (error) {
|
|
670
783
|
log('apply failed: ' + error.message);
|
|
784
|
+
reportSetupFailure(error);
|
|
671
785
|
}
|
|
672
786
|
}
|