diff --git a/lib/app/index.js b/lib/app/index.js index 62f90d8073..7304380bb6 100644 --- a/lib/app/index.js +++ b/lib/app/index.js @@ -71,8 +71,9 @@ get('/:uidParam?', function(page, model, _arg, next) { }); ready(function(model) { - var poormanscron, setupSortable, step, tour, type, _i, _j, _len, _len1, _ref1, _ref2; - $('#purl-link').val(window.location.toString() + model.get('_userId')); + var pathParts, poormanscron, setupSortable, step, tour, type, _i, _j, _len, _len1, _ref1, _ref2; + pathParts = window.location.toString().split('/'); + $('#purl').val("" + pathParts[0] + "//" + pathParts[2] + "/" + (model.get('_userId'))); $('[rel=tooltip]').tooltip(); $('[rel=popover]').popover(); model.on('set', '*', function() { @@ -278,7 +279,7 @@ ready(function(model) { return chart.draw(data, options); }; exports.buyItem = function(e, el, next) { - var hp, index, money, task, taskId, user, value, _ref3, _results; + var hp, index, money, user, value, _ref3; user = model.at('_user'); money = user.get('stats.money'); _ref3 = [$(el).attr('data-type'), $(el).attr('data-value'), $(el).attr('data-index')], type = _ref3[0], value = _ref3[1], index = _ref3[2]; @@ -299,17 +300,6 @@ ready(function(model) { hp = 50; } return user.set('stats.hp', hp); - } else if (type === 'reroll') { - _results = []; - for (taskId in user.get('tasks')) { - task = model.at('_user.tasks.' + taskId); - if (task.get('type') !== 'reward') { - _results.push(task.set('value', 0)); - } else { - _results.push(void 0); - } - } - return _results; } }; exports.vote = function(e, el, next) { diff --git a/lib/server/index.js b/lib/server/index.js index c98af5875c..be3b7f2f27 100644 --- a/lib/server/index.js +++ b/lib/server/index.js @@ -66,13 +66,13 @@ habitrpgMiddleware = function(req, res, next) { expressApp.use(express.favicon()).use(gzippo.staticGzip(publicPath, { maxAge: ONE_YEAR -})).use(express.compress()).use(express.cookieParser()).use(store.sessionMiddleware({ +})).use(express.compress()).use(express.bodyParser()).use(express.cookieParser()).use(store.sessionMiddleware({ secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE', cookie: { maxAge: ONE_YEAR }, store: new MongoStore({ - db: 'habitrpg' + url: process.env.NODE_DB_URI }) })).use(store.modelMiddleware()).use(habitrpgMiddleware).use(app.router()).use(expressApp.router).use(serverError(root)); diff --git a/src/app/index.coffee b/src/app/index.coffee index 6d98d87399..d625357cce 100644 --- a/src/app/index.coffee +++ b/src/app/index.coffee @@ -63,11 +63,11 @@ get '/:uidParam?', (page, model, {uidParam}, next) -> # ========== CONTROLLER FUNCTIONS ========== ready (model) -> - - # TODO should all UI stuff be placed in this.on('render',function(){}) ? see chat example - - # FIXME weirdest thing: doing model.set('_purl',...) and binding {_purl} in the view does not work - $('#purl-link').val(window.location.toString() + model.get('_userId')) + + # protocol+host+port = window.location.origin, only webkit. stupid. + # also, {_purl} in template won't register, have to use $().val something is messed up + pathParts = window.location.toString().split('/') + $('#purl').val "#{pathParts[0]}//#{pathParts[2]}/#{model.get('_userId')}" $('[rel=tooltip]').tooltip() $('[rel=popover]').popover() @@ -246,12 +246,7 @@ ready (model) -> hp += 15 hp = 50 if hp > 50 user.set 'stats.hp', hp - else if type == 'reroll' - for taskId of user.get('tasks') - task = model.at('_user.tasks.'+taskId) - task.set('value', 0) unless task.get('type')=='reward' - - + exports.vote = (e, el, next) -> direction = $(el).attr('data-direction') direction = 'up' if direction == 'true/' diff --git a/src/server/index.coffee b/src/server/index.coffee index fadd3e6e5a..5ccc467aeb 100644 --- a/src/server/index.coffee +++ b/src/server/index.coffee @@ -63,7 +63,7 @@ expressApp .use(express.compress()) # Uncomment to add form data parsing support - # .use(express.bodyParser()) + .use(express.bodyParser()) # .use(express.methodOverride()) # Uncomment and supply secret to add Derby session handling @@ -72,7 +72,7 @@ expressApp .use(store.sessionMiddleware secret: process.env.SESSION_SECRET || 'YOUR SECRET HERE' cookie: {maxAge: ONE_YEAR} - store: new MongoStore(db: 'habitrpg') + store: new MongoStore(url: process.env.NODE_DB_URI) ) # Adds req.getModel method diff --git a/views/app/index.html b/views/app/index.html index 8c6f2124e8..6fc8d3968a 100644 --- a/views/app/index.html +++ b/views/app/index.html @@ -17,7 +17,7 @@
Authentication isn't yet available (follow progress here),
In the meantime a persistent URL can be used accross
browsers to access your data. Bookmark the following URL.