From a29862d3e93d1a47036889a236311eb9fa0d3e77 Mon Sep 17 00:00:00 2001 From: Ayushi Panth Date: Sat, 2 Oct 2021 14:27:23 +0530 Subject: [PATCH 1/3] made changes in app.js --- app.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app.js b/app.js index 7ec44f3..6fff537 100644 --- a/app.js +++ b/app.js @@ -1,4 +1,5 @@ //Importing npm packages + const express = require("express"); const http = require("http"); const cookieParser = require("cookie-parser"); @@ -10,16 +11,20 @@ const keys = require("./config/keys"); const socketio = require("socket.io"); const formatMessage = require('./utils/messages'); const moment = require("moment"); + + //Importing MongoDB models require("./db/mongoose"); const User = require("./models/User"); const webScraper = require("./db/webScraper"); + //Importing Routes const user = require("./routes/user"); const auth = require("./routes/auth"); const friend = require("./routes/friend"); + //Variables const port = process.env.PORT||3000; @@ -82,7 +87,7 @@ io.on('connection',(socket)=>{ console.log("Room Joined"); }); - // Listen for chat message + // Listen for the chat message socket.on('chatMessage',({msg,friend_id,user_id})=>{ User.findOne({_id:user_id},async(err,user)=>{ @@ -127,5 +132,5 @@ io.on('connection',(socket)=>{ server.listen(port,()=>{ - console.log("Server started on "+ port + "!"); + console.log("Server started on the "+ port + "!"); }); \ No newline at end of file From e2bec342f22a92d2587f40c2b794220ace5afb89 Mon Sep 17 00:00:00 2001 From: Ayushi Panth Date: Sat, 2 Oct 2021 14:31:49 +0530 Subject: [PATCH 2/3] mades changes in hackathon.css for card --- assets/css/hackathon.css | 35 ++++++++++++++++++----------------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/assets/css/hackathon.css b/assets/css/hackathon.css index aa02220..d9cfcc7 100644 --- a/assets/css/hackathon.css +++ b/assets/css/hackathon.css @@ -19,7 +19,7 @@ } .back-crcle{ font-size: medium; - color: #fff; + color: #ffffff; position: relative; display: flex; justify-content: center; @@ -33,7 +33,7 @@ .back-crcle:hover{ transform: scale(1.1); transition: 0.25s ease; -color: #fff; +color: #ffffff; } .underline{ height: 2px; @@ -52,7 +52,7 @@ color: #fff; margin-top:-100px ; } .mn p{ - color: #FFF !important; font-size: 27px;font-family: 'Raleway', sans-serif; + color: #FFFFFF !important; font-size: 27px;font-family: 'Raleway', sans-serif; } .usp{ display: flex; @@ -82,7 +82,7 @@ color: #fff; justify-content: center; } .soc-icons{ - color: #fff; + color: #ffffff; font-size: xx-large; } .soc-icons i{ @@ -234,19 +234,7 @@ color: #fff; .form-control{ border: 1px solid #23232321 !important; } -.chat-container{ - background: rgb(8,25,45); -background: -moz-linear-gradient(180deg, rgba(8,25,45,1) 0%, rgba(65,78,93,1) 20%, rgba(215,219,214,1) 20%, rgba(215,219,214,1) 100%); -background: -webkit-linear-gradient(180deg, rgba(8,25,45,1) 0%, rgba(65,78,93,1) 20%, rgba(215,219,214,1) 20%, rgba(215,219,214,1) 100%); -background: linear-gradient(180deg, rgba(8,25,45,1) 0%, rgba(65,78,93,1) 20%, rgba(215,219,214,1) 20%, rgba(215,219,214,1) 100%); -filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#08192d",endColorstr="#d7dbd6",GradientType=1); - height: 100vh; - width: 100vw; - display: flex; - justify-content: center; - align-items: center; - overflow: hidden; -} + .chat-total{ background-color: #fff; width: 90vw; @@ -285,6 +273,19 @@ filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#08192d",endCo .chat-form input{ width: 92%; } +.chat-container{ + background: rgb(8,25,45); +background: -moz-linear-gradient(180deg, rgba(8,25,45,1) 0%, rgba(65,78,93,1) 20%, rgba(215,219,214,1) 20%, rgba(215,219,214,1) 100%); +background: -webkit-linear-gradient(180deg, rgba(8,25,45,1) 0%, rgba(65,78,93,1) 20%, rgba(215,219,214,1) 20%, rgba(215,219,214,1) 100%); +background: linear-gradient(180deg, rgba(8,25,45,1) 0%, rgba(65,78,93,1) 20%, rgba(215,219,214,1) 20%, rgba(215,219,214,1) 100%); +filter: progid:DXImageTransform.Microsoft.gradient(startColorstr="#08192d",endColorstr="#d7dbd6",GradientType=1); + height: 100vh; + width: 100vw; + display: flex; + justify-content: center; + align-items: center; + overflow: hidden; +} .heading { From c5530cf7b34a57f0e81234f27012731e232bc2a6 Mon Sep 17 00:00:00 2001 From: Ayushi Panth Date: Sat, 2 Oct 2021 14:41:19 +0530 Subject: [PATCH 3/3] changes in import statements --- app.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/app.js b/app.js index 6fff537..647eb25 100644 --- a/app.js +++ b/app.js @@ -1,25 +1,37 @@ //Importing npm packages const express = require("express"); + const http = require("http"); + const cookieParser = require("cookie-parser"); + const cookieSession = require("cookie-session"); + const bodyParser = require("body-parser"); + const methodOverride = require('method-override'); + const passport = require("passport"); + const keys = require("./config/keys"); + const socketio = require("socket.io"); + const formatMessage = require('./utils/messages'); + const moment = require("moment"); //Importing MongoDB models + require("./db/mongoose"); const User = require("./models/User"); const webScraper = require("./db/webScraper"); //Importing Routes + const user = require("./routes/user"); const auth = require("./routes/auth"); const friend = require("./routes/friend"); @@ -29,6 +41,7 @@ const friend = require("./routes/friend"); const port = process.env.PORT||3000; const app = express(); + const server=http.createServer(app); const io = socketio(server); @@ -67,6 +80,7 @@ app.get("/",(req,res)=>{ }); }else{ User.findOne({email:req.user.email},(err,user)=>{ + // console.log(err) if(err) Error(err); if(user){ res.redirect("/user/dashboard"); @@ -76,6 +90,7 @@ app.get("/",(req,res)=>{ }); +// new web socket connection io.on('connection',(socket)=>{ @@ -84,12 +99,12 @@ io.on('connection',(socket)=>{ // Runs when user joins room socket.on('joinRoom',({user_id})=>{ socket.join(user_id); + // console.log(user_id) console.log("Room Joined"); }); // Listen for the chat message socket.on('chatMessage',({msg,friend_id,user_id})=>{ - User.findOne({_id:user_id},async(err,user)=>{ User.findOne({_id:friend_id},async (err,friend)=>{ @@ -118,8 +133,9 @@ io.on('connection',(socket)=>{ await friend.save(); } }); - + // messaging to a friend io.to(user_id).emit('message',formatMessage(user_id,msg,friend_id)); + io.to(friend_id).emit('message',formatMessage(user_id,msg,user_id)); }); }); @@ -132,5 +148,5 @@ io.on('connection',(socket)=>{ server.listen(port,()=>{ - console.log("Server started on the "+ port + "!"); + console.log("Server started on "+ port + "!"); }); \ No newline at end of file