diff --git a/app/scripts/app.js b/app/scripts/app.js index e50a739..34b667f 100644 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -53,8 +53,12 @@ ShareDrop.App.deferReadiness(); } })(); +ShareDrop.App.Router.reopen({ + location: 'auto' +}); + ShareDrop.App.Router.map(function () { - this.route('room', { path: '/room/:room_id' }); + this.route('room', { path: '/rooms/:room_id' }); }); ShareDrop.App.ApplicationRoute = Ember.Route.extend({ diff --git a/app/scripts/vendor/peer.js b/app/scripts/vendor/peer.js index a2c487d..70ff1a2 100644 --- a/app/scripts/vendor/peer.js +++ b/app/scripts/vendor/peer.js @@ -1089,10 +1089,13 @@ Negotiator._setupListeners = function(connection, pc) { pc.oniceconnectionstatechange = function() { switch (pc.iceConnectionState) { case 'disconnected': - case 'failed': util.log('iceConnectionState is disconnected, closing connections to ' + dst); connection.close(); break; + case 'failed': + util.log('iceConnectionState is failed, closing connections to ' + dst); + connection.close(); + break; case 'completed': pc.onicecandidate = util.noop; break; diff --git a/app/server.js b/app/server.js index 897f357..7424b45 100644 --- a/app/server.js +++ b/app/server.js @@ -59,6 +59,12 @@ module.exports.server = function (options) { res.sendfile(root + '/index.html'); }); + app.get('/rooms/:id', function (req, res) { + var root = path.join(__dirname, '..', base[0]); + res.sendfile(root + '/index.html'); + }); + + app.get('/room', function (req, res) { var ip = req.headers['cf-connecting-ip'] || req.ip, name = crypto.createHmac('md5', secret).update(ip).digest('hex'); @@ -67,8 +73,7 @@ module.exports.server = function (options) { }); app.get('/auth', function (req, res) { - var ips = req.headers['x-forwarded-for'] || req.ip, - ip = ips.split(',').pop().trim(), + var ip = req.headers['cf-connecting-ip'] || req.ip, id = uuid.v1(), token = firebaseTokenGenerator.createToken( {id: id}, // will be available in Firebase security rules as 'auth'