Merge branch 'master' of github.com:FreeCodeCamp/freecodecamp
Conflicts: app.js views/challengeMap/show.jade
This commit is contained in:
51
app.js
51
app.js
@ -32,6 +32,7 @@ var express = require('express'),
|
|||||||
expressValidator = require('express-validator'),
|
expressValidator = require('express-validator'),
|
||||||
connectAssets = require('connect-assets'),
|
connectAssets = require('connect-assets'),
|
||||||
request = require('request'),
|
request = require('request'),
|
||||||
|
forceDomain = require('forcedomain'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Controllers (route handlers).
|
* Controllers (route handlers).
|
||||||
@ -48,7 +49,7 @@ var express = require('express'),
|
|||||||
/**
|
/**
|
||||||
* Stories
|
* Stories
|
||||||
*/
|
*/
|
||||||
storyController = require('./controllers/story');
|
storyController = require('./controllers/story'),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* API keys and Passport configuration.
|
* API keys and Passport configuration.
|
||||||
@ -81,19 +82,15 @@ app.set('views', path.join(__dirname, 'views'));
|
|||||||
app.set('view engine', 'jade');
|
app.set('view engine', 'jade');
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
if (process.env.NODE_ENV === 'production') {
|
||||||
app.all(/.*/, function (req, res, next) {
|
app.use(forceDomain({
|
||||||
var host = req.header('host');
|
hostname: 'www.freecodecamp.com'
|
||||||
var originalUrl = req['originalUrl'];
|
}));
|
||||||
if (host.match(/^www\..*/i)) {
|
|
||||||
next();
|
|
||||||
} else {
|
|
||||||
res.redirect(301, "http://www." + host + originalUrl);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app.use(compress());
|
app.use(compress());
|
||||||
var oneYear = 31557600000;
|
var oneYear = 31557600000;
|
||||||
|
// todo
|
||||||
|
// another app.use(express.static...) call
|
||||||
app.use(express.static(__dirname + '/public', {maxAge: oneYear}));
|
app.use(express.static(__dirname + '/public', {maxAge: oneYear}));
|
||||||
app.use(connectAssets({
|
app.use(connectAssets({
|
||||||
paths: [
|
paths: [
|
||||||
@ -134,8 +131,10 @@ app.use(helmet.xssFilter());
|
|||||||
app.use(helmet.noSniff());
|
app.use(helmet.noSniff());
|
||||||
app.use(helmet.xframe());
|
app.use(helmet.xframe());
|
||||||
app.use(function(req, res, next) {
|
app.use(function(req, res, next) {
|
||||||
res.header("Access-Control-Allow-Origin", "*");
|
res.header('Access-Control-Allow-Origin', '*');
|
||||||
res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept");
|
res.header('Access-Control-Allow-Headers',
|
||||||
|
'Origin, X-Requested-With, Content-Type, Accept'
|
||||||
|
);
|
||||||
next();
|
next();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -183,7 +182,7 @@ app.use(helmet.contentSecurityPolicy({
|
|||||||
scriptSrc: [
|
scriptSrc: [
|
||||||
'*.optimizely.com',
|
'*.optimizely.com',
|
||||||
'*.aspnetcdn.com',
|
'*.aspnetcdn.com',
|
||||||
'*.d3js.org',
|
'*.d3js.org'
|
||||||
].concat(trusted),
|
].concat(trusted),
|
||||||
'connect-src': [
|
'connect-src': [
|
||||||
'ws://*.rafflecopter.com',
|
'ws://*.rafflecopter.com',
|
||||||
@ -203,7 +202,8 @@ app.use(helmet.contentSecurityPolicy({
|
|||||||
'graph.facebook.com',
|
'graph.facebook.com',
|
||||||
'*.githubusercontent.com',
|
'*.githubusercontent.com',
|
||||||
'*.googleusercontent.com',
|
'*.googleusercontent.com',
|
||||||
'*' /* allow all input since we have user submitted images for public profile*/
|
/* allow all input since we have user submitted images for public profile*/
|
||||||
|
'*'
|
||||||
].concat(trusted),
|
].concat(trusted),
|
||||||
fontSrc: ['*.googleapis.com'].concat(trusted),
|
fontSrc: ['*.googleapis.com'].concat(trusted),
|
||||||
mediaSrc: [
|
mediaSrc: [
|
||||||
@ -244,7 +244,8 @@ app.use(function (req, res, next) {
|
|||||||
app.use(
|
app.use(
|
||||||
express.static(path.join(__dirname, 'public'), {maxAge: 31557600000})
|
express.static(path.join(__dirname, 'public'), {maxAge: 31557600000})
|
||||||
);
|
);
|
||||||
|
// todo
|
||||||
|
// why are there two express.static declarations?
|
||||||
app.use(express.static(__dirname + '/public', { maxAge: 86400000 }));
|
app.use(express.static(__dirname + '/public', { maxAge: 86400000 }));
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -263,13 +264,15 @@ app.get('/twitch', resourcesController.twitch);
|
|||||||
|
|
||||||
// Agile Project Manager Onboarding
|
// Agile Project Manager Onboarding
|
||||||
|
|
||||||
app.get('/pmi-acp-agile-project-managers', resourcesController.agileProjectManagers);
|
app.get('/pmi-acp-agile-project-managers',
|
||||||
|
resourcesController.agileProjectManagers);
|
||||||
|
|
||||||
app.get('/agile', function(req, res) {
|
app.get('/agile', function(req, res) {
|
||||||
res.redirect(301, '/pmi-acp-agile-project-managers');
|
res.redirect(301, '/pmi-acp-agile-project-managers');
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/pmi-acp-agile-project-managers-form', resourcesController.agileProjectManagersForm);
|
app.get('/pmi-acp-agile-project-managers-form',
|
||||||
|
resourcesController.agileProjectManagersForm);
|
||||||
|
|
||||||
// Nonprofit Onboarding
|
// Nonprofit Onboarding
|
||||||
|
|
||||||
@ -404,7 +407,7 @@ app.get('/api/slack', function(req, res) {
|
|||||||
});
|
});
|
||||||
return res.redirect('back');
|
return res.redirect('back');
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
req.flash('notice', {
|
req.flash('notice', {
|
||||||
msg: "Before we can send your Slack invite, we need your email address. Please update your profile information here."
|
msg: "Before we can send your Slack invite, we need your email address. Please update your profile information here."
|
||||||
@ -550,7 +553,9 @@ app.post('/completed-bonfire/', bonfireController.completedBonfire);
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
app.get('/field-guide/:fieldGuideName', fieldGuideController.returnIndividualFieldGuide);
|
app.get('/field-guide/:fieldGuideName',
|
||||||
|
fieldGuideController.returnIndividualFieldGuide
|
||||||
|
);
|
||||||
|
|
||||||
app.get('/field-guide/', fieldGuideController.returnNextFieldGuide);
|
app.get('/field-guide/', fieldGuideController.returnNextFieldGuide);
|
||||||
|
|
||||||
@ -574,9 +579,13 @@ app.post('/completed-zipline-or-basejump',
|
|||||||
coursewareController.completedZiplineOrBasejump);
|
coursewareController.completedZiplineOrBasejump);
|
||||||
|
|
||||||
// Unique Check API route
|
// Unique Check API route
|
||||||
app.get('/api/checkUniqueUsername/:username', userController.checkUniqueUsername);
|
app.get('/api/checkUniqueUsername/:username',
|
||||||
|
userController.checkUniqueUsername
|
||||||
|
);
|
||||||
|
|
||||||
app.get('/api/checkExistingUsername/:username', userController.checkExistingUsername);
|
app.get('/api/checkExistingUsername/:username',
|
||||||
|
userController.checkExistingUsername
|
||||||
|
);
|
||||||
|
|
||||||
app.get('/api/checkUniqueEmail/:email', userController.checkUniqueEmail);
|
app.get('/api/checkUniqueEmail/:email', userController.checkUniqueEmail);
|
||||||
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
"express-session": "^1.9.2",
|
"express-session": "^1.9.2",
|
||||||
"express-validator": "^2.8.0",
|
"express-validator": "^2.8.0",
|
||||||
"font-awesome": "^4.3.0",
|
"font-awesome": "^4.3.0",
|
||||||
|
"forcedomain": "^0.4.0",
|
||||||
"forever": "^0.14.1",
|
"forever": "^0.14.1",
|
||||||
"github-api": "^0.7.0",
|
"github-api": "^0.7.0",
|
||||||
"gulp-minify-css": "^0.5.1",
|
"gulp-minify-css": "^0.5.1",
|
||||||
|
@ -245,6 +245,28 @@
|
|||||||
"</div>"
|
"</div>"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"_id": "bd7158d9c436eddfaeb5bd2f",
|
||||||
|
"name": "How do I get help when I get stuck?",
|
||||||
|
"description": [
|
||||||
|
"<div class=\"col-xs-12 col-sm-10 col-sm-offset-1\">",
|
||||||
|
"<h3>When you get stuck, remember: RSAP.</h3>",
|
||||||
|
"<h3>",
|
||||||
|
" <ol>",
|
||||||
|
" <li><span class='text-info'>Read</span> the documentation or error</li>",
|
||||||
|
" <li><span class='text-info'>Search</span> Google</li>",
|
||||||
|
" <li><span class='text-info'>Ask</span> your friends for help</li>",
|
||||||
|
" <li><span class='text-info'>Post</span> on Stack Overflow</li>",
|
||||||
|
" </ol>",
|
||||||
|
"</h3>",
|
||||||
|
"<h3>This is the most time-efficient way to handle being stuck, and it's the most respectful of other people's time, too.</h3>",
|
||||||
|
"<h3>Most of the time, you'll solve your problem after just one or two steps of this algorithm.</h3>",
|
||||||
|
"<h3>We have a special chat room just for getting help: <a href='https://freecode.slack.com/messages/help/' target='_blank'>https://freecode.slack.com/messages/help/</a></h3>",
|
||||||
|
"<h3>Also, if you need to post on Stack Overflow, be sure to read their guide to asking good questions: <a href='http://stackoverflow.com/help/how-to-ask' target='_blank'>http://stackoverflow.com/help/how-to-ask</a>.</h3>",
|
||||||
|
"<h3>Learning to code is hard. But it's a lot easier if you ask for help when you need it!</h3>",
|
||||||
|
"</div>"
|
||||||
|
]
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"_id": "bd7158d9c442eddfaeb5bdef",
|
"_id": "bd7158d9c442eddfaeb5bdef",
|
||||||
"name": "How do I best use the Global Control Shortcuts for Mac?",
|
"name": "How do I best use the Global Control Shortcuts for Mac?",
|
||||||
|
@ -132,7 +132,7 @@ block content
|
|||||||
|
|
||||||
|
|
||||||
- if (user.progressTimestamps.length > 2)
|
- if (user.progressTimestamps.length > 2)
|
||||||
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank")
|
a.animated.fadeIn.btn.btn-lg.btn-block.btn-twitter(target="_blank", href="https://twitter.com/intent/tweet?text=I%20just%20#{verb}%20%40FreeCodeCamp%20Bonfire:%20#{name}&url=http%3A%2F%2Ffreecodecamp.com/bonfires/#{dashedName}&hashtags=LearnToCode, JavaScript")
|
||||||
i.fa.fa-twitter  
|
i.fa.fa-twitter  
|
||||||
= phrase
|
= phrase
|
||||||
- else
|
- else
|
||||||
|
Reference in New Issue
Block a user