Skip to content

Commit

Permalink
More auth hacks for socketio
Browse files Browse the repository at this point in the history
  • Loading branch information
davidbanham committed Mar 10, 2013
1 parent e4e0305 commit 06cbb0b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app.js
Expand Up @@ -58,7 +58,11 @@ io.enable('browser client minification'); // send minified client
io.enable('browser client etag'); // apply etag caching logic based on version number
io.enable('browser client gzip'); // gzip the file
io.set('authorization', function (data, cb) {
var cook = cookie.parse(data.headers.cookie);
if (data.headers.cookie) var cook = cookie.parse(data.headers.cookie);
if (data.query.sessu) {
var cook = {};
cook['ntor.sid'] = data.query.sessu;
}
var sessionID = connect.utils.parseSignedCookie(cook['ntor.sid'], conf.general.cookieSecret);
data.sessionID = sessionID;
if (cook['ntor.sid'] == sessionID) {
Expand Down Expand Up @@ -623,7 +627,6 @@ app.get('/search/:engine', requiresLevel(0), function(req,res) {

var getInfoHash = function(filePath, callback) {
nt.read(filePath, function(err, torrent) {
console.log(torrent);
if(err) console.error('getInfoHash error'+err);
else callback(torrent.infoHash());
});
Expand Down

0 comments on commit 06cbb0b

Please sign in to comment.