diff --git a/api-server/server/boot/settings.js b/api-server/server/boot/settings.js index e3e0e7d17e..e2ce0e3646 100644 --- a/api-server/server/boot/settings.js +++ b/api-server/server/boot/settings.js @@ -26,13 +26,6 @@ export default function settingsController(app) { createValidatorErrorHandler(alertTypes.danger), updateMyCurrentChallenge ); - api.post( - '/update-my-current-challenge', - ifNoUser401, - updateMyCurrentChallengeValidators, - createValidatorErrorHandler(alertTypes.danger), - updateMyCurrentChallenge - ); api.post('/update-my-portfolio', ifNoUser401, updateMyPortfolio); api.post('/update-my-projects', ifNoUser401, updateMyProjects); api.post( diff --git a/api-server/server/middlewares/csp.js b/api-server/server/middlewares/csp.js index 9837a09e88..335d9aa894 100644 --- a/api-server/server/middlewares/csp.js +++ b/api-server/server/middlewares/csp.js @@ -1,10 +1,11 @@ import helmet from 'helmet'; +import { homeLocation } from '../../../config/env'; + let trusted = [ "'self'", 'https://search.freecodecamp.org', - 'https://www.freecodecamp.rocks', - 'https://api.freecodecamp.rocks', + homeLocation, 'https://' + process.env.AUTH0_DOMAIN ]; @@ -12,9 +13,7 @@ const host = process.env.HOST || 'localhost'; const port = process.env.SYNC_PORT || '3000'; if (process.env.NODE_ENV !== 'production') { - trusted = trusted.concat([ - `ws://${host}:${port}` - ]); + trusted = trusted.concat([`ws://${host}:${port}`, 'http://localhost:8000']); } export default function csp() { @@ -73,11 +72,9 @@ export default function csp() { '*', 'data:' ], - mediaSrc: [ - '*.bitly.com', - '*.amazonaws.com', - '*.twitter.com' - ].concat(trusted), + mediaSrc: ['*.bitly.com', '*.amazonaws.com', '*.twitter.com'].concat( + trusted + ), frameSrc: [ '*.gitter.im', '*.gitter.im https:', diff --git a/client/src/redux/propTypes.js b/client/src/redux/propTypes.js index 1cc9b65a5c..370e759001 100644 --- a/client/src/redux/propTypes.js +++ b/client/src/redux/propTypes.js @@ -22,7 +22,7 @@ export const ChallengeNode = PropTypes.shape({ block: PropTypes.string, challengeType: PropTypes.number, dashedName: PropTypes.string, - description: PropTypes.arrayOf(PropTypes.string), + description: PropTypes.string, files: PropTypes.shape({ indexhtml: FileType, indexjs: FileType @@ -34,6 +34,7 @@ export const ChallengeNode = PropTypes.shape({ guideUrl: PropTypes.string, head: PropTypes.arrayOf(PropTypes.string), challengeOrder: PropTypes.number, + instructions: PropTypes.string, isBeta: PropTypes.bool, isComingSoon: PropTypes.bool, isLocked: PropTypes.bool, diff --git a/client/src/templates/Challenges/backend/Show.js b/client/src/templates/Challenges/backend/Show.js index eed9a32d70..4ba1dd4ee3 100644 --- a/client/src/templates/Challenges/backend/Show.js +++ b/client/src/templates/Challenges/backend/Show.js @@ -41,7 +41,7 @@ const reduxFormPropTypes = { }; const propTypes = { - description: PropTypes.arrayOf(PropTypes.string), + description: PropTypes.string, executeChallenge: PropTypes.func.isRequired, id: PropTypes.string, output: PropTypes.string, @@ -126,7 +126,8 @@ export class BackEnd extends Component { challengeNode: { fields: { blockName, slug }, title, - description + description, + instructions } }, output, @@ -145,7 +146,10 @@ export class BackEnd extends Component {
{blockNameTitle} - +
{ - if (descriptionRegex.test(line)) { - return ( -
- ); - } - return ( -

- ); - }); -} - -function ChallengeDescription({ description, section }) { - // TODO: Remove bootstrap +function ChallengeDescription({ description, instructions, section }) { return ( - {renderDescription(description)} +

+ {instructions ? ( + +
+
+
+ + ) : ( +
+ )} ); diff --git a/client/src/templates/Challenges/components/Side-Panel.js b/client/src/templates/Challenges/components/Side-Panel.js index f6db300866..eda5547ce7 100644 --- a/client/src/templates/Challenges/components/Side-Panel.js +++ b/client/src/templates/Challenges/components/Side-Panel.js @@ -1,4 +1,4 @@ -import React, { PureComponent } from 'react'; +import React, { Component } from 'react'; import PropTypes from 'prop-types'; import ReactDom from 'react-dom'; import { connect } from 'react-redux'; @@ -29,16 +29,17 @@ const mapDispatchToProps = dispatch => const MathJax = global.MathJax; const propTypes = { - description: PropTypes.arrayOf(PropTypes.string), + description: PropTypes.string, guideUrl: PropTypes.string, initConsole: PropTypes.func.isRequired, + instructions: PropTypes.string, section: PropTypes.string, tests: PropTypes.arrayOf(PropTypes.object), title: PropTypes.string, videoUrl: PropTypes.string }; -export class SidePanel extends PureComponent { +export class SidePanel extends Component { constructor(props) { super(props); this.bindTopDiv = this.bindTopDiv.bind(this); @@ -84,6 +85,7 @@ export class SidePanel extends PureComponent { const { title, description, + instructions, guideUrl, tests, section, @@ -95,7 +97,7 @@ export class SidePanel extends PureComponent {
{title} - +
diff --git a/client/src/templates/Challenges/project/Side-Panel.js b/client/src/templates/Challenges/project/Side-Panel.js index fd848c7b40..38ef38caf5 100644 --- a/client/src/templates/Challenges/project/Side-Panel.js +++ b/client/src/templates/Challenges/project/Side-Panel.js @@ -1,36 +1,23 @@ -import React, { PureComponent } from 'react'; +import React from 'react'; import PropTypes from 'prop-types'; import ChallengeTitle from '../components/Challenge-Title'; import Spacer from '../../../components/helpers/Spacer'; const propTypes = { - description: PropTypes.arrayOf(PropTypes.string), + description: PropTypes.string, isCompleted: PropTypes.bool, isSignedIn: PropTypes.bool, title: PropTypes.string }; -export default class SidePanel extends PureComponent { - renderDescription(title = '', description = []) { - return description.map((line, index) => ( -
  • - )); - } - - render() { - const { title, description, isCompleted } = this.props; - return ( -
    - - {title} -
      {this.renderDescription(title, description)}
    -
    - ); - } +export default function SidePanel({ title, description, isCompleted }) { + return ( +
    + + {title} +
    +
    + ); } SidePanel.displayName = 'ProjectSidePanel'; diff --git a/client/src/templates/Guide/GuideArticle.js b/client/src/templates/Guide/GuideArticle.js index 68b7e9153e..a7b2b34c6f 100644 --- a/client/src/templates/Guide/GuideArticle.js +++ b/client/src/templates/Guide/GuideArticle.js @@ -39,7 +39,6 @@ class GuideArticle extends Component { }, pageContext: { meta } } = this.props; - console.log(title); return (