Socket
Socket
Sign inDemoInstall

photon

Package Overview
Dependencies
4
Maintainers
22
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.1 to 3.0.0

5

History.md

@@ -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 @@ ==================

6

index.js

@@ -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);

2

package.json
{
"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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc