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

@jitsi/js-utils

Package Overview
Dependencies
Maintainers
7
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jitsi/js-utils - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

38

avatar/index.js
import md5 from 'js-md5';
/**
* Returns the Avatar URL to be used for the participant.
*
* @param {string} [participant.avatarID] - Participant's avatar ID.
* @param {string} [participant.email] - Participant's e-mail address.
* @param {string} [participant.id] - Participant's ID.
* @param {string} [avatarService.urlPrefix] - URL Prefix of the avatar service.
* @param {string} [avatarService.urlSuffix] - URL Suffix of the avatar service.
* @returns {string} - Avatar URL.
*/
export function getAvatarURL(participant, avatarService = {}) {
const { avatarID, email, id } = participant;
const { urlPrefix = 'https://abotars.jitsi.net/meeple/', urlSuffix = '' } = avatarService;
return getGravatarURL(email)
|| generateAvatarURL(avatarID || id, urlPrefix, urlSuffix);
}
/**
* Returns the Avatar URL generated from the given avatar service.
*
* @param {string} key - Key using which avatar has to be generated.
* @param {string} urlPrefix - URL Prefix of the avatar service to be used.
* @param {string} urlSuffix - URL Suffix of the avatar service to be used.
* @returns {string}
*/
function generateAvatarURL(key, urlPrefix, urlSuffix) {
return urlPrefix + md5.hex(key.trim().toLowerCase()) + urlSuffix;
}
/**
* Returns the Gravatar URL of a given email id.
*
* @param {string} key - Email or id for which we need gravatar url.
* @param {string} key - Email or id for which we need gravatar URL.
* @param {string} baseURL - Base Gravatar URL.
* @returns {string} - Gravatar URL.
*/
export function getGravatarURL(key) {
const urlPrefix = 'https://www.gravatar.com/avatar/';
export function getGravatarURL(key, baseURL = 'https://seccdn.libravatar.org/avatar/') {
const urlSuffix = '?d=404&size=200';

@@ -46,3 +16,3 @@

return `${urlPrefix}${avatarKey}${urlSuffix}`;
return `${baseURL}${avatarKey}${urlSuffix}`;
}

@@ -49,0 +19,0 @@

2

package.json
{
"name": "@jitsi/js-utils",
"version": "1.0.2",
"version": "1.0.3",
"description": "Utilities for Jitsi JS projects",

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

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