Permalink
Browse files

Merge pull request #132 from ericbarch/master

Separation of IRC and websocket code. Created IRC connection class.
  • Loading branch information...
2 parents 9e283c5 + 39bce6f commit 239f3bdf9b4d3be36eb13ab199bc6a4e7a89f258 David Petersen committed Jul 3, 2012
Showing with 365 additions and 393 deletions.
  1. +1 −0 assets/css/subway.css
  2. +8 −2 assets/js/client.js
  3. +2 −0 assets/js/views/overview.js
  4. +0 −277 lib/irchandler.js
  5. +155 −0 lib/irclink.js
  6. +1 −0 lib/models.js
  7. +8 −103 lib/restore.js
  8. +171 −0 lib/socket.js
  9. +11 −9 lib/subway.js
  10. +3 −1 subway
  11. +5 −1 views/templates.jade
View
1 assets/css/subway.css
@@ -405,6 +405,7 @@ html { overflow: hidden; }
.userlist_user {
border-bottom: 1px solid #CCCCCC;
display: table;
+ height: 31px;
width: 100%;
}
View
10 assets/js/client.js
@@ -109,7 +109,6 @@ $(function() {
});
irc.socket.on('notice', function(data) {
- //TODO: make this work
var window = irc.chatWindows.getByName('status');
if(window === undefined){
irc.connected = true;
@@ -230,7 +229,14 @@ $(function() {
});
irc.socket.on('error', function(data) {
- console.log(data.message);
+ var window = irc.chatWindows.getByName('status');
+ if(window === undefined){
+ irc.connected = true;
+ irc.appView.render();
+ irc.chatWindows.add({name: 'status', type: 'status'});
+ window = irc.chatWindows.getByName('status');
+ }
+ window.stream.add({sender: 'error', raw: data.text, type: 'notice'});
});
irc.socket.on('netError', function(data) {
View
2 assets/js/views/overview.js
@@ -52,6 +52,7 @@ var OverviewView = Backbone.View.extend({
var port = $('#connect-port').val();
var secure = $('#connect-secure').is(':checked');
var selfSigned = $('#connect-selfSigned').is(':checked');
+ var rejoin = $('#connect-rejoin').is(':checked');
var password = $('#connect-password').val();
if (!server) {
@@ -74,6 +75,7 @@ var OverviewView = Backbone.View.extend({
port: port,
secure: secure,
selfSigned: selfSigned,
+ rejoin: rejoin,
password: password
};
View
277 lib/irchandler.js
@@ -1,277 +0,0 @@
-var irc = require('irc'),
- bcrypt = require('bcrypt'),
- mongoose = require('mongoose');
-
-var User = mongoose.model('User');
-var Connection = mongoose.model('Connection');
-var Channel = mongoose.model('Channel');
-var Message = mongoose.model('Message');
-
-var log_message = function(username, channelName, channelServer, msg_object) {
- Channel.findOne({name: channelName.toLowerCase(), user: username}, function(err, channel) {
- if(!channel){
- var channel = new Channel({name: channelName.toLowerCase(), server: channelServer.toLowerCase(), user: username});
- }
- channel.messages.push(msg_object);
- channel.save();
- });
-};
-
-var clear_unreads = function(channels){
- for(key in channels){
- if(channels.hasOwnProperty(key)){
- var channel = channels[key];
- channel.unread_messages = 0;
- channel.unread_mentions = 0;
- }
- }
-};
-
-
-
-var irchandler = exports.irchandler = function(socket, app, clients) {
- this.app = app;
-
- var current_user;
- // Events to signal TO the front-end
- var events = {
- 'join': ['channel', 'nick'],
- 'part': ['channel', 'nick'],
- 'quit': ['nick', 'reason', 'channels', 'message'],
- 'topic': ['channel', 'topic', 'nick'],
- 'nick': ['oldNick', 'newNick', 'channels'],
- 'names': ['channel', 'nicks'],
- 'message': ['from', 'to', 'text'],
- '+mode': ['channel', 'by', 'mode', 'argument', 'message'],
- '-mode': ['channel', 'by', 'mode', 'argument', 'message'],
- 'notice': ['nick', 'to', 'text', 'message'],
- 'pm': ['nick', 'text'],
- 'registered': ['message'],
- 'motd': ['motd'],
- 'error': ['message'],
- 'netError': ['message']
- };
-
- socket.on('getDatabaseState', function(){
- socket.emit('databaseState', {state: mongoose.connection.readyState});
- });
-
- socket.on('register', function(data) {
- bcrypt.genSalt(10, function(err, salt) {
- bcrypt.hash(data.password, salt, function(err, hash) {
- // Store hash in your password DB.
- var user = new User();
- user.username = data.username;
- user.password = hash;
- user.save();
- socket.emit('register_success', {username: user.username});
- current_user = user;
- });
- });
- });
-
- socket.on('login', function(data){
- User.findOne({username: data.username}, function(err, user) {
- if(user){
- bcrypt.compare(data.password, user.password, function(err, res) {
- if(res === true){
- var exists;
- //client.logged_in = true;
- current_user = user;
- if(clients[user.username] !== undefined){
- exists = true;
- } else {
- exists = false;
- }
- socket.emit('login_success', {username: user.username, exists: exists});
- console.log('logged in');
- } else {
- socket.emit('login_error', {message: 'Wrong password'});
- console.log('Wrong password');
- }
- });
- } else {
- socket.emit('login_error', {message: 'No user found'});
- console.log('No user found');
- }
- });
- });
-
- socket.on('connect', function(data) {
- var client;
- if(current_user){
- client = clients[current_user.username];
- }
- if(client === undefined) {
- client = new irc.Client(data.server, data.nick, {
- port: data.port || (data.secure ? 6697 : 6667),
- password: data.password,
- secure: data.secure,
- selfSigned: data.selfSigned,
- debug: false,
- showErrors: false,
- channels: data.channels,
- userName: 'subway',
- realName: 'Subway IRC client'
- });
-
- // save this connection
- if(current_user){
- var conn = new Connection({ user: current_user.username,
- hostname: data.server,
- port: data.port || (data.secure ? 6697 : 6667),
- ssl: data.secure,
- selfSigned: data.selfSigned,
- channels: data.channels,
- nick: data.nick,
- password: data.password });
- conn.save();
- clients[current_user.username] = client;
- }
- } else {
- socket.emit('restore_connection', {nick: client.nick,
- server: client.opt.server, channels: client.chans});
- clear_unreads(client.chans);
- }
-
- // Socket events sent FROM the front-end
- socket.on('join', function(name) {
- if (name[0] != '#')
- name = '#' + name;
-
- client.join(name);
- });
-
- socket.on('part_pm', function(name){
- if(client.chans[name.toLowerCase()] !== undefined){
- delete client.chans[name.toLowerCase()];
- }
- });
-
- socket.on('part', function(name) {
- if (name[0] != '#')
- name = '#' + name;
-
- client.part(name);
- if(current_user){
- // update the user's connection / channel list
- Connection.update({ user: current_user.username }, { $pull: { channels: name.toLowerCase() } }, function(err) {
- if (err) {
- // handle error
- }
- });
- }
- });
-
- socket.on('say', function(data) {
- client.say(data.target, data.message);
- socket.emit('message', {to:data.target.toLowerCase(), from: client.nick.toLowerCase(), text:data.message});
- if(current_user){
- log_message(current_user.username, data.target, client.opt.server, {user: client.nick, message: data.message});
- }
- });
-
- socket.on('action', function(data) {
- client.action(data.target, data.message);
- socket.emit('message', {
- to: data.target.toLowerCase(),
- from: client.nick.toLowerCase(),
- text: '\u0001ACTION ' + data.message}
- );
- });
-
- socket.on('topic', function(data){
- client.send('TOPIC ', data.name, data.topic);
- });
-
- socket.on('nick', function(data){
- client.send('NICK', data.nick);
- client.nick = data.nick.toLowerCase();
- client.opt.nick = client.nick;
- });
-
- socket.on('command', function(text) { console.log(text); client.send(text); });
-
- socket.on('disconnect', function() {
- if(!current_user){
- client.disconnect();
- } else {
- clear_unreads(client.chans);
- }
- });
-
- socket.on('getOldMessages', function(data){
- Channel.find({name: data.channelName.toLowerCase(), server: client.opt.server.toLowerCase(), user: current_user.username},
- {messages: {$slice: [data.skip, data.amount]}},
- function(err, results) {
- if(results){
- if(results[0]){
- results[0]['name'] = data.channelName.toLowerCase();
- }
- socket.emit('oldMessages', results[0]);
- }
- });
- });
-
- // Add a listener on client for the given event & argument names
- var activateListener = function(event, argNames) {
- //remove duplicate events
- client.listeners(event).forEach(function(item){
- client.removeListener(event, item);
- });
- client.addListener(event, function() {
- console.log('Event ' + event + ' sent');
- // Associate specified names with callback arguments
- // to avoid getting tripped up on the other side
- var callbackArgs = arguments;
- args = {};
- argNames.forEach(function(arg, index) {
- args[arg] = callbackArgs[index];
- });
- console.log(args);
- socket.emit(event, args);
-
- // This is the logic on what to do on a recieved message
- if(event == 'message'){
- if(current_user){
- var target;
- if (args.to[0] != '#')
- target = args.from.toLowerCase();
- else
- target = args.to.toLowerCase();
-
- log_message(current_user.username, target, client.opt.server, {user: args.from, message: args.text});
-
- if(client.chans[target] === undefined){
- client.chans[target] = {serverName: target,
- unread_messages: 0, unread_mentions: 0};
- }
-
- if(socket.disconnected){
- client.chans[target].unread_messages++;
-
- var re = new RegExp('\\b' + client.nick.toLowerCase() + '\\b', 'g');
- if(re.test(args.text)){
- client.chans[target].unread_mentions++;
- }
- }
- }
- }
-
- // This is the logic to assign a user to log messages on join
- if(event == 'join') {
- if(current_user){
- // update the user's channel list
- Connection.update({ user: current_user.username }, { $addToSet: { channels: args.channel.toLowerCase() } }, function(err) {
- // handle error
- });
- }
- }
-
- });
- };
-
- for (var event in events) { activateListener(event, events[event]); }
- console.log('Starting IRC client; wiring up socket events.');
- });
-}
View
155 lib/irclink.js
@@ -0,0 +1,155 @@
+var irc = require('irc'),
+ mongoose = require('mongoose');
+
+// establish models
+var User = mongoose.model('User');
+var Connection = mongoose.model('Connection');
+var Channel = mongoose.model('Channel');
+var Message = mongoose.model('Message');
+
+// Constructor
+var IRCLink = function(hostname, port, ssl, selfSigned, nick, realName, password, rejoin, channels) {
+ this.sockets = new Array();
+ this.server = hostname;
+
+ if (channels === undefined || !rejoin)
+ var channels = new Array();
+
+ this.client = new irc.Client(hostname, nick, {
+ userName: nick,
+ realName: realName,
+ port: port || (ssl ? 6697 : 6667),
+ debug: false,
+ showErrors: false,
+ autoRejoin: true,
+ autoConnect: true,
+ channels: channels,
+ password: password,
+ secure: ssl,
+ selfSigned: selfSigned,
+ certExpired: false,
+ floodProtection: false,
+ floodProtectionDelay: 1000,
+ stripColors: true
+ });
+
+ // Events to signal TO the front-end
+ this.events = {
+ 'join': ['channel', 'nick'],
+ 'part': ['channel', 'nick'],
+ 'quit': ['nick', 'reason', 'channels', 'message'],
+ 'topic': ['channel', 'topic', 'nick'],
+ 'nick': ['oldNick', 'newNick', 'channels'],
+ 'names': ['channel', 'nicks'],
+ 'message': ['from', 'to', 'text'],
+ '+mode': ['channel', 'by', 'mode', 'argument', 'message'],
+ '-mode': ['channel', 'by', 'mode', 'argument', 'message'],
+ 'notice': ['nick', 'to', 'text', 'message'],
+ 'pm': ['nick', 'text'],
+ 'registered': ['message'],
+ 'motd': ['motd'],
+ 'error': ['message'],
+ 'netError': ['message']
+ };
+
+ // store the instance
+ var instance = this;
+
+ // Add a listener on client for the given event & argument names
+ this.activateListener = function(event, argNames) {
+ instance.client.addListener(event, function() {
+ // Associate specified names with callback arguments
+ var callbackArgs = arguments;
+ var args = {};
+ argNames.forEach(function(arg, index) {
+ args[arg] = callbackArgs[index];
+ });
+
+ // loop through all sockets and emit events
+ for (var i = 0; i < instance.sockets.length; i++) {
+ instance.sockets[i].emit(event, args);
+ }
+
+ // This is the logic on what to do on a recieved message
+ if(event == 'message'){
+ if(instance.username){
+ var target;
+ if (args.to[0] != '#')
+ target = args.from.toLowerCase();
+ else
+ target = args.to.toLowerCase();
+
+ // log this message
+ instance.logMessage(target, {user: args.from, message: args.text});
+
+ if(instance.sockets.length == 0){
+ instance.client.chans[target].unread_messages++;
+
+ var re = new RegExp('\\b' + nick.toLowerCase() + '\\b', 'g');
+ if(re.test(args.text.toLowerCase())){
+ instance.client.chans[target].unread_mentions++;
+ }
+ }
+ }
+ }
+
+ // This is the logic to assign a user to log messages on join
+ if(event == 'join') {
+ var target = args.channel.toLowerCase();
+
+ if(instance.client.chans[target] === undefined)
+ instance.client.chans[target] = {serverName: target, unread_messages: 0, unread_mentions: 0};
+
+ if(instance.username && rejoin){
+ // update the user's channel list
+ Connection.update({ user: instance.username }, { $addToSet: { channels: target } }, function(err) {});
+ }
+ }
+ });
+ };
+
+ for (var event in this.events) {
+ this.activateListener(event, this.events[event]);
+ }
+}
+
+// properties and methods
+IRCLink.prototype = {
+ associateUser: function(username) {
+ this.username = username;
+ },
+ clearUnreads: function() {
+ for(key in this.client.chans){
+ if(this.client.chans.hasOwnProperty(key)){
+ var channel = this.client.chans[key];
+ channel.unread_messages = 0;
+ channel.unread_mentions = 0;
+ }
+ }
+ },
+ disconnect: function() {
+ this.client.disconnect();
+ },
+ addSocket: function(socket) {
+ this.sockets.push(socket);
+ },
+ removeSocket: function(socket) {
+ var index = this.sockets.indexOf(socket);
+ if (index != -1) this.sockets.splice(index, 1);
+ },
+ logMessage: function(target, msg) {
+ if (this.username) {
+ var instance = this;
+ Channel.findOne({name: target.toLowerCase(), server: this.server, user: this.username}, function(err, channel) {
+ if(!channel){
+ var channel = new Channel({name: target.toLowerCase(), server: instance.server, user: instance.username});
+ }
+ channel.messages.push(msg);
+ channel.save();
+ });
+ }
+ }
+};
+
+// node.js module export
+module.exports = IRCLink;
View
1 lib/models.js
@@ -14,6 +14,7 @@ module.exports = function() {
hostname: String,
port: Number,
ssl: Boolean,
+ rejoin: Boolean,
selfSigned: Boolean,
channels: [String],
nick: String,
View
111 lib/restore.js
@@ -1,114 +1,19 @@
-var irc = require('irc'),
- bcrypt = require('bcrypt'),
- mongoose = require('mongoose');
-
+var mongoose = require('mongoose'),
+ IRCLink = require('./irclink');
+// establish models
var User = mongoose.model('User');
var Connection = mongoose.model('Connection');
var Channel = mongoose.model('Channel');
var Message = mongoose.model('Message');
-
-
-
-var log_message = function(username, channelName, channelServer, msg_object) {
- Channel.findOne({name: channelName.toLowerCase(), user: username}, function(err, channel) {
- if(!channel){
- var channel = new Channel({name: channelName.toLowerCase(), server: channelServer.toLowerCase(), user: username});
- }
- channel.messages.push(msg_object);
- channel.save();
- });
-};
-
-
-/* RECONNECT ALL SESSIONS HERE */
-module.exports = function(app, clients) {
- this.app = app;
-
- var events = {
- 'join': ['channel', 'nick'],
- 'part': ['channel', 'nick'],
- 'quit': ['nick', 'reason', 'channels', 'message'],
- 'topic': ['channel', 'topic', 'nick'],
- 'nick': ['oldNick', 'newNick', 'channels'],
- 'names': ['channel', 'nicks'],
- 'message': ['from', 'to', 'text'],
- '+mode': ['channel', 'by', 'mode', 'argument', 'message'],
- '-mode': ['channel', 'by', 'mode', 'argument', 'message'],
- 'notice': ['nick', 'to', 'text', 'message'],
- 'pm': ['nick', 'text'],
- 'registered': ['message'],
- 'motd': ['motd'],
- 'error': ['message'],
- 'netError': ['message']
- };
-
+module.exports = function (connections) {
+ // restore connections
Connection.find({},function(err, docs){
docs.forEach(function(doc){
- var currentuser = {username: doc.user};
-
- var client = new irc.Client(doc.hostname, doc.nick, {
- port: doc.port || (doc.ssl ? 6697 : 6667),
- password: doc.password,
- secure: doc.ssl,
- selfSigned: doc.selfSigned,
- debug: false,
- showErrors: false,
- channels: [],
- userName: 'subway',
- realName: 'Subway IRC client'
- });
-
- clients[doc.user] = client;
-
- // rejoin all channels
- doc.channels.forEach(function(chan, index){
- setTimeout(function(){ client.join(chan); }, 15000 + (index * 1000));
- });
-
- // Add a listener on client for the given event & argument names
- var activateListener = function(event, argNames) {
- //remove duplicate events
- client.listeners(event).forEach(function(item){
- client.removeListener(event, item);
- });
- client.addListener(event, function() {
- // Associate specified names with callback arguments
- // to avoid getting tripped up on the other side
- var callbackArgs = arguments;
- args = {};
- argNames.forEach(function(arg, index) {
- args[arg] = callbackArgs[index];
- });
-
- // This is the logic on what to do on a recieved message
- if(event == 'message'){
- var target;
- if (args.to[0] != '#')
- target = args.from.toLowerCase();
- else
- target = args.to.toLowerCase();
-
- log_message(doc.user, target, doc.hostname, {user: args.from, message: args.text});
-
- if(client.chans[target] === undefined){
- client.chans[target] = {serverName: target,
- unread_messages: 0, unread_mentions: 0};
- }
-
- client.chans[target].unread_messages++;
-
- var re = new RegExp('\\b' + client.nick + '\\b', 'g');
- if(re.test(args.text)){
- client.chans[target].unread_mentions++;
- }
- }
- });
- };
-
- for (var event in events) { activateListener(event, events[event]); }
-
+ var connection = new IRCLink(doc.hostname, doc.port, doc.ssl, doc.selfSigned, doc.nick, doc.nick, doc.password, doc.rejoin, doc.channels);
+ connection.associateUser(doc.user);
+ connections[doc.user] = connection;
});
});
}
View
171 lib/socket.js
@@ -0,0 +1,171 @@
+var bcrypt = require('bcrypt'),
+ mongoose = require('mongoose'),
+ IRCLink = require('./irclink');
+
+// establish models
+var User = mongoose.model('User');
+var Connection = mongoose.model('Connection');
+var Channel = mongoose.model('Channel');
+var Message = mongoose.model('Message');
+
+module.exports = function(socket, connections) {
+ var current_user;
+
+ socket.on('getDatabaseState', function(){
+ socket.emit('databaseState', {state: mongoose.connection.readyState});
+ });
+
+ socket.on('register', function(data) {
+ bcrypt.genSalt(10, function(err, salt) {
+ bcrypt.hash(data.password, salt, function(err, hash) {
+ // Store hash in your password DB.
+ var user = new User();
+ user.username = data.username;
+ user.password = hash;
+ user.save();
+ socket.emit('register_success', {username: user.username});
+ current_user = user;
+ });
+ });
+ });
+
+ socket.on('login', function(data){
+ User.findOne({username: data.username}, function(err, user) {
+ if(user){
+ bcrypt.compare(data.password, user.password, function(err, res) {
+ if(res === true){
+ var exists;
+ current_user = user;
+ if(connections[user.username] !== undefined){
+ exists = true;
+ } else {
+ exists = false;
+ }
+ socket.emit('login_success', {username: user.username, exists: exists});
+ } else {
+ socket.emit('login_error', {message: 'Wrong password'});
+ }
+ });
+ } else {
+ }
+ });
+ });
+
+ socket.on('connect', function(data) {
+ var connection;
+ if(current_user){
+ connection = connections[current_user.username];
+ }
+ if(connection === undefined) {
+ connection = new IRCLink(data.server, data.port, data.secure, data.selfSigned, data.nick, data.nick, data.password, data.rejoin);
+
+ // save this connection
+ if(current_user){
+ // bind this socket to the proper IRC instance
+ connection.associateUser(current_user.username);
+
+ var conn = new Connection({ user: current_user.username,
+ hostname: data.server,
+ port: data.port || (data.secure ? 6697 : 6667),
+ ssl: data.secure,
+ rejoin: data.rejoin,
+ selfSigned: data.selfSigned,
+ channels: data.channels,
+ nick: data.nick,
+ password: data.password });
+
+ conn.save();
+ connections[current_user.username] = connection;
+ }
+ } else {
+ socket.emit('restore_connection', {nick: connection.client.nick,
+ server: connection.client.opt.server, channels: connection.client.chans});
+ connection.clearUnreads();
+ }
+
+ // register this socket with our user's IRC connection
+ connection.addSocket(socket);
+
+ // Socket events sent FROM the front-end
+ socket.on('join', function(name) {
+ if (name[0] != '#')
+ name = '#' + name;
+
+ connection.client.join(name);
+ });
+
+ socket.on('part_pm', function(name){
+ if(connection.clients.chans[name.toLowerCase()] !== undefined){
+ delete connection.clients.chans[name.toLowerCase()];
+ }
+ });
+
+ socket.on('part', function(name) {
+ if (name[0] != '#')
+ name = '#' + name;
+
+ connection.client.part(name);
+ if(current_user){
+ // update the user's connection / channel list
+ Connection.update({ user: current_user.username }, { $pull: { channels: name.toLowerCase() } }, function(err) {});
+ }
+ });
+
+ socket.on('say', function(data) {
+ connection.client.say(data.target, data.message);
+ socket.emit('message', {to:data.target.toLowerCase(), from: connection.client.nick.toLowerCase(), text:data.message});
+ if(current_user){
+ connection.logMessage(data.target, {user: connection.client.nick, message: data.message});
+ }
+ });
+
+ socket.on('action', function(data) {
+ connection.client.action(data.target, data.message);
+ socket.emit('message', {
+ to: data.target.toLowerCase(),
+ from: connection.client.nick.toLowerCase(),
+ text: '\u0001ACTION ' + data.message}
+ );
+ });
+
+ socket.on('topic', function(data){
+ connection.client.send('TOPIC ', data.name, data.topic);
+ });
+
+ socket.on('nick', function(data){
+ connection.client.send('NICK', data.nick);
+ connection.client.nick = data.nick.toLowerCase();
+ connection.client.opt.nick = client.nick;
+ });
+
+ socket.on('command', function(text) {
+ connection.client.send(text);
+ });
+
+ socket.on('disconnect', function() {
+ if(!current_user){
+ // not logged in, drop this session
+ connection.disconnect();
+ } else {
+ // keep the session alive, remove this socket, and clear unreads
+ connection.removeSocket(socket);
+ connection.clearUnreads();
+ }
+ });
+
+ socket.on('getOldMessages', function(data){
+ if (current_user) {
+ Channel.find({name: data.channelName.toLowerCase(), server: connection.client.opt.server.toLowerCase(), user: current_user.username},
+ {messages: {$slice: [data.skip, data.amount]}},
+ function(err, results) {
+ if(results){
+ if(results[0]){
+ results[0]['name'] = data.channelName.toLowerCase();
+ }
+ socket.emit('oldMessages', results[0]);
+ }
+ });
+ }
+ });
+ });
+}
View
20 lib/subway.js
@@ -2,7 +2,7 @@
require('./models.js')()
var app = require('./webserver').app,
- irchandler = require('./irchandler'),
+ sockethandler = require('./socket'),
io = require('socket.io'),
mongoose = require('mongoose');
@@ -15,19 +15,21 @@ var Subway = function() {
}
Subway.prototype.start = function () {
- var app = this.app;
- var clients = {};
+ var connections = {};
- mongoose.connect(app.set('mongoose_auth'));
+ mongoose.connect(this.app.set('mongoose_auth'));
- if (this.app.address()) console.log('Subway started on port %s', this.app.address().port);
+ // link up socket.io with our express app
this.io = io.listen(this.app);
- require('./restore')(app, clients);
-
this.io.sockets.on('connection', function(socket) {
- irchandler.irchandler(socket, app, clients);
+ sockethandler(socket, connections);
});
+
+ // restore sessions
+ require('./restore')(connections);
+
+ if (this.app.address()) console.log('Subway started on port %s', this.app.address().port);
}
-exports.subway = new Subway();
+module.exports = Subway;
View
4 subway
@@ -1,4 +1,6 @@
#!/usr/bin/env node
-var subway = require('./lib/subway').subway;
+var Subway = require('./lib/subway');
+
+var subway = new Subway();
subway.start();
View
6 views/templates.jade
@@ -46,6 +46,10 @@ script(id="overview_connection", type="text/html")
label(for="connect-secure") SSL
.controls
input#connect-secure(type="checkbox")
+ .control-group
+ label(for="connect-rejoin") Bouncer Mode
+ .controls
+ input#connect-rejoin(type="checkbox")
.control-group#ssl-self-signed
label(for="connect-selfSigned") Self-signed SSL Cert
.controls
@@ -63,7 +67,7 @@ script(id="overview_connection", type="text/html")
script(id="overview_settings", type="text/html")
#home_parent
a.overview_button#home Home
- p The Settings will go here - Don't worry I am going to get around to it...someday...
+ p Coming soon.
script(id="overview_login", type="text/html")
#home_parent

0 comments on commit 239f3bd

Please sign in to comment.