@stendahls/libravatar-server
Advanced tools
Comparing version 1.7.0 to 1.8.0
@@ -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 @@ } |
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
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
20473
435
1
+ Addedchownr@2.0.0(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addedmimic-response@3.1.0(transitive)
+ Addedminipass@5.0.0(transitive)
+ Addedmkdirp@1.0.4(transitive)
+ Addednode-addon-api@3.2.1(transitive)
+ Addedsemver@7.6.3(transitive)
+ Addedsharp@0.25.4(transitive)
+ Addedsimple-get@4.0.1(transitive)
+ Addedtar@6.2.1(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removednan@2.22.0(transitive)
- Removedsemver@6.3.1(transitive)
- Removedsharp@0.23.4(transitive)
- Removedtar@5.0.11(transitive)
Updateddotenv@^8.2.0
Updatedsharp@^0.25.4