This commit is contained in:
David Baker 2020-03-06 16:42:24 +00:00
parent dd59fd586a
commit 0304096e46

View File

@ -1,13 +1,17 @@
const { execFile } = require('child_process'); const { execFile } = require('child_process');
const path = require('path');
// Loosely based on computeSignToolArgs from app-builder-lib/src/codeSign/windowsCodeSign.ts // Loosely based on computeSignToolArgs from app-builder-lib/src/codeSign/windowsCodeSign.ts
function computeSignToolArgs(options, keyContainer) { function computeSignToolArgs(options, keyContainer) {
const args = []; const args = [];
if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") { if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") {
const timestampingServiceUrl = options.options.timeStampServer || "http://timestamp.digicert.com"; const timestampingServiceUrl = options.options.timeStampServer || "http://timestamp.digicert.com";
args.push(options.isNest || options.hash === "sha256" ? "/tr" : "/t", options.isNest || options.hash === "sha256" ? (options.options.rfc3161TimeStampServer || "http://timestamp.comodoca.com/rfc3161") : timestampingServiceUrl); args.push(
options.isNest || options.hash === "sha256" ? "/tr" : "/t",
options.isNest || options.hash === "sha256" ? (
options.options.rfc3161TimeStampServer || "http://timestamp.comodoca.com/rfc3161"
) : timestampingServiceUrl,
);
} }
args.push('/kc', keyContainer); args.push('/kc', keyContainer);
@ -23,21 +27,21 @@ function computeSignToolArgs(options, keyContainer) {
args.push('/f', 'riot.im\\New_Vector_Ltd.pem'); args.push('/f', 'riot.im\\New_Vector_Ltd.pem');
if (options.hash !== "sha1") { if (options.hash !== "sha1") {
args.push("/fd", options.hash) args.push("/fd", options.hash);
if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") { if (process.env.ELECTRON_BUILDER_OFFLINE !== "true") {
args.push("/td", "sha256") args.push("/td", "sha256");
} }
} }
// msi does not support dual-signing // msi does not support dual-signing
if (options.isNest) { if (options.isNest) {
args.push("/as") args.push("/as");
} }
// https://github.com/electron-userland/electron-builder/issues/2875#issuecomment-387233610 // https://github.com/electron-userland/electron-builder/issues/2875#issuecomment-387233610
args.push("/debug") args.push("/debug");
// must be last argument // must be last argument
args.push(options.path) args.push(options.path);
return args; return args;
} }
@ -54,9 +58,6 @@ exports.default = async function(options) {
return; return;
} }
const inPath = options.path;
const appOutDir = path.dirname(inPath);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const args = ['sign'].concat(computeSignToolArgs(options, keyContainer)); const args = ['sign'].concat(computeSignToolArgs(options, keyContainer));