Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

kepler-api

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

kepler-api - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

lib/TunnelManager.js

65

lib/Build.js
// Generated by CoffeeScript 1.9.2
(function() {
var Build, Promise, Screenshot;
var Build, Promise, Screenshot, TunnelManager, dns, ip, url;
Screenshot = require('./Screenshot');
TunnelManager = require('./TunnelManager');
Promise = require('bluebird');
dns = require('dns');
ip = require('ip');
url = require('url');
Build = (function() {

@@ -45,3 +53,3 @@ function Build(project, number) {

Build.prototype.capture = function(targetUrl, slug, meta, versions, delay) {
var data, ref;
var actualSlug, pieces, ref, ref1;
if (typeof targetUrl === 'object' && !(targetUrl instanceof String)) {

@@ -56,11 +64,46 @@ ref = targetUrl, targetUrl = ref.targetUrl, slug = ref.slug, meta = ref.meta, versions = ref.versions, delay = ref.delay;

}
data = {
'slug': slug,
'target': targetUrl,
'meta': meta,
'versions': versions,
'delay': delay
};
slug = this.rpc('POST', '', data);
return Screenshot(this.project, this, slug);
pieces = url.parse(targetUrl);
if ((ref1 = pieces.protocol) !== 'http:' && ref1 !== 'https:') {
throw new Error('Only http(s) supported');
}
actualSlug = Promise.fromNode(function(next) {
return dns.lookup(pieces.hostname, next);
}).spread(function(address, family) {
if (ip.isPrivate(address)) {
if (!pieces.port) {
if (pieces.protocol === 'http:') {
pieces.port = 80;
} else {
pieces.port = 443;
}
}
return TunnelManager.open(pieces.hostname, pieces.port).then(function(tunnel) {
var i, key, len, ref2, tunnelPieces;
tunnelPieces = url.parse(tunnel);
ref2 = ['protocol', 'host', 'port', 'hostname'];
for (i = 0, len = ref2.length; i < len; i++) {
key = ref2[i];
pieces[key] = tunnelPieces[key];
}
return url.format(pieces);
});
} else {
return targetUrl;
}
}).then((function(_this) {
return function(target) {
var data;
data = {
'slug': slug,
'target': target,
'meta': meta,
'versions': versions,
'delay': delay
};
return _this.rpc('POST', '', data);
};
})(this))["finally"](function() {
return TunnelManager.close(pieces.hostname, pieces.port);
});
return Screenshot(this.project, this, actualSlug);
};

@@ -67,0 +110,0 @@

2

lib/index.js

@@ -31,3 +31,3 @@ // Generated by CoffeeScript 1.9.2

} else {
return build = project.build();
return build = project.build(properties.buildMeta);
}

@@ -34,0 +34,0 @@ };

{
"name": "kepler-api",
"version": "0.0.4",
"version": "0.0.5",
"description": "Screenshot service API",
"keywords": ["screenshot", "api", "phantom", "phantomjs"],
"keywords": [
"screenshot",
"api",
"phantom",
"phantomjs"
],
"author": "Planetary <team@planetary.io>",

@@ -20,2 +25,4 @@ "contributors": [

"bluebird": "^2.9.25",
"ip": "^0.3.2",
"localtunnel": "^1.5.0",
"request": "^2.55.0"

@@ -32,3 +39,5 @@ },

"main": "lib",
"files": ["lib"],
"files": [
"lib"
],
"scripts": {

@@ -35,0 +44,0 @@ "prepublish": "coffee -o lib -c src"

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