freeze racer at bd27c5d, there's an issue with the memory subscriptions & accessing a REST path without a session?

This commit is contained in:
Tyler Renelle 2013-02-15 15:10:31 -05:00
parent 219065907d
commit ca1233e845
3 changed files with 6 additions and 5 deletions

View file

@ -5,7 +5,7 @@
"main": "./server.js",
"dependencies": {
"derby": "git://github.com/codeparty/derby#master",
"racer": "git://github.com/lefnire/racer#habitrpg",
"racer": "git://github.com/lefnire/racer.git#bd27c5d",
"racer-db-mongo": "git://github.com/lefnire/racer-db-mongo#habitrpg",
"derby-ui-boot": "git://github.com/codeparty/derby-ui-boot#master",
"derby-auth": "git://github.com/lefnire/derby-auth#master",

View file

@ -81,7 +81,7 @@ mongo_store = new MongoStore {url: process.env.NODE_DB_URI}, ->
return next() if req.is('json')
if !req.session.userId? and !req.query?.play? and req.url == '/'
res.redirect('/splash.html')
return res.redirect('/splash.html')
else
next()

View file

@ -14,15 +14,16 @@ module.exports = (expressApp, root, derby) ->
staticPages.render 'terms', res
# localhost:3000/users/9/tasks.ics?apiToken=ae164366-f1ad-4a7d-83ef-b1d1085a96b6
expressApp.get '/users/:uid/tasks.ics', (req, res) ->
expressApp.get '/users/:uid/tasks.ics', (req, res, next) ->
{uid} = req.params
{apiToken} = req.query
model = req.getModel()
query = model.query('users').withIdAndToken(uid, apiToken)
query.fetch (err, result) ->
throw err if err
model.fetch query, (err, result) ->
return next(err) if err
tasks = result.at(0).get('tasks')
return next "No tasks found for user #{uid}" unless tasks?
tasksWithDates = _.filter tasks, (task) -> !!task.date
ical = new icalendar.iCalendar()