Use new Ember auto routing

This commit is contained in:
Szymon Nowak 2014-04-13 22:28:27 +02:00
parent c99844d066
commit 94179c8b8d
3 changed files with 16 additions and 4 deletions

View File

@ -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({

View File

@ -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;

View File

@ -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'