dsh-snowbreak-heimdall 3.8.2 → 3.8.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.
@@ -526,8 +526,11 @@
526
526
  var rows = sheetRows().map(function (pair) {
527
527
  return '<div class="hm-sheet__row"><span>' + pair[0] + "</span><b>" + pair[1] + "</b></div>";
528
528
  }).join("");
529
- var warnings = hmStatus && hmStatus.warnings && hmStatus.warnings.length
530
- ? '<div class="hm-sheet__warn"><i>警告</i>' + hmStatus.warnings.map(function (w) {
529
+ var notes = [];
530
+ if (hmStatus && hmStatus.hashError) notes.push("哈希计算失败:" + hmStatus.hashError);
531
+ if (hmStatus && hmStatus.warnings && hmStatus.warnings.length) notes = notes.concat(hmStatus.warnings);
532
+ var warnings = notes.length
533
+ ? '<div class="hm-sheet__warn"><i>警告</i>' + notes.map(function (w) {
531
534
  return "<span>" + w + "</span>";
532
535
  }).join("") + "</div>"
533
536
  : "";
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.8.2';
21
+ const VERSION = '3.8.3';
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
@@ -66,7 +66,7 @@ function writeState(patch) {
66
66
 
67
67
  function sha256File(file) {
68
68
  const hash = createHash('sha256');
69
- const handle = fs.openSync(file, 'rb');
69
+ const handle = fs.openSync(file, 'r');
70
70
  try {
71
71
  const buffer = Buffer.allocUnsafe(4 * 1024 * 1024);
72
72
  let read = 0;
@@ -87,9 +87,12 @@ function buildStatus() {
87
87
  const originalSha = typeof state.originalSha256 === 'string' ? state.originalSha256 : null;
88
88
  const patchedSha = typeof state.patchedSha256 === 'string' ? state.patchedSha256 : null;
89
89
  let currentSha = null;
90
+ let hashError = null;
90
91
  try {
91
92
  if (fs.existsSync(TARGET)) currentSha = sha256File(TARGET);
92
- } catch (_) { /* unreadable archive */ }
93
+ } catch (error) {
94
+ hashError = String(error && error.message ? error.message : error);
95
+ }
93
96
  const backupFile = typeof state.backupFile === 'string' ? state.backupFile : null;
94
97
  let backupOk = null;
95
98
  if (backupFile) {
@@ -114,6 +117,7 @@ function buildStatus() {
114
117
  needsReapply: !!(currentSha && originalSha && currentSha !== originalSha && currentSha !== patchedSha),
115
118
  backupOk,
116
119
  backupFile,
120
+ hashError,
117
121
  report: state.report || null,
118
122
  warnings: Array.isArray(state.warnings) ? state.warnings : [],
119
123
  checkedAt: new Date().toISOString(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-snowbreak-heimdall",
3
- "version": "3.8.2",
3
+ "version": "3.8.3",
4
4
  "description": "《尘白禁区》海姆达尔终端 / 世界树公司源码级皮肤:加载画面、双主题、菜单/侧栏/图标,插件仅在加载后播放启动动画。Windows / DSH 0.2.2-rc.x。",
5
5
  "type": "module",
6
6
  "license": "MIT",