fix: 发布 1.1.39,中文 Windows 官方桌面更新不再卡在准备重启

Fixes #47

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
叫我小杨同学andCursor committed 2026-09-29 20:10:51 +08:00
1 parent 701b4188cd
commit a049e3c7d5
8 files changed
+96 -18

No files matched your search

+50 -5
View File
@@ -3136,6 +3136,11 @@ const NEW_TOOL_PATCHES = [
{
pattern: "var DesktopUpdateCoordinator = class {",
replace:
"function dshPurgeWshLiteral(value) {\n" +
"\treturn JSON.stringify(String(value == null ? \"\" : value)).replace(/[^\\u0000-\\u007e]/g, function (ch) {\n" +
"\t\treturn \"\\\\u\" + (\"0000\" + ch.charCodeAt(0).toString(16)).slice(-4);\n" +
"\t});\n" +
"}\n" +
"function dshPurgeHandoffDesktopUpdate(owner) {\n" +
"\ttry {\n" +
"\t\tconst cache = join(process.env.LOCALAPPDATA || \"\", \"@deepseek-aidsh-desktop-updater\");\n" +
@@ -3159,11 +3164,12 @@ const NEW_TOOL_PATCHES = [
"\t\tconst installDir = dirname(exe);\n" +
"\t\tconst logPath = join(process.env.TEMP || \"\", \"dsh-purge-official-update.log\");\n" +
"\t\tconst body = readFileSync(templatePath, \"utf8\")\n" +
"\t\t\t.split(\"__EXE_JSON__\").join(JSON.stringify(exe))\n" +
"\t\t\t.split(\"__INSTALLER_JSON__\").join(JSON.stringify(installer))\n" +
"\t\t\t.split(\"__RESOURCES_JSON__\").join(JSON.stringify(resources))\n" +
"\t\t\t.split(\"__INSTALL_DIR_JSON__\").join(JSON.stringify(installDir))\n" +
"\t\t\t.split(\"__LOG_JSON__\").join(JSON.stringify(logPath));\n" +
"\t\t\t.split(\"__EXE_JSON__\").join(dshPurgeWshLiteral(exe))\n" +
"\t\t\t.split(\"__INSTALLER_JSON__\").join(dshPurgeWshLiteral(installer))\n" +
"\t\t\t.split(\"__RESOURCES_JSON__\").join(dshPurgeWshLiteral(resources))\n" +
"\t\t\t.split(\"__INSTALL_DIR_JSON__\").join(dshPurgeWshLiteral(installDir))\n" +
"\t\t\t.split(\"__LOG_JSON__\").join(dshPurgeWshLiteral(logPath));\n" +
"\t\tfor (var i = 0; i < body.length; i++) { if (body.charCodeAt(i) > 127) throw new Error(\"desktop update script is not ascii\"); }\n" +
"\t\tconst script = join(process.env.TEMP || \"\", \"dsh-purge-official-update.js\");\n" +
"\t\tconst launcher = join(process.env.TEMP || \"\", \"dsh-purge-official-update.cmd\");\n" +
"\t\twriteFileSync(script, body, \"utf8\");\n" +
@@ -3178,6 +3184,45 @@ const NEW_TOOL_PATCHES = [
],
markers: ["function dshPurgeHandoffDesktopUpdate", "dshPurgeHandoffDesktopUpdate(this)"],
},
{
id: 46, name: "OFFICIAL_DESKTOP_UPDATE_ASCII", layer: "代码", layer_en: "Code",
desc: "已接管的官方桌面更新改为 ASCII 脚本,中文 Windows 不再吞掉换行",
file: "desktop-shell",
optional: true,
skipIfMarked: true,
replacements: [
{
pattern: "function dshPurgeHandoffDesktopUpdate(owner) {",
replace:
"function dshPurgeWshLiteral(value) {\n" +
"\treturn JSON.stringify(String(value == null ? \"\" : value)).replace(/[^\\u0000-\\u007e]/g, function (ch) {\n" +
"\t\treturn \"\\\\u\" + (\"0000\" + ch.charCodeAt(0).toString(16)).slice(-4);\n" +
"\t});\n" +
"}\n" +
"function dshPurgeHandoffDesktopUpdate(owner) {",
},
{
pattern:
"\t\tconst body = readFileSync(templatePath, \"utf8\")\n" +
"\t\t\t.split(\"__EXE_JSON__\").join(JSON.stringify(exe))\n" +
"\t\t\t.split(\"__INSTALLER_JSON__\").join(JSON.stringify(installer))\n" +
"\t\t\t.split(\"__RESOURCES_JSON__\").join(JSON.stringify(resources))\n" +
"\t\t\t.split(\"__INSTALL_DIR_JSON__\").join(JSON.stringify(installDir))\n" +
"\t\t\t.split(\"__LOG_JSON__\").join(JSON.stringify(logPath));\n" +
"\t\tconst script = join(process.env.TEMP || \"\", \"dsh-purge-official-update.js\");\n",
replace:
"\t\tconst body = readFileSync(templatePath, \"utf8\")\n" +
"\t\t\t.split(\"__EXE_JSON__\").join(dshPurgeWshLiteral(exe))\n" +
"\t\t\t.split(\"__INSTALLER_JSON__\").join(dshPurgeWshLiteral(installer))\n" +
"\t\t\t.split(\"__RESOURCES_JSON__\").join(dshPurgeWshLiteral(resources))\n" +
"\t\t\t.split(\"__INSTALL_DIR_JSON__\").join(dshPurgeWshLiteral(installDir))\n" +
"\t\t\t.split(\"__LOG_JSON__\").join(dshPurgeWshLiteral(logPath));\n" +
"\t\tfor (var i = 0; i < body.length; i++) { if (body.charCodeAt(i) > 127) throw new Error(\"desktop update script is not ascii\"); }\n" +
"\t\tconst script = join(process.env.TEMP || \"\", \"dsh-purge-official-update.js\");\n",
},
],
markers: ["function dshPurgeWshLiteral"],
},
];
export const ALL_PATCHES = [...PATCHES, ...CODE_PATCHES, ...ENGINE_PATCHES, ...NEW_TOOL_PATCHES];