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kBAAJ,GAAyB,gBAAzB;AACD;;AAED,MAAI,gBAAgB,CAAC,SAAjB,IAA8B,IAAlC,EAAwC;AACtC,UAAM,SAAS,GAAG;AAChB,MAAA,4CAA4C,EAAE,KAD9B;AAEhB,MAAA,oBAAoB,EAAE,KAFN;AAGhB,MAAA,2CAA2C,EAAE,IAH7B;AAIhB,MAAA,qCAAqC,EAAE,KAJvB;AAKhB,MAAA,0CAA0C,EAAE;AAL5B,KAAlB;AAOA,IAAA,gBAAgB,CAAC,SAAjB,GAA6B,SAA7B;AACA,IAAA,gBAAgB,CAAC,WAAD,CAAhB,GAAgC,SAAhC;AACD;AACF,C","sourcesContent":["import BluebirdPromise from \"bluebird-lst\"\nimport { asArray, getPlatformIconFileName, InvalidConfigurationError, log } from \"builder-util\"\nimport { copyOrLinkFile, unlinkIfExists } from \"builder-util/out/fs\"\nimport { rename, utimes } from \"fs-extra\"\nimport * as path from \"path\"\nimport { filterCFBundleIdentifier } from \"../appInfo\"\nimport { AsarIntegrity } from \"../asar/integrity\"\nimport MacPackager from \"../macPackager\"\nimport { normalizeExt } from \"../platformPackager\"\nimport { executeAppBuilderAndWriteJson, executeAppBuilderAsJson } from \"../util/appBuilder\"\n\nfunction doRename(basePath: string, oldName: string, newName: string) {\n return rename(path.join(basePath, oldName), path.join(basePath, newName))\n}\n\nfunction moveHelpers(helperSuffixes: Array, frameworksPath: string, appName: string, prefix: string): Promise {\n return BluebirdPromise.map(helperSuffixes, suffix => {\n const executableBasePath = path.join(frameworksPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n return doRename(executableBasePath, `${prefix}${suffix}`, appName + suffix)\n .then(() => doRename(frameworksPath, `${prefix}${suffix}.app`, `${appName}${suffix}.app`))\n })\n}\n\nfunction getAvailableHelperSuffixes(helperEHPlist: string | null, helperNPPlist: string | null) {\n const result = [\" Helper\"]\n if (helperEHPlist != null) {\n result.push(\" Helper EH\")\n }\n if (helperNPPlist != null) {\n result.push(\" Helper NP\")\n }\n return result\n}\n\n/** @internal */\nexport async function createMacApp(packager: MacPackager, appOutDir: string, asarIntegrity: AsarIntegrity | null, isMas: boolean) {\n const appInfo = packager.appInfo\n const appFilename = appInfo.productFilename\n\n const contentsPath = path.join(appOutDir, packager.info.framework.distMacOsAppName, \"Contents\")\n const frameworksPath = path.join(contentsPath, \"Frameworks\")\n const loginItemPath = path.join(contentsPath, \"Library\", \"LoginItems\")\n\n const appPlistFilename = path.join(contentsPath, \"Info.plist\")\n const helperPlistFilename = path.join(frameworksPath, \"Electron Helper.app\", \"Contents\", \"Info.plist\")\n const helperEHPlistFilename = path.join(frameworksPath, \"Electron Helper EH.app\", \"Contents\", \"Info.plist\")\n const helperNPPlistFilename = path.join(frameworksPath, \"Electron Helper NP.app\", \"Contents\", \"Info.plist\")\n const helperLoginPlistFilename = path.join(loginItemPath, \"Electron Login Helper.app\", \"Contents\", \"Info.plist\")\n\n const plistContent: Array = await executeAppBuilderAsJson([\"decode-plist\", \"-f\", appPlistFilename, \"-f\", helperPlistFilename, \"-f\", helperEHPlistFilename, \"-f\", helperNPPlistFilename, \"-f\", helperLoginPlistFilename])\n\n if (plistContent[0] == null) {\n throw new Error(\"corrupted Electron dist\")\n }\n\n const appPlist = plistContent[0]!!\n const helperPlist = plistContent[1]!!\n const helperEHPlist = plistContent[2]\n const helperNPPlist = plistContent[3]\n const helperLoginPlist = plistContent[4]\n\n // if an extend-info file was supplied, copy its contents in first\n if (plistContent[5] != null) {\n Object.assign(appPlist, plistContent[5])\n }\n\n const buildMetadata = packager.config!!\n const oldHelperBundleId = (buildMetadata as any)[\"helper-bundle-id\"]\n if (oldHelperBundleId != null) {\n log.warn(\"build.helper-bundle-id is deprecated, please set as build.mac.helperBundleId\")\n }\n const helperBundleIdentifier = filterCFBundleIdentifier(packager.platformSpecificBuildOptions.helperBundleId || oldHelperBundleId || `${appInfo.macBundleIdentifier}.helper`)\n\n await packager.applyCommonInfo(appPlist, contentsPath)\n\n // required for electron-updater proxy\n if (!isMas) {\n configureLocalhostAts(appPlist)\n }\n\n helperPlist.CFBundleExecutable = `${appFilename} Helper`\n helperPlist.CFBundleDisplayName = `${appInfo.productName} Helper`\n helperPlist.CFBundleIdentifier = helperBundleIdentifier\n helperPlist.CFBundleVersion = appPlist.CFBundleVersion\n\n function configureHelper(helper: any, postfix: string) {\n helper.CFBundleExecutable = `${appFilename} Helper ${postfix}`\n helper.CFBundleDisplayName = `${appInfo.productName} Helper ${postfix}`\n helper.CFBundleIdentifier = `${helperBundleIdentifier}.${postfix}`\n helper.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n if (helperEHPlist != null) {\n configureHelper(helperEHPlist, \"EH\")\n }\n if (helperNPPlist != null) {\n configureHelper(helperNPPlist, \"NP\")\n }\n if (helperLoginPlist != null) {\n helperLoginPlist.CFBundleExecutable = `${appFilename} Login Helper`\n helperLoginPlist.CFBundleDisplayName = `${appInfo.productName} Login Helper`\n // noinspection SpellCheckingInspection\n helperLoginPlist.CFBundleIdentifier = `${appInfo.macBundleIdentifier}.loginhelper`\n helperLoginPlist.CFBundleVersion = appPlist.CFBundleVersion\n }\n\n const protocols = asArray(buildMetadata.protocols).concat(asArray(packager.platformSpecificBuildOptions.protocols))\n if (protocols.length > 0) {\n appPlist.CFBundleURLTypes = protocols.map(protocol => {\n const schemes = asArray(protocol.schemes)\n if (schemes.length === 0) {\n throw new InvalidConfigurationError(`Protocol \"${protocol.name}\": must be at least one scheme specified`)\n }\n return {\n CFBundleURLName: protocol.name,\n CFBundleTypeRole: protocol.role || \"Editor\",\n CFBundleURLSchemes: schemes.slice()\n }\n })\n }\n\n const fileAssociations = packager.fileAssociations\n if (fileAssociations.length > 0) {\n appPlist.CFBundleDocumentTypes = await BluebirdPromise.map(fileAssociations, async fileAssociation => {\n const extensions = asArray(fileAssociation.ext).map(normalizeExt)\n const customIcon = await packager.getResource(getPlatformIconFileName(fileAssociation.icon, true), `${extensions[0]}.icns`)\n let iconFile = appPlist.CFBundleIconFile\n if (customIcon != null) {\n iconFile = path.basename(customIcon)\n await copyOrLinkFile(customIcon, path.join(path.join(contentsPath, \"Resources\"), iconFile))\n }\n\n const result = {\n CFBundleTypeExtensions: extensions,\n CFBundleTypeName: fileAssociation.name || extensions[0],\n CFBundleTypeRole: fileAssociation.role || \"Editor\",\n CFBundleTypeIconFile: iconFile\n } as any\n\n if (fileAssociation.isPackage) {\n result.LSTypeIsPackage = true\n }\n return result\n })\n }\n\n if (asarIntegrity != null) {\n appPlist.AsarIntegrity = JSON.stringify(asarIntegrity)\n }\n\n const plistDataToWrite: any = {\n [appPlistFilename]: appPlist,\n [helperPlistFilename]: helperPlist,\n }\n if (helperEHPlist != null) {\n plistDataToWrite[helperEHPlistFilename] = helperEHPlist\n }\n if (helperNPPlist != null) {\n plistDataToWrite[helperNPPlistFilename] = helperNPPlist\n }\n if (helperLoginPlist != null) {\n plistDataToWrite[helperLoginPlistFilename] = helperLoginPlist\n }\n\n await Promise.all([\n executeAppBuilderAndWriteJson([\"encode-plist\"], plistDataToWrite),\n doRename(path.join(contentsPath, \"MacOS\"), \"Electron\", appPlist.CFBundleExecutable),\n unlinkIfExists(path.join(appOutDir, \"LICENSE\")),\n unlinkIfExists(path.join(appOutDir, \"LICENSES.chromium.html\")),\n ])\n\n await moveHelpers(getAvailableHelperSuffixes(helperEHPlist, helperNPPlist), frameworksPath, appFilename, \"Electron\")\n\n if (helperLoginPlist != null) {\n const prefix = \"Electron\"\n const suffix = \" Login Helper\"\n const executableBasePath = path.join(loginItemPath, `${prefix}${suffix}.app`, \"Contents\", \"MacOS\")\n await doRename(executableBasePath, `${prefix}${suffix}`, appFilename + suffix)\n .then(() => doRename(loginItemPath, `${prefix}${suffix}.app`, `${appFilename}${suffix}.app`))\n }\n\n const appPath = path.join(appOutDir, `${appFilename}.app`)\n await rename(path.dirname(contentsPath), appPath)\n // https://github.com/electron-userland/electron-builder/issues/840\n const now = Date.now() / 1000\n await utimes(appPath, now, now)\n}\n\nfunction configureLocalhostAts(appPlist: any) {\n // https://bencoding.com/2015/07/20/app-transport-security-and-localhost/\n let ats = appPlist.NSAppTransportSecurity\n if (ats == null) {\n ats = {}\n appPlist.NSAppTransportSecurity = ats\n }\n\n ats.NSAllowsLocalNetworking = true\n // https://github.com/electron-userland/electron-builder/issues/3377#issuecomment-446035814\n ats.NSAllowsArbitraryLoads = true\n\n let exceptionDomains = ats.NSExceptionDomains\n if (exceptionDomains == null) {\n exceptionDomains = {}\n ats.NSExceptionDomains = exceptionDomains\n }\n\n if (exceptionDomains.localhost == null) {\n const allowHttp = {\n NSTemporaryExceptionAllowsInsecureHTTPSLoads: false,\n NSIncludesSubdomains: false,\n NSTemporaryExceptionAllowsInsecureHTTPLoads: true,\n NSTemporaryExceptionMinimumTLSVersion: \"1.0\",\n NSTemporaryExceptionRequiresForwardSecrecy: false\n }\n exceptionDomains.localhost = allowHttp\n exceptionDomains[\"127.0.0.1\"] = allowHttp\n }\n}"],"sourceRoot":""}