sign safari app for mac and mas
This commit is contained in:
parent
216e9dc0ba
commit
2c6229a936
70
gulpfile.js
70
gulpfile.js
|
@ -41,29 +41,10 @@ function pkgMas(cb) {
|
|||
const appPath = paths.dist + 'mas/Bitwarden.app';
|
||||
const pkgPath = paths.dist + 'mas/Bitwarden-mas.pkg';
|
||||
const pkgSignedPath = paths.dist + 'mas/Bitwarden-mas-signed.pkg';
|
||||
const safariAppexPath = appPath + '/Contents/PlugIns/safari.appex';
|
||||
const safariAppexFrameworkPath = safariAppexPath + '/Contents/Frameworks/';
|
||||
const safariEntitlementsPath = paths.resources + 'safari.entitlements';
|
||||
|
||||
return del([paths.dist + 'mas/Bitwarden*.pkg'])
|
||||
.then(() => {
|
||||
const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib'))
|
||||
.map((p) => safariAppexFrameworkPath + p);
|
||||
const allItems = libs.concat([safariAppexPath]);
|
||||
const promises = [];
|
||||
allItems.forEach((i) => {
|
||||
const proc = child.spawn('codesign', [
|
||||
'--verbose',
|
||||
'--force',
|
||||
'--sign',
|
||||
'3rd Party Mac Developer Application: 8bit Solutions LLC',
|
||||
'--entitlements',
|
||||
safariEntitlementsPath,
|
||||
i]);
|
||||
stdOutProc(proc);
|
||||
promises.push(new Promise((resolve) => proc.on('close', resolve)));
|
||||
});
|
||||
return Promise.all(promises);
|
||||
return signLibs(cb, 'mas');
|
||||
}).then(() => {
|
||||
const proc = child.spawn('productbuild', [
|
||||
'--component',
|
||||
|
@ -87,6 +68,54 @@ function pkgMas(cb) {
|
|||
});
|
||||
}
|
||||
|
||||
|
||||
function signMac(cb) {
|
||||
return signSafariExt(cb, 'mac');
|
||||
}
|
||||
|
||||
function signSafariExt(cb, dir) {
|
||||
const appPath = paths.dist + dir + '/Bitwarden.app';
|
||||
const safariAppexPath = appPath + '/Contents/PlugIns/safari.appex';
|
||||
const safariAppexFrameworkPath = safariAppexPath + '/Contents/Frameworks/';
|
||||
const safariEntitlementsPath = paths.resources + 'safari.entitlements';
|
||||
|
||||
const libs = fs.readdirSync(safariAppexFrameworkPath).filter((p) => p.endsWith('.dylib'))
|
||||
.map((p) => safariAppexFrameworkPath + p);
|
||||
const allItems = libs.concat([safariAppexPath]);
|
||||
const promises = [];
|
||||
allItems.forEach((i) => {
|
||||
var args = dir === 'mas' ?
|
||||
[
|
||||
'--verbose',
|
||||
'--force',
|
||||
'--sign',
|
||||
'3rd Party Mac Developer Application: 8bit Solutions LLC',
|
||||
'--entitlements',
|
||||
safariEntitlementsPath,
|
||||
i
|
||||
] :
|
||||
[
|
||||
'--verbose',
|
||||
'--force',
|
||||
'-o',
|
||||
'runtime',
|
||||
'--sign',
|
||||
'Developer ID Application: 8bit Solutions LLC',
|
||||
'--entitlements',
|
||||
safariEntitlementsPath,
|
||||
i
|
||||
];
|
||||
const proc = child.spawn('codesign', args);
|
||||
stdOutProc(proc);
|
||||
promises.push(new Promise((resolve) => proc.on('close', resolve)));
|
||||
});
|
||||
return Promise.all(promises).then(() => {
|
||||
return cb;
|
||||
}, () => {
|
||||
return cb;
|
||||
});
|
||||
}
|
||||
|
||||
function stdOutProc(proc) {
|
||||
proc.stdout.on('data', (data) => console.log(data.toString()));
|
||||
proc.stderr.on('data', (data) => console.error(data.toString()));
|
||||
|
@ -98,4 +127,5 @@ exports.webfonts = gulp.series(clean, webfonts);
|
|||
exports['prebuild:renderer'] = gulp.parallel(webfonts, cleanupAotIssue);
|
||||
exports.fixSweetAlert = fixSweetAlert;
|
||||
exports.pkgMas = pkgMas;
|
||||
exports.signMac = signMac;
|
||||
exports.postinstall = fixSweetAlert;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
param (
|
||||
[string] $version,
|
||||
[switch] $mas
|
||||
[string] $version
|
||||
)
|
||||
|
||||
# Dependencies:
|
||||
|
@ -13,8 +12,7 @@ $dir = Split-Path -Parent $MyInvocation.MyCommand.Path;
|
|||
$rootDir = $dir + "\..";
|
||||
$distDir = $rootDir + "\dist";
|
||||
$distSafariDir = $distDir + "\safari";
|
||||
$distSafariAppexDmg = $distSafariDir + "\browser\dist\Safari\dmg\build\Release\safari.appex";
|
||||
$distSafariAppexMas = $distSafariDir + "\browser\dist\Safari\mas\build\Release\safari.appex";
|
||||
$distSafariAppex = $distSafariDir + "\browser\dist\Safari\build\Release\safari.appex";
|
||||
$pluginsAppex = $rootDir + "\PlugIns\safari.appex";
|
||||
|
||||
if(Test-Path -Path $distSafariDir) {
|
||||
|
@ -37,9 +35,5 @@ if(-not ([string]::IsNullOrEmpty($version))) {
|
|||
|
||||
npm i
|
||||
npm run dist:safari
|
||||
if($mas) {
|
||||
Copy-Item -Path $distSafariAppexMas -Destination $pluginsAppex –Recurse
|
||||
} else {
|
||||
Copy-Item -Path $distSafariAppexDmg -Destination $pluginsAppex –Recurse
|
||||
}
|
||||
Copy-Item -Path $distSafariAppex -Destination $pluginsAppex –Recurse
|
||||
cd $rootDir
|
||||
|
|
Loading…
Reference in New Issue