Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Copyright (c) 2015-2016 Yuya Ochiai
// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
'use strict';
const spawnSync = require('child_process').spawnSync;
const path7za = require('7zip-bin').path7za;
const pkg = require('../src/package.json');
const appVersion = pkg.version;
const productName = pkg.productName;
function renameInZip(zipPath, oldName, newName) {
const result = spawnSync(path7za, ['rn', zipPath, oldName, newName]);
return result.status === 0;
}
console.log('Manipulating 64-bit zip...');
if (!renameInZip(`release/${productName}-${appVersion}-win.zip`, 'win-unpacked', `${productName}-${appVersion}-win64`)) {
throw new Error('7za returned non-zero exit code for 64-bit zip');
}
console.log('Manipulating 32-bit zip...');
import fs from 'fs-extra'
import path from 'path-extra'
import { log } from '../lib/utils'
import child_process from 'child_process'
import Seven from 'node-7z'
import sevenBin from '7zip-bin'
const pathTo7zip = sevenBin.path7za
const { ROOT } = global
export const NPM_EXEC_PATH = path.join(ROOT, 'node_modules', 'npm', 'bin', 'npm-cli.js')
export const PLUGIN_JSON_PATH = path.join(ROOT, 'assets', 'data', 'plugin.json')
export const compress7z = async (files, archive, options) => {
options = {
...options,
$bin: pathTo7zip,
}
try {
await fs.remove(archive)
} catch (e) {
console.error(e.stack)
}
await Seven.add(archive, files, options)
callback({error: ERROR_UNZIPPING_THE_FILE, detail: error.message});
}
}
catch(error)
{
console.error(error);
callback({error: ERROR_UNZIPPING_THE_FILE, detail: error.message});
}
});
}
else if(inArray(fileExtension(path), compressedExtensions['7z']))
{
if(un7z === false) un7z = require('node-7z');
if(bin7z === false) bin7z = asarToAsarUnpacked(require('7zip-bin').path7za);
un7z.extractFull(path, p.join(tempFolder, shaExt), {$progress: true, p: false/*'myPassword'*/, $bin: bin7z}).on('progress', function(progress) {
setProgress(progress.percent / 100, contentRightZindex);
}).on('end', function (data) {
try
{
if(fs.existsSync(p.join(tempFolder, shaExt))) fs.renameSync(p.join(tempFolder, shaExt), p.join(tempFolder, sha));
var files = file.returnAll(p.join(tempFolder, sha), {from: p.join(tempFolder, sha), to: virtualPath});
if(!json || json.mtime != mtime)
cache.writeFile(cacheFile, JSON.stringify({mtime: mtime, files: files}), {}, function(){});
const fs = require('fs-extra')
const path = require('path')
const childProcess = require('child_process')
const path7za = require('7zip-bin').path7za
const PromiseExt = require('ember-cli/lib/ext/promise')
module.exports = function shipMac (pkg, options) {
const mkdir = PromiseExt.denodeify(fs.mkdirs)
return mkdir(path.join('electron-builds', 'installers'))
.finally(() => createZip(pkg, options))
}
function createZip (pkg, options) {
const ee = pkg['ember-electron']
const access = PromiseExt.denodeify(fs.access)
const unlink = PromiseExt.denodeify(fs.unlink)
const name = options.name || ee.name || pkg.name
export function extractSeven(path, destinationPath) {
const def = deferred()
let pathTo7zip
if (is.development) {
pathTo7zip = sevenBin.path7za
} else {
const binName = platform({
macos: '7za',
linux: '7za',
windows: '7za.exe',
})
pathTo7zip = getAppResourcesPath('7zip-bin', binName)
}
const seven = extractFull(path, destinationPath, {
$bin: pathTo7zip,
recursive: true,
})
seven.on('end', () => {
async function runScript() {
const zipExe = zip.path7za;
const nodeObsPath = path.join(__dirname, '..', 'node_modules', '@streamlabs', 'obs-studio-node', 'libobs');
const obsFrameCaptureFilterDownloadUrl = `https://github.com/pursuit-gg/obs-frame-capture-filter/releases/download/v${OBS_FRAME_CAPTURE_FILTER_VERSION}/obs-frame-capture-filter-v${OBS_FRAME_CAPTURE_FILTER_VERSION}.zip`;
const obsFrameCaptureFilterArchivePath = path.join(os.tmpdir(), `obs-frame-capture-filter-v${OBS_FRAME_CAPTURE_FILTER_VERSION}.zip`);
const obsFrameCaptureFilterArchive = fs.createWriteStream(obsFrameCaptureFilterArchivePath);
const obsFrameCaptureFilterArchiveFinishPromise = new Promise(resolve => obsFrameCaptureFilterArchive.on('finish', resolve));
sh.echo(`Downloading obs-frame-capture-filter version ${OBS_FRAME_CAPTURE_FILTER_VERSION}...`);
https.get(obsFrameCaptureFilterDownloadUrl, redirectResponse => (
https.get(redirectResponse.headers.location, response => response.pipe(obsFrameCaptureFilterArchive))
));
await obsFrameCaptureFilterArchiveFinishPromise;
sh.echo('Extracting obs-frame-capture-filter archive...');
const result = sh.exec(`"${zipExe}" x "${obsFrameCaptureFilterArchivePath}" -o"${nodeObsPath}" -aoa`);