Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Check whether the image exists at Gravatar.
await request.head(gravatarUrl).promise();
res.redirect(gravatarUrl);
return;
} catch (e) {
// No image available at Gravtar, therefore no forwarding.
}
}
res.status(200);
res.setHeader('Content-Type', 'image/svg+xml');
res.setHeader('Cache-Control', 'public, max-age=' + ms(privateConfig.apiHttpCaching) / 1000);
res.end(new Avatars(spriteCollectionPackage(options.cast(requestOptions))).create(seed));
} catch (e) {
console.error(e);
res.status(500).end('Failed to load package ' + spriteCollection.name);
}
}
);
import React, { Component } from 'react';
import Avatars from '@dicebear/avatars';
import MaleSpriteCollection from '@dicebear/avatars-male-sprites';
import FemaleSpriteCollection from '@dicebear/avatars-female-sprites';
let maleAvatars = new Avatars(MaleSpriteCollection);
let femaleAvatars = new Avatars(FemaleSpriteCollection);
class PublisherIcon extends Component {
constructor(props){
super(props);
this.state = {
avatarSrc: ""
}
this.updateAvatar = this.updateAvatar.bind(this);
this.setDiceBearAvatar = this.setDiceBearAvatar.bind(this);
}
componentDidMount(){
// Every time the state changes, log it
this.updateAvatar(this.props)
}
import React, { Component } from 'react';
import Avatars from '@dicebear/avatars';
import MaleSpriteCollection from '@dicebear/avatars-male-sprites';
import FemaleSpriteCollection from '@dicebear/avatars-female-sprites';
let maleAvatars = new Avatars(MaleSpriteCollection);
let femaleAvatars = new Avatars(FemaleSpriteCollection);
class PublisherIcon extends Component {
constructor(props){
super(props);
this.state = {
avatarSrc: ""
}
this.updateAvatar = this.updateAvatar.bind(this);
this.setDiceBearAvatar = this.setDiceBearAvatar.bind(this);
}
componentDidMount(){
// Every time the state changes, log it
this.updateAvatar(this.props)
svg() {
const options = {}
const avatars = new Avatars(sprites(options))
return avatars.create(this.address)
}
}