Actual configurable port

This commit is contained in:
Dan Seripap 2016-02-20 09:09:05 -05:00
parent 6273e21b22
commit 59ee6ca56f
3 changed files with 8 additions and 5 deletions

View File

@ -11,7 +11,7 @@ import fs from 'fs';
import Room from './room';
const $CONFIG = {
port: 3000
port: process.env.port || 3000
}
const app = express();

View File

@ -106,7 +106,7 @@ $(function() {
}
// Adds the visual chat message to the message list
function addChatMessage (data, options) {
function addChatMessage (data, options, dataType) {
if (!data.message.trim().length) return;
// Don't fade the message in if there is an 'X was typing'
@ -121,8 +121,10 @@ $(function() {
.text(data.username)
.css('color', getUsernameColor(data.username));
let $messageBodyDiv = $('<span class="messageBody">');
if (options.file) {
// TODO: Ask client if accept/reject attachment
// If reject, destroy object in memory
// If accept, render image or content dispose
if (dataType.file) {
let image = new Image();
image.src = `data:image/png;base64,${data.message}`;
$messageBodyDiv.html(image);
@ -308,7 +310,7 @@ $(function() {
// username: data.username,
// message: file
// }
addChatMessage(data, {file: true})
addChatMessage(data, false, {file: true})
} else {
addChatMessage(data);
}

View File

@ -23,6 +23,7 @@ class Room {
id: socket.user.id,
message: data.message,
messageType: data.messageType,
data: data.data,
vector: data.vector,
secretKeys: data.secretKeys,
signature: data.signature