diff --git a/package.json b/package.json index 06e4002b..f965440f 100644 --- a/package.json +++ b/package.json @@ -2,9 +2,9 @@ "name": "zoff", "version": "2.0.2", "description": "Zoff, the shared YouTube based radio services", - "main": "server/index.js", + "main": "server/app.js", "scripts": { - "start": "gulp build && node server/index.js", + "start": "gulp build && node server/app.js", "test": "echo \"Error: no test specified\" && exit 1" }, "repository": { diff --git a/server/app.js b/server/app.js index 35ae9b3a..88358055 100644 --- a/server/app.js +++ b/server/app.js @@ -1,13 +1,8 @@ -var express = require('express'), - cluster = require('cluster'), +var cluster = require('cluster'), net = require('net'), - socketio = require('socket.io'), - socket_redis = require('socket.io-redis'); - - var path = require('path'); - var publicPath = path.join(__dirname, 'public'); - - var http = require('http'); + path = require('path'), + publicPath = path.join(__dirname, 'public'), + http = require('http'); var port = 8080, num_processes = require('os').cpus().length; @@ -37,7 +32,7 @@ if (cluster.isMaster) { // Helper function for getting a worker index based on IP address. // This is a hot path so it should be really fast. The way it works // is by converting the IP address to a number by removing non numeric - // characters, then compressing it to the number of slots we have. + // characters, then compressing it to the number of slots we have. // // Compared against "real" hashing (from the sticky-session code) and // "real" IP number conversion, this function is on par in terms of @@ -110,28 +105,13 @@ if (cluster.isMaster) { var socketIO = app.socketIO; var redis = require('socket.io-redis'); - socketIO.adapter(redis({ host: 'localhost', port: 6379 })); - //socketIO.set( 'origins', '*localhost:8080' ); + try { + socketIO.adapter(redis({ host: 'localhost', port: 6379 })); + } catch(e) { + console.log("No redis-server to connect to.."); + } socketIO.listen(server); - // Tell Socket.IO to use the redis adapter. By default, the redis - // server is assumed to be on localhost:6379. You don't have to - // specify them explicitly unless you want to change them. - //io.adapter(socket_redis({ host: 'localhost', port: 6379 })); - - // Here you might use Socket.IO middleware for authorization etc. - - /*io.on('connection', function(socket) { - console.log('New client connection detected on process ' + process.pid); - - socket.emit('welcome', {message: 'Welcome to BlueFrog Chat Room'}); - socket.on('new.message', function(message) { - socket.emit('new.message', message); - }) - - });*/ - - // Listen to messages sent from the master. Ignore everything else. process.on('message', function(message, connection) { if (message !== 'sticky-session:connection') { diff --git a/server/public/assets/js/list.js b/server/public/assets/js/list.js index b80dbf97..1802355d 100755 --- a/server/public/assets/js/list.js +++ b/server/public/assets/js/list.js @@ -825,18 +825,7 @@ var List = { show: function() { if(!Helper.mobilecheck()) { - /*if(showToggle){ - showToggle=false; - $("#toptitle").empty(); - $("#chan").addClass("bigChan"); - //$("#chan").html("zoff.me/"+encodeURI(chan)); - $("#chan").html("zoff.me/"+chan.toLowerCase()); - }else{ - showToggle=true; - $("#toptitle").html("Zoff"); - $("#chan").removeClass("bigChan"); - $("#chan").html(chan); - }*/$("#channel-share-modal").modal("open"); + $("#channel-share-modal").modal("open"); } }, diff --git a/server/public/assets/js/listeners.js b/server/public/assets/js/listeners.js index cb0d6d0f..de2d0938 100755 --- a/server/public/assets/js/listeners.js +++ b/server/public/assets/js/listeners.js @@ -1,7 +1,6 @@ var chan = window.chan === undefined ? $("#chan").html() : window.chan; var w_p = true; var hasadmin = 0; -var showToggle = true; var list_html = $("#list-song-html").html(); var unseen = false; var api_key = "***REMOVED***";