sekur-chat/patches/electron-builder-squirrel-windows+26.0.6.patch

77 lines
4.5 KiB
Diff
Raw Normal View History

diff --git a/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js b/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js
index 15312f4..1d7a8d6 100644
--- a/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js
+++ b/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js
@@ -38,7 +38,15 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
if (distOptions.vendorDirectory) {
this.select7zipArch(distOptions.vendorDirectory, arch);
}
+ distOptions.fixUpPaths = true;
+ if (this.options.msi) {
+ distOptions.setupMsi = setupFile;
+ }
+ else {
+ distOptions.setupExe = setupFile;
+ }
await (0, electron_winstaller_1.createWindowsInstaller)(distOptions);
+ await packager.signAndEditResources(artifactPath, arch, installerOutDir);
await packager.info.callArtifactBuildCompleted({
file: artifactPath,
target: this,
@@ -93,24 +101,26 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
const appInfo = packager.appInfo;
// If not specified will use the Squirrel.Windows that is shipped with electron-installer(https://github.com/electron/windows-installer/tree/main/vendor)
// After https://github.com/electron-userland/electron-builder-binaries/pull/56 merged, will add `electron-builder-binaries` to get the latest version of squirrel.
- let vendorDirectory = this.options.customSquirrelVendorDir;
+ let vendorDirectory = this.options.customSquirrelVendorDir || path.join(require.resolve("electron-winstaller/package.json"), "..", "vendor");
if ((0, builder_util_1.isEmptyOrSpaces)(vendorDirectory) || !fs.existsSync(vendorDirectory)) {
builder_util_1.log.warn({ vendorDirectory }, "unable to access Squirrel.Windows vendor directory, falling back to default electron-winstaller");
- vendorDirectory = undefined;
+ vendorDirectory = path.join(require.resolve("electron-winstaller/package.json"), "..", "vendor");
}
const options = {
appDirectory: this.appDirectory,
outputDirectory: this.outputDirectory,
name: this.options.useAppIdAsId ? appInfo.id : this.appName,
+ title: appInfo.productName || appInfo.name,
version: appInfo.version,
description: appInfo.description,
- exe: `${this.packager.platformSpecificBuildOptions.executableName || this.options.name || appInfo.productName}.exe`,
+ exe: `${appInfo.productFilename || this.options.name || appInfo.productName}.exe`,
authors: appInfo.companyName || "",
iconUrl,
copyright: appInfo.copyright,
vendorDirectory,
nuspecTemplate: path.join(__dirname, "..", "template.nuspectemplate"),
noMsi: !this.options.msi,
+ usePackageJson: false,
};
const projectUrl = await appInfo.computePackageUrl();
if (projectUrl != null) {
@@ -121,13 +131,19 @@ class SquirrelWindowsTarget extends app_builder_lib_1.Target {
await (0, promises_1.writeFile)(nuspecTemplate, templateContent);
options.nuspecTemplate = nuspecTemplate;
}
- if (await (await packager.signingManager.value).cscInfo.value) {
- options.windowsSign = {
- hookFunction: async (file) => {
- await packager.sign(file);
- },
- };
+ const tmpVendorDirectory = await packager.info.tempDirManager.createTempDir({ prefix: "squirrel-windows-vendor" });
+ // Copy entire vendor directory to temp directory
+ await fs.promises.cp(vendorDirectory, tmpVendorDirectory, { recursive: true });
+ builder_util_1.log.debug({ from: vendorDirectory, to: tmpVendorDirectory }, "copied vendor directory");
+ const files = await fs.promises.readdir(tmpVendorDirectory);
+ for (const file of files) {
+ if (["Squirrel.exe", "StubExecutable.exe"].includes(file)) {
+ const filePath = path.join(tmpVendorDirectory, file);
+ builder_util_1.log.debug({ file: filePath }, "signing vendor executable");
+ await packager.sign(filePath);
+ }
}
+ options.vendorDirectory = tmpVendorDirectory;
if ((0, builder_util_1.isEmptyOrSpaces)(options.description)) {
options.description = this.options.name || appInfo.productName;
}