photon
Advanced tools
Comparing version 2.0.1 to 3.0.0
@@ -0,1 +1,6 @@ | ||
3.0.0 / 2018-01-08 | ||
================== | ||
* Add support for WordPress.com photon server (#10, @sirreal) | ||
2.0.1 / 2017-11-08 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -58,3 +58,3 @@ | ||
if ( isAlreadyPhotoned( parsedUrl.host ) ) { | ||
if ( isWpcomImage( parsedUrl.host ) || isAlreadyPhotoned( parsedUrl.host ) ) { | ||
// We already have a server to use. | ||
@@ -104,2 +104,6 @@ // Use it, even if it doesn't match our hash. | ||
function isWpcomImage( host ) { | ||
return /\.files\.wordpress\.com$/.test(host); | ||
} | ||
function isAlreadyPhotoned( host ) { | ||
@@ -106,0 +110,0 @@ return /^i[0-2]\.wp\.com$/.test(host); |
{ | ||
"name": "photon", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "JavaScript library for the WordPress.com Photon image manipulation service", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -67,3 +67,3 @@ # photon.js | ||
MIT – Copyright 2014-2017 Automattic | ||
MIT – Copyright 2014-2018 Automattic | ||
@@ -70,0 +70,0 @@ [Node.js]: http://nodejs.org |
@@ -61,2 +61,7 @@ | ||
it('should handle photoning a WordPress.com url', function() { | ||
var url = photon('https://example.files.wordpress.com/2018/12/pexels-photo-1461974.jpeg'); | ||
assert.strictEqual(photon(url), url); | ||
}); | ||
it('should add width parameters if specified', function() { | ||
@@ -69,2 +74,10 @@ var photonedUrl = photon('http://example.com/image.png', { width: 50 }); | ||
it('should add width parameters to WordPress.com url if specified', function() { | ||
var photonedUrl = photon('https://example.files.wordpress.com/2018/12/pexels-photo-1461974.jpeg', { width: 50 }); | ||
var parsedUrl = parseUrl(photonedUrl, true, true); | ||
assertQuery(photonedUrl, { 'w':'50' }); | ||
}); | ||
it('should return null for URLs with querystrings from non-photon hosts', function() { | ||
@@ -71,0 +84,0 @@ var url = 'http://example.com/image.png?foo=bar'; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
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
89656
2511
0
1