diff --git a/app/src/Chat.js b/app/src/Chat.js index c53f9c1..87a1312 100644 --- a/app/src/Chat.js +++ b/app/src/Chat.js @@ -431,7 +431,7 @@ export default class Chat extends Component { className="party-controls-users-chip" clickable size="small" - label={usersOnCall[id].info.name} + label={usersOnCall[id].info.name || ' '} /> ) : null; })} diff --git a/functions/modules/createRoom.js b/functions/modules/createRoom.js index 3919f2e..d8f4cfc 100644 --- a/functions/modules/createRoom.js +++ b/functions/modules/createRoom.js @@ -46,6 +46,23 @@ module.exports = async (req, res) => { err ); }); + await admin + .firestore() + .collection('rooms') + .doc(bodydata.partyName) + .collection('messages') + .add({ + uid: '', + name: '', + text: `Voice calls are unavailable temporarily.`, + time: new Date(), + }) + .catch((err) => { + console.error( + `Failed to add system voice call message : \n\t Room: ${bodydata.partyName}`, + err + ); + }); await admin .firestore() .collection('rooms') diff --git a/functions/modules/tokenRefresher.js b/functions/modules/tokenRefresher.js index 8981197..92def06 100644 --- a/functions/modules/tokenRefresher.js +++ b/functions/modules/tokenRefresher.js @@ -1,20 +1,21 @@ const VoxeetSecret = require('../VoxeetSecret.json'); module.exports = async (req, res) => { - const { key, secret } = VoxeetSecret; - const credentials = btoa(encodeURI(key) + ':' + encodeURI(secret)); - const headers = { - 'Content-Type': 'application/json', - 'Cache-Control': 'no-cache', - Authorization: 'Basic ' + credentials, - }; - const oauth = await fetch(VoxeetSecret.refreshURL, { - method: 'POST', - headers, - body: JSON.stringify({ - refresh_token: req.params.token, - }), - }) - .then((oauthResponse) => oauthResponse.json()) - .catch((err) => res.status(500).send(err)); - if (oauth) res.status(200).send(oauth); + res.status(403).send({ message: 'Voice calls are unavailable temporarily.' }); + // const { key, secret } = VoxeetSecret; + // const credentials = btoa(encodeURI(key) + ':' + encodeURI(secret)); + // const headers = { + // 'Content-Type': 'application/json', + // 'Cache-Control': 'no-cache', + // Authorization: 'Basic ' + credentials, + // }; + // const oauth = await fetch(VoxeetSecret.refreshURL, { + // method: 'POST', + // headers, + // body: JSON.stringify({ + // refresh_token: req.params.token, + // }), + // }) + // .then((oauthResponse) => oauthResponse.json()) + // .catch((err) => res.status(500).send(err)); + // if (oauth) res.status(200).send(oauth); }; diff --git a/functions/modules/tokenValidator.js b/functions/modules/tokenValidator.js index dc28d91..5173201 100644 --- a/functions/modules/tokenValidator.js +++ b/functions/modules/tokenValidator.js @@ -1,21 +1,22 @@ const VoxeetSecret = require('../VoxeetSecret.json'); const fetch = require('node-fetch'); module.exports = async (req, res) => { - const { key, secret } = VoxeetSecret; - const credentials = Buffer.from(encodeURI(key) + ':' + encodeURI(secret)).toString('base64'); - const headers = { - 'Content-Type': 'application/json', - 'Cache-Control': 'no-cache', - Authorization: 'Basic ' + credentials, - }; - const oauth = await fetch(VoxeetSecret.validateURL, { - method: 'POST', - headers, - body: JSON.stringify({ - grant_type: 'client_credentials', - }), - }) - .then((oauthResponse) => oauthResponse.json()) - .catch((err) => res.status(500).send(err)); - if (oauth) res.status(200).send(oauth); + res.status(403).send({ message: 'Voice calls are unavailable temporarily.' }); + // const { key, secret } = VoxeetSecret; + // const credentials = Buffer.from(encodeURI(key) + ':' + encodeURI(secret)).toString('base64'); + // const headers = { + // 'Content-Type': 'application/json', + // 'Cache-Control': 'no-cache', + // Authorization: 'Basic ' + credentials, + // }; + // const oauth = await fetch(VoxeetSecret.validateURL, { + // method: 'POST', + // headers, + // body: JSON.stringify({ + // grant_type: 'client_credentials', + // }), + // }) + // .then((oauthResponse) => oauthResponse.json()) + // .catch((err) => res.status(500).send(err)); + // if (oauth) res.status(200).send(oauth); };