mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
a bunch of small fixes
This commit is contained in:
parent
80922c1047
commit
6a42b681e3
6 changed files with 8 additions and 10 deletions
|
|
@ -26,7 +26,7 @@ _ = require('lodash');
|
|||
get('/:uidParam?', function(page, model, _arg, next) {
|
||||
var sess, uidParam;
|
||||
uidParam = _arg.uidParam;
|
||||
if (uidParam === 'privacy' || uidParam === 'terms' || uidParam === 'auth') {
|
||||
if ((uidParam === 'privacy' || uidParam === 'terms' || uidParam === 'auth')) {
|
||||
return next();
|
||||
}
|
||||
sess = model.session;
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ server = http.createServer(expressApp);
|
|||
|
||||
module.exports = server;
|
||||
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
expressApp.all('*', function(req, res, next) {
|
||||
if (req.headers['x-forwarded-proto'] !== 'https') {
|
||||
return res.redirect('https://' + req.headers.host + req.url);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,8 @@ var scoring;
|
|||
scoring = require('../app/scoring');
|
||||
|
||||
module.exports = function(expressApp, root, derby) {
|
||||
var staticPages;
|
||||
staticPages = derby.createStatic(root);
|
||||
expressApp.get('/:uid/up/:score?', function(req, res) {
|
||||
var model, score;
|
||||
score = parseInt(req.params.score) || 1;
|
||||
|
|
@ -35,13 +37,9 @@ module.exports = function(expressApp, root, derby) {
|
|||
return res.send(200);
|
||||
});
|
||||
expressApp.get('/privacy', function(req, res) {
|
||||
var staticPages;
|
||||
staticPages = derby.createStatic(root);
|
||||
return staticPages.render('privacy', res);
|
||||
});
|
||||
expressApp.get('/terms', function(req, res) {
|
||||
var staticPages;
|
||||
staticPages = derby.createStatic(root);
|
||||
return staticPages.render('terms', res);
|
||||
});
|
||||
expressApp.post('/', function(req) {
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ _ = require 'lodash'
|
|||
|
||||
get '/:uidParam?', (page, model, {uidParam}, next) ->
|
||||
#FIXME figure out a better way to do this
|
||||
return next() if (uidParam == 'privacy' or uidParam == 'terms' or uidParam == 'auth')
|
||||
return next() if (uidParam in ['privacy','terms','auth'])
|
||||
|
||||
sess = model.session
|
||||
if sess.habitRpgAuth && sess.habitRpgAuth.facebook
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ module.exports = server
|
|||
|
||||
# Force SSL
|
||||
# Set before other routes, as early as possible
|
||||
if process.env.NODE_ENV!='production'
|
||||
if process.env.NODE_ENV=='production'
|
||||
expressApp.all '*', (req, res, next) ->
|
||||
if req.headers['x-forwarded-proto']!='https'
|
||||
res.redirect('https://'+req.headers.host+req.url)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,8 @@
|
|||
scoring = require('../app/scoring')
|
||||
|
||||
module.exports = (expressApp, root, derby) ->
|
||||
|
||||
staticPages = derby.createStatic root
|
||||
|
||||
expressApp.get '/:uid/up/:score?', (req, res) ->
|
||||
score = parseInt(req.params.score) || 1
|
||||
|
|
@ -21,11 +23,9 @@ module.exports = (expressApp, root, derby) ->
|
|||
res.send(200)
|
||||
|
||||
expressApp.get '/privacy', (req, res) ->
|
||||
staticPages = derby.createStatic root
|
||||
staticPages.render 'privacy', res
|
||||
|
||||
expressApp.get '/terms', (req, res) ->
|
||||
staticPages = derby.createStatic root
|
||||
staticPages.render 'terms', res
|
||||
|
||||
expressApp.post '/', (req) ->
|
||||
|
|
|
|||
Loading…
Reference in a new issue