aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorakshitkrnagpal <akshitkrnagpal@gmail.com>2018-06-23 05:06:48 +0530
committerHristo Terezov <hristo@jitsi.org>2018-06-29 16:13:34 -0500
commit541cfd340146135f21d9cd8a18ec11b5d3d333fa (patch)
tree404cf16806db341d0f0a80e6c64495b0d8b08294
parentc0f5d0e208c15b75a5714fd738bdb5f37c72d79e (diff)
Replaced getAvatarURL from js-utils
-rw-r--r--app/features/settings/middleware.js2
-rw-r--r--app/features/settings/reducer.js2
-rw-r--r--app/features/utils/functions.js33
-rw-r--r--package-lock.json12
-rw-r--r--package.json2
-rw-r--r--webpack.config.js2
6 files changed, 16 insertions, 37 deletions
diff --git a/app/features/settings/middleware.js b/app/features/settings/middleware.js
index 0d6e489..ece54ea 100644
--- a/app/features/settings/middleware.js
+++ b/app/features/settings/middleware.js
@@ -1,6 +1,6 @@
// @flow
-import { getAvatarURL } from '../utils';
+import { getAvatarURL } from 'js-utils';
import { SET_EMAIL, SET_NAME } from './actionTypes';
import { setAvatarURL } from './actions';
diff --git a/app/features/settings/reducer.js b/app/features/settings/reducer.js
index 5daaf4e..e453a06 100644
--- a/app/features/settings/reducer.js
+++ b/app/features/settings/reducer.js
@@ -2,7 +2,7 @@
import os from 'os';
-import { getAvatarURL } from '../utils';
+import { getAvatarURL } from 'js-utils';
import {
SET_AVATAR_URL,
diff --git a/app/features/utils/functions.js b/app/features/utils/functions.js
index df26f0b..2b86d2e 100644
--- a/app/features/utils/functions.js
+++ b/app/features/utils/functions.js
@@ -3,7 +3,6 @@
// @flow
import { shell } from 'electron';
-import md5 from 'js-md5';
import config from '../config';
/**
@@ -56,35 +55,3 @@ export function normalizeServerURL(url: string) {
export function openExternalLink(link: string) {
shell.openExternal(link);
}
-
-/**
- * Returns the Avatar URL to be used.
- *
- * @param {string} key - Unique key to generate Avatar URL.
- * @returns {string}
- */
-export function getAvatarURL({ email, id }: {
- email: string,
- id: string
-}) {
- let key = email || id;
- let urlPrefix;
- let urlSuffix;
-
- // If the ID looks like an e-mail address, we'll use Gravatar because it
- // supports e-mail addresses.
- if (key && key.indexOf('@') > 0) {
-
- // URL prefix and suffix of gravatar service.
- urlPrefix = 'https://www.gravatar.com/avatar/';
- urlSuffix = '?d=wavatar&size=200';
- } else {
- key = id;
-
- // Otherwise, use a default (meeples, of course).
- urlPrefix = 'https://abotars.jitsi.net/meeple/';
- urlSuffix = '';
- }
-
- return urlPrefix + md5.hex(key.trim().toLowerCase()) + urlSuffix;
-}
diff --git a/package-lock.json b/package-lock.json
index 007b6db..e8e7292 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2363,6 +2363,11 @@
"integrity": "sha1-aN/1++YMUes3cl6p4+0xDcwed24=",
"dev": true
},
+ "bowser": {
+ "version": "1.9.1",
+ "resolved": "https://registry.npmjs.org/bowser/-/bowser-1.9.1.tgz",
+ "integrity": "sha512-UXti1JB6oK8hO983AImunnV6j/fqAEeDlPXh99zhsP5g32oLbxJJ6qcOaUesR+tqqhnUVQHlRJyD0dfiV0Hxaw=="
+ },
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -7321,6 +7326,13 @@
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz",
"integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls="
},
+ "js-utils": {
+ "version": "github:jitsi/js-utils#0c53500a5120be2aa3fc590f0f932a0d4771920f",
+ "requires": {
+ "bowser": "1.9.1",
+ "js-md5": "0.7.3"
+ }
+ },
"js-yaml": {
"version": "3.7.0",
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.7.0.tgz",
diff --git a/package.json b/package.json
index 261dc08..2e3227f 100644
--- a/package.json
+++ b/package.json
@@ -45,8 +45,8 @@
"electron-window-state": "4.1.1",
"history": "4.7.2",
"jitsi-meet-electron-utils": "github:jitsi/jitsi-meet-electron-utils#1972c3bf0884ace68eb496894dabae593d6dbf49",
- "js-md5": "0.7.3",
"mousetrap": "1.6.2",
+ "js-utils": "github:jitsi/js-utils#0c53500a5120be2aa3fc590f0f932a0d4771920f",
"react": "16.3.2",
"react-dom": "16.3.2",
"react-redux": "5.0.7",
diff --git a/webpack.config.js b/webpack.config.js
index 13fce15..62831a6 100644
--- a/webpack.config.js
+++ b/webpack.config.js
@@ -12,7 +12,7 @@ const commonConfig = {
module: {
rules: [
{
- exclude: /(node_modules)/,
+ exclude: /node_modules(?!\/js-utils)/,
loader: 'babel-loader',
options: {
presets: [