app-builder-lib 26.15.6 → 26.16.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/out/configuration.d.ts +32 -0
- package/out/configuration.js.map +1 -1
- package/out/electron/ElectronFramework.d.ts +2 -1
- package/out/electron/ElectronFramework.js +30 -25
- package/out/electron/ElectronFramework.js.map +1 -1
- package/out/macPackager.d.ts +7 -2
- package/out/macPackager.js +40 -11
- package/out/macPackager.js.map +1 -1
- package/out/node-module-collector/nodeModulesCollector.d.ts +11 -1
- package/out/node-module-collector/nodeModulesCollector.js +16 -2
- package/out/node-module-collector/nodeModulesCollector.js.map +1 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.js +3 -1
- package/out/node-module-collector/pnpmNodeModulesCollector.js.map +1 -1
- package/out/targets/AppxTarget.js +5 -5
- package/out/targets/AppxTarget.js.map +1 -1
- package/out/targets/MsiTarget.js +8 -11
- package/out/targets/MsiTarget.js.map +1 -1
- package/out/targets/appimage/appImageUtil.d.ts +1 -1
- package/out/targets/appimage/appImageUtil.js +3 -3
- package/out/targets/appimage/appImageUtil.js.map +1 -1
- package/out/targets/appimage/appLauncher.js +3 -9
- package/out/targets/appimage/appLauncher.js.map +1 -1
- package/out/targets/blockmap/blockmap.js +2 -2
- package/out/targets/blockmap/blockmap.js.map +1 -1
- package/out/targets/nsis/nsisOptions.d.ts +2 -0
- package/out/targets/nsis/nsisOptions.js.map +1 -1
- package/out/toolsets/icons.js +2 -2
- package/out/toolsets/icons.js.map +1 -1
- package/out/toolsets/linux.js +3 -3
- package/out/toolsets/linux.js.map +1 -1
- package/out/util/appFileCopier.d.ts +21 -0
- package/out/util/appFileCopier.js +58 -0
- package/out/util/appFileCopier.js.map +1 -1
- package/out/util/electronGet.d.ts +46 -0
- package/out/util/electronGet.js +191 -35
- package/out/util/electronGet.js.map +1 -1
- package/out/version.d.ts +1 -1
- package/out/version.js +1 -1
- package/out/version.js.map +1 -1
- package/package.json +8 -8
- package/scheme.json +20 -1
- package/templates/appx/appxmanifest.xml +1 -2
- package/templates/nsis/include/allowOnlyOneInstallerInstance.nsh +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppxTarget.js","sourceRoot":"","sources":["../../src/targets/AppxTarget.ts"],"names":[],"mappings":";;AAAA,+CAAkG;AAClG,+DAA0D;AAC1D,uCAAiE;AACjE,6BAA4B;AAE5B,iDAA0D;AAC1D,kCAAgC;AAChC,qDAAqD;AAGrD,6CAA6C;AAC7C,iDAA+C;AAC/C,yDAAwE;AAExE,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAEnC,MAAM,4BAA4B,GAA2B;IAC3D,eAAe,EAAE,sBAAsB;IACvC,uBAAuB,EAAE,wBAAwB;IACjD,qBAAqB,EAAE,sBAAsB;IAC7C,qBAAqB,EAAE,wBAAwB;CAChD,CAAA;AAED,MAAM,6BAA6B,GAAG;IACpC,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAA;AAED,MAAM,qBAAqB,GAAG,OAAO,CAAA;AAErC,MAAqB,UAAW,SAAQ,aAAM;IAK5C,YACmB,QAAqB,EAC7B,MAAc;QAEvB,KAAK,CAAC,MAAM,CAAC,CAAA;QAHI,aAAQ,GAAR,QAAQ,CAAa;QAC7B,WAAM,GAAN,MAAM,CAAQ;QANhB,YAAO,GAAgB,IAAA,iCAAU,EAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,4BAA4B,EAAE,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;QAErH,qBAAgB,GAAG,KAAK,CAAA;QAQtB,IAAI,OAAO,CAAC,Q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AC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAyB;IACvD,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAA;AACrF,CAAC","sourcesContent":["import { Arch, asArray, copyOrLinkFile, InvalidConfigurationError, log, walk } from \"builder-util\"\nimport { deepAssign, Nullish } from \"builder-util-runtime\"\nimport { emptyDir, readdir, readFile, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { AppXOptions } from \"../\"\nimport { getWindowsKitsBundle } from \"../toolsets/windows\"\nimport { Target } from \"../core\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WinPackager } from \"../winPackager\"\nimport { createStageDir } from \"./targetUtil\"\nimport { isOldWin6 } from \"../toolsets/windows\"\nimport { CAPABILITIES, isValidCapabilityName } from \"./AppxCapabilities\"\n\nconst APPX_ASSETS_DIR_NAME = \"appx\"\n\nconst vendorAssetsForDefaultAssets: Record<string, string> = {\n \"StoreLogo.png\": \"SampleAppx.50x50.png\",\n \"Square150x150Logo.png\": \"SampleAppx.150x150.png\",\n \"Square44x44Logo.png\": \"SampleAppx.44x44.png\",\n \"Wide310x150Logo.png\": \"SampleAppx.310x150.png\",\n}\n\nconst restrictedApplicationIdValues = [\n \"CON\",\n \"PRN\",\n \"AUX\",\n \"NUL\",\n \"COM1\",\n \"COM2\",\n \"COM3\",\n \"COM4\",\n \"COM5\",\n \"COM6\",\n \"COM7\",\n \"COM8\",\n \"COM9\",\n \"LPT1\",\n \"LPT2\",\n \"LPT3\",\n \"LPT4\",\n \"LPT5\",\n \"LPT6\",\n \"LPT7\",\n \"LPT8\",\n \"LPT9\",\n]\n\nconst DEFAULT_RESOURCE_LANG = \"en-US\"\n\nexport default class AppXTarget extends Target {\n readonly options: AppXOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, this.packager.config.appx)\n\n isAsyncSupported = false\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"appx\")\n\n if (process.platform !== \"darwin\" && (process.platform !== \"win32\" || isOldWin6())) {\n throw new Error(\"AppX is supported only on Windows 10 or Windows Server 2012 R2 (version number 6.3+)\")\n }\n }\n\n // https://docs.microsoft.com/en-us/windows/uwp/packaging/create-app-package-with-makeappx-tool#mapping-files\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"appx\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"AppX\",\n file: artifactPath,\n arch,\n })\n\n const vendorPath = await getWindowsKitsBundle({ winCodeSign: this.packager.config.toolsets?.winCodeSign, arch: arch })\n const vm = await packager.vm.value\n\n const stageDir = await createStageDir(this, packager, arch)\n\n const mappingFile = stageDir.getTempFile(\"mapping.txt\")\n const makeAppXArgs = [\"pack\", \"/o\" /* overwrite the output file if it exists */, \"/f\", vm.toVmFile(mappingFile), \"/p\", vm.toVmFile(artifactPath)]\n if (packager.compression === \"store\") {\n makeAppXArgs.push(\"/nc\")\n }\n\n const mappingList: Array<Array<string>> = []\n mappingList.push(\n await Promise.all(\n (await walk(appOutDir)).map(file => {\n let appxPath = file.substring(appOutDir.length + 1)\n if (path.sep !== \"\\\\\") {\n appxPath = appxPath.replace(/\\//g, \"\\\\\")\n }\n return `\"${vm.toVmFile(file)}\" \"app\\\\${appxPath}\"`\n })\n )\n )\n\n const userAssetDir = await this.packager.getResource(undefined, APPX_ASSETS_DIR_NAME)\n const assetInfo = await AppXTarget.computeUserAssets(vm, vendorPath.appxAssets, userAssetDir)\n const userAssets = assetInfo.userAssets\n\n const manifestFile = stageDir.getTempFile(\"AppxManifest.xml\")\n await this.writeManifest(manifestFile, arch, await this.computePublisherName(), userAssets)\n\n await packager.info.emitAppxManifestCreated(manifestFile)\n mappingList.push(assetInfo.mappings)\n mappingList.push([`\"${vm.toVmFile(manifestFile)}\" \"AppxManifest.xml\"`])\n\n if (isScaledAssetsProvided(userAssets)) {\n const outFile = vm.toVmFile(stageDir.getTempFile(\"resources.pri\"))\n const makePriPath = vm.toVmFile(path.join(vendorPath.kit, \"makepri.exe\"))\n\n const assetRoot = stageDir.getTempFile(\"appx/assets\")\n await emptyDir(assetRoot)\n await Promise.all(assetInfo.allAssets.map(it => copyOrLinkFile(it, path.join(assetRoot, path.basename(it)))))\n\n await vm.exec(makePriPath, [\n \"new\",\n \"/Overwrite\",\n \"/Manifest\",\n vm.toVmFile(manifestFile),\n \"/ProjectRoot\",\n vm.toVmFile(path.dirname(assetRoot)),\n \"/ConfigXml\",\n vm.toVmFile(path.join(getTemplatePath(\"appx\"), \"priconfig.xml\")),\n \"/OutputFile\",\n outFile,\n ])\n\n // in addition to resources.pri, resources.scale-140.pri and other such files will be generated\n for (const resourceFile of (await readdir(stageDir.dir)).filter(it => it.startsWith(\"resources.\")).sort()) {\n mappingList.push([`\"${vm.toVmFile(stageDir.getTempFile(resourceFile))}\" \"${resourceFile}\"`])\n }\n makeAppXArgs.push(\"/l\")\n }\n\n let mapping = \"[Files]\"\n for (const list of mappingList) {\n mapping += \"\\r\\n\" + list.join(\"\\r\\n\")\n }\n await writeFile(mappingFile, mapping)\n packager.debugLogger.add(\"appx.mapping\", mapping)\n\n if (this.options.makeappxArgs != null) {\n makeAppXArgs.push(...this.options.makeappxArgs)\n }\n this.buildQueueManager.add(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath.kit, \"makeappx.exe\")), makeAppXArgs)\n await packager.signIf(artifactPath)\n\n await stageDir.cleanup()\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"appx\"),\n target: this,\n isWriteUpdateInfo: this.options.electronUpdaterAware,\n })\n })\n }\n\n private static async computeUserAssets(vm: VmManager, vendorPath: string, userAssetDir: string | null) {\n const mappings: Array<string> = []\n let userAssets: Array<string>\n const allAssets: Array<string> = []\n if (userAssetDir == null) {\n userAssets = []\n } else {\n userAssets = (await readdir(userAssetDir)).filter(it => !it.startsWith(\".\") && !it.endsWith(\".db\") && it.includes(\".\"))\n for (const name of userAssets) {\n mappings.push(`\"${vm.toVmFile(userAssetDir)}${vm.pathSep}${name}\" \"assets\\\\${name}\"`)\n allAssets.push(path.join(userAssetDir, name))\n }\n }\n\n for (const defaultAsset of Object.keys(vendorAssetsForDefaultAssets)) {\n if (userAssets.length === 0 || !isDefaultAssetIncluded(userAssets, defaultAsset)) {\n const file = path.join(vendorPath, \"appxAssets\", vendorAssetsForDefaultAssets[defaultAsset])\n mappings.push(`\"${vm.toVmFile(file)}\" \"assets\\\\${defaultAsset}\"`)\n allAssets.push(file)\n }\n }\n\n // we do not use process.arch to build path to tools, because even if you are on x64, ia32 appx tool must be used if you build appx for ia32\n return { userAssets, mappings, allAssets }\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n private async computePublisherName() {\n const signtoolManager = await this.packager.signingManager.value\n return signtoolManager.computePublisherName(this, this.options.publisher)\n }\n\n private async writeManifest(outFile: string, arch: Arch, publisher: string, userAssets: Array<string>) {\n const appInfo = this.packager.appInfo\n const options = this.options\n const executable = `app\\\\${appInfo.productFilename}.exe`\n const displayName = options.displayName || appInfo.productName\n const capabilities = this.getCapabilities()\n const extensions = await this.getExtensions(executable, displayName)\n const archSpecificMinVersion = arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"\n\n const customManifestPath = await this.packager.getResource(this.options.customManifestPath)\n if (customManifestPath) {\n log.info({ manifestPath: log.filePath(customManifestPath) }, \"custom appx manifest found\")\n }\n const manifestFileContent = await readFile(customManifestPath || path.join(getTemplatePath(\"appx\"), \"appxmanifest.xml\"), \"utf8\")\n const manifest = manifestFileContent.replace(/\\${([a-zA-Z0-9]+)}/g, (match, p1): string => {\n switch (p1) {\n case \"publisher\":\n return publisher\n\n case \"publisherDisplayName\": {\n const name = options.publisherDisplayName || appInfo.companyName\n if (name == null) {\n throw new InvalidConfigurationError(`Please specify \"author\" in the application package.json — it is required because \"appx.publisherDisplayName\" is not set.`)\n }\n return name\n }\n\n case \"version\":\n return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true)\n\n case \"applicationId\": {\n const validCharactersRegex = /^([A-Za-z][A-Za-z0-9]*)(\\.[A-Za-z][A-Za-z0-9]*)*$/\n const identitynumber = parseInt(options.identityName as string, 10) || NaN\n let result: string\n if (options.applicationId) {\n result = options.applicationId\n } else if (!isNaN(identitynumber) && options.identityName !== null && options.identityName !== undefined) {\n if (options.identityName[0] === \"0\") {\n log.warn(`Remove the 0${identitynumber}`)\n result = options.identityName.replace(\"0\" + identitynumber.toString(), \"\")\n } else {\n log.warn(`Remove the ${identitynumber}`)\n result = options.identityName.replace(identitynumber.toString(), \"\")\n }\n } else {\n result = options.identityName || appInfo.name\n }\n\n if (result.length < 1 || result.length > 64) {\n const message = `Appx Application.Id must be between 1 and 64 characters in length: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (!validCharactersRegex.test(result)) {\n const message = `AppX Application.Id cannot contain alpha-numeric, period, and dash characters: ${result}\"`\n throw new InvalidConfigurationError(message)\n } else if (restrictedApplicationIdValues.includes(result.toUpperCase())) {\n const message = `AppX Application.Id cannot contain restricted values ${JSON.stringify(restrictedApplicationIdValues)}: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (result == null && options.applicationId == null) {\n const message = `Please set appx.applicationId (or correct appx.identityName or name)`\n throw new InvalidConfigurationError(message)\n }\n\n return result\n }\n\n case \"identityName\": {\n const result = options.identityName || appInfo.name\n const validCharactersRegex = /^[a-zA-Z0-9.-]+$/\n if (result.length < 3 || result.length > 50) {\n const message = `Appx identityName.Id must be between 3 and 50 characters in length: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (!validCharactersRegex.test(result)) {\n const message = `AppX identityName.Id cannot contain of alpha-numeric, period, and dash characters: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (restrictedApplicationIdValues.includes(result.toUpperCase())) {\n const message = `AppX identityName.Id cannot contain restricted values ${JSON.stringify(restrictedApplicationIdValues)}: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (result == null && options.identityName == null) {\n const message = `Please set appx.identityName or name`\n throw new InvalidConfigurationError(message)\n }\n\n return result\n }\n\n case \"executable\":\n return executable\n\n case \"displayName\":\n return displayName\n\n case \"description\":\n return appInfo.description || appInfo.productName\n\n case \"backgroundColor\":\n return options.backgroundColor || \"#464646\"\n\n case \"logo\":\n return \"assets\\\\StoreLogo.png\"\n\n case \"square150x150Logo\":\n return \"assets\\\\Square150x150Logo.png\"\n\n case \"square44x44Logo\":\n return \"assets\\\\Square44x44Logo.png\"\n\n case \"lockScreen\":\n return lockScreenTag(userAssets)\n\n case \"defaultTile\":\n return defaultTileTag(userAssets, options.showNameOnTiles || false)\n\n case \"splashScreen\":\n return splashScreenTag(userAssets)\n\n case \"arch\":\n return arch === Arch.ia32 ? \"x86\" : arch === Arch.arm64 ? \"arm64\" : \"x64\"\n\n case \"resourceLanguages\":\n return resourceLanguageTag(asArray(options.languages))\n\n case \"capabilities\":\n return capabilities\n\n case \"extensions\":\n return extensions\n\n case \"minVersion\":\n return options.minVersion || archSpecificMinVersion\n\n case \"maxVersionTested\":\n return options.maxVersionTested || options.minVersion || archSpecificMinVersion\n\n default:\n throw new Error(`Macro ${p1} is not defined`)\n }\n })\n await writeFile(outFile, manifest)\n }\n\n private getCapabilities(): string {\n const caps = asArray(this.options.capabilities)\n\n const capSet = new Set(caps)\n\n const invalid = Array.from(capSet).filter(cap => !isValidCapabilityName(cap))\n if (invalid.length > 0) {\n throw new Error(`invalid windows capabilit${invalid.length === 1 ? \"y\" : \"ies\"} specified: ${invalid.join(\", \")}`)\n }\n\n // Ensure runFullTrust is always included\n capSet.add(\"runFullTrust\")\n\n // Filter and map in one pass\n const capabilityStrings = CAPABILITIES.filter(cap => capSet.has(cap.name)).map(cap => ` ${cap.toXMLString()}`)\n\n return `<Capabilities>\\n${capabilityStrings.join(\"\\n\")}\\n</Capabilities>`\n }\n\n private async getExtensions(executable: string, displayName: string): Promise<string> {\n const uriSchemes = asArray(this.packager.config.protocols).concat(asArray(this.packager.platformSpecificBuildOptions.protocols))\n\n const fileAssociations = asArray(this.packager.config.fileAssociations).concat(asArray(this.packager.platformSpecificBuildOptions.fileAssociations))\n\n let isAddAutoLaunchExtension = this.options.addAutoLaunchExtension\n if (isAddAutoLaunchExtension === undefined) {\n const deps = this.packager.info.metadata.dependencies\n isAddAutoLaunchExtension = deps != null && deps[\"electron-winstore-auto-launch\"] != null\n }\n\n if (!isAddAutoLaunchExtension && uriSchemes.length === 0 && fileAssociations.length === 0 && this.options.customExtensionsPath === undefined) {\n return \"\"\n }\n\n let extensions = \"<Extensions>\"\n\n if (isAddAutoLaunchExtension) {\n extensions += `\n <desktop:Extension Category=\"windows.startupTask\" Executable=\"${executable}\" EntryPoint=\"Windows.FullTrustApplication\">\n <desktop:StartupTask TaskId=\"SlackStartup\" Enabled=\"true\" DisplayName=\"${displayName}\" />\n </desktop:Extension>`\n }\n\n for (const protocol of uriSchemes) {\n for (const scheme of asArray(protocol.schemes)) {\n extensions += `\n <uap:Extension Category=\"windows.protocol\">\n <uap:Protocol Name=\"${scheme}\">\n <uap:DisplayName>${protocol.name}</uap:DisplayName>\n </uap:Protocol>\n </uap:Extension>`\n }\n }\n\n for (const fileAssociation of fileAssociations) {\n for (const ext of asArray(fileAssociation.ext)) {\n extensions += `\n <uap:Extension Category=\"windows.fileTypeAssociation\">\n <uap:FileTypeAssociation Name=\"${ext}\">\n <uap:SupportedFileTypes>\n <uap:FileType>.${ext}</uap:FileType>\n </uap:SupportedFileTypes>\n </uap:FileTypeAssociation>\n </uap:Extension>`\n }\n }\n\n if (this.options.customExtensionsPath !== undefined) {\n const extensionsPath = path.resolve(this.packager.info.appDir, this.options.customExtensionsPath)\n extensions += await readFile(extensionsPath, \"utf8\")\n }\n\n extensions += \"</Extensions>\"\n return extensions\n }\n}\n\n// get the resource - language tag, see https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest\nfunction resourceLanguageTag(userLanguages: Array<string> | Nullish): string {\n if (userLanguages == null || userLanguages.length === 0) {\n userLanguages = [DEFAULT_RESOURCE_LANG]\n }\n return userLanguages.map(it => `<Resource Language=\"${it.trim().replace(/_/g, \"-\")}\" />`).join(\"\\n\")\n}\n\nfunction lockScreenTag(userAssets: Array<string>): string {\n if (isDefaultAssetIncluded(userAssets, \"BadgeLogo.png\")) {\n return '<uap:LockScreen Notification=\"badgeAndTileText\" BadgeLogo=\"assets\\\\BadgeLogo.png\" />'\n } else {\n return \"\"\n }\n}\n\nfunction defaultTileTag(userAssets: Array<string>, showNameOnTiles: boolean): string {\n const defaultTiles: Array<string> = [\"<uap:DefaultTile\", 'Wide310x150Logo=\"assets\\\\Wide310x150Logo.png\"']\n\n if (isDefaultAssetIncluded(userAssets, \"LargeTile.png\")) {\n defaultTiles.push('Square310x310Logo=\"assets\\\\LargeTile.png\"')\n }\n if (isDefaultAssetIncluded(userAssets, \"SmallTile.png\")) {\n defaultTiles.push('Square71x71Logo=\"assets\\\\SmallTile.png\"')\n }\n\n if (showNameOnTiles) {\n defaultTiles.push(\">\")\n defaultTiles.push(\"<uap:ShowNameOnTiles>\")\n defaultTiles.push(\"<uap:ShowOn\", 'Tile=\"wide310x150Logo\"', \"/>\")\n defaultTiles.push(\"<uap:ShowOn\", 'Tile=\"square150x150Logo\"', \"/>\")\n defaultTiles.push(\"</uap:ShowNameOnTiles>\")\n defaultTiles.push(\"</uap:DefaultTile>\")\n } else {\n defaultTiles.push(\"/>\")\n }\n return defaultTiles.join(\" \")\n}\n\nfunction splashScreenTag(userAssets: Array<string>): string {\n if (isDefaultAssetIncluded(userAssets, \"SplashScreen.png\")) {\n return '<uap:SplashScreen Image=\"assets\\\\SplashScreen.png\" />'\n } else {\n return \"\"\n }\n}\n\nfunction isDefaultAssetIncluded(userAssets: Array<string>, defaultAsset: string) {\n const defaultAssetName = defaultAsset.substring(0, defaultAsset.indexOf(\".\"))\n return userAssets.some(it => it.includes(defaultAssetName))\n}\n\nfunction isScaledAssetsProvided(userAssets: Array<string>) {\n return userAssets.some(it => it.includes(\".scale-\") || it.includes(\".targetsize-\"))\n}\n"]}
|
|
1
|
+
{"version":3,"file":"AppxTarget.js","sourceRoot":"","sources":["../../src/targets/AppxTarget.ts"],"names":[],"mappings":";;AAAA,+CAAgH;AAChH,+DAA0D;AAC1D,uCAAiE;AACjE,6BAA4B;AAE5B,iDAA0D;AAC1D,kCAAgC;AAChC,qDAAqD;AAGrD,6CAA6C;AAC7C,iDAA+C;AAC/C,yDAAwE;AAExE,MAAM,oBAAoB,GAAG,MAAM,CAAA;AAEnC,MAAM,4BAA4B,GAA2B;IAC3D,eAAe,EAAE,sBAAsB;IACvC,uBAAuB,EAAE,wBAAwB;IACjD,qBAAqB,EAAE,sBAAsB;IAC7C,qBAAqB,EAAE,wBAAwB;CAChD,CAAA;AAED,MAAM,6BAA6B,GAAG;IACpC,KAAK;IACL,KAAK;IACL,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;IACN,MAAM;CACP,CAAA;AAED,MAAM,qBAAqB,GAAG,OAAO,CAAA;AAErC,MAAqB,UAAW,SAAQ,aAAM;IAK5C,YACmB,QAAqB,EAC7B,MAAc;QAEvB,KAAK,CAAC,MAAM,CAAC,CAAA;QAHI,aAAQ,GAAR,QAAQ,CAAa;QAC7B,WAAM,GAAN,MAAM,CAAQ;QANhB,YAAO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AC3D,OAAO,uDAAuD,CAAA;IAChE,CAAC;SAAM,CAAC;QACN,OAAO,EAAE,CAAA;IACX,CAAC;AACH,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAyB,EAAE,YAAoB;IAC7E,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,CAAC,CAAC,EAAE,YAAY,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAA;IAC7E,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,gBAAgB,CAAC,CAAC,CAAA;AAC7D,CAAC;AAED,SAAS,sBAAsB,CAAC,UAAyB;IACvD,OAAO,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC,CAAA;AACrF,CAAC","sourcesContent":["import { Arch, asArray, copyOrLinkFile, InvalidConfigurationError, log, walk, escapeForXml } from \"builder-util\"\nimport { deepAssign, Nullish } from \"builder-util-runtime\"\nimport { emptyDir, readdir, readFile, writeFile } from \"fs-extra\"\nimport * as path from \"path\"\nimport { AppXOptions } from \"../\"\nimport { getWindowsKitsBundle } from \"../toolsets/windows\"\nimport { Target } from \"../core\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WinPackager } from \"../winPackager\"\nimport { createStageDir } from \"./targetUtil\"\nimport { isOldWin6 } from \"../toolsets/windows\"\nimport { CAPABILITIES, isValidCapabilityName } from \"./AppxCapabilities\"\n\nconst APPX_ASSETS_DIR_NAME = \"appx\"\n\nconst vendorAssetsForDefaultAssets: Record<string, string> = {\n \"StoreLogo.png\": \"SampleAppx.50x50.png\",\n \"Square150x150Logo.png\": \"SampleAppx.150x150.png\",\n \"Square44x44Logo.png\": \"SampleAppx.44x44.png\",\n \"Wide310x150Logo.png\": \"SampleAppx.310x150.png\",\n}\n\nconst restrictedApplicationIdValues = [\n \"CON\",\n \"PRN\",\n \"AUX\",\n \"NUL\",\n \"COM1\",\n \"COM2\",\n \"COM3\",\n \"COM4\",\n \"COM5\",\n \"COM6\",\n \"COM7\",\n \"COM8\",\n \"COM9\",\n \"LPT1\",\n \"LPT2\",\n \"LPT3\",\n \"LPT4\",\n \"LPT5\",\n \"LPT6\",\n \"LPT7\",\n \"LPT8\",\n \"LPT9\",\n]\n\nconst DEFAULT_RESOURCE_LANG = \"en-US\"\n\nexport default class AppXTarget extends Target {\n readonly options: AppXOptions = deepAssign({}, this.packager.platformSpecificBuildOptions, this.packager.config.appx)\n\n isAsyncSupported = false\n\n constructor(\n private readonly packager: WinPackager,\n readonly outDir: string\n ) {\n super(\"appx\")\n\n if (process.platform !== \"darwin\" && (process.platform !== \"win32\" || isOldWin6())) {\n throw new Error(\"AppX is supported only on Windows 10 or Windows Server 2012 R2 (version number 6.3+)\")\n }\n }\n\n // https://docs.microsoft.com/en-us/windows/uwp/packaging/create-app-package-with-makeappx-tool#mapping-files\n async build(appOutDir: string, arch: Arch): Promise<any> {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"appx\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"AppX\",\n file: artifactPath,\n arch,\n })\n\n const vendorPath = await getWindowsKitsBundle({ winCodeSign: this.packager.config.toolsets?.winCodeSign, arch: arch })\n const vm = await packager.vm.value\n\n const stageDir = await createStageDir(this, packager, arch)\n\n const mappingFile = stageDir.getTempFile(\"mapping.txt\")\n const makeAppXArgs = [\"pack\", \"/o\" /* overwrite the output file if it exists */, \"/f\", vm.toVmFile(mappingFile), \"/p\", vm.toVmFile(artifactPath)]\n if (packager.compression === \"store\") {\n makeAppXArgs.push(\"/nc\")\n }\n\n const mappingList: Array<Array<string>> = []\n mappingList.push(\n await Promise.all(\n (await walk(appOutDir)).map(file => {\n let appxPath = file.substring(appOutDir.length + 1)\n if (path.sep !== \"\\\\\") {\n appxPath = appxPath.replace(/\\//g, \"\\\\\")\n }\n return `\"${vm.toVmFile(file)}\" \"app\\\\${appxPath}\"`\n })\n )\n )\n\n const userAssetDir = await this.packager.getResource(undefined, APPX_ASSETS_DIR_NAME)\n const assetInfo = await AppXTarget.computeUserAssets(vm, vendorPath.appxAssets, userAssetDir)\n const userAssets = assetInfo.userAssets\n\n const manifestFile = stageDir.getTempFile(\"AppxManifest.xml\")\n await this.writeManifest(manifestFile, arch, await this.computePublisherName(), userAssets)\n\n await packager.info.emitAppxManifestCreated(manifestFile)\n mappingList.push(assetInfo.mappings)\n mappingList.push([`\"${vm.toVmFile(manifestFile)}\" \"AppxManifest.xml\"`])\n\n if (isScaledAssetsProvided(userAssets)) {\n const outFile = vm.toVmFile(stageDir.getTempFile(\"resources.pri\"))\n const makePriPath = vm.toVmFile(path.join(vendorPath.kit, \"makepri.exe\"))\n\n const assetRoot = stageDir.getTempFile(\"appx/assets\")\n await emptyDir(assetRoot)\n await Promise.all(assetInfo.allAssets.map(it => copyOrLinkFile(it, path.join(assetRoot, path.basename(it)))))\n\n await vm.exec(makePriPath, [\n \"new\",\n \"/Overwrite\",\n \"/Manifest\",\n vm.toVmFile(manifestFile),\n \"/ProjectRoot\",\n vm.toVmFile(path.dirname(assetRoot)),\n \"/ConfigXml\",\n vm.toVmFile(path.join(getTemplatePath(\"appx\"), \"priconfig.xml\")),\n \"/OutputFile\",\n outFile,\n ])\n\n // in addition to resources.pri, resources.scale-140.pri and other such files will be generated\n for (const resourceFile of (await readdir(stageDir.dir)).filter(it => it.startsWith(\"resources.\")).sort()) {\n mappingList.push([`\"${vm.toVmFile(stageDir.getTempFile(resourceFile))}\" \"${resourceFile}\"`])\n }\n makeAppXArgs.push(\"/l\")\n }\n\n let mapping = \"[Files]\"\n for (const list of mappingList) {\n mapping += \"\\r\\n\" + list.join(\"\\r\\n\")\n }\n await writeFile(mappingFile, mapping)\n packager.debugLogger.add(\"appx.mapping\", mapping)\n\n if (this.options.makeappxArgs != null) {\n makeAppXArgs.push(...this.options.makeappxArgs)\n }\n this.buildQueueManager.add(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath.kit, \"makeappx.exe\")), makeAppXArgs)\n await packager.signIf(artifactPath)\n\n await stageDir.cleanup()\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"appx\"),\n target: this,\n isWriteUpdateInfo: this.options.electronUpdaterAware,\n })\n })\n }\n\n private static async computeUserAssets(vm: VmManager, vendorPath: string, userAssetDir: string | null) {\n const mappings: Array<string> = []\n let userAssets: Array<string>\n const allAssets: Array<string> = []\n if (userAssetDir == null) {\n userAssets = []\n } else {\n userAssets = (await readdir(userAssetDir)).filter(it => !it.startsWith(\".\") && !it.endsWith(\".db\") && it.includes(\".\"))\n for (const name of userAssets) {\n mappings.push(`\"${vm.toVmFile(userAssetDir)}${vm.pathSep}${name}\" \"assets\\\\${name}\"`)\n allAssets.push(path.join(userAssetDir, name))\n }\n }\n\n for (const defaultAsset of Object.keys(vendorAssetsForDefaultAssets)) {\n if (userAssets.length === 0 || !isDefaultAssetIncluded(userAssets, defaultAsset)) {\n const file = path.join(vendorPath, \"appxAssets\", vendorAssetsForDefaultAssets[defaultAsset])\n mappings.push(`\"${vm.toVmFile(file)}\" \"assets\\\\${defaultAsset}\"`)\n allAssets.push(file)\n }\n }\n\n // we do not use process.arch to build path to tools, because even if you are on x64, ia32 appx tool must be used if you build appx for ia32\n return { userAssets, mappings, allAssets }\n }\n\n // https://github.com/electron-userland/electron-builder/issues/2108#issuecomment-333200711\n private async computePublisherName() {\n const signtoolManager = await this.packager.signingManager.value\n return signtoolManager.computePublisherName(this, this.options.publisher)\n }\n\n private async writeManifest(outFile: string, arch: Arch, publisher: string, userAssets: Array<string>) {\n const appInfo = this.packager.appInfo\n const options = this.options\n const executable = `app\\\\${appInfo.productFilename}.exe`\n const displayName = options.displayName || appInfo.productName\n const capabilities = this.getCapabilities()\n const extensions = await this.getExtensions(executable, displayName)\n const archSpecificMinVersion = arch === Arch.arm64 ? \"10.0.16299.0\" : \"10.0.14316.0\"\n\n const customManifestPath = await this.packager.getResource(this.options.customManifestPath)\n if (customManifestPath) {\n log.info({ manifestPath: log.filePath(customManifestPath) }, \"custom appx manifest found\")\n }\n const manifestFileContent = await readFile(customManifestPath || path.join(getTemplatePath(\"appx\"), \"appxmanifest.xml\"), \"utf8\")\n const manifest = manifestFileContent.replace(/\\${([a-zA-Z0-9]+)}/g, (match, p1): string => {\n switch (p1) {\n case \"publisher\":\n return escapeForXml(publisher)\n\n case \"publisherDisplayName\": {\n const name = options.publisherDisplayName || appInfo.companyName\n if (name == null) {\n throw new InvalidConfigurationError(`Please specify \"author\" in the application package.json — it is required because \"appx.publisherDisplayName\" is not set.`)\n }\n return escapeForXml(name)\n }\n\n case \"version\":\n return appInfo.getVersionInWeirdWindowsForm(options.setBuildNumber === true)\n\n case \"applicationId\": {\n const validCharactersRegex = /^([A-Za-z][A-Za-z0-9]*)(\\.[A-Za-z][A-Za-z0-9]*)*$/\n const identitynumber = parseInt(options.identityName as string, 10) || NaN\n let result: string\n if (options.applicationId) {\n result = options.applicationId\n } else if (!isNaN(identitynumber) && options.identityName !== null && options.identityName !== undefined) {\n if (options.identityName[0] === \"0\") {\n log.warn(`Remove the 0${identitynumber}`)\n result = options.identityName.replace(\"0\" + identitynumber.toString(), \"\")\n } else {\n log.warn(`Remove the ${identitynumber}`)\n result = options.identityName.replace(identitynumber.toString(), \"\")\n }\n } else {\n result = options.identityName || appInfo.name\n }\n\n if (result.length < 1 || result.length > 64) {\n const message = `Appx Application.Id must be between 1 and 64 characters in length: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (!validCharactersRegex.test(result)) {\n const message = `AppX Application.Id cannot contain alpha-numeric, period, and dash characters: ${result}\"`\n throw new InvalidConfigurationError(message)\n } else if (restrictedApplicationIdValues.includes(result.toUpperCase())) {\n const message = `AppX Application.Id cannot contain restricted values ${JSON.stringify(restrictedApplicationIdValues)}: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (result == null && options.applicationId == null) {\n const message = `Please set appx.applicationId (or correct appx.identityName or name)`\n throw new InvalidConfigurationError(message)\n }\n\n return result\n }\n\n case \"identityName\": {\n const result = options.identityName || appInfo.name\n const validCharactersRegex = /^[a-zA-Z0-9.-]+$/\n if (result.length < 3 || result.length > 50) {\n const message = `Appx identityName.Id must be between 3 and 50 characters in length: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (!validCharactersRegex.test(result)) {\n const message = `AppX identityName.Id cannot contain of alpha-numeric, period, and dash characters: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (restrictedApplicationIdValues.includes(result.toUpperCase())) {\n const message = `AppX identityName.Id cannot contain restricted values ${JSON.stringify(restrictedApplicationIdValues)}: ${result}`\n throw new InvalidConfigurationError(message)\n } else if (result == null && options.identityName == null) {\n const message = `Please set appx.identityName or name`\n throw new InvalidConfigurationError(message)\n }\n\n return result\n }\n\n case \"executable\":\n return executable\n\n case \"displayName\":\n return escapeForXml(displayName)\n\n case \"description\":\n return escapeForXml(appInfo.description || appInfo.productName)\n\n case \"backgroundColor\":\n return escapeForXml(options.backgroundColor || \"#464646\")\n\n case \"logo\":\n return \"assets\\\\StoreLogo.png\"\n\n case \"square150x150Logo\":\n return \"assets\\\\Square150x150Logo.png\"\n\n case \"square44x44Logo\":\n return \"assets\\\\Square44x44Logo.png\"\n\n case \"lockScreen\":\n return lockScreenTag(userAssets)\n\n case \"defaultTile\":\n return defaultTileTag(userAssets, options.showNameOnTiles || false)\n\n case \"splashScreen\":\n return splashScreenTag(userAssets)\n\n case \"arch\":\n return arch === Arch.ia32 ? \"x86\" : arch === Arch.arm64 ? \"arm64\" : \"x64\"\n\n case \"resourceLanguages\":\n return resourceLanguageTag(asArray(options.languages))\n\n case \"capabilities\":\n return capabilities\n\n case \"extensions\":\n return extensions\n\n case \"minVersion\":\n return options.minVersion || archSpecificMinVersion\n\n case \"maxVersionTested\":\n return options.maxVersionTested || options.minVersion || archSpecificMinVersion\n\n default:\n throw new Error(`Macro ${p1} is not defined`)\n }\n })\n await writeFile(outFile, manifest)\n }\n\n private getCapabilities(): string {\n const caps = asArray(this.options.capabilities)\n\n const capSet = new Set(caps)\n\n const invalid = Array.from(capSet).filter(cap => !isValidCapabilityName(cap))\n if (invalid.length > 0) {\n throw new Error(`invalid windows capabilit${invalid.length === 1 ? \"y\" : \"ies\"} specified: ${invalid.join(\", \")}`)\n }\n\n // Ensure runFullTrust is always included\n capSet.add(\"runFullTrust\")\n\n // Filter and map in one pass\n const capabilityStrings = CAPABILITIES.filter(cap => capSet.has(cap.name)).map(cap => ` ${cap.toXMLString()}`)\n\n return `<Capabilities>\\n${capabilityStrings.join(\"\\n\")}\\n</Capabilities>`\n }\n\n private async getExtensions(executable: string, displayName: string): Promise<string> {\n const uriSchemes = asArray(this.packager.config.protocols).concat(asArray(this.packager.platformSpecificBuildOptions.protocols))\n\n const fileAssociations = asArray(this.packager.config.fileAssociations).concat(asArray(this.packager.platformSpecificBuildOptions.fileAssociations))\n\n let isAddAutoLaunchExtension = this.options.addAutoLaunchExtension\n if (isAddAutoLaunchExtension === undefined) {\n const deps = this.packager.info.metadata.dependencies\n isAddAutoLaunchExtension = deps != null && deps[\"electron-winstore-auto-launch\"] != null\n }\n\n if (!isAddAutoLaunchExtension && uriSchemes.length === 0 && fileAssociations.length === 0 && this.options.customExtensionsPath === undefined) {\n return \"\"\n }\n\n let extensions = \"<Extensions>\"\n\n if (isAddAutoLaunchExtension) {\n extensions += `\n <desktop:Extension Category=\"windows.startupTask\" Executable=\"${executable}\" EntryPoint=\"Windows.FullTrustApplication\">\n <desktop:StartupTask TaskId=\"SlackStartup\" Enabled=\"true\" DisplayName=\"${displayName}\" />\n </desktop:Extension>`\n }\n\n for (const protocol of uriSchemes) {\n for (const scheme of asArray(protocol.schemes)) {\n extensions += `\n <uap:Extension Category=\"windows.protocol\">\n <uap:Protocol Name=\"${scheme}\">\n <uap:DisplayName>${protocol.name}</uap:DisplayName>\n </uap:Protocol>\n </uap:Extension>`\n }\n }\n\n for (const fileAssociation of fileAssociations) {\n for (const ext of asArray(fileAssociation.ext)) {\n extensions += `\n <uap:Extension Category=\"windows.fileTypeAssociation\">\n <uap:FileTypeAssociation Name=\"${ext}\">\n <uap:SupportedFileTypes>\n <uap:FileType>.${ext}</uap:FileType>\n </uap:SupportedFileTypes>\n </uap:FileTypeAssociation>\n </uap:Extension>`\n }\n }\n\n if (this.options.customExtensionsPath !== undefined) {\n const extensionsPath = path.resolve(this.packager.info.appDir, this.options.customExtensionsPath)\n extensions += await readFile(extensionsPath, \"utf8\")\n }\n\n extensions += \"</Extensions>\"\n return extensions\n }\n}\n\n// get the resource - language tag, see https://docs.microsoft.com/en-us/windows/uwp/globalizing/manage-language-and-region#specify-the-supported-languages-in-the-apps-manifest\nfunction resourceLanguageTag(userLanguages: Array<string> | Nullish): string {\n if (userLanguages == null || userLanguages.length === 0) {\n userLanguages = [DEFAULT_RESOURCE_LANG]\n }\n return userLanguages.map(it => `<Resource Language=\"${it.trim().replace(/_/g, \"-\")}\" />`).join(\"\\n\")\n}\n\nfunction lockScreenTag(userAssets: Array<string>): string {\n if (isDefaultAssetIncluded(userAssets, \"BadgeLogo.png\")) {\n return '<uap:LockScreen Notification=\"badgeAndTileText\" BadgeLogo=\"assets\\\\BadgeLogo.png\" />'\n } else {\n return \"\"\n }\n}\n\nfunction defaultTileTag(userAssets: Array<string>, showNameOnTiles: boolean): string {\n const defaultTiles: Array<string> = [\"<uap:DefaultTile\", 'Wide310x150Logo=\"assets\\\\Wide310x150Logo.png\"']\n\n if (isDefaultAssetIncluded(userAssets, \"LargeTile.png\")) {\n defaultTiles.push('Square310x310Logo=\"assets\\\\LargeTile.png\"')\n }\n if (isDefaultAssetIncluded(userAssets, \"SmallTile.png\")) {\n defaultTiles.push('Square71x71Logo=\"assets\\\\SmallTile.png\"')\n }\n\n if (showNameOnTiles) {\n defaultTiles.push(\">\")\n defaultTiles.push(\"<uap:ShowNameOnTiles>\")\n defaultTiles.push(\"<uap:ShowOn\", 'Tile=\"wide310x150Logo\"', \"/>\")\n defaultTiles.push(\"<uap:ShowOn\", 'Tile=\"square150x150Logo\"', \"/>\")\n defaultTiles.push(\"</uap:ShowNameOnTiles>\")\n defaultTiles.push(\"</uap:DefaultTile>\")\n } else {\n defaultTiles.push(\"/>\")\n }\n return defaultTiles.join(\" \")\n}\n\nfunction splashScreenTag(userAssets: Array<string>): string {\n if (isDefaultAssetIncluded(userAssets, \"SplashScreen.png\")) {\n return '<uap:SplashScreen Image=\"assets\\\\SplashScreen.png\" />'\n } else {\n return \"\"\n }\n}\n\nfunction isDefaultAssetIncluded(userAssets: Array<string>, defaultAsset: string) {\n const defaultAssetName = defaultAsset.substring(0, defaultAsset.indexOf(\".\"))\n return userAssets.some(it => it.includes(defaultAssetName))\n}\n\nfunction isScaledAssetsProvided(userAssets: Array<string>) {\n return userAssets.some(it => it.includes(\".scale-\") || it.includes(\".targetsize-\"))\n}\n"]}
|
package/out/targets/MsiTarget.js
CHANGED
|
@@ -197,7 +197,7 @@ class MsiTarget extends core_1.Target {
|
|
|
197
197
|
directoryId = "d" + (0, crypto_1.createHash)("md5").update(dirName).digest("base64").replace(/\//g, "_").replace(/\+/g, ".").replace(/=+$/, "");
|
|
198
198
|
if (!dirNames.has(dirName)) {
|
|
199
199
|
dirNames.add(dirName);
|
|
200
|
-
dirs.push(`<Directory Id="${directoryId}" Name="${ROOT_DIR_ID}:\\${dirName.replace(/\//g, "\\")}\\"/>`);
|
|
200
|
+
dirs.push(`<Directory Id="${directoryId}" Name="${ROOT_DIR_ID}:\\${(0, builder_util_1.escapeForXml)(dirName.replace(/\//g, "\\"))}\\"/>`);
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
else if (!isRootDirAddedToRemoveTable) {
|
|
@@ -206,7 +206,7 @@ class MsiTarget extends core_1.Target {
|
|
|
206
206
|
// since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid
|
|
207
207
|
// https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix
|
|
208
208
|
let result = `<Component${directoryId === null ? "" : ` Directory="${directoryId}"`}>`;
|
|
209
|
-
result += `\n${fileSpace} <File Name="${
|
|
209
|
+
result += `\n${fileSpace} <File Name="${(0, builder_util_1.escapeForXml)(fileName)}" Source="$(var.appDir)${path.sep}${(0, builder_util_1.escapeForXml)(packagePath)}" ReadOnly="yes" KeyPath="yes"`;
|
|
210
210
|
const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`;
|
|
211
211
|
if (isMainExecutable) {
|
|
212
212
|
result += ' Id="mainExecutable"';
|
|
@@ -219,16 +219,16 @@ class MsiTarget extends core_1.Target {
|
|
|
219
219
|
result += `>\n`;
|
|
220
220
|
const shortcutName = commonOptions.shortcutName;
|
|
221
221
|
if (isCreateDesktopShortcut) {
|
|
222
|
-
result += `${fileSpace} <Shortcut Id="desktopShortcut" Directory="DesktopFolder" Name="${
|
|
222
|
+
result += `${fileSpace} <Shortcut Id="desktopShortcut" Directory="DesktopFolder" Name="${(0, builder_util_1.escapeForXml)(shortcutName)}" WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" Icon="${this.iconId}"/>\n`;
|
|
223
223
|
}
|
|
224
224
|
const hasMenuCategory = commonOptions.menuCategory != null;
|
|
225
225
|
const startMenuShortcutDirectoryId = hasMenuCategory ? "AppProgramMenuDir" : "ProgramMenuFolder";
|
|
226
226
|
if (commonOptions.isCreateStartMenuShortcut) {
|
|
227
227
|
if (hasMenuCategory) {
|
|
228
|
-
dirs.push(`<Directory Id="${startMenuShortcutDirectoryId}" Name="ProgramMenuFolder:\\${commonOptions.menuCategory}\\"/>`);
|
|
228
|
+
dirs.push(`<Directory Id="${startMenuShortcutDirectoryId}" Name="ProgramMenuFolder:\\${(0, builder_util_1.escapeForXml)(commonOptions.menuCategory)}\\"/>`);
|
|
229
229
|
}
|
|
230
|
-
result += `${fileSpace} <Shortcut Id="startMenuShortcut" Directory="${startMenuShortcutDirectoryId}" Name="${
|
|
231
|
-
result += `${fileSpace} <ShortcutProperty Key="System.AppUserModel.ID" Value="${
|
|
230
|
+
result += `${fileSpace} <Shortcut Id="startMenuShortcut" Directory="${startMenuShortcutDirectoryId}" Name="${(0, builder_util_1.escapeForXml)(shortcutName)}" WorkingDirectory="APPLICATIONFOLDER" Advertise="yes" Icon="${this.iconId}">\n`;
|
|
231
|
+
result += `${fileSpace} <ShortcutProperty Key="System.AppUserModel.ID" Value="${(0, builder_util_1.escapeForXml)(this.packager.appInfo.id)}"/>\n`;
|
|
232
232
|
result += `${fileSpace} </Shortcut>\n`;
|
|
233
233
|
}
|
|
234
234
|
result += `${fileSpace}</File>`;
|
|
@@ -244,9 +244,9 @@ class MsiTarget extends core_1.Target {
|
|
|
244
244
|
for (const item of fileAssociations) {
|
|
245
245
|
const extensions = (0, builder_util_1.asArray)(item.ext).map(platformPackager_1.normalizeExt);
|
|
246
246
|
for (const ext of extensions) {
|
|
247
|
-
result += `${fileSpace} <ProgId Id="${this.productMsiIdPrefix}.${ext}" Advertise="yes" Icon="${this.iconId}" ${item.description ? `Description="${item.description}"` : ""}>\n`;
|
|
247
|
+
result += `${fileSpace} <ProgId Id="${this.productMsiIdPrefix}.${ext}" Advertise="yes" Icon="${this.iconId}" ${item.description ? `Description="${(0, builder_util_1.escapeForXml)(item.description)}"` : ""}>\n`;
|
|
248
248
|
result += `${fileSpace} <Extension Id="${ext}" Advertise="yes">\n`;
|
|
249
|
-
result += `${fileSpace} <Verb Id="open" Command="Open with ${
|
|
249
|
+
result += `${fileSpace} <Verb Id="open" Command="Open with ${(0, builder_util_1.escapeForXml)(this.packager.appInfo.productName)}" Argument=""%1""/>\n`;
|
|
250
250
|
result += `${fileSpace} </Extension>\n`;
|
|
251
251
|
result += `${fileSpace} </ProgId>\n`;
|
|
252
252
|
}
|
|
@@ -262,7 +262,4 @@ function listToString(list, indentLevel) {
|
|
|
262
262
|
const space = " ".repeat(indentLevel * 2);
|
|
263
263
|
return list.join(`\n${space}`);
|
|
264
264
|
}
|
|
265
|
-
function xmlAttr(str) {
|
|
266
|
-
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
267
|
-
}
|
|
268
265
|
//# sourceMappingURL=MsiTarget.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MsiTarget.js","sourceRoot":"","sources":["../../src/targets/MsiTarget.ts"],"names":[],"mappings":";;AAAA,+CAAuD;AACvD,+DAAuD;AACvD,mCAAmC;AACnC,2BAA0B;AAC1B,0CAAiD;AACjD,uCAA+B;AAC/B,6BAA4B;AAE5B,gDAA8C;AAC9C,kCAAgC;AAChC,wGAAuJ;AACvJ,0DAAkD;AAClD,qDAAqD;AACrD,iCAAoC;AACpC,yCAA4C;AAE5C,qDAAqD;AACrD,6CAA4E;AAE5E,MAAM,qCAAqC,GAAG,2BAAI,CAAC,KAAK,CAAC,sCAAsC,CAAC,CAAA;AAChG,MAAM,WAAW,GAAG,mBAAmB,CAAA;AAEvC,mHAAmH;AACnH,MAAqB,SAAU,SAAQ,aAAM;IAK3C,YACqB,QAAqB,EAC/B,MAAc,EACvB,IAAI,GAAG,KAAK,EACZ,gBAAgB,GAAG,IAAI;;QAEvB,KAAK,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAA;QALV,aAAQ,GAAR,QAAQ,CAAa;QAC/B,WAAM,GAAN,MAAM,CAAQ;QANN,OAAE,GAAG,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,IAAI,cAAS,EAAE,CAAC,CAAC,CAAC,IAAI,sBAAa,CAAC,MAAA,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,0CAAE,IAAI,CAAC,CAAA;QAEtH,YAAO,GAAe,IAAA,iCAAU,EAAC,IAAI,CAAC,QAAQ,CAA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,iCAAiC,CAAA;wBAC7I,MAAM,IAAI,GAAG,SAAS,oBAAoB,CAAA;wBAC1C,MAAM,IAAI,GAAG,SAAS,eAAe,CAAA;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,GAAG,MAAM,KAAK,SAAS,cAAc,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAA;IACvE,CAAC;CACF;AAvRD,4BAuRC;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,WAAmB;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC;AAED,SAAS,OAAO,CAAC,GAAW;IAC1B,OAAO,GAAG,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAA;AAC/H,CAAC","sourcesContent":["import { Arch, asArray, log, walk } from \"builder-util\"\nimport { deepAssign, UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { withToolsetLock } from \"../util/toolsetLock\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager(this.packager.config.toolsets?.wine)\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n // wix 4.0.0.5512.2 doesn't support the arm64 architecture so default to x64 when building for arm64.\n // This will result in an x64 MSI installer that installs an arm64 version of the application. This is a\n // stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixArch = arch == Arch.arm64 ? Arch.x64 : arch\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.info.emitMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromUrl(\"wix-4.0.0.5512.2\", \"wix-4.0.0.5512.2.7z\", \"fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", wixArch === Arch.ia32 ? \"x86\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array<string>, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\",\n vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n return {\n ...commonOptions,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n }\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = (await walk(appOutDir)).map(file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${dirName.replace(/\\//g, \"\\\\\")}\\\\\"/>`)\n }\n } else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = `<Component${directoryId === null ? \"\" : ` Directory=\"${directoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${xmlAttr(fileName)}\" Source=\"$(var.appDir)${path.sep}${xmlAttr(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n } else if (directoryId === null) {\n result += ` Id=\"${path.basename(packagePath)}_f\"`\n }\n\n const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER\n if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {\n result += `>\\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} <Shortcut Id=\"desktopShortcut\" Directory=\"DesktopFolder\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\"/>\\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${commonOptions.menuCategory}\\\\\"/>`)\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${xmlAttr(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\">\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${xmlAttr(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${ext}\" Advertise=\"yes\" Icon=\"${this.iconId}\" ${\n item.description ? `Description=\"${item.description}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${ext}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${xmlAttr(this.packager.appInfo.productName)}\" Argument=\""%1"\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n\nfunction xmlAttr(str: string) {\n return str.replace(/&/g, \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AAe,CAAA;oBACvC,CAAC;gBACH,CAAC;YACH,CAAC;YAED,OAAO,GAAG,MAAM,KAAK,SAAS,cAAc,CAAA;QAC9C,CAAC,CAAC,CAAA;QAEF,OAAO,EAAE,IAAI,EAAE,YAAY,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,CAAA;IACvE,CAAC;CACF;AAvRD,4BAuRC;AAED,SAAS,YAAY,CAAC,IAAmB,EAAE,WAAmB;IAC5D,MAAM,KAAK,GAAG,GAAG,CAAC,MAAM,CAAC,WAAW,GAAG,CAAC,CAAC,CAAA;IACzC,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,EAAE,CAAC,CAAA;AAChC,CAAC","sourcesContent":["import { Arch, asArray, log, walk, escapeForXml } from \"builder-util\"\nimport { deepAssign, UUID } from \"builder-util-runtime\"\nimport { createHash } from \"crypto\"\nimport * as ejs from \"ejs\"\nimport { readFile, writeFile } from \"fs/promises\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { MsiOptions } from \"../\"\nimport { getBinFromUrl } from \"../binDownload\"\nimport { Target } from \"../core\"\nimport { DesktopShortcutCreationPolicy, FinalCommonWindowsInstallerOptions, getEffectiveOptions } from \"../options/CommonWindowsInstallerConfiguration\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { getTemplatePath } from \"../util/pathManager\"\nimport { VmManager } from \"../vm/vm\"\nimport { WineVmManager } from \"../vm/WineVm\"\nimport { WinPackager } from \"../winPackager\"\nimport { withToolsetLock } from \"../util/toolsetLock\"\nimport { createStageDir, getWindowsInstallationDirName } from \"./targetUtil\"\n\nconst ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID = UUID.parse(\"d752fe43-5d44-44d5-9fc9-6dd1bf19d5cc\")\nconst ROOT_DIR_ID = \"APPLICATIONFOLDER\"\n\n// WiX doesn't support Mono, so, dontnet462 is required to be installed for wine (preinstalled in our bundled wine)\nexport default class MsiTarget extends Target {\n protected readonly vm = process.platform === \"win32\" ? new VmManager() : new WineVmManager(this.packager.config.toolsets?.wine)\n\n readonly options: MsiOptions = deepAssign(this.packager.platformSpecificBuildOptions, this.packager.config.msi)\n\n constructor(\n protected readonly packager: WinPackager,\n readonly outDir: string,\n name = \"msi\",\n isAsyncSupported = true\n ) {\n super(name, isAsyncSupported)\n }\n\n protected projectTemplate = new Lazy<(data: any) => string>(async () => {\n const template = (await readFile(path.join(getTemplatePath(this.name), \"template.xml\"), \"utf8\"))\n .replace(/{{/g, \"<%\")\n .replace(/}}/g, \"%>\")\n .replace(/\\${([^}]+)}/g, \"<%=$1%>\")\n return ejs.compile(template)\n })\n\n /**\n * A product-specific string that can be used in an [MSI Identifier](https://docs.microsoft.com/en-us/windows/win32/msi/identifier).\n */\n private get productMsiIdPrefix() {\n const sanitizedId = this.packager.appInfo.productFilename.replace(/[^\\w.]/g, \"\").replace(/^[^A-Za-z_]+/, \"\")\n return sanitizedId.length > 0 ? sanitizedId : \"App\" + this.upgradeCode.replace(/-/g, \"\")\n }\n\n protected get iconId() {\n return `${this.productMsiIdPrefix}Icon.exe`\n }\n\n protected get upgradeCode(): string {\n return (this.options.upgradeCode || UUID.v5(this.packager.appInfo.id, ELECTRON_BUILDER_UPGRADE_CODE_NS_UUID)).toUpperCase()\n }\n\n async build(appOutDir: string, arch: Arch) {\n const packager = this.packager\n const artifactName = packager.expandArtifactBeautyNamePattern(this.options, \"msi\", arch)\n const artifactPath = path.join(this.outDir, artifactName)\n await packager.info.emitArtifactBuildStarted({\n targetPresentableName: \"MSI\",\n file: artifactPath,\n arch,\n })\n\n const stageDir = await createStageDir(this, packager, arch)\n const vm = this.vm\n\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n\n // wix 4.0.0.5512.2 doesn't support the arm64 architecture so default to x64 when building for arm64.\n // This will result in an x64 MSI installer that installs an arm64 version of the application. This is a\n // stopgap until the electron-builder-binaries wix version is upgraded to a version that supports arm64:\n // https://github.com/electron-userland/electron-builder/issues/6077\n const wixArch = arch == Arch.arm64 ? Arch.x64 : arch\n\n const projectFile = stageDir.getTempFile(\"project.wxs\")\n const objectFiles = [\"project.wixobj\"]\n await writeFile(projectFile, await this.writeManifest(appOutDir, wixArch, commonOptions))\n\n await packager.info.emitMsiProjectCreated(projectFile)\n\n // noinspection SpellCheckingInspection\n const vendorPath = await getBinFromUrl(\"wix-4.0.0.5512.2\", \"wix-4.0.0.5512.2.7z\", \"fe677fcd837b18c9b912985d91636bbd8a1e800c3b3a6a841b6f96e89624e839\")\n\n // noinspection SpellCheckingInspection\n const candleArgs = [\"-arch\", wixArch === Arch.ia32 ? \"x86\" : \"x64\", `-dappDir=${vm.toVmFile(appOutDir)}`].concat(this.getCommonWixArgs())\n candleArgs.push(\"project.wxs\")\n await withToolsetLock(async () => {\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"candle.exe\")), candleArgs, {\n cwd: stageDir.dir,\n })\n await this.light(objectFiles, vm, artifactPath, appOutDir, vendorPath, stageDir.dir)\n })\n\n await stageDir.cleanup()\n\n await packager.signIf(artifactPath)\n\n await packager.info.emitArtifactBuildCompleted({\n file: artifactPath,\n packager,\n arch,\n safeArtifactName: packager.computeSafeArtifactName(artifactName, \"msi\"),\n target: this,\n isWriteUpdateInfo: false,\n })\n }\n\n private async light(objectFiles: Array<string>, vm: VmManager, artifactPath: string, appOutDir: string, vendorPath: string, tempDir: string) {\n // noinspection SpellCheckingInspection\n const lightArgs = [\n \"-out\",\n vm.toVmFile(artifactPath),\n \"-v\",\n // https://github.com/wixtoolset/issues/issues/5169\n \"-spdb\",\n // https://sourceforge.net/p/wix/bugs/2405/\n // error LGHT1076 : ICE61: This product should remove only older versions of itself. The Maximum version is not less than the current product. (1.1.0.42 1.1.0.42)\n \"-sw1076\",\n `-dappDir=${vm.toVmFile(appOutDir)}`,\n // \"-dcl:high\",\n ]\n .concat(this.getCommonWixArgs())\n .concat(this.getAdditionalLightArgs())\n\n // http://windows-installer-xml-wix-toolset.687559.n2.nabble.com/Build-3-5-2229-0-give-me-the-following-error-error-LGHT0216-An-unexpected-Win32-exception-with-errorn-td5707443.html\n if (process.platform !== \"win32\") {\n // noinspection SpellCheckingInspection\n lightArgs.push(\"-sval\")\n }\n\n if (this.options.oneClick === false) {\n lightArgs.push(\"-ext\", \"WixUIExtension\")\n }\n\n // objectFiles - only filenames, we set current directory to our temp stage dir\n lightArgs.push(...objectFiles)\n await vm.exec(vm.toVmFile(path.join(vendorPath, \"light.exe\")), lightArgs, {\n cwd: tempDir,\n })\n }\n\n private getAdditionalLightArgs() {\n const args: Array<string> = []\n if (this.options.additionalLightArgs != null) {\n args.push(...this.options.additionalLightArgs)\n }\n return args\n }\n\n private getCommonWixArgs() {\n const args: Array<string> = [\"-pedantic\"]\n if (this.options.warningsAsErrors !== false) {\n args.push(\"-wx\")\n }\n if (this.options.additionalWixArgs != null) {\n args.push(...this.options.additionalWixArgs)\n }\n return args\n }\n\n protected async writeManifest(appOutDir: string, wixArch: Arch, commonOptions: FinalCommonWindowsInstallerOptions) {\n const appInfo = this.packager.appInfo\n const { files, dirs } = await this.computeFileDeclaration(appOutDir)\n const options = this.options\n\n return (await this.projectTemplate.value)({\n ...(await this.getBaseOptions(commonOptions)),\n isCreateDesktopShortcut: commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER,\n isRunAfterFinish: options.runAfterFinish !== false,\n // https://stackoverflow.com/questions/1929038/compilation-error-ice80-the-64bitcomponent-uses-32bitdirectory\n programFilesId: wixArch === Arch.x64 ? \"ProgramFiles64Folder\" : \"ProgramFilesFolder\",\n // wix in the name because special wix format can be used in the name\n installationDirectoryWixName: getWindowsInstallationDirName(appInfo, commonOptions.isAssisted || commonOptions.isPerMachine === true),\n dirs,\n files,\n })\n }\n\n protected async getBaseOptions(commonOptions: FinalCommonWindowsInstallerOptions): Promise<any> {\n const appInfo = this.packager.appInfo\n const iconPath = await this.packager.getIconPath()\n const compression = this.packager.compression\n\n const companyName = appInfo.companyName\n if (!companyName) {\n log.warn(`Manufacturer is not set for MSI — please set \"author\" in the package.json`)\n }\n\n return {\n ...commonOptions,\n iconPath: iconPath == null ? null : this.vm.toVmFile(iconPath),\n iconId: this.iconId,\n compressionLevel: compression === \"store\" ? \"none\" : \"high\",\n version: appInfo.getVersionInWeirdWindowsForm(),\n productName: appInfo.productName,\n upgradeCode: this.upgradeCode,\n manufacturer: companyName || appInfo.productName,\n appDescription: appInfo.description,\n }\n }\n\n private async computeFileDeclaration(appOutDir: string) {\n const appInfo = this.packager.appInfo\n let isRootDirAddedToRemoveTable = false\n const dirNames = new Set<string>()\n const dirs: Array<string> = []\n const fileSpace = \" \".repeat(6)\n const commonOptions = getEffectiveOptions(this.options, this.packager)\n const files = (await walk(appOutDir)).map(file => {\n const packagePath = file.substring(appOutDir.length + 1)\n\n const lastSlash = packagePath.lastIndexOf(path.sep)\n const fileName = lastSlash > 0 ? packagePath.substring(lastSlash + 1) : packagePath\n let directoryId: string | null = null\n let dirName = \"\"\n // Wix Directory.FileSource doesn't work - https://stackoverflow.com/questions/21519388/wix-filesource-confusion\n if (lastSlash > 0) {\n // This Name attribute may also define multiple directories using the inline directory syntax.\n // For example, \"ProgramFilesFolder:\\My Company\\My Product\\bin\" would create a reference to a Directory element with Id=\"ProgramFilesFolder\" then create directories named \"My Company\" then \"My Product\" then \"bin\" nested beneath each other.\n // This syntax is a shortcut to defining each directory in an individual Directory element.\n dirName = packagePath.substring(0, lastSlash)\n // https://github.com/electron-userland/electron-builder/issues/3027\n directoryId = \"d\" + createHash(\"md5\").update(dirName).digest(\"base64\").replace(/\\//g, \"_\").replace(/\\+/g, \".\").replace(/=+$/, \"\")\n if (!dirNames.has(dirName)) {\n dirNames.add(dirName)\n dirs.push(`<Directory Id=\"${directoryId}\" Name=\"${ROOT_DIR_ID}:\\\\${escapeForXml(dirName.replace(/\\//g, \"\\\\\"))}\\\\\"/>`)\n }\n } else if (!isRootDirAddedToRemoveTable) {\n isRootDirAddedToRemoveTable = true\n }\n\n // since RegistryValue can be part of Component, *** *** *** *** *** *** *** *** *** wix cannot auto generate guid\n // https://stackoverflow.com/questions/1405100/change-my-component-guid-in-wix\n let result = `<Component${directoryId === null ? \"\" : ` Directory=\"${directoryId}\"`}>`\n result += `\\n${fileSpace} <File Name=\"${escapeForXml(fileName)}\" Source=\"$(var.appDir)${path.sep}${escapeForXml(packagePath)}\" ReadOnly=\"yes\" KeyPath=\"yes\"`\n const isMainExecutable = packagePath === `${appInfo.productFilename}.exe`\n if (isMainExecutable) {\n result += ' Id=\"mainExecutable\"'\n } else if (directoryId === null) {\n result += ` Id=\"${path.basename(packagePath)}_f\"`\n }\n\n const isCreateDesktopShortcut = commonOptions.isCreateDesktopShortcut !== DesktopShortcutCreationPolicy.NEVER\n if (isMainExecutable && (isCreateDesktopShortcut || commonOptions.isCreateStartMenuShortcut)) {\n result += `>\\n`\n const shortcutName = commonOptions.shortcutName\n if (isCreateDesktopShortcut) {\n result += `${fileSpace} <Shortcut Id=\"desktopShortcut\" Directory=\"DesktopFolder\" Name=\"${escapeForXml(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\"/>\\n`\n }\n\n const hasMenuCategory = commonOptions.menuCategory != null\n const startMenuShortcutDirectoryId = hasMenuCategory ? \"AppProgramMenuDir\" : \"ProgramMenuFolder\"\n if (commonOptions.isCreateStartMenuShortcut) {\n if (hasMenuCategory) {\n dirs.push(`<Directory Id=\"${startMenuShortcutDirectoryId}\" Name=\"ProgramMenuFolder:\\\\${escapeForXml(commonOptions.menuCategory)}\\\\\"/>`)\n }\n result += `${fileSpace} <Shortcut Id=\"startMenuShortcut\" Directory=\"${startMenuShortcutDirectoryId}\" Name=\"${escapeForXml(\n shortcutName\n )}\" WorkingDirectory=\"APPLICATIONFOLDER\" Advertise=\"yes\" Icon=\"${this.iconId}\">\\n`\n result += `${fileSpace} <ShortcutProperty Key=\"System.AppUserModel.ID\" Value=\"${escapeForXml(this.packager.appInfo.id)}\"/>\\n`\n result += `${fileSpace} </Shortcut>\\n`\n }\n result += `${fileSpace}</File>`\n\n if (hasMenuCategory) {\n result += `<RemoveFolder Id=\"${startMenuShortcutDirectoryId}\" Directory=\"${startMenuShortcutDirectoryId}\" On=\"uninstall\"/>\\n`\n }\n } else {\n result += `/>`\n }\n\n const fileAssociations = this.packager.fileAssociations\n if (isMainExecutable && fileAssociations.length !== 0) {\n for (const item of fileAssociations) {\n const extensions = asArray(item.ext).map(normalizeExt)\n for (const ext of extensions) {\n result += `${fileSpace} <ProgId Id=\"${this.productMsiIdPrefix}.${ext}\" Advertise=\"yes\" Icon=\"${this.iconId}\" ${\n item.description ? `Description=\"${escapeForXml(item.description)}\"` : \"\"\n }>\\n`\n result += `${fileSpace} <Extension Id=\"${ext}\" Advertise=\"yes\">\\n`\n result += `${fileSpace} <Verb Id=\"open\" Command=\"Open with ${escapeForXml(this.packager.appInfo.productName)}\" Argument=\""%1"\"/>\\n`\n result += `${fileSpace} </Extension>\\n`\n result += `${fileSpace} </ProgId>\\n`\n }\n }\n }\n\n return `${result}\\n${fileSpace}</Component>`\n })\n\n return { dirs: listToString(dirs, 2), files: listToString(files, 3) }\n }\n}\n\nfunction listToString(list: Array<string>, indentLevel: number) {\n const space = \" \".repeat(indentLevel * 2)\n return list.join(`\\n${space}`)\n}\n"]}
|
|
@@ -36,7 +36,7 @@ export declare function buildLegacyFuse2AppImage(opts: AppImageBuilderOptions):
|
|
|
36
36
|
/**
|
|
37
37
|
* Validates that critical path fields (executable name, product filename, license filename)
|
|
38
38
|
* contain only characters that are safe for use in filesystem paths and embedded bash strings.
|
|
39
|
-
* Allowed: Unicode letters, digits, dots, underscores, hyphens, and
|
|
39
|
+
* Allowed: Unicode letters, digits, dots, underscores, hyphens, spaces, and parentheses.
|
|
40
40
|
*/
|
|
41
41
|
export declare function validateCriticalPathString(str: string, fieldName: string): void;
|
|
42
42
|
export type AppRunScriptBase = {
|
|
@@ -106,11 +106,11 @@ function escapeShellString(str) {
|
|
|
106
106
|
/**
|
|
107
107
|
* Validates that critical path fields (executable name, product filename, license filename)
|
|
108
108
|
* contain only characters that are safe for use in filesystem paths and embedded bash strings.
|
|
109
|
-
* Allowed: Unicode letters, digits, dots, underscores, hyphens, and
|
|
109
|
+
* Allowed: Unicode letters, digits, dots, underscores, hyphens, spaces, and parentheses.
|
|
110
110
|
*/
|
|
111
111
|
function validateCriticalPathString(str, fieldName) {
|
|
112
|
-
if (!/^[\p{L}\p{N}._\- ]+$/u.test(str)) {
|
|
113
|
-
throw new builder_util_1.InvalidConfigurationError(`${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, and
|
|
112
|
+
if (!/^[\p{L}\p{N}._\- ()]+$/u.test(str)) {
|
|
113
|
+
throw new builder_util_1.InvalidConfigurationError(`${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, spaces, and parentheses.`);
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
async function writeAppLauncherAndRelatedFiles(opts) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appImageUtil.js","sourceRoot":"","sources":["../../../src/targets/appimage/appImageUtil.ts"],"names":[],"mappings":";;AA0CA,gEAyCC;AAED,4DAqCC;AAiCD,gEAMC;AAqFD,oDA+JC;AArZD,+CAAoG;AACpG,+BAA8B;AAC9B,6BAA4B;AAE5B,gDAAuD;AACvD,+CAAwD;AACxD,oFAAiE;AAEjE,qDAAqD;AAkC9C,KAAK,UAAU,0BAA0B,CAAC,mBAA8C,EAAE,IAA4B;IAC3H,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAExD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAEvB,0CAA0C;QAC1C,MAAM,+BAA+B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AK,EAAE,CAAC,CAAA;AAC7F,CAAC;AAkBD,SAAS,OAAO,CAAC,MAAoB;IACnC,OAAO,UAAU,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;AACpE,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAoB;IACvD,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEnC,OAAO;;;;;;;;;;;;;0CAaiC,mCAAkB;;;;;;;;;;;;;;;;eAgB7C,MAAM,CAAC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAiFd,mCAAkB;;;;EAKtC,WAAW;QACT,CAAC,CAAC;sDACgD,MAAM,CAAC,eAAe;;;;;;;sDAOtB,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,wBAAwB,MAAM,CAAC,QAAQ,8CAA8C,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;;;2CAGtK,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,MAAM,CAAC,QAAQ;;;;;sDAKhE,MAAM,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;GAoBlE;QACC,CAAC,CAAC,EACN;CACC,CAAA;AACD,CAAC","sourcesContent":["import { Arch, copyDir, copyFile, exec, exists, InvalidConfigurationError, log } from \"builder-util\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport { FileAssociation } from \"../../options/FileAssociation\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { copyIcons, copyMimeTypes } from \"./appLauncher\"\nimport { appendBlockmap } from \"../differentialUpdateInfoBuilder\"\nimport { BlockMapDataHolder } from \"builder-util-runtime\"\nimport { APP_RUN_ENTRYPOINT } from \"./AppImageTarget\"\nimport { ToolsetConfig } from \"../../configuration\"\nimport { IconInfo } from \"../../util/iconConverter\"\n\ninterface Options {\n productName: string\n productFilename: string\n executableName: string\n desktopEntry: string\n icons: IconInfo[]\n license?: string | null\n fileAssociations: FileAssociation[]\n /**\n * The compression type available for static runtime is limited as it's only compiled with support for gzip and zstd.\n * \"xz\" is only valid for the legacy FUSE2 (0.0.0) toolset.\n *\n * [stderr] Squashfs image uses lzo compression, this version supports only zlib, zstd.\n * Failed to open squashfs image\n * Failed to extract AppImage\n *\n */\n compression?: \"gzip\" | \"zstd\" | \"xz\"\n /** Pre-computed desktop basename (already validated). When absent, falls back to `executableName`. */\n desktopBaseName?: string\n}\n\nexport interface AppImageBuilderOptions {\n appDir: string\n stageDir: string\n arch: Arch\n output: string\n options: Options\n}\n\nexport async function buildStaticRuntimeAppImage(appimageToolVersion: ToolsetConfig[\"appimage\"], opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n // Write AppRun launcher and related files\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtimeLibraries: libraries, runtime, mksquashfs } = await getAppImageTools(appimageToolVersion, arch)\n await copyDir(libraries, path.join(stageDir, \"usr\", \"lib\"))\n\n // Copy app directory to stage\n // mksquashfs doesn't support merging, so we copy the entire app dir\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n // Create squashfs with offset for runtime\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n }\n await exec(mksquashfs, args, {\n cwd: stageDir,\n })\n\n // Write runtime data at the beginning of the file\n await writeRuntimeData(output, runtimeData)\n\n // Make executable\n await fs.chmod(output, 0o755)\n\n // Append blockmap inside try block to ensure cleanup on failure\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n // Clean up partial build on failure\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nexport async function buildLegacyFuse2AppImage(opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtime, mksquashfs, runtimeLibraries } = await getAppImageTools(\"0.0.0\", arch)\n // Mirror the app-builder-lib Go implementation: bundle lib/<arch> into usr/lib for x64 and ia32.\n // arm targets don't have a dedicated lib dir in the FUSE2 toolset.\n if (arch === Arch.x64 || arch === Arch.ia32) {\n await copyDir(runtimeLibraries, path.join(stageDir, \"usr\", \"lib\"))\n }\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n if (options.compression === \"xz\") {\n // Match the dictionary/block-size settings used by the original app-builder Go implementation\n args.push(\"-Xdict-size\", \"100%\", \"-b\", \"1048576\")\n }\n }\n await exec(mksquashfs, args, { cwd: stageDir })\n\n await writeRuntimeData(output, runtimeData)\n await fs.chmod(output, 0o755)\n\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nasync function writeRuntimeData(filePath: string, runtimeData: Buffer): Promise<void> {\n const fd = await fs.open(filePath, \"r+\")\n try {\n await fs.write(fd, runtimeData, 0, runtimeData.length, 0)\n } finally {\n try {\n await fs.close(fd)\n } catch (closeError: any) {\n // Log but don't throw - preserve original error if any\n log.warn({ message: closeError.message, file: filePath }, `failed to close file descriptor`)\n }\n }\n}\n\n/**\n * Escapes a string for safe use in shell scripts by wrapping in single quotes\n * and escaping any single quotes within the string.\n *\n * This allows strings with spaces, special characters, etc. to be safely used.\n */\nfunction escapeShellString(str: string): string {\n // Escape single quotes by replacing ' with '\\''\n // Then wrap the whole string in single quotes\n return `'${str.replace(/'/g, \"'\\\\''\")}'`\n}\n\n/**\n * Validates that critical path fields (executable name, product filename, license filename)\n * contain only characters that are safe for use in filesystem paths and embedded bash strings.\n * Allowed: Unicode letters, digits, dots, underscores, hyphens, and spaces.\n */\nexport function validateCriticalPathString(str: string, fieldName: string): void {\n if (!/^[\\p{L}\\p{N}._\\- ]+$/u.test(str)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, and spaces.`\n )\n }\n}\n\nasync function writeAppLauncherAndRelatedFiles(opts: AppImageBuilderOptions): Promise<void> {\n const {\n stageDir,\n options: { license, executableName, productFilename, productName, desktopEntry, desktopBaseName },\n } = opts\n\n // executableName and productFilename are embedded directly into double-quoted bash strings\n // and used as filesystem paths, so they must pass the whitelist.\n // productName is not validated here because it is only ever passed through escapeShellString().\n validateCriticalPathString(executableName, \"executableName\")\n validateCriticalPathString(productFilename, \"productFilename\")\n\n // Write desktop file\n const desktopFileName = `${desktopBaseName ?? executableName}.desktop`\n await fs.writeFile(path.join(stageDir, desktopFileName), desktopEntry, { mode: 0o644 })\n await copyIcons(opts)\n\n const templateConfig: AppRunScriptBase = {\n DesktopFileName: desktopFileName,\n ExecutableName: executableName,\n ProductName: productName,\n ProductFilename: productFilename,\n ResourceName: `appimagekit-${executableName}`,\n }\n\n const mimeTypeFile = await copyMimeTypes(stageDir, opts.options)\n if (mimeTypeFile) {\n templateConfig.MimeTypeFile = mimeTypeFile\n }\n\n let finalConfig: AppRunScript = templateConfig\n\n // Copy license file if provided\n if (license) {\n // Validate license file exists\n if (!(await exists(license))) {\n throw new InvalidConfigurationError(`License file not found: ${license}`)\n }\n\n const licenseBaseName = path.basename(license)\n const ext = path.extname(license).toLowerCase()\n\n // Validate license filename for path safety\n validateCriticalPathString(licenseBaseName, \"licenseBaseName\")\n\n // Validate extension\n if (![\".txt\", \".html\"].includes(ext)) {\n log.warn({ license, expected: \".txt or .html\" }, `license file has unexpected extension`)\n }\n\n await copyFile(license, path.join(stageDir, licenseBaseName))\n\n finalConfig = {\n ...templateConfig,\n EulaFile: licenseBaseName,\n IsHtmlEula: ext === \".html\",\n }\n }\n\n const appRunContent = generateAppRunScript(finalConfig)\n await fs.writeFile(path.join(stageDir, APP_RUN_ENTRYPOINT), appRunContent, { mode: 0o755 })\n}\n\nexport type AppRunScriptBase = {\n ExecutableName: string\n DesktopFileName: string\n ProductFilename: string\n ProductName: string\n ResourceName: string\n MimeTypeFile?: string\n}\n\nexport type AppRunScriptWithEula = AppRunScriptBase & {\n EulaFile: string\n IsHtmlEula: boolean\n}\n\nexport type AppRunScript = AppRunScriptBase | AppRunScriptWithEula\n\nfunction hasEula(config: AppRunScript): config is AppRunScriptWithEula {\n return \"EulaFile\" in config && typeof config.EulaFile === \"string\"\n}\n\nexport function generateAppRunScript(config: AppRunScript): string {\n const eulaEnabled = hasEula(config)\n\n return `#!/usr/bin/env bash\nset -e\n\nTHIS=\"$0\"\n# http://stackoverflow.com/questions/3190818/\nargs=(\"$@\")\nNUMBER_OF_ARGS=\"$#\"\n\nif [ -z \"$APPDIR\" ] ; then\n # Find the AppDir. It is the directory that contains AppRun.\n # This assumes that this script resides inside the AppDir or a subdirectory.\n # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR\n path=\"$(dirname \"$(readlink -f \"\\${THIS}\")\")\"\n while [[ \"$path\" != \"\" && ! -e \"$path/${APP_RUN_ENTRYPOINT}\" ]]; do\n path=\\${path%/*}\n done\n APPDIR=\"$path\"\nfi\n\nif [ -z \"$APPDIR\" ] ; then\n echo \"ERROR: could not locate the AppDir. Ensure this script is run from within a properly structured AppImage.\" >&2\n exit 1\nfi\n\nexport PATH=\"\\${APPDIR}:\\${APPDIR}/usr/sbin\\${PATH:+:\\${PATH}}\"\nexport XDG_DATA_DIRS=\"\\${APPDIR}/usr/share/\\${XDG_DATA_DIRS:+:\\${XDG_DATA_DIRS}}:/usr/share/gnome:/usr/local/share/:/usr/share/\"\nexport LD_LIBRARY_PATH=\"\\${APPDIR}/usr/lib\\${LD_LIBRARY_PATH:+:\\${LD_LIBRARY_PATH}}\"\nexport GSETTINGS_SCHEMA_DIR=\"\\${APPDIR}/usr/share/glib-2.0/schemas\\${GSETTINGS_SCHEMA_DIR:+:\\${GSETTINGS_SCHEMA_DIR}}\"\n\nBIN=\"$APPDIR/${config.ExecutableName}\"\n\nif [ -z \"$APPIMAGE_EXIT_AFTER_INSTALL\" ] ; then\n trap atexit EXIT\nfi\n\nisEulaAccepted=1\n\nHAVE_NO_SANDBOX=0\nfor arg in \"\\${args[@]}\" ; do\n if [ \"$arg\" = --no-sandbox ] ; then\n HAVE_NO_SANDBOX=1\n break\n fi\ndone\nNO_SANDBOX=()\n# Use 'unshare -Ur true' as a heuristic to detect whether user namespaces are available.\n# Notes:\n# - When running as root, this check will always succeed even if the sandbox configuration\n# actually relies on unprivileged user namespaces. In practice, Chrome/Electron usually\n# disables or adjusts the sandbox separately when running as root, so this probe is mostly\n# a no-op in that scenario.\n# - On minimal systems (e.g. Alpine or stripped-down containers) 'unshare' may not exist.\n# In that case the shell will return exit code 127 (\"command not found\"), which will cause\n# us to add '--no-sandbox'. This is an intentional fail-safe: we prefer the app to start\n# without sandboxing rather than crash on startup.\nif [ $HAVE_NO_SANDBOX -eq 0 ] && ! unshare -Ur true 2>/dev/null ; then\n NO_SANDBOX=(--no-sandbox)\nfi\n\natexit()\n{\n if [ $isEulaAccepted == 1 ] ; then\n if [ $NUMBER_OF_ARGS -eq 0 ] ; then\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\"\n else\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\" \"\\${args[@]}\"\n fi\n fi\n}\n\nerror()\n{\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --error --text \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --msgbox \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --msgbox \"\\${1}\" 2>/dev/null\n else\n echo \"\\${1}\"\n fi\n exit 1\n}\n\nyesno()\n{\n TITLE=$1\n TEXT=$2\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --question --title=\"$TITLE\" --text=\"$TEXT\" 2>/dev/null || exit 0\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --title \"$TITLE\" --yesno \"$TEXT\" || exit 0\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --title \"$TITLE\" --clear --yesno \"$TEXT\" 10 80 || exit 0\n else\n echo \"zenity, kdialog, Xdialog missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\ncheck_dep()\n{\n DEP=$1\n if ! command -v \"$DEP\" &>/dev/null ; then\n echo \"$DEP is missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\nif [ -z \"$APPIMAGE\" ] ; then\n APPIMAGE=\"$APPDIR/${APP_RUN_ENTRYPOINT}\"\n # not running from within an AppImage; hence using the AppRun for Exec=\nfi\n\n${\n eulaEnabled\n ? `if [ -z \"$APPIMAGE_SILENT_INSTALL\" ] ; then\n EULA_MARK_DIR=\"\\${XDG_CONFIG_HOME:-$HOME/.config}/${config.ProductFilename}\"\n EULA_MARK_FILE=\"$EULA_MARK_DIR/eulaAccepted\"\n # show EULA only if desktop file doesn't exist\n if [ ! -e \"$EULA_MARK_FILE\" ] ; then\n if [ -x /usr/bin/zenity ] ; then\n # on cancel simply exits and our trap handler launches app, so, $isEulaAccepted is set here to 0 and then to 1 if EULA accepted\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" zenity --text-info --title=${escapeShellString(config.ProductName)} --filename=\"$APPDIR/${config.EulaFile}\" --ok-label=Agree --cancel-label=Disagree ${config.IsHtmlEula ? \"--html\" : \"\"}\n elif [ -x /usr/bin/Xdialog ] ; then\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" Xdialog --title ${escapeShellString(config.ProductName)} --textbox \"$APPDIR/${config.EulaFile}\" 30 80 --ok-label Agree --cancel-label Disagree\n elif [ -x /usr/bin/kdialog ] ; then\n # cannot find any option to force Agree/Disagree buttons for kdialog. And official example exactly with OK button https://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs#Example_21._--textbox_dialog_box\n # in any case we pass labels text\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" kdialog --textbox \"$APPDIR/${config.EulaFile}\" --yes-label Agree --cancel-label \"Disagree\"\n fi\n\n case $? in\n 0)\n isEulaAccepted=1\n echo \"License accepted\"\n mkdir -p \"$EULA_MARK_DIR\"\n touch \"$EULA_MARK_FILE\"\n ;;\n 1)\n echo \"License not accepted\"\n exit 0\n ;;\n -1)\n echo \"An unexpected error has occurred.\"\n isEulaAccepted=1\n ;;\n esac\n fi\nfi`\n : \"\"\n}\n`\n}\n"]}
|
|
1
|
+
{"version":3,"file":"appImageUtil.js","sourceRoot":"","sources":["../../../src/targets/appimage/appImageUtil.ts"],"names":[],"mappings":";;AA0CA,gEAyCC;AAED,4DAqCC;AAiCD,gEAMC;AAqFD,oDA+JC;AArZD,+CAAoG;AACpG,+BAA8B;AAC9B,6BAA4B;AAE5B,gDAAuD;AACvD,+CAAwD;AACxD,oFAAiE;AAEjE,qDAAqD;AAkC9C,KAAK,UAAU,0BAA0B,CAAC,mBAA8C,EAAE,IAA4B;IAC3H,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,CAAA;IAExD,IAAI,CAAC;QACH,MAAM,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;QAEvB,0CAA0C;QAC1C,MAAM,+BAA+B,CAAC,IAAI,CAAC,CAAA;QAE3C,MAAM,EAAE,gBAAgB,EAAE,SAAS,EAAE,OAAO,E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,UAAU,IAAI,MAAM,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,QAAQ,CAAA;AACpE,CAAC;AAED,SAAgB,oBAAoB,CAAC,MAAoB;IACvD,MAAM,WAAW,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAEnC,OAAO;;;;;;;;;;;;;0CAaiC,mCAAkB;;;;;;;;;;;;;;;;eAgB7C,MAAM,CAAC,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;sBAiFd,mCAAkB;;;;EAKtC,WAAW;QACT,CAAC,CAAC;sDACgD,MAAM,CAAC,eAAe;;;;;;;sDAOtB,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,wBAAwB,MAAM,CAAC,QAAQ,8CAA8C,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE;;;2CAGtK,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,uBAAuB,MAAM,CAAC,QAAQ;;;;;sDAKhE,MAAM,CAAC,QAAQ;;;;;;;;;;;;;;;;;;;;GAoBlE;QACC,CAAC,CAAC,EACN;CACC,CAAA;AACD,CAAC","sourcesContent":["import { Arch, copyDir, copyFile, exec, exists, InvalidConfigurationError, log } from \"builder-util\"\nimport * as fs from \"fs-extra\"\nimport * as path from \"path\"\nimport { FileAssociation } from \"../../options/FileAssociation\"\nimport { getAppImageTools } from \"../../toolsets/linux\"\nimport { copyIcons, copyMimeTypes } from \"./appLauncher\"\nimport { appendBlockmap } from \"../differentialUpdateInfoBuilder\"\nimport { BlockMapDataHolder } from \"builder-util-runtime\"\nimport { APP_RUN_ENTRYPOINT } from \"./AppImageTarget\"\nimport { ToolsetConfig } from \"../../configuration\"\nimport { IconInfo } from \"../../util/iconConverter\"\n\ninterface Options {\n productName: string\n productFilename: string\n executableName: string\n desktopEntry: string\n icons: IconInfo[]\n license?: string | null\n fileAssociations: FileAssociation[]\n /**\n * The compression type available for static runtime is limited as it's only compiled with support for gzip and zstd.\n * \"xz\" is only valid for the legacy FUSE2 (0.0.0) toolset.\n *\n * [stderr] Squashfs image uses lzo compression, this version supports only zlib, zstd.\n * Failed to open squashfs image\n * Failed to extract AppImage\n *\n */\n compression?: \"gzip\" | \"zstd\" | \"xz\"\n /** Pre-computed desktop basename (already validated). When absent, falls back to `executableName`. */\n desktopBaseName?: string\n}\n\nexport interface AppImageBuilderOptions {\n appDir: string\n stageDir: string\n arch: Arch\n output: string\n options: Options\n}\n\nexport async function buildStaticRuntimeAppImage(appimageToolVersion: ToolsetConfig[\"appimage\"], opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n // Write AppRun launcher and related files\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtimeLibraries: libraries, runtime, mksquashfs } = await getAppImageTools(appimageToolVersion, arch)\n await copyDir(libraries, path.join(stageDir, \"usr\", \"lib\"))\n\n // Copy app directory to stage\n // mksquashfs doesn't support merging, so we copy the entire app dir\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n // Create squashfs with offset for runtime\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n }\n await exec(mksquashfs, args, {\n cwd: stageDir,\n })\n\n // Write runtime data at the beginning of the file\n await writeRuntimeData(output, runtimeData)\n\n // Make executable\n await fs.chmod(output, 0o755)\n\n // Append blockmap inside try block to ensure cleanup on failure\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n // Clean up partial build on failure\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nexport async function buildLegacyFuse2AppImage(opts: AppImageBuilderOptions): Promise<BlockMapDataHolder> {\n const { stageDir, output, appDir, options, arch } = opts\n\n try {\n await fs.remove(output)\n\n await writeAppLauncherAndRelatedFiles(opts)\n\n const { runtime, mksquashfs, runtimeLibraries } = await getAppImageTools(\"0.0.0\", arch)\n // Mirror the app-builder-lib Go implementation: bundle lib/<arch> into usr/lib for x64 and ia32.\n // arm targets don't have a dedicated lib dir in the FUSE2 toolset.\n if (arch === Arch.x64 || arch === Arch.ia32) {\n await copyDir(runtimeLibraries, path.join(stageDir, \"usr\", \"lib\"))\n }\n await copyDir(appDir, stageDir)\n\n const runtimeData = await fs.readFile(runtime)\n\n const args: string[] = [stageDir, output, \"-offset\", runtimeData.length.toString(), \"-all-root\", \"-noappend\", \"-no-progress\", \"-quiet\", \"-no-xattrs\", \"-no-fragments\"]\n if (options.compression) {\n args.push(\"-comp\", options.compression)\n if (options.compression === \"xz\") {\n // Match the dictionary/block-size settings used by the original app-builder Go implementation\n args.push(\"-Xdict-size\", \"100%\", \"-b\", \"1048576\")\n }\n }\n await exec(mksquashfs, args, { cwd: stageDir })\n\n await writeRuntimeData(output, runtimeData)\n await fs.chmod(output, 0o755)\n\n const updateInfo = await appendBlockmap(output)\n return updateInfo\n } catch (error) {\n await fs.remove(output).catch(() => {})\n throw error\n }\n}\n\nasync function writeRuntimeData(filePath: string, runtimeData: Buffer): Promise<void> {\n const fd = await fs.open(filePath, \"r+\")\n try {\n await fs.write(fd, runtimeData, 0, runtimeData.length, 0)\n } finally {\n try {\n await fs.close(fd)\n } catch (closeError: any) {\n // Log but don't throw - preserve original error if any\n log.warn({ message: closeError.message, file: filePath }, `failed to close file descriptor`)\n }\n }\n}\n\n/**\n * Escapes a string for safe use in shell scripts by wrapping in single quotes\n * and escaping any single quotes within the string.\n *\n * This allows strings with spaces, special characters, etc. to be safely used.\n */\nfunction escapeShellString(str: string): string {\n // Escape single quotes by replacing ' with '\\''\n // Then wrap the whole string in single quotes\n return `'${str.replace(/'/g, \"'\\\\''\")}'`\n}\n\n/**\n * Validates that critical path fields (executable name, product filename, license filename)\n * contain only characters that are safe for use in filesystem paths and embedded bash strings.\n * Allowed: Unicode letters, digits, dots, underscores, hyphens, spaces, and parentheses.\n */\nexport function validateCriticalPathString(str: string, fieldName: string): void {\n if (!/^[\\p{L}\\p{N}._\\- ()]+$/u.test(str)) {\n throw new InvalidConfigurationError(\n `${fieldName} contains characters that cannot be safely used in file paths: ${str}. Please use only letters, digits, hyphens, underscores, dots, spaces, and parentheses.`\n )\n }\n}\n\nasync function writeAppLauncherAndRelatedFiles(opts: AppImageBuilderOptions): Promise<void> {\n const {\n stageDir,\n options: { license, executableName, productFilename, productName, desktopEntry, desktopBaseName },\n } = opts\n\n // executableName and productFilename are embedded directly into double-quoted bash strings\n // and used as filesystem paths, so they must pass the whitelist.\n // productName is not validated here because it is only ever passed through escapeShellString().\n validateCriticalPathString(executableName, \"executableName\")\n validateCriticalPathString(productFilename, \"productFilename\")\n\n // Write desktop file\n const desktopFileName = `${desktopBaseName ?? executableName}.desktop`\n await fs.writeFile(path.join(stageDir, desktopFileName), desktopEntry, { mode: 0o644 })\n await copyIcons(opts)\n\n const templateConfig: AppRunScriptBase = {\n DesktopFileName: desktopFileName,\n ExecutableName: executableName,\n ProductName: productName,\n ProductFilename: productFilename,\n ResourceName: `appimagekit-${executableName}`,\n }\n\n const mimeTypeFile = await copyMimeTypes(stageDir, opts.options)\n if (mimeTypeFile) {\n templateConfig.MimeTypeFile = mimeTypeFile\n }\n\n let finalConfig: AppRunScript = templateConfig\n\n // Copy license file if provided\n if (license) {\n // Validate license file exists\n if (!(await exists(license))) {\n throw new InvalidConfigurationError(`License file not found: ${license}`)\n }\n\n const licenseBaseName = path.basename(license)\n const ext = path.extname(license).toLowerCase()\n\n // Validate license filename for path safety\n validateCriticalPathString(licenseBaseName, \"licenseBaseName\")\n\n // Validate extension\n if (![\".txt\", \".html\"].includes(ext)) {\n log.warn({ license, expected: \".txt or .html\" }, `license file has unexpected extension`)\n }\n\n await copyFile(license, path.join(stageDir, licenseBaseName))\n\n finalConfig = {\n ...templateConfig,\n EulaFile: licenseBaseName,\n IsHtmlEula: ext === \".html\",\n }\n }\n\n const appRunContent = generateAppRunScript(finalConfig)\n await fs.writeFile(path.join(stageDir, APP_RUN_ENTRYPOINT), appRunContent, { mode: 0o755 })\n}\n\nexport type AppRunScriptBase = {\n ExecutableName: string\n DesktopFileName: string\n ProductFilename: string\n ProductName: string\n ResourceName: string\n MimeTypeFile?: string\n}\n\nexport type AppRunScriptWithEula = AppRunScriptBase & {\n EulaFile: string\n IsHtmlEula: boolean\n}\n\nexport type AppRunScript = AppRunScriptBase | AppRunScriptWithEula\n\nfunction hasEula(config: AppRunScript): config is AppRunScriptWithEula {\n return \"EulaFile\" in config && typeof config.EulaFile === \"string\"\n}\n\nexport function generateAppRunScript(config: AppRunScript): string {\n const eulaEnabled = hasEula(config)\n\n return `#!/usr/bin/env bash\nset -e\n\nTHIS=\"$0\"\n# http://stackoverflow.com/questions/3190818/\nargs=(\"$@\")\nNUMBER_OF_ARGS=\"$#\"\n\nif [ -z \"$APPDIR\" ] ; then\n # Find the AppDir. It is the directory that contains AppRun.\n # This assumes that this script resides inside the AppDir or a subdirectory.\n # If this script is run inside an AppImage, then the AppImage runtime likely has already set $APPDIR\n path=\"$(dirname \"$(readlink -f \"\\${THIS}\")\")\"\n while [[ \"$path\" != \"\" && ! -e \"$path/${APP_RUN_ENTRYPOINT}\" ]]; do\n path=\\${path%/*}\n done\n APPDIR=\"$path\"\nfi\n\nif [ -z \"$APPDIR\" ] ; then\n echo \"ERROR: could not locate the AppDir. Ensure this script is run from within a properly structured AppImage.\" >&2\n exit 1\nfi\n\nexport PATH=\"\\${APPDIR}:\\${APPDIR}/usr/sbin\\${PATH:+:\\${PATH}}\"\nexport XDG_DATA_DIRS=\"\\${APPDIR}/usr/share/\\${XDG_DATA_DIRS:+:\\${XDG_DATA_DIRS}}:/usr/share/gnome:/usr/local/share/:/usr/share/\"\nexport LD_LIBRARY_PATH=\"\\${APPDIR}/usr/lib\\${LD_LIBRARY_PATH:+:\\${LD_LIBRARY_PATH}}\"\nexport GSETTINGS_SCHEMA_DIR=\"\\${APPDIR}/usr/share/glib-2.0/schemas\\${GSETTINGS_SCHEMA_DIR:+:\\${GSETTINGS_SCHEMA_DIR}}\"\n\nBIN=\"$APPDIR/${config.ExecutableName}\"\n\nif [ -z \"$APPIMAGE_EXIT_AFTER_INSTALL\" ] ; then\n trap atexit EXIT\nfi\n\nisEulaAccepted=1\n\nHAVE_NO_SANDBOX=0\nfor arg in \"\\${args[@]}\" ; do\n if [ \"$arg\" = --no-sandbox ] ; then\n HAVE_NO_SANDBOX=1\n break\n fi\ndone\nNO_SANDBOX=()\n# Use 'unshare -Ur true' as a heuristic to detect whether user namespaces are available.\n# Notes:\n# - When running as root, this check will always succeed even if the sandbox configuration\n# actually relies on unprivileged user namespaces. In practice, Chrome/Electron usually\n# disables or adjusts the sandbox separately when running as root, so this probe is mostly\n# a no-op in that scenario.\n# - On minimal systems (e.g. Alpine or stripped-down containers) 'unshare' may not exist.\n# In that case the shell will return exit code 127 (\"command not found\"), which will cause\n# us to add '--no-sandbox'. This is an intentional fail-safe: we prefer the app to start\n# without sandboxing rather than crash on startup.\nif [ $HAVE_NO_SANDBOX -eq 0 ] && ! unshare -Ur true 2>/dev/null ; then\n NO_SANDBOX=(--no-sandbox)\nfi\n\natexit()\n{\n if [ $isEulaAccepted == 1 ] ; then\n if [ $NUMBER_OF_ARGS -eq 0 ] ; then\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\"\n else\n exec \"$BIN\" \"\\${NO_SANDBOX[@]}\" \"\\${args[@]}\"\n fi\n fi\n}\n\nerror()\n{\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --error --text \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --msgbox \"\\${1}\" 2>/dev/null\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --msgbox \"\\${1}\" 2>/dev/null\n else\n echo \"\\${1}\"\n fi\n exit 1\n}\n\nyesno()\n{\n TITLE=$1\n TEXT=$2\n if [ -x /usr/bin/zenity ] ; then\n LD_LIBRARY_PATH=\"\" zenity --question --title=\"$TITLE\" --text=\"$TEXT\" 2>/dev/null || exit 0\n elif [ -x /usr/bin/kdialog ] ; then\n LD_LIBRARY_PATH=\"\" kdialog --title \"$TITLE\" --yesno \"$TEXT\" || exit 0\n elif [ -x /usr/bin/Xdialog ] ; then\n LD_LIBRARY_PATH=\"\" Xdialog --title \"$TITLE\" --clear --yesno \"$TEXT\" 10 80 || exit 0\n else\n echo \"zenity, kdialog, Xdialog missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\ncheck_dep()\n{\n DEP=$1\n if ! command -v \"$DEP\" &>/dev/null ; then\n echo \"$DEP is missing. Skipping \\${THIS}.\"\n exit 0\n fi\n}\n\nif [ -z \"$APPIMAGE\" ] ; then\n APPIMAGE=\"$APPDIR/${APP_RUN_ENTRYPOINT}\"\n # not running from within an AppImage; hence using the AppRun for Exec=\nfi\n\n${\n eulaEnabled\n ? `if [ -z \"$APPIMAGE_SILENT_INSTALL\" ] ; then\n EULA_MARK_DIR=\"\\${XDG_CONFIG_HOME:-$HOME/.config}/${config.ProductFilename}\"\n EULA_MARK_FILE=\"$EULA_MARK_DIR/eulaAccepted\"\n # show EULA only if desktop file doesn't exist\n if [ ! -e \"$EULA_MARK_FILE\" ] ; then\n if [ -x /usr/bin/zenity ] ; then\n # on cancel simply exits and our trap handler launches app, so, $isEulaAccepted is set here to 0 and then to 1 if EULA accepted\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" zenity --text-info --title=${escapeShellString(config.ProductName)} --filename=\"$APPDIR/${config.EulaFile}\" --ok-label=Agree --cancel-label=Disagree ${config.IsHtmlEula ? \"--html\" : \"\"}\n elif [ -x /usr/bin/Xdialog ] ; then\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" Xdialog --title ${escapeShellString(config.ProductName)} --textbox \"$APPDIR/${config.EulaFile}\" 30 80 --ok-label Agree --cancel-label Disagree\n elif [ -x /usr/bin/kdialog ] ; then\n # cannot find any option to force Agree/Disagree buttons for kdialog. And official example exactly with OK button https://techbase.kde.org/Development/Tutorials/Shell_Scripting_with_KDE_Dialogs#Example_21._--textbox_dialog_box\n # in any case we pass labels text\n isEulaAccepted=0\n LD_LIBRARY_PATH=\"\" kdialog --textbox \"$APPDIR/${config.EulaFile}\" --yes-label Agree --cancel-label \"Disagree\"\n fi\n\n case $? in\n 0)\n isEulaAccepted=1\n echo \"License accepted\"\n mkdir -p \"$EULA_MARK_DIR\"\n touch \"$EULA_MARK_FILE\"\n ;;\n 1)\n echo \"License not accepted\"\n exit 0\n ;;\n -1)\n echo \"An unexpected error has occurred.\"\n isEulaAccepted=1\n ;;\n esac\n fi\nfi`\n : \"\"\n}\n`\n}\n"]}
|
|
@@ -7,12 +7,6 @@ const fs = require("fs-extra");
|
|
|
7
7
|
const builder_util_1 = require("builder-util");
|
|
8
8
|
const ICON_DIR_RELATIVE_PATH = "usr/share/icons/hicolor";
|
|
9
9
|
const MIME_TYPE_DIR_RELATIVE_PATH = "usr/share/mime/packages";
|
|
10
|
-
/**
|
|
11
|
-
* Escapes special XML characters to prevent injection
|
|
12
|
-
*/
|
|
13
|
-
function xmlEscape(str) {
|
|
14
|
-
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
15
|
-
}
|
|
16
10
|
async function copyIcons(options) {
|
|
17
11
|
const { stageDir, options: configuration } = options;
|
|
18
12
|
const iconCommonDir = path.join(stageDir, ICON_DIR_RELATIVE_PATH);
|
|
@@ -64,8 +58,8 @@ async function copyMimeTypes(stageDir, options) {
|
|
|
64
58
|
continue;
|
|
65
59
|
}
|
|
66
60
|
// XML-escape to prevent injection
|
|
67
|
-
mimeTypeParts.push(`<mime-type type="${
|
|
68
|
-
mimeTypeParts.push(` <comment>${
|
|
61
|
+
mimeTypeParts.push(`<mime-type type="${(0, builder_util_1.escapeForXml)(fileAssociation.mimeType)}">`);
|
|
62
|
+
mimeTypeParts.push(` <comment>${(0, builder_util_1.escapeForXml)(productName)} document</comment>`);
|
|
69
63
|
// Handle extension(s)
|
|
70
64
|
const extensions = Array.isArray(fileAssociation.ext) ? fileAssociation.ext : [fileAssociation.ext];
|
|
71
65
|
for (const ext of extensions) {
|
|
@@ -74,7 +68,7 @@ async function copyMimeTypes(stageDir, options) {
|
|
|
74
68
|
builder_util_1.log.warn({ extension: ext }, `file extension contains unexpected characters and will be skipped`);
|
|
75
69
|
continue;
|
|
76
70
|
}
|
|
77
|
-
mimeTypeParts.push(` <glob pattern="*.${
|
|
71
|
+
mimeTypeParts.push(` <glob pattern="*.${(0, builder_util_1.escapeForXml)(ext)}"/>`);
|
|
78
72
|
}
|
|
79
73
|
mimeTypeParts.push(' <generic-icon name="x-office-document"/>');
|
|
80
74
|
mimeTypeParts.push("</mime-type>");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"appLauncher.js","sourceRoot":"","sources":["../../../src/targets/appimage/appLauncher.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"appLauncher.js","sourceRoot":"","sources":["../../../src/targets/appimage/appLauncher.ts"],"names":[],"mappings":";;AAQA,8BA2CC;AAED,sCA0DC;AA/GD,6BAA4B;AAC5B,+BAA8B;AAC9B,+CAAgE;AAGhE,MAAM,sBAAsB,GAAG,yBAAyB,CAAA;AACxD,MAAM,2BAA2B,GAAG,yBAAyB,CAAA;AAEtD,KAAK,UAAU,SAAS,CAAC,OAA+B;IAC7D,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,aAAa,EAAE,GAAG,OAAO,CAAA;IACpD,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,sBAAsB,CAAC,CAAA;IAEjE,MAAM,EAAE,CAAC,SAAS,CAAC,aAAa,CAAC,CA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AAA;IAEtK,6EAA6E;IAC7E,MAAM,EAAE,CAAC,SAAS,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAA;IAE7D,OAAO,IAAI,CAAC,IAAI,CAAC,2BAA2B,EAAE,QAAQ,CAAC,CAAA;AACzD,CAAC","sourcesContent":["import * as path from \"path\"\nimport * as fs from \"fs-extra\"\nimport { copyOrLinkFile, log, escapeForXml } from \"builder-util\"\nimport { AppImageBuilderOptions } from \"./appImageUtil\"\n\nconst ICON_DIR_RELATIVE_PATH = \"usr/share/icons/hicolor\"\nconst MIME_TYPE_DIR_RELATIVE_PATH = \"usr/share/mime/packages\"\n\nexport async function copyIcons(options: AppImageBuilderOptions): Promise<void> {\n const { stageDir, options: configuration } = options\n const iconCommonDir = path.join(stageDir, ICON_DIR_RELATIVE_PATH)\n\n await fs.ensureDir(iconCommonDir)\n\n const icons = configuration.icons\n if (!icons || icons.length === 0) {\n throw new Error(\"At least one icon is required for AppImage\")\n }\n\n const iconExtWithDot = path.extname(icons[0].file)\n const iconFileName = `${configuration.executableName}${iconExtWithDot}`\n const maxIconIndex = icons.length - 1\n\n const iconInfoList = icons.map(icon => {\n if (path.extname(icon.file) !== iconExtWithDot) {\n throw new Error(`All icons must have the same extension: expected ${iconExtWithDot}, but got ${icon.file}`)\n }\n let iconSizeDir: string\n\n if (iconExtWithDot === \".svg\") {\n // SVG icons go in scalable/apps directory per freedesktop icon theme spec\n iconSizeDir = \"scalable/apps\"\n } else {\n iconSizeDir = `${icon.size}x${icon.size}/apps`\n }\n\n const iconRelativeToStageFile = path.join(ICON_DIR_RELATIVE_PATH, iconSizeDir, iconFileName)\n const iconDir = path.join(iconCommonDir, iconSizeDir)\n const iconFile = path.join(iconDir, iconFileName)\n return { icon, iconDir, iconFile, iconRelativeToStageFile }\n })\n await Promise.all(\n iconInfoList.map(async ({ icon, iconDir, iconFile }) => {\n await fs.ensureDir(iconDir)\n await copyOrLinkFile(icon.file, iconFile)\n })\n )\n // Create symlinks for the last (largest) icon\n const { iconRelativeToStageFile } = iconInfoList[maxIconIndex]\n await fs.symlink(iconRelativeToStageFile, path.join(stageDir, iconFileName))\n await fs.symlink(iconRelativeToStageFile, path.join(stageDir, \".DirIcon\"))\n}\n\nexport async function copyMimeTypes(\n stageDir: string,\n options: Pick<AppImageBuilderOptions[\"options\"], \"fileAssociations\" | \"productName\" | \"executableName\">\n): Promise<string | null> {\n const { fileAssociations, productName, executableName } = options\n\n if (!fileAssociations || fileAssociations.length === 0) {\n return null\n }\n\n if (!fileAssociations || fileAssociations.length === 0) {\n return null\n }\n\n const mimeTypeParts: string[] = []\n\n for (const fileAssociation of fileAssociations) {\n if (!fileAssociation.mimeType) {\n continue\n }\n\n // XML-escape to prevent injection\n mimeTypeParts.push(`<mime-type type=\"${escapeForXml(fileAssociation.mimeType)}\">`)\n mimeTypeParts.push(` <comment>${escapeForXml(productName)} document</comment>`)\n\n // Handle extension(s)\n const extensions = Array.isArray(fileAssociation.ext) ? fileAssociation.ext : [fileAssociation.ext]\n\n for (const ext of extensions) {\n // Validate extension doesn't contain dangerous characters\n if (!/^[a-zA-Z0-9_-]+$/.test(ext)) {\n log.warn({ extension: ext }, `file extension contains unexpected characters and will be skipped`)\n continue\n }\n mimeTypeParts.push(` <glob pattern=\"*.${escapeForXml(ext)}\"/>`)\n }\n\n mimeTypeParts.push(' <generic-icon name=\"x-office-document\"/>')\n mimeTypeParts.push(\"</mime-type>\")\n }\n\n // If no mime-types were generated, return null\n if (mimeTypeParts.length === 0) {\n return null\n }\n\n const mimeTypeDir = path.join(stageDir, MIME_TYPE_DIR_RELATIVE_PATH)\n const fileName = `${executableName}.xml`\n const mimeTypeFile = path.join(mimeTypeDir, fileName)\n\n await fs.ensureDir(mimeTypeDir)\n\n const xmlContent = ['<?xml version=\"1.0\"?>', '<mime-info xmlns=\"http://www.freedesktop.org/standards/shared-mime-info\">', ...mimeTypeParts, \"</mime-info>\"].join(\"\\n\")\n\n // Use 0o644 (rw-r--r--) instead of 0o666 to avoid world-writable permissions\n await fs.writeFile(mimeTypeFile, xmlContent, { mode: 0o644 })\n\n return path.join(MIME_TYPE_DIR_RELATIVE_PATH, fileName)\n}\n"]}
|