mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
a bunch of small fixes
This commit is contained in:
@@ -26,7 +26,7 @@ _ = require('lodash');
|
|||||||
get('/:uidParam?', function(page, model, _arg, next) {
|
get('/:uidParam?', function(page, model, _arg, next) {
|
||||||
var sess, uidParam;
|
var sess, uidParam;
|
||||||
uidParam = _arg.uidParam;
|
uidParam = _arg.uidParam;
|
||||||
if (uidParam === 'privacy' || uidParam === 'terms' || uidParam === 'auth') {
|
if ((uidParam === 'privacy' || uidParam === 'terms' || uidParam === 'auth')) {
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
sess = model.session;
|
sess = model.session;
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ server = http.createServer(expressApp);
|
|||||||
|
|
||||||
module.exports = server;
|
module.exports = server;
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
expressApp.all('*', function(req, res, next) {
|
expressApp.all('*', function(req, res, next) {
|
||||||
if (req.headers['x-forwarded-proto'] !== 'https') {
|
if (req.headers['x-forwarded-proto'] !== 'https') {
|
||||||
return res.redirect('https://' + req.headers.host + req.url);
|
return res.redirect('https://' + req.headers.host + req.url);
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ var scoring;
|
|||||||
scoring = require('../app/scoring');
|
scoring = require('../app/scoring');
|
||||||
|
|
||||||
module.exports = function(expressApp, root, derby) {
|
module.exports = function(expressApp, root, derby) {
|
||||||
|
var staticPages;
|
||||||
|
staticPages = derby.createStatic(root);
|
||||||
expressApp.get('/:uid/up/:score?', function(req, res) {
|
expressApp.get('/:uid/up/:score?', function(req, res) {
|
||||||
var model, score;
|
var model, score;
|
||||||
score = parseInt(req.params.score) || 1;
|
score = parseInt(req.params.score) || 1;
|
||||||
@@ -35,13 +37,9 @@ module.exports = function(expressApp, root, derby) {
|
|||||||
return res.send(200);
|
return res.send(200);
|
||||||
});
|
});
|
||||||
expressApp.get('/privacy', function(req, res) {
|
expressApp.get('/privacy', function(req, res) {
|
||||||
var staticPages;
|
|
||||||
staticPages = derby.createStatic(root);
|
|
||||||
return staticPages.render('privacy', res);
|
return staticPages.render('privacy', res);
|
||||||
});
|
});
|
||||||
expressApp.get('/terms', function(req, res) {
|
expressApp.get('/terms', function(req, res) {
|
||||||
var staticPages;
|
|
||||||
staticPages = derby.createStatic(root);
|
|
||||||
return staticPages.render('terms', res);
|
return staticPages.render('terms', res);
|
||||||
});
|
});
|
||||||
expressApp.post('/', function(req) {
|
expressApp.post('/', function(req) {
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ _ = require 'lodash'
|
|||||||
|
|
||||||
get '/:uidParam?', (page, model, {uidParam}, next) ->
|
get '/:uidParam?', (page, model, {uidParam}, next) ->
|
||||||
#FIXME figure out a better way to do this
|
#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
|
sess = model.session
|
||||||
if sess.habitRpgAuth && sess.habitRpgAuth.facebook
|
if sess.habitRpgAuth && sess.habitRpgAuth.facebook
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ module.exports = server
|
|||||||
|
|
||||||
# Force SSL
|
# Force SSL
|
||||||
# Set before other routes, as early as possible
|
# 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) ->
|
expressApp.all '*', (req, res, next) ->
|
||||||
if req.headers['x-forwarded-proto']!='https'
|
if req.headers['x-forwarded-proto']!='https'
|
||||||
res.redirect('https://'+req.headers.host+req.url)
|
res.redirect('https://'+req.headers.host+req.url)
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
scoring = require('../app/scoring')
|
scoring = require('../app/scoring')
|
||||||
|
|
||||||
module.exports = (expressApp, root, derby) ->
|
module.exports = (expressApp, root, derby) ->
|
||||||
|
|
||||||
|
staticPages = derby.createStatic root
|
||||||
|
|
||||||
expressApp.get '/:uid/up/:score?', (req, res) ->
|
expressApp.get '/:uid/up/:score?', (req, res) ->
|
||||||
score = parseInt(req.params.score) || 1
|
score = parseInt(req.params.score) || 1
|
||||||
@@ -21,11 +23,9 @@ module.exports = (expressApp, root, derby) ->
|
|||||||
res.send(200)
|
res.send(200)
|
||||||
|
|
||||||
expressApp.get '/privacy', (req, res) ->
|
expressApp.get '/privacy', (req, res) ->
|
||||||
staticPages = derby.createStatic root
|
|
||||||
staticPages.render 'privacy', res
|
staticPages.render 'privacy', res
|
||||||
|
|
||||||
expressApp.get '/terms', (req, res) ->
|
expressApp.get '/terms', (req, res) ->
|
||||||
staticPages = derby.createStatic root
|
|
||||||
staticPages.render 'terms', res
|
staticPages.render 'terms', res
|
||||||
|
|
||||||
expressApp.post '/', (req) ->
|
expressApp.post '/', (req) ->
|
||||||
|
|||||||
Reference in New Issue
Block a user