Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: share emoji's in video conferencing #12

Merged
merged 8 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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