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AAV,CAAxC,EAAyD;AAAC,MAAA,WAAW,EAAE;AAAd,KAAzD,CAAN;AACD;;AA5VoE,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { Arch, asArray, InvalidConfigurationError, log, use, executeAppBuilder } from \"builder-util\"\nimport { parseDn } from \"builder-util-runtime\"\nimport { CopyFileTransformer, FileTransformer, walk } from \"builder-util/out/fs\"\nimport { createHash } from \"crypto\"\nimport { readdir } from \"fs-extra\"\nimport isCI from \"is-ci\"\nimport { Lazy } from \"lazy-val\"\nimport * as path from \"path\"\nimport { downloadCertificate } from \"./codeSign/codesign\"\nimport { CertificateFromStoreInfo, CertificateInfo, FileCodeSigningInfo, getCertificateFromStoreInfo, getCertInfo, sign, WindowsSignOptions } from \"./codeSign/windowsCodeSign\"\nimport { AfterPackContext } from \"./configuration\"\nimport { DIR_TARGET, Platform, Target } from \"./core\"\nimport { RequestedExecutionLevel, WindowsConfiguration } from \"./options/winOptions\"\nimport { Packager } from \"./packager\"\nimport { chooseNotNull, PlatformPackager } from \"./platformPackager\"\nimport AppXTarget from \"./targets/AppxTarget\"\nimport { NsisTarget } from \"./targets/nsis/NsisTarget\"\nimport { AppPackageHelper, CopyElevateHelper } from \"./targets/nsis/nsisUtil\"\nimport { WebInstallerTarget } from \"./targets/nsis/WebInstallerTarget\"\nimport { createCommonTarget } from \"./targets/targetFactory\"\nimport { BuildCacheManager, digest } from \"./util/cacheManager\"\nimport { isBuildCacheEnabled } from \"./util/flags\"\nimport { time } from \"./util/timer\"\nimport { getWindowsVm, VmManager } from \"./vm/vm\"\n\nexport class WinPackager extends PlatformPackager {\n readonly cscInfo = new Lazy(() => {\n const platformSpecificBuildOptions = this.platformSpecificBuildOptions\n if (platformSpecificBuildOptions.certificateSubjectName != null || platformSpecificBuildOptions.certificateSha1 != null) {\n return this.vm.value\n .then(vm => getCertificateFromStoreInfo(platformSpecificBuildOptions, vm))\n .catch(e => {\n // https://github.com/electron-userland/electron-builder/pull/2397\n if (platformSpecificBuildOptions.sign == null) {\n throw e\n }\n else {\n log.debug({error: e}, \"getCertificateFromStoreInfo error\")\n return null\n }\n })\n }\n\n const certificateFile = platformSpecificBuildOptions.certificateFile\n if (certificateFile != null) {\n const certificatePassword = this.getCscPassword()\n return Promise.resolve({\n file: certificateFile,\n password: certificatePassword == null ? null : certificatePassword.trim(),\n })\n }\n\n const cscLink = this.getCscLink(\"WIN_CSC_LINK\")\n if (cscLink == null) {\n return Promise.resolve(null)\n }\n\n return downloadCertificate(cscLink, this.info.tempDirManager, this.projectDir)\n // before then\n .catch(e => {\n if (e instanceof InvalidConfigurationError) {\n throw new InvalidConfigurationError(`Env WIN_CSC_LINK is not correct, cannot resolve: ${e.message}`)\n }\n else {\n throw e\n }\n })\n .then(path => {\n return {\n file: path!!,\n password: this.getCscPassword(),\n }\n })\n })\n\n private _iconPath = new Lazy(() => this.getOrConvertIcon(\"ico\"))\n\n readonly vm = new Lazy(() => process.platform === \"win32\" ? Promise.resolve(new VmManager()) : getWindowsVm(this.debugLogger))\n\n readonly computedPublisherName = new Lazy | null>(async () => {\n const publisherName = (this.platformSpecificBuildOptions as WindowsConfiguration).publisherName\n if (publisherName === null) {\n return null\n }\n else if (publisherName != null) {\n return asArray(publisherName)\n }\n\n const certInfo = await this.lazyCertInfo.value\n return certInfo == null ? null : [certInfo.commonName]\n })\n\n readonly lazyCertInfo = new Lazy(async () => {\n const cscInfo = await this.cscInfo.value\n if (cscInfo == null) {\n return null\n }\n\n if (\"subject\" in cscInfo) {\n const bloodyMicrosoftSubjectDn = (cscInfo as CertificateFromStoreInfo).subject\n return {\n commonName: parseDn(bloodyMicrosoftSubjectDn).get(\"CN\")!!,\n bloodyMicrosoftSubjectDn,\n }\n }\n\n const cscFile = (cscInfo as FileCodeSigningInfo).file\n if (cscFile == null) {\n return null\n }\n return await getCertInfo(cscFile, (cscInfo as FileCodeSigningInfo).password || \"\")\n })\n\n get isForceCodeSigningVerification(): boolean {\n return this.platformSpecificBuildOptions.verifyUpdateCodeSignature !== false\n }\n\n constructor(info: Packager) {\n super(info, Platform.WINDOWS)\n }\n\n get defaultTarget(): Array {\n return [\"nsis\"]\n }\n\n protected doGetCscPassword(): string | undefined | null {\n return chooseNotNull(chooseNotNull(this.platformSpecificBuildOptions.certificatePassword, process.env.WIN_CSC_KEY_PASSWORD), super.doGetCscPassword())\n }\n\n createTargets(targets: Array, mapper: (name: string, factory: (outDir: string) => Target) => void): void {\n let copyElevateHelper: CopyElevateHelper | null\n const getCopyElevateHelper = () => {\n if (copyElevateHelper == null) {\n copyElevateHelper = new CopyElevateHelper()\n }\n return copyElevateHelper\n }\n\n let helper: AppPackageHelper | null\n const getHelper = () => {\n if (helper == null) {\n helper = new AppPackageHelper(getCopyElevateHelper())\n }\n return helper\n }\n\n for (const name of targets) {\n if (name === DIR_TARGET) {\n continue\n }\n\n if (name === \"nsis\" || name === \"portable\") {\n mapper(name, outDir => new NsisTarget(this, outDir, name, getHelper()))\n }\n else if (name === \"nsis-web\") {\n // package file format differs from nsis target\n mapper(name, outDir => new WebInstallerTarget(this, path.join(outDir, name), name, new AppPackageHelper(getCopyElevateHelper())))\n }\n else {\n const targetClass: typeof NsisTarget | typeof AppXTarget | null = (() => {\n switch (name) {\n case \"squirrel\":\n try {\n return require(\"electron-builder-squirrel-windows\").default\n }\n catch (e) {\n throw new InvalidConfigurationError(`Module electron-builder-squirrel-windows must be installed in addition to build Squirrel.Windows: ${e.stack || e}`)\n }\n\n case \"appx\":\n return require(\"./targets/AppxTarget\").default\n\n case \"msi\":\n return require(\"./targets/MsiTarget\").default\n\n default:\n return null\n }\n })()\n\n mapper(name, outDir => targetClass === null ? createCommonTarget(name, outDir, this) : new (targetClass as any)(this, outDir, name))\n }\n }\n }\n\n getIconPath() {\n return this._iconPath.value\n }\n\n async sign(file: string, logMessagePrefix?: string): Promise {\n const signOptions: WindowsSignOptions = {\n path: file,\n name: this.appInfo.productName,\n site: await this.appInfo.computePackageUrl(),\n options: this.platformSpecificBuildOptions,\n }\n\n const cscInfo = await this.cscInfo.value\n if (cscInfo == null) {\n if (this.platformSpecificBuildOptions.sign != null) {\n await sign(signOptions, this)\n }\n else if (this.forceCodeSigning) {\n throw new InvalidConfigurationError(`App is not signed and \"forceCodeSigning\" is set to true, please ensure that code signing configuration is correct, please see https://electron.build/code-signing`)\n }\n return\n }\n\n if (logMessagePrefix == null) {\n logMessagePrefix = \"signing\"\n }\n\n if (\"file\" in cscInfo) {\n log.info({\n file: log.filePath(file),\n certificateFile: (cscInfo as FileCodeSigningInfo).file,\n }, logMessagePrefix)\n }\n else {\n const info = cscInfo as CertificateFromStoreInfo\n log.info({\n file: log.filePath(file),\n subject: info.subject,\n thumbprint: info.thumbprint,\n store: info.store,\n user: info.isLocalMachineStore ? \"local machine\" : \"current user\",\n }, logMessagePrefix)\n }\n\n await this.doSign({\n ...signOptions,\n cscInfo,\n options: {\n ...this.platformSpecificBuildOptions,\n },\n })\n }\n\n private async doSign(options: WindowsSignOptions) {\n for (let i = 0; i < 3; i++) {\n try {\n await sign(options, this)\n break\n }\n catch (e) {\n // https://github.com/electron-userland/electron-builder/issues/1414\n const message = e.message\n if (message != null && message.includes(\"Couldn't resolve host name\")) {\n log.warn({error: message, attempt: i + 1}, `cannot sign`)\n continue\n }\n throw e\n }\n }\n }\n\n async signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null) {\n const appInfo = this.appInfo\n\n const files: Array = []\n\n const args = [\n file,\n \"--set-version-string\", \"FileDescription\", appInfo.productName,\n \"--set-version-string\", \"ProductName\", appInfo.productName,\n \"--set-version-string\", \"LegalCopyright\", appInfo.copyright,\n \"--set-file-version\", appInfo.buildVersion,\n \"--set-product-version\", appInfo.getVersionInWeirdWindowsForm(),\n ]\n\n if (internalName != null) {\n args.push(\n \"--set-version-string\", \"InternalName\", internalName,\n \"--set-version-string\", \"OriginalFilename\", \"\",\n )\n }\n\n if (requestedExecutionLevel != null && requestedExecutionLevel !== \"asInvoker\") {\n args.push(\"--set-requested-execution-level\", requestedExecutionLevel)\n }\n\n use(appInfo.companyName, it => args.push(\"--set-version-string\", \"CompanyName\", it!))\n use(this.platformSpecificBuildOptions.legalTrademarks, it => args.push(\"--set-version-string\", \"LegalTrademarks\", it!))\n const iconPath = await this.getIconPath()\n use(iconPath, it => {\n files.push(it)\n args.push(\"--set-icon\", it)\n })\n\n const config = this.config\n const cscInfoForCacheDigest = !isBuildCacheEnabled() || isCI || config.electronDist != null ? null : await this.cscInfo.value\n let buildCacheManager: BuildCacheManager | null = null\n // resources editing doesn't change executable for the same input and executed quickly - no need to complicate\n if (cscInfoForCacheDigest != null) {\n const cscFile = (cscInfoForCacheDigest as FileCodeSigningInfo).file\n if (cscFile != null) {\n files.push(cscFile)\n }\n\n const timer = time(\"executable cache\")\n const hash = createHash(\"sha512\")\n hash.update(config.electronVersion || \"no electronVersion\")\n hash.update(JSON.stringify(this.platformSpecificBuildOptions))\n hash.update(JSON.stringify(args))\n hash.update(this.platformSpecificBuildOptions.certificateSha1 || \"no certificateSha1\")\n hash.update(this.platformSpecificBuildOptions.certificateSubjectName || \"no subjectName\")\n\n buildCacheManager = new BuildCacheManager(outDir, file, arch)\n if (await buildCacheManager.copyIfValid(await digest(hash, files))) {\n timer.end()\n return\n }\n timer.end()\n }\n\n const timer = time(\"wine&sign\")\n // rcedit crashed of executed using wine, resourcehacker works\n if (process.platform === \"win32\" || this.info.framework.name === \"electron\") {\n await executeAppBuilder([\"rcedit\", \"--args\", JSON.stringify(args)])\n }\n\n await this.sign(file)\n timer.end()\n\n if (buildCacheManager != null) {\n await buildCacheManager.save()\n }\n }\n\n private isSignDlls(): boolean {\n return this.platformSpecificBuildOptions.signDlls === true\n }\n\n protected createTransformerForExtraFiles(packContext: AfterPackContext): FileTransformer | null {\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {\n return null\n }\n\n return file => {\n if (file.endsWith(\".exe\") || (this.isSignDlls() && file.endsWith(\".dll\"))) {\n const parentDir = path.dirname(file)\n if (parentDir !== packContext.appOutDir) {\n return new CopyFileTransformer(file => this.sign(file))\n }\n }\n return null\n }\n }\n\n protected async signApp(packContext: AfterPackContext, isAsar: boolean): Promise {\n const exeFileName = `${this.appInfo.productFilename}.exe`\n if (this.platformSpecificBuildOptions.signAndEditExecutable === false) {\n return\n }\n\n await BluebirdPromise.map(readdir(packContext.appOutDir), (file: string): any => {\n if (file === exeFileName) {\n return this.signAndEditResources(path.join(packContext.appOutDir, exeFileName), packContext.arch, packContext.outDir, path.basename(exeFileName, \".exe\"), this.platformSpecificBuildOptions.requestedExecutionLevel)\n }\n else if (file.endsWith(\".exe\") || (this.isSignDlls() && file.endsWith(\".dll\"))) {\n return this.sign(path.join(packContext.appOutDir, file))\n }\n return null\n })\n\n if (!isAsar) {\n return\n }\n\n const outResourcesDir = path.join(packContext.appOutDir, \"resources\", \"app.asar.unpacked\")\n // noinspection JSUnusedLocalSymbols\n const fileToSign = await walk(outResourcesDir, (file, stat) => stat.isDirectory() || file.endsWith(\".exe\") || file.endsWith(\".dll\"))\n await BluebirdPromise.map(fileToSign, file => this.sign(file), {concurrency: 4})\n }\n}"],"sourceRoot":""}