forked from CringeStudios/element-desktop
62 lines
3.9 KiB
Diff
62 lines
3.9 KiB
Diff
diff --git a/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js b/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js
|
|
index 15312f4..07e8c52 100644
|
|
--- a/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js
|
|
+++ b/node_modules/electron-builder-squirrel-windows/out/SquirrelWindowsTarget.js
|
|
@@ -93,24 +93,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 +123,20 @@ 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");
|
|
+ // Find and sign all executables in the temp vendor directory
|
|
+ const files = await fs.promises.readdir(tmpVendorDirectory);
|
|
+ for (const file of files) {
|
|
+ if (file.endsWith(".exe") || file.endsWith(".dll")) {
|
|
+ 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;
|
|
}
|