mirror of
https://github.com/Kong/insomnia
synced 2024-11-12 17:26:32 +00:00
93c91ebdbe
* Upgrade Electron to 8, bump Node version, fix font-manager * Specify nodeIntegration as true * Get <webview> working again * Get <webview> working again * Electron 9.0 * Escape parens in plugin install exec path (newer Electron added them) * Bump versions for first alpha * Electron 9.1 * Convert all Electron APIs that switched from callback to Promise * Fix send-and-download feature * Remove user-agent override hack for OAuth 2 login window * Bump alpha version * Fix issue regarding chokidar * Add package-lock.json * Upgrade chokidar because @babel/cli uses an older incompatible version of fsevents * Fix source maps * Read .nvmrc in GitHub actions * Address remaining PR feedback
41 lines
919 B
JavaScript
41 lines
919 B
JavaScript
// @flow
|
|
import * as React from 'react';
|
|
import crypto from 'crypto';
|
|
|
|
type Props = {|
|
|
email?: string,
|
|
size?: number,
|
|
fallback?: string,
|
|
className?: string,
|
|
rouned?: boolean,
|
|
|};
|
|
|
|
class GravatarImg extends React.PureComponent<Props> {
|
|
render() {
|
|
const { email, size: rawSize, className, fallback, rounded } = this.props;
|
|
const size = rawSize || 100;
|
|
let src = fallback;
|
|
|
|
if (email) {
|
|
const hash = crypto
|
|
.createHash('md5')
|
|
.update(email.trim().toLowerCase())
|
|
.digest('hex');
|
|
src = `https://www.gravatar.com/avatar/${hash}?s=${size * 2}`;
|
|
}
|
|
|
|
const cssSize = `${size}px`;
|
|
return (
|
|
<img
|
|
src={src}
|
|
alt="Profile picture"
|
|
title="Profile picture"
|
|
className={className}
|
|
style={{ width: cssSize, height: cssSize, borderRadius: rounded ? cssSize : null }}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default GravatarImg;
|