New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

openfin-launcher

Package Overview
Dependencies
Maintainers
3
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

openfin-launcher - npm Package Compare versions

Comparing version 1.2.1 to 1.3.1

deleteme.js

6

index.js

@@ -1,2 +0,1 @@

var os = require('os');
var rvmDownloader = require('./lib/rvm-downloader');

@@ -6,5 +5,6 @@ var nixLauncher = require('./lib/nix-launcher');

var expandOptions = require('./lib/expand-options');
var assetUtilities = require('./lib/asset-utilities');
var isWindows = os.type().toLowerCase().indexOf('windows') !== -1;
var launchOpenFin = isWindows ? winLauncher.launchOpenFin : nixLauncher.launchOpenFin;
var runningOs = assetUtilities.getRunningOs();
var launchOpenFin = runningOs === assetUtilities.OS_TYPES.windows ? winLauncher.launchOpenFin : nixLauncher.launchOpenFin;

@@ -11,0 +11,0 @@ module.exports = {

var spawn = require('child_process').spawn;
var q = require('q');
var https = require('https');
var http = require('http');
var expandOptions = require('./expand-options');
var assetFetcher = require('./asset-fetcher');
var assetUtilities = require('./asset-utilities');

@@ -12,27 +12,10 @@ function isURL(str) {

function download(url, existingDeffered) {
var isHttps = url.lastIndexOf('https') >= 0;
var downloadStream = isHttps ? https : http;
var deffered = existingDeffered || q.defer();
function onError(err) {
if (isHttps) {
console.log('HTTPS download failed, trying http');
download(url.replace('https', 'http'), deffered);
assetFetcher.getData(url, function(err, data) {
if (err) {
deffered.reject(err);
} else {
deffered.reject(new Error(err));
deffered.resolve(data);
}
}
downloadStream.get(url, function(res) {
var content = '';
res.setEncoding('utf8');
res.on('data', function(chunk) {
content += chunk;
});
res.on('end', function() {
deffered.resolve(content);
});
res.on('error', onError);
}).on('error', onError);
});
return deffered.promise;

@@ -45,3 +28,2 @@ }

return download(configPath).then(function(config) {
console.log('got the config');
return JSON.parse(config);

@@ -56,3 +38,2 @@ });

//TODO: handle linux.
function launch(options) {

@@ -64,18 +45,27 @@ var deffered = q.defer();

try {
var of = spawn(combinedOpts.macAppPath + '/Contents/MacOS/OpenFin', ['--startup-url="' + combinedOpts.configPath + '" ', config.runtime.arguments], {
encoding: 'utf8'
});
assetUtilities.downloadRuntime(config.runtime.version, function(err, runtimePath) {
if (err) {
deffered.reject(err);
} else {
//BUG: in linux there is a bug were '--no-sandbox' is not only required but it needs to be the only thing.
var args = assetUtilities.getRunningOs() !== assetUtilities.OS_TYPES.linux ? config.runtime.arguments : '--no-sandbox';
var of = spawn(runtimePath, ['--startup-url="' + combinedOpts.configPath + '" ', args], {
encoding: 'utf8'
});
of.stdout.on('data', function(data) {
console.log("" + data);
});
of.stderr.on('data', function(data) {
console.log("" + data);
});
of.stdout.on('data', function(data) {
console.log("" + data);
});
of.stderr.on('data', function(data) {
console.log("" + data);
});
of.on('exit', function(code) {
console.log(code);
deffered.resolve(code);
of.on('exit', function(code) {
console.log(code);
deffered.resolve(code);
});
}
});
} catch (error) {
console.log(error);
deffered.reject(error);

@@ -82,0 +72,0 @@ }

@@ -1,35 +0,24 @@

var https = require('https');
var http = require('http');
var request = require('request');
var path = require('path');
var unzip = require('unzip');
var q = require('q');
var assetFetcher = require('./asset-fetcher');
var assetUtilities = require('./asset-utilities');
var fs = require('fs');
function download(url, writePath) {
var deffered = q.defer(),
isHttps,
downloadStream;
function onError(err) {
if (isHttps) {
console.log('HTTPS download failed, trying http');
getRvm(url.replace('https', 'http'));
var deffered = q.defer();
var tmpLocation = '.rvmTmp';
assetFetcher.downloadFile(url, tmpLocation, function(err) {
if (err) {
deffered.reject(err);
} else {
deffered.reject(new Error(err));
assetUtilities.unzipFile(tmpLocation, writePath, function(unzipErr) {
if (unzipErr) {
deffered.reject(unzipErr);
} else {
fs.unlink(tmpLocation);
deffered.resolve();
}
});
}
}
});
function getRvm(rvmUrl) {
isHttps = rvmUrl.lastIndexOf('https') >= 0;
downloadStream = isHttps ? https : http;
request.get(rvmUrl).on('error', onError).pipe(unzip.Extract({
path: path.dirname(writePath)
}).on('close', function() {
deffered.resolve();
}));
}
getRvm(url);
return deffered.promise;

@@ -36,0 +25,0 @@ }

{
"name": "openfin-launcher",
"version": "1.2.1",
"version": "1.3.1",
"description": "OpenFin launcher",

@@ -16,6 +16,7 @@ "author": "Ricardo de Pena <ricardo.depena@gmail.com>",

"dependencies": {
"unzip": "^0.1.11",
"lodash": "^2.4.1",
"q": "^1.1.2",
"request": "^2.69.0"
"request": "^2.69.0",
"single-line-log": "^1.1.1",
"unzip": "^0.1.11"
},

@@ -22,0 +23,0 @@ "devDependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc