mirror of
https://github.com/darkwire/darkwire.io.git
synced 2025-07-18 10:49:02 +00:00
More cleanup: Removed sessions, as they are not needed
This commit is contained in:
parent
7e66df3ac0
commit
6ec8d9c5a0
20
package.json
20
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"
|
||||
|
@ -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.
|
||||
|
||||
|
18
src/app.js
18
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) {
|
||||
|
@ -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;
|
||||
|
@ -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();
|
||||
|
@ -36,7 +36,7 @@
|
||||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
|
||||
<ul class="nav navbar-nav navbar-right">
|
||||
<li><a href="/" target="_blank"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> New Room</a></li>
|
||||
<li><a href="https://darkwire.io/" target="_blank"><span class="glyphicon glyphicon-plus" aria-hidden="true"></span> New Room</a></li>
|
||||
<li><a href="javascript:void(0)" id="settings-nav"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Settings</a></li>
|
||||
<li><a href="javascript:void(0)" id="about-nav"><span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> About</a></li>
|
||||
</ul>
|
||||
|
Loading…
x
Reference in New Issue
Block a user