mirror of
https://github.com/szimek/sharedrop.git
synced 2026-06-13 21:03:07 +08:00
Use new Ember auto routing
This commit is contained in:
parent
c99844d066
commit
94179c8b8d
@ -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({
|
||||
|
||||
5
app/scripts/vendor/peer.js
vendored
5
app/scripts/vendor/peer.js
vendored
@ -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;
|
||||
|
||||
@ -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'
|
||||
|
||||
Loading…
Reference in New Issue
Block a user