diff --git a/package.json b/package.json index 2c9f13475bf..d63c8c60802 100644 --- a/package.json +++ b/package.json @@ -117,8 +117,8 @@ "@react-aria/focus": "3.19.1", "@react-aria/interactions": "3.23.0", "@react-aria/utils": "3.25.3", - "@react-types/shared": "3.27.0", "@react-spring/web": "9.7.5", + "@react-types/shared": "3.27.0", "@signalapp/libsignal-client": "0.68.0", "@signalapp/quill-cjs": "2.1.2", "@signalapp/ringrtc": "2.50.5", @@ -370,14 +370,14 @@ "@vitest/expect@2.0.5": "patches/@vitest+expect+2.0.5.patch", "got@11.8.5": "patches/got+11.8.5.patch", "react-textarea-autosize@8.5.5": "patches/react-textarea-autosize+8.5.5.patch", - "app-builder-lib@26.0.10": "patches/app-builder-lib@26.0.10.patch", "growing-file@0.1.3": "patches/growing-file+0.1.3.patch", "websocket@1.0.34": "patches/websocket+1.0.34.patch", "@types/websocket@1.0.0": "patches/@types+websocket+1.0.0.patch", "backbone@1.6.0": "patches/backbone+1.6.0.patch", "node-fetch@2.6.7": "patches/node-fetch+2.6.7.patch", "zod@3.23.8": "patches/zod+3.23.8.patch", - "@electron/rebuild": "patches/@electron__rebuild.patch" + "@electron/rebuild": "patches/@electron__rebuild.patch", + "app-builder-lib": "patches/app-builder-lib.patch" }, "onlyBuiltDependencies": [ "@indutny/mac-screen-share", @@ -481,7 +481,17 @@ }, "nsis": { "deleteAppDataOnUninstall": true, - "differentialPackage": true + "differentialPackage": true, + "customNsisBinary": { + "url": "https://updates.signal.org/desktop/nsis/nsis-3.0.4.1.7z", + "version": "3.0.4.1-signal", + "checksum": "uCkLCNjivpXuNbo8W73U0s64hEsiXnjVJeaYs3Iu7Ky87liDc2zKgJUomauM9YTg4DxashuwE6HEH4vSnXKBOw==" + }, + "customNsisResources": { + "url": "https://updates.signal.org/desktop/nsis/nsis-resources-3.4.1.7z", + "version": "3.4.1-signal", + "checksum": "KmySC53iz92XNYVgEy5gc0/cpXiyWsxxOX5UETBAt889TIvsNlUx7uKBxkQVf3D2Ycex0D2IPGjRdGYr1bftrw==" + } }, "linux": { "category": "Network;InstantMessaging;Chat", diff --git a/patches/app-builder-lib.patch b/patches/app-builder-lib.patch new file mode 100644 index 00000000000..0b736a804e4 --- /dev/null +++ b/patches/app-builder-lib.patch @@ -0,0 +1,219 @@ +diff --git a/out/node-module-collector/pnpmNodeModulesCollector.js b/out/node-module-collector/pnpmNodeModulesCollector.js +index e52d98fbc0d9d7fdd72a156823fca2bbc9b393fd..410701db7b805d984305ca89ac32d1d6908663ae 100644 +--- a/out/node-module-collector/pnpmNodeModulesCollector.js ++++ b/out/node-module-collector/pnpmNodeModulesCollector.js +@@ -25,17 +25,32 @@ class PnpmNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollect + extractProductionDependencyTree(tree) { + const p = path.normalize(this.resolvePath(tree.path)); + const packageJson = require(path.join(p, "package.json")); +- const prodDependencies = { ...(packageJson.dependencies || {}), ...(packageJson.optionalDependencies || {}) }; + const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) }; + const dependencies = Object.entries(deps).reduce((acc, curr) => { ++ var _b, _c; + const [packageName, dependency] = curr; +- if (!prodDependencies[packageName]) { ++ let isOptional; ++ if ((_b = packageJson.dependencies) === null || _b === void 0 ? void 0 : _b[packageName]) { ++ isOptional = false; ++ } ++ else if ((_c = packageJson.optionalDependencies) === null || _c === void 0 ? void 0 : _c[packageName]) { ++ isOptional = true; ++ } ++ else { + return acc; + } +- return { +- ...acc, +- [packageName]: this.extractProductionDependencyTree(dependency), +- }; ++ try { ++ return { ++ ...acc, ++ [packageName]: this.extractProductionDependencyTree(dependency), ++ }; ++ } ++ catch (error) { ++ if (isOptional) { ++ return acc; ++ } ++ throw error; ++ } + }, {}); + const { name, version, path: packagePath, workspaces } = tree; + const depTree = { +diff --git a/out/targets/nsis/NsisTarget.js b/out/targets/nsis/NsisTarget.js +index 8336c600a45fb843e0c88f3c7673b30f435c5aab..746569c20e4c9e32abf040e9c722e3eb97d53c62 100644 +--- a/out/targets/nsis/NsisTarget.js ++++ b/out/targets/nsis/NsisTarget.js +@@ -7,7 +7,6 @@ const debug_1 = require("debug"); + const fs = require("fs"); + const fs_extra_1 = require("fs-extra"); + const path = require("path"); +-const binDownload_1 = require("../../binDownload"); + const core_1 = require("../../core"); + const CommonWindowsInstallerConfiguration_1 = require("../../options/CommonWindowsInstallerConfiguration"); + const platformPackager_1 = require("../../platformPackager"); +@@ -25,8 +24,6 @@ const nsisUtil_1 = require("./nsisUtil"); + const debug = (0, debug_1.default)("electron-builder:nsis"); + // noinspection SpellCheckingInspection + const ELECTRON_BUILDER_NS_UUID = builder_util_runtime_1.UUID.parse("50e065bc-3134-11e6-9bab-38c9862bdaf3"); +-// noinspection SpellCheckingInspection +-const nsisResourcePathPromise = () => (0, binDownload_1.getBinFromUrl)("nsis-resources", "3.4.1", "Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q=="); + const USE_NSIS_BUILT_IN_COMPRESSOR = false; + class NsisTarget extends core_1.Target { + constructor(packager, outDir, targetName, packageHelper) { +@@ -546,7 +543,7 @@ class NsisTarget extends core_1.Target { + const taskManager = new builder_util_1.AsyncTaskManager(packager.info.cancellationToken); + const pluginArch = this.isUnicodeEnabled ? "x86-unicode" : "x86-ansi"; + taskManager.add(async () => { +- scriptGenerator.addPluginDir(pluginArch, path.join(await nsisResourcePathPromise(), "plugins", pluginArch)); ++ scriptGenerator.addPluginDir(pluginArch, path.join(await (0, nsisUtil_1.NSIS_RESOURCES_PATH)(), "plugins", pluginArch)); + }); + taskManager.add(async () => { + const userPluginDir = path.join(packager.info.buildResourcesDir, pluginArch); +diff --git a/out/targets/nsis/nsisUtil.js b/out/targets/nsis/nsisUtil.js +index 693d39c95f23b6ba890a560a4ce925c6400a45f4..5ce1e38bf9bb237b2e44f65186a3ca405b42fd26 100644 +--- a/out/targets/nsis/nsisUtil.js ++++ b/out/targets/nsis/nsisUtil.js +@@ -35,6 +35,19 @@ const NSIS_PATH = () => { + }); + }; + exports.NSIS_PATH = NSIS_PATH; ++const NSIS_RESOURCES_PATH = () => { ++ return exports.NsisTargetOptions.then((options) => { ++ if (options.customNsisResources) { ++ const { checksum, url, version } = options.customNsisResources; ++ if (checksum && url) { ++ const binaryVersion = version || checksum.substr(0, 8); ++ return (0, binDownload_1.getBinFromCustomLoc)("nsis-resources", binaryVersion, url, checksum); ++ } ++ } ++ return (0, binDownload_1.getBinFromUrl)("nsis-resources", "3.4.1", "Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q=="); ++ }); ++}; ++exports.NSIS_RESOURCES_PATH = NSIS_RESOURCES_PATH; + class AppPackageHelper { + constructor(elevateHelper) { + this.elevateHelper = elevateHelper; +diff --git a/scheme.json b/scheme.json +index a4fc2517768ac5dac24c1dbdec0315d85e4c1bad..d738fab1d4983fea664972b59c0cd837f6c7c2b6 100644 +--- a/scheme.json ++++ b/scheme.json +@@ -465,6 +465,36 @@ + ], + "type": "object" + }, ++ "CustomNsisResources": { ++ "additionalProperties": false, ++ "properties": { ++ "checksum": { ++ "default": "Dqd6g+2buwwvoG1Vyf6BHR1b+25QMmPcwZx40atOT57gH27rkjOei1L0JTldxZu4NFoEmW4kJgZ3DlSWVON3+Q==", ++ "type": [ ++ "null", ++ "string" ++ ] ++ }, ++ "url": { ++ "default": "https://github.com/electron-userland/electron-builder-binaries/releases/download/nsis-resources-3.4.1/nsis-resources-3.4.1.7z", ++ "type": [ ++ "null", ++ "string" ++ ] ++ }, ++ "version": { ++ "default": "3.4.1", ++ "type": [ ++ "null", ++ "string" ++ ] ++ } ++ }, ++ "required": [ ++ "url" ++ ], ++ "type": "object" ++ }, + "CustomPublishOptions": { + "additionalProperties": {}, + "properties": { +@@ -3900,6 +3930,17 @@ + ], + "description": "Allows you to provide your own `makensis`, such as one with support for debug logging via LogSet and LogText. (Logging also requires option `debugLogging = true`)" + }, ++ "customNsisResources": { ++ "anyOf": [ ++ { ++ "$ref": "#/definitions/CustomNsisResources" ++ }, ++ { ++ "type": "null" ++ } ++ ], ++ "description": "Allows you to provide your own `nsis-resources`" ++ }, + "deleteAppDataOnUninstall": { + "default": false, + "description": "*one-click installer only.* Whether to delete app data on uninstall.", +diff --git a/templates/nsis/include/installer.nsh b/templates/nsis/include/installer.nsh +index 34e91dfe82fdbb2e929820f2e8deb771b7f7893c..73bfffc6c227a018cbbeb690d6d7b882ed142fc8 100644 +--- a/templates/nsis/include/installer.nsh ++++ b/templates/nsis/include/installer.nsh +@@ -90,7 +90,13 @@ + ${if} $installMode == "all" + SetShellVarContext current + ${endif} +- !insertmacro copyFile "$EXEPATH" "$LOCALAPPDATA\${APP_INSTALLER_STORE_FILE}" ++ # SIGNAL CHANGE START ++ # This file is needed for electron-builder's native incremental updates, ++ # but we have our own system so no need to place it. Clean it up instead. ++ # ++ # !insertmacro copyFile "$EXEPATH" "$LOCALAPPDATA\${APP_INSTALLER_STORE_FILE}" ++ RMDir /r /REBOOTOK "$LOCALAPPDATA\signal-desktop-updater" ++ # SIGNAL CHANGE END + ${if} $installMode == "all" + SetShellVarContext all + ${endif} +diff --git a/templates/nsis/installSection.nsh b/templates/nsis/installSection.nsh +index 053772f55ca6ece52f0a34c4fa0f05c9a5f07bd2..a58ea8c19116f8ec3fb7515ec4104282f635ecc8 100644 +--- a/templates/nsis/installSection.nsh ++++ b/templates/nsis/installSection.nsh +@@ -22,11 +22,37 @@ StrCpy $appExe "$INSTDIR\${APP_EXECUTABLE_FILENAME}" + SpiderBanner::Show /MODERN + !endif + ++ # Set text (1000 is the id of text element of SpiderBanner) + FindWindow $0 "#32770" "" $hwndparent + FindWindow $0 "#32770" "" $hwndparent $0 +- GetDlgItem $0 $0 1000 +- SendMessage $0 ${WM_SETTEXT} 0 "STR:$(installing)" + ++ GetDlgItem $1 $0 1000 ++ SendMessage $1 ${WM_SETTEXT} 0 "STR:$(installing)" ++ ++ # Set header image compatible with "ManifestDPIAware" mode. ++ !ifdef HEADER_ICO ++ # Convert 24 Dialog Units to pixels: ++ # See https://github.com/mozilla/gecko-dev/blob/8de0e699002872d969aebf1bc8407e5c839a4472/toolkit/mozapps/installer/windows/nsis/common.nsh#L8801 ++ ++ # rect = LPRect { .left = 0, .top = 0, .right = 24, .bottom = 0 } ++ # See https://nsis.sourceforge.io/Docs/System/System.html#faq ++ System::Call "*(i 0, i 0, i 24, i 0) p.r1" ++ ++ # Call `MapDialogRect(window, &rect)` ++ System::Call `user32::MapDialogRect(p $0, p r1)` ++ ++ # rect.right now contains the converted value (24du => ?px). ++ # Place `rect.right` into `r2` ++ System::Call "*$1(i, i, i.r2, i)" ++ System::Free $1 ++ ++ # Load image and pass `r2` as both width and height, get the image handle ++ # back to `r2` register. ++ System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\installerHeaderico.ico", i ${IMAGE_ICON}, i r2, i r2, i ${LR_LOADFROMFILE}) i.r2` ++ # 1025 is the id of the icon of SpiderBanner. ++ GetDlgItem $1 $0 1025 ++ SendMessage $1 ${STM_SETIMAGE} ${IMAGE_ICON} $2 ++ !endif + StrCpy $1 $hwndparent + System::Call 'user32::ShutdownBlockReasonCreate(${SYSTYPE_PTR}r1, w "$(installing)")' + ${endif} diff --git a/patches/app-builder-lib@26.0.10.patch b/patches/app-builder-lib@26.0.10.patch deleted file mode 100644 index 6daab59e345..00000000000 --- a/patches/app-builder-lib@26.0.10.patch +++ /dev/null @@ -1,106 +0,0 @@ -diff --git a/out/node-module-collector/pnpmNodeModulesCollector.js b/out/node-module-collector/pnpmNodeModulesCollector.js -index e52d98fbc0d9d7fdd72a156823fca2bbc9b393fd..34c02fcfd6f81f84f49c90219425814ee3026bcd 100644 ---- a/out/node-module-collector/pnpmNodeModulesCollector.js -+++ b/out/node-module-collector/pnpmNodeModulesCollector.js -@@ -25,17 +25,32 @@ class PnpmNodeModulesCollector extends nodeModulesCollector_1.NodeModulesCollect - extractProductionDependencyTree(tree) { - const p = path.normalize(this.resolvePath(tree.path)); - const packageJson = require(path.join(p, "package.json")); -- const prodDependencies = { ...(packageJson.dependencies || {}), ...(packageJson.optionalDependencies || {}) }; - const deps = { ...(tree.dependencies || {}), ...(tree.optionalDependencies || {}) }; - const dependencies = Object.entries(deps).reduce((acc, curr) => { -+ var _b, _c; - const [packageName, dependency] = curr; -- if (!prodDependencies[packageName]) { -+ let isOptional; -+ if ((_b = packageJson.dependencies) === null || _b === void 0 ? void 0 : _b[packageName]) { -+ isOptional = false; -+ } -+ else if ((_c = packageJson.optionalDependencies) === null || _c === void 0 ? void 0 : _c[packageName]) { -+ isOptional = true; -+ } -+ else { - return acc; - } -- return { -- ...acc, -- [packageName]: this.extractProductionDependencyTree(dependency), -- }; -+ try { -+ return { -+ ...acc, -+ [packageName]: this.extractProductionDependencyTree(dependency), -+ }; -+ } -+ catch (error) { -+ if (isOptional) { -+ return acc; -+ } -+ throw error; -+ } - }, {}); - const { name, version, path: packagePath, workspaces } = tree; - const depTree = { -diff --git a/templates/nsis/include/installer.nsh b/templates/nsis/include/installer.nsh -index 34e91dfe82fdbb2e929820f2e8deb771b7f7893c..73bfffc6c227a018cbbeb690d6d7b882ed142fc8 100644 ---- a/templates/nsis/include/installer.nsh -+++ b/templates/nsis/include/installer.nsh -@@ -90,7 +90,13 @@ - ${if} $installMode == "all" - SetShellVarContext current - ${endif} -- !insertmacro copyFile "$EXEPATH" "$LOCALAPPDATA\${APP_INSTALLER_STORE_FILE}" -+ # SIGNAL CHANGE START -+ # This file is needed for electron-builder's native incremental updates, -+ # but we have our own system so no need to place it. Clean it up instead. -+ # -+ # !insertmacro copyFile "$EXEPATH" "$LOCALAPPDATA\${APP_INSTALLER_STORE_FILE}" -+ RMDir /r /REBOOTOK "$LOCALAPPDATA\signal-desktop-updater" -+ # SIGNAL CHANGE END - ${if} $installMode == "all" - SetShellVarContext all - ${endif} -diff --git a/templates/nsis/installSection.nsh b/templates/nsis/installSection.nsh -index 053772f55ca6ece52f0a34c4fa0f05c9a5f07bd2..a58ea8c19116f8ec3fb7515ec4104282f635ecc8 100644 ---- a/templates/nsis/installSection.nsh -+++ b/templates/nsis/installSection.nsh -@@ -22,11 +22,37 @@ StrCpy $appExe "$INSTDIR\${APP_EXECUTABLE_FILENAME}" - SpiderBanner::Show /MODERN - !endif - -+ # Set text (1000 is the id of text element of SpiderBanner) - FindWindow $0 "#32770" "" $hwndparent - FindWindow $0 "#32770" "" $hwndparent $0 -- GetDlgItem $0 $0 1000 -- SendMessage $0 ${WM_SETTEXT} 0 "STR:$(installing)" - -+ GetDlgItem $1 $0 1000 -+ SendMessage $1 ${WM_SETTEXT} 0 "STR:$(installing)" -+ -+ # Set header image compatible with "ManifestDPIAware" mode. -+ !ifdef HEADER_ICO -+ # Convert 24 Dialog Units to pixels: -+ # See https://github.com/mozilla/gecko-dev/blob/8de0e699002872d969aebf1bc8407e5c839a4472/toolkit/mozapps/installer/windows/nsis/common.nsh#L8801 -+ -+ # rect = LPRect { .left = 0, .top = 0, .right = 24, .bottom = 0 } -+ # See https://nsis.sourceforge.io/Docs/System/System.html#faq -+ System::Call "*(i 0, i 0, i 24, i 0) p.r1" -+ -+ # Call `MapDialogRect(window, &rect)` -+ System::Call `user32::MapDialogRect(p $0, p r1)` -+ -+ # rect.right now contains the converted value (24du => ?px). -+ # Place `rect.right` into `r2` -+ System::Call "*$1(i, i, i.r2, i)" -+ System::Free $1 -+ -+ # Load image and pass `r2` as both width and height, get the image handle -+ # back to `r2` register. -+ System::Call `user32::LoadImage(i 0, t "$PLUGINSDIR\installerHeaderico.ico", i ${IMAGE_ICON}, i r2, i r2, i ${LR_LOADFROMFILE}) i.r2` -+ # 1025 is the id of the icon of SpiderBanner. -+ GetDlgItem $1 $0 1025 -+ SendMessage $1 ${STM_SETIMAGE} ${IMAGE_ICON} $2 -+ !endif - StrCpy $1 $hwndparent - System::Call 'user32::ShutdownBlockReasonCreate(${SYSTYPE_PTR}r1, w "$(installing)")' - ${endif} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0c69991144..a0d2f37086f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,9 +36,9 @@ patchedDependencies: '@vitest/expect@2.0.5': hash: e8a96f71e52bf903c9f1eadba4740489a0beb48da33db52354adca484fe1f495 path: patches/@vitest+expect+2.0.5.patch - app-builder-lib@26.0.10: - hash: 344a0cce85e08dfd5565f526be9a74e1004c4950b3f2f88e6fe5561daad18a93 - path: patches/app-builder-lib@26.0.10.patch + app-builder-lib: + hash: 02f7a0b289e0e32e4a589f2db221809f13bb6facd20edeeeb613de1718848e32 + path: patches/app-builder-lib.patch backbone@1.6.0: hash: 342b4b6012f8aecfa041554256444cb25af75bc933cf2ab1e91c4f66a8e47a31 path: patches/backbone+1.6.0.patch @@ -13419,7 +13419,7 @@ snapshots: app-builder-bin@5.0.0-alpha.12: {} - app-builder-lib@26.0.10(patch_hash=344a0cce85e08dfd5565f526be9a74e1004c4950b3f2f88e6fe5561daad18a93)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10): + app-builder-lib@26.0.10(patch_hash=02f7a0b289e0e32e4a589f2db221809f13bb6facd20edeeeb613de1718848e32)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10): dependencies: '@develar/schema-utils': 2.6.5 '@electron/asar': 3.2.18 @@ -14603,7 +14603,7 @@ snapshots: dmg-builder@26.0.10(patch_hash=cb72ed47fa8d45513a36db33fcb41cb75c30cada4737da067bf3fa1f063725f2)(electron-builder-squirrel-windows@26.0.10): dependencies: - app-builder-lib: 26.0.10(patch_hash=344a0cce85e08dfd5565f526be9a74e1004c4950b3f2f88e6fe5561daad18a93)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10) + app-builder-lib: 26.0.10(patch_hash=02f7a0b289e0e32e4a589f2db221809f13bb6facd20edeeeb613de1718848e32)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10) builder-util: 26.0.7 builder-util-runtime: 9.3.1 fs-extra: 10.1.0 @@ -14749,7 +14749,7 @@ snapshots: electron-builder-squirrel-windows@26.0.10(dmg-builder@26.0.10): dependencies: - app-builder-lib: 26.0.10(patch_hash=344a0cce85e08dfd5565f526be9a74e1004c4950b3f2f88e6fe5561daad18a93)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10) + app-builder-lib: 26.0.10(patch_hash=02f7a0b289e0e32e4a589f2db221809f13bb6facd20edeeeb613de1718848e32)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10) builder-util: 26.0.7 electron-winstaller: 5.4.0 transitivePeerDependencies: @@ -14759,7 +14759,7 @@ snapshots: electron-builder@26.0.10(electron-builder-squirrel-windows@26.0.10): dependencies: - app-builder-lib: 26.0.10(patch_hash=344a0cce85e08dfd5565f526be9a74e1004c4950b3f2f88e6fe5561daad18a93)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10) + app-builder-lib: 26.0.10(patch_hash=02f7a0b289e0e32e4a589f2db221809f13bb6facd20edeeeb613de1718848e32)(dmg-builder@26.0.10)(electron-builder-squirrel-windows@26.0.10) builder-util: 26.0.7 builder-util-runtime: 9.3.1 chalk: 4.1.2