Comparing version 1.1.0 to 1.1.1
{ | ||
"name": "immp", | ||
"description": "Image Manipulation Middleware Proxy", | ||
"version": "1.1.0", | ||
"version": "1.1.1", | ||
"repository": "garrows/IMMP", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -33,2 +33,3 @@ var _ = require('underscore'), | ||
var image = { | ||
query: JSON.stringify(_req.query), | ||
location: _req.query.image, | ||
@@ -73,2 +74,3 @@ resize: { | ||
if (stat && now - createdAt < config.ttl) { | ||
_res.statusCode = 304; | ||
gm(config.cacheFolder + '/' + image.hash) | ||
@@ -75,0 +77,0 @@ .options(gmOptions) |
@@ -1,2 +0,4 @@ | ||
var cluster = require('cluster'), | ||
var async = require('async'), | ||
cluster = require('cluster'), | ||
cwd = process.cwd(), | ||
fs = require('fs'), | ||
@@ -8,3 +10,3 @@ gm = require('gm'), | ||
var immpPath = path.join(process.cwd(), '/.tmp/immp'), | ||
var immpPath = path.join(cwd, '/.tmp/immp'), | ||
gmOptions = { | ||
@@ -19,3 +21,3 @@ bufferStream: true, | ||
cluster.setupMaster({ | ||
exec: path.join(process.cwd(), '/bin/www') | ||
exec: path.join(cwd, '/bin/www') | ||
}); | ||
@@ -36,2 +38,4 @@ cluster.fork(); | ||
it('should resize by width', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -55,2 +59,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&resize=200x0', function(_httpResponse) { | ||
it('should resize by height', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -74,2 +80,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&resize=0x200', function(_httpResponse) { | ||
it('should not upscale by default', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -94,2 +102,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&resize=2000x2000', function(_httpResponse) { | ||
it('should upscale when upscaling is true', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -114,2 +124,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&resize=2000x2000&upscale=true', function(_httpResponse) { | ||
it('should resize by width and height and retain the aspect ratio', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -136,2 +148,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&resize=100x200', function(_httpResponse) { | ||
it('should crop to a square', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -156,2 +170,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&crop=1x1', function(_httpResponse) { | ||
it('should crop to a short width big height ratio', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -177,2 +193,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&crop=9x16', function(_httpResponse) { | ||
it('should crop to a big width short height ratio', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -197,2 +215,4 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&crop=16x9', function(_httpResponse) { | ||
it('should crop and resize', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
@@ -216,2 +236,41 @@ http.get('http://localhost:3000/im/?image=/images/robot.jpg&crop=1x1&resize=50x100', function(_httpResponse) { | ||
it('should invalidate the cache by using adding a timestamp to the query object', function(_done) { | ||
this.slow(5000); | ||
this.timeout(10000); | ||
var requestUrl = 'http://localhost:3000/im/?image=/images/robot.jpg&crop=16x19&resize=300x300'; | ||
async.waterfall([ | ||
function(_callback) { | ||
http.get(requestUrl, function(_httpResponse) { | ||
_httpResponse.statusCode.should.eql(200); | ||
_callback(); | ||
}); | ||
}, | ||
function(_callback) { | ||
http.get(requestUrl, function(_httpResponse) { | ||
_httpResponse.statusCode.should.eql(304); | ||
_callback(); | ||
}); | ||
}, | ||
function(_callback) { | ||
http.get(requestUrl + '&c=1', function(_httpResponse) { | ||
_httpResponse.statusCode.should.eql(200); | ||
_callback(); | ||
}); | ||
} | ||
], _done); | ||
}); | ||
}); |
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
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
15135
352
2