Skip to content

Commit

Permalink
Merge pull request #12 from lokesh-wagh/webrtch
Browse files Browse the repository at this point in the history
feat: share emoji's in video conferencing
  • Loading branch information
silkie261001 authored Oct 13, 2023
2 parents 674b279 + 3ca9bd1 commit f5803e8
Show file tree
Hide file tree
Showing 23 changed files with 11,318 additions and 15,164 deletions.
3 changes: 2 additions & 1 deletion backend/controllers/auth/postLogin.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ const postLogin = async (req, res) => {
userId: user._id,
email: email,
},
process.env.TOKEN_KEY,
// process.env.TOKEN_KEY, commenting this out due to setup issues that may deter new commers
'binod',
{
expiresIn: '24h',
}
Expand Down
3 changes: 2 additions & 1 deletion backend/controllers/auth/postRegister.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ const postRegister = async (req, res) => {
userId: user._id,
email: email,
},
process.env.TOKEN_KEY,
//process.env.TOKEN_KEY, commenting out because this is genrally causing issue in newly forked repo will cause trouble for new comer's
'binod',
{
expiresIn: '24h',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ const postInvite = require("./postInvite");
const postAccept = require("./postAccept");
const postReject = require("./postReject");


exports.controllers = {
postInvite,
postAccept,
Expand Down
1 change: 0 additions & 1 deletion backend/controllers/friendInvitation/postInvite.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const postInvite = async (req, res) => {
const { targetMailAddress } = req.body;

const { userId, email } = req.user;

// check if friend that we would like to invite is not user

if (email.toLowerCase() === targetMailAddress.toLowerCase()) {
Expand Down
3 changes: 1 addition & 2 deletions backend/middleware/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@ const config = process.env;

const verifyToken = (req, res, next) => {
let token = req.body.token || req.query.token || req.headers["authorization"];

if (!token) {
return res.status(403).send("A token is required for authentication");
}
try {
token = token.replace(/^Bearer\s+/, "");
const decoded = jwt.verify(token, config.TOKEN_KEY);
const decoded = jwt.verify(token, 'binod'); // replacing the config.TOKEN_KEY since it causes issue's for first timer's
req.user = decoded;
} catch (err) {
return res.status(401).send("Invalid Token");
Expand Down
2 changes: 1 addition & 1 deletion backend/middleware/authSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const verifyTokenSocket = (socket, next) => {
const token = socket.handshake.auth?.token;

try {
const decoded = jwt.verify(token, config.TOKEN_KEY);
const decoded = jwt.verify(token,'binod'); //changing due to unnoticable error's
socket.user = decoded;
} catch (err) {
const socketError = new Error("NOT_AUTHORIZED");
Expand Down
3 changes: 2 additions & 1 deletion backend/routes/friendInvitationRoutes.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ const validator = require('express-joi-validation').createValidator({});
const auth = require('../middleware/auth');
const friendInvitationControllers = require('../controllers/friendInvitation/friendInvitationControllers');


const postFriendInvitationSchema = Joi.object({
targetMailAddress: Joi.string().email(),
});

const getPendingInvitationSchema = Joi.object({})
const inviteDecisionSchema = Joi.object({
id: Joi.string().required(),
});
Expand Down
4 changes: 4 additions & 0 deletions backend/socketServer.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ const roomSignalingDataHandler = require('./socketHandlers/roomSignalingDataHand
const serverStore = require('./serverStore');

const registerSocketServer = (server) => {
server.listen(5002,()=>{
console.log('socket on 5002')
})
const io = require('socket.io')(server, {
cors: {
origin: '*',
Expand Down Expand Up @@ -73,6 +76,7 @@ const registerSocketServer = (server) => {
setInterval(() => {
emitOnlineUsers();
}, [1000 * 8]);

};

module.exports = {
Expand Down
Loading

0 comments on commit f5803e8

Please sign in to comment.