Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@stendahls/libravatar-server

Package Overview
Dependencies
Maintainers
5
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stendahls/libravatar-server - npm Package Compare versions

Comparing version 1.7.0 to 1.8.0

2

modules/ElvisClient.js

@@ -22,3 +22,3 @@ const got = require( 'got' );

console.log( `Successuflly logged in to Elvis server version ${ response.serverVersion } at ${ this.hostUrl }` );
console.log( `Successuflly logged in to Elvis server version ${ response.serverVersion } at ${ this.hostUrl } with user ${ username }` );
this.token = response.authToken;

@@ -25,0 +25,0 @@ } )

{
"name": "@stendahls/libravatar-server",
"version": "1.7.0",
"version": "1.8.0",
"description": "A node implementation of the Libravatar API",

@@ -15,10 +15,10 @@ "main": "server.js",

"dependencies": {
"dotenv": "^8.1.0",
"dotenv": "^8.2.0",
"express": "^4.17.1",
"got": "^9.6.0",
"is-url": "^1.2.4",
"sharp": "^0.23.0"
"sharp": "^0.25.4"
},
"devDependencies": {
"nodemon": "^1.19.2"
"nodemon": "^2.0.4"
},

@@ -25,0 +25,0 @@ "repository": {

@@ -89,3 +89,4 @@ const sharp = require( 'sharp' );

if ( cache[ emailHash ] && cache[ emailHash ].assetModified >= hashes[ emailHash ].assetModified ) {
const sizeKey = `${ targetSize }x${ targetSize }`
const sizeKey = `${ targetSize }x${ targetSize }`;
if ( cache[ emailHash ].resizedImages[ sizeKey ] ) {

@@ -96,3 +97,3 @@ return cache[ emailHash ].resizedImages[ sizeKey ];

try {
const avatarImage = await sharp( cache[ emailHash ].data )
const avatarImage = await sharp( cache[ emailHash ].imageData )
.resize( {

@@ -109,3 +110,3 @@ width: targetSize,

} catch ( cacheReadError ) {
console.error( `Failed to load the hash ${ emailHash } from cache` );
console.error( `Failed to load the hash ${ emailHash } with size ${ sizeKey } from cache` );
console.error( cache[ emailHash ] );

@@ -112,0 +113,0 @@ }

@@ -61,4 +61,2 @@ #!/usr/bin/env node

const defaultImageCache = {};
app.get( '/', ( request, response ) => {

@@ -85,2 +83,7 @@ response.send( `<!DOCTYPE html>

</p>
<p>
Non-standard options available: <br>
<b>disallowedproviders</b>
A comma separated list of providers that shouldn't be used. Available providers are file, elivs & libaravatarOrg
</p>
</body>

@@ -102,2 +105,3 @@ </html>` );

let targetSize = defaultSize;
let disallowedProviders = [];

@@ -143,9 +147,20 @@ if ( !request.params.emailHash ) {

}
if ( request.query.disallowedproviders ){
disallowedProviders = request.query.disallowedproviders.split(',');
}
if ( !forceDefault ) {
let i = 0;
while (i < providersOrder.length && !avatarImage) {
const provider = providers[providersOrder[i]];
for(const providerName of providersOrder){
if ( disallowedProviders.includes( providerName ) ) {
continue;
}
const provider = providers[providerName];
avatarImage = await provider(emailHash, targetSize);
i = i + 1;
if(avatarImage){
break;
}
}

@@ -152,0 +167,0 @@ }

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc