176 lines
7.7 KiB
Diff
176 lines
7.7 KiB
Diff
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}
|