caravaggio
Advanced tools
Comparing version 1.3.2 to 1.3.3
{ | ||
"name": "caravaggio", | ||
"version": "1.3.2", | ||
"version": "1.3.3", | ||
"description": "A blazing fast image processor service", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
module.exports = value => ({ | ||
transformations: [ | ||
[{ | ||
{ | ||
name: 'blur', | ||
operation: 'blur', | ||
params: [value && parseFloat(value, 10)], | ||
}], | ||
}, | ||
], | ||
}); |
module.exports = value => ({ | ||
transformations: [ | ||
[ | ||
{ | ||
name: 'flip', | ||
operation: !value || value.toLowerCase() === 'x' ? 'flop' : 'flip', | ||
params: [true], | ||
}, | ||
], | ||
{ | ||
name: 'flip', | ||
operation: !value || value.toLowerCase() === 'x' ? 'flop' : 'flip', | ||
params: [true], | ||
}, | ||
], | ||
}); |
@@ -65,5 +65,5 @@ const blurNormalizer = require('./blur'); | ||
}); | ||
// console.log(JSON.stringify(result, null, ' ')); | ||
return result; | ||
}; | ||
}; |
const logger = require('../logger'); | ||
const reducer = async (acc, { /* name, */ operation, params }) => acc.then(async (pipeline) => { | ||
const reducer = async (acc, { name, operation, params }) => acc.then(async (pipeline) => { | ||
if (operation instanceof Function) { | ||
return (await operation(pipeline)).reduce(reducer, Promise.resolve(pipeline)); | ||
} | ||
// console.log(acc, operation); | ||
if (!pipeline.hasOperation(operation)) { | ||
throw new Error(`Invalid operation: ${operation}`); | ||
throw new Error(`Invalid operation: ${name}:${operation}`); | ||
} | ||
@@ -10,0 +11,0 @@ logger.debug(`Applying transformation "${operation}" with parameters: ${JSON.stringify(params, null, '')}`); |
@@ -14,3 +14,3 @@ const { URL } = require('url'); | ||
const options = parseOptions(req.params._[0]); | ||
const url = new URL(req.params._[1]); | ||
const url = new URL(decodeURIComponent(req.params._[1])); | ||
const resource = await cache.get(url, options); | ||
@@ -17,0 +17,0 @@ if (resource) { |
@@ -46,3 +46,3 @@ const redirect = require('micro-redirect'); | ||
} | ||
res.setHeader('Content-type', await getMimeType(resource, options)); | ||
res.setHeader('content-type', await getMimeType(resource, options)); | ||
return send(res, 200, resource.buffer); | ||
@@ -49,0 +49,0 @@ } |
Sorry, the diff of this file is not supported yet
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
38022
45