dsh-snowbreak-heimdall 3.8.4 → 3.8.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/lib/index.js +1 -1
- package/package.json +1 -1
- package/patch/__pycache__/patcher.cpython-314.pyc +0 -0
- package/patch/patcher.py +36 -17
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.
|
|
21
|
+
const VERSION = '3.8.6';
|
|
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
|
package/package.json
CHANGED
|
Binary file
|
package/patch/patcher.py
CHANGED
|
@@ -726,18 +726,21 @@ def compose_tree(tree, target):
|
|
|
726
726
|
break
|
|
727
727
|
if js_path:
|
|
728
728
|
js_text = read(js_path).decode("utf-8")
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
729
|
+
# Minified helper and namespace names move between releases, so the
|
|
730
|
+
# anchors match the call shape and the English literal, not the whole
|
|
731
|
+
# expression.
|
|
732
|
+
boot_rules = [
|
|
733
|
+
(r'(wordmark=\$?\w+\(\w+\.wordmark,")HARNESS(")',
|
|
734
|
+
r'\1海姆达尔\2'),
|
|
735
|
+
(r'(hint=\$?\w+\(\w+\.hint,")Loading plugins(?:…|\.\.\.)?(")',
|
|
736
|
+
r'\1正在建立安全链路\2'),
|
|
737
|
+
(r'(\(\w+\.failedTitle,")Failed to load plugins(")',
|
|
738
|
+
r'\1接入失败\2'),
|
|
736
739
|
]
|
|
737
740
|
changed = 0
|
|
738
|
-
for
|
|
739
|
-
|
|
740
|
-
|
|
741
|
+
for pattern, replacement in boot_rules:
|
|
742
|
+
js_text, count = re.subn(pattern, replacement, js_text, count=1)
|
|
743
|
+
if count:
|
|
741
744
|
changed += 1
|
|
742
745
|
if changed:
|
|
743
746
|
replacements[js_path] = js_text.encode("utf-8")
|
|
@@ -964,15 +967,31 @@ def apply_external(target, backup_dir, warnings):
|
|
|
964
967
|
log("external " + name + " replaced")
|
|
965
968
|
rcedit = os.path.join(ROOT, "vendor", "rcedit", "rcedit-x64.exe")
|
|
966
969
|
pristine = True
|
|
970
|
+
backup_exe = os.path.join(backup_dir, os.path.basename(paths["exe"]) + ".orig")
|
|
971
|
+
recorded = None
|
|
967
972
|
try:
|
|
968
973
|
with open(os.path.join(backup_dir, "external.json"), encoding="utf-8") as handle:
|
|
969
|
-
|
|
970
|
-
if os.path.isfile(paths["exe"]) and info.get("sha256") == sha256_file(paths["exe"]):
|
|
971
|
-
pristine = False
|
|
972
|
-
warnings.append("exe icon: backup is not pristine (it already matches the patched exe); skipped")
|
|
973
|
-
log("exe icon skipped: backup is not pristine")
|
|
974
|
+
recorded = (json.load(handle).get("exe") or {}).get("sha256")
|
|
974
975
|
except (OSError, ValueError):
|
|
975
|
-
|
|
976
|
+
recorded = None
|
|
977
|
+
if not os.path.isfile(backup_exe) or not recorded:
|
|
978
|
+
pristine = False
|
|
979
|
+
warnings.append("exe icon: backup executable missing; executable icon unchanged")
|
|
980
|
+
else:
|
|
981
|
+
backup_sha = sha256_file(backup_exe)
|
|
982
|
+
current_sha = sha256_file(paths["exe"]) if os.path.isfile(paths["exe"]) else None
|
|
983
|
+
applied_sha = (load_state().get("external") or {}).get("exe")
|
|
984
|
+
if backup_sha != recorded:
|
|
985
|
+
pristine = False
|
|
986
|
+
warnings.append("exe icon: backup does not match its manifest; executable icon unchanged")
|
|
987
|
+
elif current_sha == applied_sha:
|
|
988
|
+
# Our own earlier patch is in place; the pristine backup is intact.
|
|
989
|
+
pristine = False
|
|
990
|
+
log("exe icon already applied")
|
|
991
|
+
elif current_sha != recorded:
|
|
992
|
+
pristine = False
|
|
993
|
+
warnings.append("exe icon: executable changed since the backup; icon left alone")
|
|
994
|
+
log("exe icon skipped: exe differs from the recorded pristine hash")
|
|
976
995
|
if pristine and os.path.isfile(paths["exe"]) and os.path.isfile(rcedit):
|
|
977
996
|
tmp = paths["exe"] + ".heimdall.tmp"
|
|
978
997
|
try:
|
|
@@ -997,7 +1016,7 @@ def apply_external(target, backup_dir, warnings):
|
|
|
997
1016
|
pass
|
|
998
1017
|
warnings.append("exe icon: " + str(exc))
|
|
999
1018
|
log("exe icon skipped: %s" % exc)
|
|
1000
|
-
elif os.path.isfile(paths["exe"]):
|
|
1019
|
+
elif pristine and os.path.isfile(paths["exe"]):
|
|
1001
1020
|
warnings.append("rcedit missing; executable icon unchanged")
|
|
1002
1021
|
return applied
|
|
1003
1022
|
|