Commit 0c447903 authored by Kenny Au's avatar Kenny Au Committed by Harrison Healey

Use gfycat-sdk npm module. (#563)

parent e980be68
......@@ -5011,6 +5011,14 @@
"integrity": "sha1-q93z1dHnfdlnzPorA2oKH7Jv1/c=",
"dev": true
},
"gfycat-sdk": {
"version": "1.4.18",
"resolved": "https://registry.npmjs.org/gfycat-sdk/-/gfycat-sdk-1.4.18.tgz",
"integrity": "sha512-BrINtO6rj8Nr0pm38Qr3epayOuvlKcEFcDCw6yL9T4SrsWTECct6FS/isli766kdij2GGG6bWU6bRp+fDS2Cbg==",
"requires": {
"babel-runtime": "6.26.0"
}
},
"github": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/github/-/github-0.2.4.tgz",
......
......@@ -3,7 +3,7 @@
import {GifTypes} from 'action_types';
import {Client4} from 'client';
import gfycatSdk from 'utils/gfycatSdk';
import gfycatSdk from 'utils/gfycat_sdk';
// APP PROPS
......
This diff is collapsed.
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import Gfycat from './gfycat-sdk.umd.bundle.min';
import Gfycat from 'gfycat-sdk';
const defaultKey = '2_KtH_W5';
const defaultSecret = '3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof';
let activeKey = null;
let activeSecret = null;
let instance = null;
export default function(key, secret) {
let currentKey = key;
let currentSecret = secret;
if (!key || !secret) {
currentKey = '2_KtH_W5';
currentSecret = '3wLVZPiswc3DnaiaFoLkDvB4X0IV6CpMkj4tf2inJRsBY6-FnkT08zGmppWFgeof';
if (instance && activeKey === key && activeSecret === secret) {
return instance;
}
if (instance && activeKey === currentKey && activeSecret === currentSecret) {
if (!key || !secret) {
instance = new Gfycat({client_id: defaultKey, client_secret: defaultSecret});
return instance;
}
activeKey = currentKey;
activeSecret = currentSecret;
instance = new Gfycat({client_id: activeKey, client_secret: activeSecret});
activeKey = key;
activeSecret = secret;
instance = new Gfycat({client_id: key, client_secret: secret});
return instance;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment