ayaports/backports/element-desktop/tasje-no-fuses.patch

53 lines
2 KiB
Diff
Raw Normal View History

2025-01-07 14:09:43 -05:00
we can't do fuses because we ship one binary in the electron package.
and we can't import them here, since they are in devDependencies, which are uninstalled at this stage.
--- ./electron-builder.ts.orig
+++ ./electron-builder.ts
@@ -2,8 +2,7 @@
import * as fs from "node:fs";
import * as path from "node:path";
import * as plist from "plist";
-import { AfterPackContext, Arch, Configuration as BaseConfiguration, Platform } from "electron-builder";
-import { computeData } from "app-builder-lib/out/asar/integrity";
2025-01-07 14:09:43 -05:00
+import { Configuration as BaseConfiguration } from "electron-builder";
import { readFile, writeFile } from "node:fs/promises";
2025-01-07 14:09:43 -05:00
/**
@@ -46,26 +45,6 @@
} & BaseConfiguration["deb"];
}
-async function injectAsarIntegrity(context: AfterPackContext) {
- const packager = context.packager;
2025-01-07 14:09:43 -05:00
-
- // We only need to re-generate asar on universal Mac builds, due to https://github.com/electron/universal/issues/116
- if (packager.platform !== Platform.MAC || context.arch !== Arch.universal) return;
2025-01-07 14:09:43 -05:00
-
- const resourcesPath = packager.getResourcesDir(context.appOutDir);
- const asarIntegrity = await computeData({
- resourcesPath,
- resourcesRelativePath: "Resources",
- resourcesDestinationPath: resourcesPath,
- extraResourceMatchers: [],
- });
2025-01-07 14:09:43 -05:00
-
- const plistPath = path.join(resourcesPath, "..", "Info.plist");
- const data = plist.parse(await readFile(plistPath, "utf8")) as unknown as Writable<plist.PlistObject>;
- data["ElectronAsarIntegrity"] = asarIntegrity as unknown as Writable<plist.PlistValue>;
- await writeFile(plistPath, plist.build(data));
-}
2025-01-07 14:09:43 -05:00
-
/**
* @type {import('electron-builder').Configuration}
* @see https://www.electron.build/configuration/configuration
@@ -89,9 +68,6 @@
loadBrowserProcessSpecificV8Snapshot: false,
enableEmbeddedAsarIntegrityValidation: true,
2025-01-07 14:09:43 -05:00
- },
- afterPack: async (context: AfterPackContext) => {
- await injectAsarIntegrity(context);
},
2025-01-07 14:09:43 -05:00
files: [
"package.json",