From 6ec8d9c5a06665289e2dac366060eb913767c8bb Mon Sep 17 00:00:00 2001 From: Dan Seripap Date: Fri, 19 Feb 2016 08:55:56 -0500 Subject: [PATCH] More cleanup: Removed sessions, as they are not needed --- package.json | 20 +++++++++++--------- readme.md | 8 ++++++-- src/app.js | 18 ------------------ src/js/audio.js | 2 +- src/js/main.js | 2 +- src/views/index.mustache | 4 ++-- 6 files changed, 21 insertions(+), 33 deletions(-) diff --git a/package.json b/package.json index 97776b7..6a9acad 100644 --- a/package.json +++ b/package.json @@ -1,17 +1,14 @@ { "name": "darkwire", - "version": "1.0.0", - "description": "", + "version": "1.2.3", + "description": "Encrypted web socket chat", "main": "index.js", "dependencies": { "babel": "^5.8.23", "babelify": "^7.2.0", "browserify": "^13.0.0", "compression": "^1.6.0", - "connect-redis": "^3.0.1", "express": "^4.13.3", - "express-session": "^1.12.1", - "express-socket.io-session": "^1.3.1", "gulp": "^3.9.0", "gulp-uglify": "^1.5.1", "mustache-express": "^1.2.2", @@ -19,14 +16,19 @@ "shortid": "^2.2.4", "socket.io": "^1.4.0", "underscore": "^1.8.3", - "uuid": "^2.0.1", - "vinyl-buffer": "^1.0.0", - "vinyl-source-stream": "^1.1.0" + "uuid": "^2.0.1" }, "devDependencies": { "babel-preset-es2015": "^6.3.13", "compression": "^1.6.0", - "gulp-nodemon": "^2.0.6" + "gulp": "^3.9.1", + "gulp-nodemon": "^2.0.6", + "vinyl-buffer": "^1.0.0", + "vinyl-source-stream": "^1.1.0" + }, + "scripts": { + "start": "gulp start", + "bundle": "gulp bundle" }, "author": "Daniel Seripap", "license": "MIT" diff --git a/readme.md b/readme.md index 1401d38..061f78f 100644 --- a/readme.md +++ b/readme.md @@ -4,9 +4,13 @@ Simple encrypted web chat. Powered by [socket.io](http://socket.io) and the [web ### Installation - npm install -g gulp npm install - gulp start + + # Bundle JS files + npm run bundle + + # Start a local instance of darkwire + npm start Create a **.secret** file in **/src** folder with a your session secret. It doesn't matter what it is- just keep it private. diff --git a/src/app.js b/src/app.js index 06da948..3b508d1 100644 --- a/src/app.js +++ b/src/app.js @@ -1,7 +1,5 @@ import express from 'express'; import mustacheExpress from 'mustache-express'; -import session from 'express-session'; -import Redis from 'connect-redis'; import Io from 'socket.io'; import http from 'http'; import shortid from 'shortid'; @@ -14,30 +12,14 @@ import fs from 'fs'; const app = express(); const server = http.createServer(app); const io = Io(server); -const RedisStore = Redis(session); -const sessionMiddleware = session({ - store: new RedisStore({ - host: 'localhost', - port: 6379, - db: 2 - }), - secret: fs.readFileSync(__dirname + '/.secret', 'UTF-8'), - resave: true, - saveUninitialized: true -}); let rooms = []; -io.use(function(socket, next) { - sessionMiddleware(socket.request, socket.request.res, next); -}); - app.use(compression()); app.use(favicon(__dirname + '/public/favicon.ico')); app.engine('mustache', mustacheExpress()); app.set('view engine', 'mustache'); app.set('views', __dirname + '/views'); -app.use(sessionMiddleware); app.use(express.static(__dirname + '/public')); function generateNewRoom(req, res, id) { diff --git a/src/js/audio.js b/src/js/audio.js index 44213c9..3f441b7 100644 --- a/src/js/audio.js +++ b/src/js/audio.js @@ -1,4 +1,4 @@ -export default class AudoHandler { +export default class AudioHandler { constructor() { this._beep = window.Audio && new window.Audio('beep.mp3') || false; this._soundEnabled = true; diff --git a/src/js/main.js b/src/js/main.js index dcda95f..100221e 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -43,7 +43,7 @@ $(function() { if (!roomId) return; - $('input.share-text').val(document.location.protocol + "//" + document.location.hostname + roomId); + $('input.share-text').val(document.location.protocol + "//" + document.location.host + roomId); $('input.share-text').click(function() { $(this).focus(); diff --git a/src/views/index.mustache b/src/views/index.mustache index 7b2fce2..1d8c8ae 100644 --- a/src/views/index.mustache +++ b/src/views/index.mustache @@ -36,7 +36,7 @@