forked from CringeStudios/element-desktop
Compare commits
2 Commits
develop
...
t3chguy/ma
Author | SHA1 | Date | |
---|---|---|---|
![]() |
0856e64e42 | ||
![]() |
cf59556fd0 |
@ -1,10 +1,6 @@
|
||||
import * as os from "node:os";
|
||||
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";
|
||||
import { readFile, writeFile } from "node:fs/promises";
|
||||
import { Configuration as BaseConfiguration } from "electron-builder";
|
||||
|
||||
/**
|
||||
* This script has different outputs depending on your os platform.
|
||||
@ -46,26 +42,6 @@ interface Configuration extends BaseConfiguration {
|
||||
} & BaseConfiguration["deb"];
|
||||
}
|
||||
|
||||
async function injectAsarIntegrity(context: AfterPackContext) {
|
||||
const packager = context.packager;
|
||||
|
||||
// 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;
|
||||
|
||||
const resourcesPath = packager.getResourcesDir(context.appOutDir);
|
||||
const asarIntegrity = await computeData({
|
||||
resourcesPath,
|
||||
resourcesRelativePath: "Resources",
|
||||
resourcesDestinationPath: resourcesPath,
|
||||
extraResourceMatchers: [],
|
||||
});
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {import('electron-builder').Configuration}
|
||||
* @see https://www.electron.build/configuration/configuration
|
||||
@ -90,9 +66,6 @@ const config: Omit<Writable<Configuration>, "electronFuses"> & {
|
||||
loadBrowserProcessSpecificV8Snapshot: false,
|
||||
enableEmbeddedAsarIntegrityValidation: true,
|
||||
},
|
||||
afterPack: async (context: AfterPackContext) => {
|
||||
await injectAsarIntegrity(context);
|
||||
},
|
||||
files: [
|
||||
"package.json",
|
||||
{
|
||||
@ -154,6 +127,7 @@ const config: Omit<Writable<Configuration>, "electronFuses"> & {
|
||||
entitlements: "./build/entitlements.mac.plist",
|
||||
icon: "build/icons/icon.icns",
|
||||
mergeASARs: true,
|
||||
x64ArchFiles: "*.node", // hak already runs lipo
|
||||
},
|
||||
win: {
|
||||
target: ["squirrel", "msi"],
|
||||
|
@ -103,7 +103,6 @@
|
||||
"matrix-web-i18n": "^3.2.1",
|
||||
"mkdirp": "^3.0.0",
|
||||
"pacote": "^21.0.0",
|
||||
"plist": "^3.1.0",
|
||||
"prettier": "^3.0.0",
|
||||
"rimraf": "^6.0.0",
|
||||
"tar": "^7.0.0",
|
||||
@ -115,6 +114,7 @@
|
||||
"keytar": "^7.9.0"
|
||||
},
|
||||
"resolutions": {
|
||||
"@electron/universal": "2.0.2",
|
||||
"@types/node": "18.19.76",
|
||||
"config-file-ts": "0.2.8-rc1"
|
||||
}
|
||||
|
14
yarn.lock
14
yarn.lock
@ -978,7 +978,7 @@
|
||||
ajv "^6.12.0"
|
||||
ajv-keywords "^3.4.1"
|
||||
|
||||
"@electron/asar@3.2.18", "@electron/asar@^3.2.7":
|
||||
"@electron/asar@3.2.18":
|
||||
version "3.2.18"
|
||||
resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.2.18.tgz#fa607f829209bab8b9e0ce6658d3fe81b2cba517"
|
||||
integrity sha512-2XyvMe3N3Nrs8cV39IKELRHTYUWFKrmqqSY1U+GMlc0jvqjIVnoxhNd2H4JolWQncbJi1DCvb5TNxZuI2fEjWg==
|
||||
@ -987,7 +987,7 @@
|
||||
glob "^7.1.6"
|
||||
minimatch "^3.0.4"
|
||||
|
||||
"@electron/asar@3.3.1", "@electron/asar@^3.2.1":
|
||||
"@electron/asar@3.3.1", "@electron/asar@^3.2.1", "@electron/asar@^3.3.1":
|
||||
version "3.3.1"
|
||||
resolved "https://registry.yarnpkg.com/@electron/asar/-/asar-3.3.1.tgz#cd14e897770d9844673dd7c1dc8944e086e1e0ea"
|
||||
integrity sha512-WtpC/+34p0skWZiarRjLAyqaAX78DofhDxnREy/V5XHfu1XEXbFCSSMcDQ6hNCPJFaPy8/NnUgYuf9uiCkvKPg==
|
||||
@ -1076,12 +1076,12 @@
|
||||
tar "^6.0.5"
|
||||
yargs "^17.0.1"
|
||||
|
||||
"@electron/universal@2.0.1":
|
||||
version "2.0.1"
|
||||
resolved "https://registry.yarnpkg.com/@electron/universal/-/universal-2.0.1.tgz#7b070ab355e02957388f3dbd68e2c3cd08c448ae"
|
||||
integrity sha512-fKpv9kg4SPmt+hY7SVBnIYULE9QJl8L3sCfcBsnqbJwwBwAeTLokJ9TRt9y7bK0JAzIW2y78TVVjvnQEms/yyA==
|
||||
"@electron/universal@2.0.1", "@electron/universal@2.0.2":
|
||||
version "2.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@electron/universal/-/universal-2.0.2.tgz#834466e6b117fdb94048bcbde5c91d2d4571e718"
|
||||
integrity sha512-mqY1szx5/d5YLvfCDWWoJdkSIjIz+NdWN4pN0r78lYiE7De+slLpuF3lVxIT+hlJnwk5sH2wFRMl6/oUgUVO3A==
|
||||
dependencies:
|
||||
"@electron/asar" "^3.2.7"
|
||||
"@electron/asar" "^3.3.1"
|
||||
"@malept/cross-spawn-promise" "^2.0.0"
|
||||
debug "^4.3.1"
|
||||
dir-compare "^4.2.0"
|
||||
|
Loading…
x
Reference in New Issue
Block a user