actually finish refactor

This commit is contained in:
Ian Ramzy 2020-04-06 00:44:16 -04:00
parent 5b4b397418
commit abd99cd487
4 changed files with 19 additions and 33 deletions

2
.env
View File

@ -1,5 +1,5 @@
# Required for all uses # Required for all uses
# It takes like 2 mins to get a free twilio account https://www.twilio.com/login # It takes 2 mins to get a free twilio account https://www.twilio.com/login
TWILIO_ACCOUNT_SID=ACfc9705a2b725a7a314995eb8635a9079 TWILIO_ACCOUNT_SID=ACfc9705a2b725a7a314995eb8635a9079
TWILIO_AUTH_TOKEN=9ab36b8ac190d20687aff0561749dbc1 TWILIO_AUTH_TOKEN=9ab36b8ac190d20687aff0561749dbc1

View File

@ -125,8 +125,8 @@
<div class="HoverState">End Call</div> <div class="HoverState">End Call</div>
</div> </div>
</div> </div>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="https://webrtc.github.io/adapter/adapter-latest.js"></script>
<script src="/socket.io/socket.io.js"></script> <script src="/socket.io/socket.io.js"></script>
<script src="../js/snackbar.js"></script> <script src="../js/snackbar.js"></script>
<script src="../js/autolink.js"></script> <script src="../js/autolink.js"></script>

View File

@ -28,7 +28,7 @@
} }
} }
/*Fade in page on load*/ /* End Fade in page on load*/
body { body {
background: #16171b; background: #16171b;
@ -60,10 +60,6 @@ video {
white-space: nowrap; white-space: nowrap;
top: 20px; top: 20px;
left: 20px; left: 20px;
/*margin-left: 30px;*/
/*margin-top: 30px;*/
/*-ms-transform: translate(-50%, -50%);*/
/*transform: translate(-50%, -50%);*/
float: left; float: left;
} }
@ -79,6 +75,7 @@ a {
text-decoration: none; text-decoration: none;
} }
/*Moveable local video id*/
#moveable { #moveable {
z-index: 100; z-index: 100;
position: absolute; position: absolute;
@ -86,6 +83,7 @@ a {
cursor: move; cursor: move;
} }
/*Text inside local video*/
#moveable p { #moveable p {
z-index: 101; z-index: 101;
position: absolute; position: absolute;
@ -105,7 +103,7 @@ a {
#local-video { #local-video {
width: 100%; width: 100%;
height: auto; height: auto;
border-radius: 20px; border-radius: 10px;
-webkit-transform: scaleX(-1); -webkit-transform: scaleX(-1);
transform: scaleX(-1); transform: scaleX(-1);
background: #16171a; background: #16171a;
@ -114,20 +112,15 @@ a {
/*caption text*/ /*caption text*/
#remote-video-text { #remote-video-text {
box-sizing: border-box; box-sizing: border-box;
/*padding: 0;*/
margin: 0; margin: 0;
width: 65vw; width: 65vw;
position: absolute; position: absolute;
top: calc(80%); top: calc(80%);
left: 20vw; left: 20vw;
/*-ms-transform: translate(-50%, -90%);*/
/*transform: translate(-50%, -90%);*/
z-index: 1; z-index: 1;
color: white; color: white;
font-family: "Heebo", sans-serif; font-family: "Heebo", sans-serif;
font-size: 1.2rem; font-size: 1.2rem;
/*white-space: nowrap;*/
font-weight: bold; font-weight: bold;
text-align: left; text-align: left;
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
@ -145,26 +138,20 @@ a {
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
width: 65%; width: 65%;
height: auto; height: auto;
max-height: 100%; max-height: 100%;
max-width: 100%; max-width: 100%;
border-radius: 10px; border-radius: 10px;
background-image: url(../images/loader.gif); background-image: url(../images/loader.gif);
background-size: 400px auto; background-size: 400px auto;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center center; background-position: center center;
/*box-shadow: 9px 9px 16px #0a0b0c, -9px -9px 16px #222328;*/
/*-webkit-box-shadow: 9px 9px 16px #0a0b0c, -9px -9px 16px #222328;*/
/*object-fit: fill;*/
} }
#remote-video.fullscreen { #remote-video.fullscreen {
/*object-fit: fill;*/
width: 100%; width: 100%;
} }
/*Neomorphic buttons*/ /*Buttons*/
.multi-button button { .multi-button button {
border: none; border: none;
font-size: 1.5rem; font-size: 1.5rem;
@ -182,8 +169,6 @@ button:focus {
button:hover { button:hover {
color: white; color: white;
/*border-radius: 100px;*/
/*background: #16171a;*/
} }
.multi-button { .multi-button {
@ -192,7 +177,6 @@ button:hover {
top: 50%; top: 50%;
-ms-transform: translate(0%, -50%); -ms-transform: translate(0%, -50%);
transform: translate(0%, -50%); transform: translate(0%, -50%);
z-index: 999; z-index: 999;
border-radius: 10px; border-radius: 10px;
background: #16171a; background: #16171a;
@ -222,10 +206,13 @@ button:hover {
margin: 0 auto; margin: 0 auto;
} }
/*Neomorphic buttons*/ /*.fa-phone-slash {*/
/* color: #470000;*/
/*}*/
/*simple chat*/ /*End buttons*/
/*Text chat*/
#entire-chat { #entire-chat {
position: absolute; position: absolute;
height: 100%; height: 100%;
@ -280,9 +267,6 @@ button:hover {
overflow: scroll; overflow: scroll;
font-family: "Heebo", sans-serif; font-family: "Heebo", sans-serif;
font-size: 0.8rem; font-size: 0.8rem;
/*background: #1c1d22;*/
/*background: #16171a;*/
/*box-shadow: 9px 9px 16px #0a0b0c, -9px -9px 16px #222328;*/
} }
#chat-zone::-webkit-scrollbar { #chat-zone::-webkit-scrollbar {
@ -311,9 +295,6 @@ button:hover {
/*recieved messages*/ /*recieved messages*/
#chat-zone .message-item.moderator .message-bloc { #chat-zone .message-item.moderator .message-bloc {
/*background-color: #376df9;*/
/*background: linear-gradient(100deg, #376df9 0, #ff5fa0 75%, #ffc55a 100%);*/
background-color: rgb(29, 30, 33); background-color: rgb(29, 30, 33);
color: #fff; color: #fff;
position: relative; position: relative;
@ -373,4 +354,4 @@ button:hover {
} }
} }
/*simple chat*/ /*End text chat*/

View File

@ -10,11 +10,12 @@ var http = require("http").createServer(app);
var io = require("socket.io")(http); var io = require("socket.io")(http);
var path = require("path"); var path = require("path");
var public = path.join(__dirname, "public"); var public = path.join(__dirname, "public");
const url = require("url"); // built-in utility const url = require("url");
// enable ssl redirect // enable ssl redirect
app.use(sslRedirect()); app.use(sslRedirect());
// Remove trailing slashes in url
app.use(function (req, res, next) { app.use(function (req, res, next) {
if (req.path.substr(-1) === "/" && req.path.length > 1) { if (req.path.substr(-1) === "/" && req.path.length > 1) {
let query = req.url.slice(req.path.length); let query = req.url.slice(req.path.length);
@ -49,8 +50,10 @@ app.get("/notsupported", function (req, res) {
res.sendFile(path.join(public, "notsupported.html")); res.sendFile(path.join(public, "notsupported.html"));
}); });
// Serve static files in the public directory
app.use(express.static("public")); app.use(express.static("public"));
// Simple logging function to add room name
function logIt(msg, room) { function logIt(msg, room) {
if (room) { if (room) {
console.log(room + ": " + msg); console.log(room + ": " + msg);
@ -73,6 +76,7 @@ io.on("connection", function (socket) {
socket.join(room); socket.join(room);
// When the client is second to join the room, both clients are ready. // When the client is second to join the room, both clients are ready.
logIt("Broadcasting ready message", room); logIt("Broadcasting ready message", room);
// First to join call initiates call
socket.broadcast.to(room).emit("willInitiateCall", room); socket.broadcast.to(room).emit("willInitiateCall", room);
socket.emit("ready", room).to(room); socket.emit("ready", room).to(room);
socket.broadcast.to(room).emit("ready", room); socket.broadcast.to(room).emit("ready", room);
@ -115,6 +119,7 @@ io.on("connection", function (socket) {
}); });
}); });
// Listen for Heroku port, otherwise just use 3000
var port = process.env.PORT || 3000; var port = process.env.PORT || 3000;
http.listen(port, function () { http.listen(port, function () {
console.log("http://localhost:" + port); console.log("http://localhost:" + port);