Comparing version 0.0.4 to 0.0.5
// 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 @@ |
@@ -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" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
14373
10
390
4
+ Addedip@^0.3.2
+ Addedlocaltunnel@^1.5.0
+ Addedansi-regex@2.1.1(transitive)
+ Addedaxios@0.19.0(transitive)
+ Addedcamelcase@3.0.0(transitive)
+ Addedcliui@3.2.0(transitive)
+ Addedcode-point-at@1.1.0(transitive)
+ Addeddebug@4.1.1(transitive)
+ Addeddecamelize@1.2.0(transitive)
+ Addederror-ex@1.3.2(transitive)
+ Addedfind-up@1.1.2(transitive)
+ Addedfollow-redirects@1.5.10(transitive)
+ Addedfunction-bind@1.1.2(transitive)
+ Addedget-caller-file@1.0.3(transitive)
+ Addedgraceful-fs@4.2.11(transitive)
+ Addedhasown@2.0.2(transitive)
+ Addedhosted-git-info@2.8.9(transitive)
+ Addedinvert-kv@1.0.0(transitive)
+ Addedip@0.3.3(transitive)
+ Addedis-arrayish@0.2.1(transitive)
+ Addedis-buffer@2.0.5(transitive)
+ Addedis-core-module@2.15.1(transitive)
+ Addedis-fullwidth-code-point@1.0.0(transitive)
+ Addedis-utf8@0.2.1(transitive)
+ Addedlcid@1.0.0(transitive)
+ Addedload-json-file@1.1.0(transitive)
+ Addedlocaltunnel@1.9.2(transitive)
+ Addedms@2.1.3(transitive)
+ Addednormalize-package-data@2.5.0(transitive)
+ Addednumber-is-nan@1.0.1(transitive)
+ Addedopenurl@1.1.1(transitive)
+ Addedos-locale@1.4.0(transitive)
+ Addedparse-json@2.2.0(transitive)
+ Addedpath-exists@2.1.0(transitive)
+ Addedpath-parse@1.0.7(transitive)
+ Addedpath-type@1.1.0(transitive)
+ Addedpify@2.3.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedread-pkg@1.1.0(transitive)
+ Addedread-pkg-up@1.0.1(transitive)
+ Addedrequire-directory@2.1.1(transitive)
+ Addedrequire-main-filename@1.0.1(transitive)
+ Addedresolve@1.22.8(transitive)
+ Addedsemver@5.7.2(transitive)
+ Addedset-blocking@2.0.0(transitive)
+ Addedspdx-correct@3.2.0(transitive)
+ Addedspdx-exceptions@2.5.0(transitive)
+ Addedspdx-expression-parse@3.0.1(transitive)
+ Addedspdx-license-ids@3.0.20(transitive)
+ Addedstring-width@1.0.2(transitive)
+ Addedstrip-ansi@3.0.1(transitive)
+ Addedstrip-bom@2.0.0(transitive)
+ Addedsupports-preserve-symlinks-flag@1.0.0(transitive)
+ Addedvalidate-npm-package-license@3.0.4(transitive)
+ Addedwhich-module@1.0.0(transitive)
+ Addedwrap-ansi@2.1.0(transitive)
+ Addedy18n@3.2.2(transitive)
+ Addedyargs@6.6.0(transitive)
+ Addedyargs-parser@4.2.1(transitive)