From a19fb29f3688dcc844952ba86ece131eb9669f4b Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Mon, 9 Jul 2018 16:31:16 -0400 Subject: [PATCH 1/3] WIP: enable backpack in preview --- README.md | 17 +++++++++-------- src/views/preview/presentation.jsx | 6 ++++++ src/views/preview/preview.jsx | 6 ++++++ webpack.config.js | 1 + 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 210e72876..917786707 100644 --- a/README.md +++ b/README.md @@ -81,14 +81,15 @@ To stop the process that is making the site available to your web browser (creat `npm start` can be configured with the following environment variables -| Variable | Default | Description | -| ------------- | ----------------------------- | ---------------------------------------------- | -| `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests | -| `SENTRY_DSN` | `''` | DSN for Sentry | -| `FALLBACK` | `''` | Pass-through location for old site | -| `GA_TRACKER` | `''` | Where to log Google Analytics data | -| `NODE_ENV` | `null` | If not `production`, app acts like development | -| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) | +| Variable | Default | Description | +| --------------- | ---------------------------------- | ---------------------------------------------- | +| `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests | +| `BACKPACK_HOST` | `https://backpack.scratch.mit.edu` | Hostname for backpack requests | +| `SENTRY_DSN` | `''` | DSN for Sentry | +| `FALLBACK` | `''` | Pass-through location for old site | +| `GA_TRACKER` | `''` | Where to log Google Analytics data | +| `NODE_ENV` | `null` | If not `production`, app acts like development | +| `PORT` | `8333` | Port for devserver (http://localhost:XXXX) | **NOTE:** Because by default `API_HOST=https://api.scratch.mit.edu`, please be aware that, by default, you will be seeing and interacting with real data on the Scratch website. diff --git a/src/views/preview/presentation.jsx b/src/views/preview/presentation.jsx index a62aa663f..bfebb7ec6 100644 --- a/src/views/preview/presentation.jsx +++ b/src/views/preview/presentation.jsx @@ -28,6 +28,7 @@ const projectShape = require('./projectshape.jsx').projectShape; require('./preview.scss'); const PreviewPresentation = ({ + backpackOptions, comments, editable, extensions, @@ -124,6 +125,7 @@ const PreviewPresentation = ({
Date: Thu, 12 Jul 2018 10:01:27 -0400 Subject: [PATCH 2/3] WIP: configure GUI for staging --- .travis.yml | 10 ++++++++++ src/views/preview/presentation.jsx | 6 ++++++ src/views/preview/preview.jsx | 8 ++++++++ webpack.config.js | 2 ++ 4 files changed, 26 insertions(+) diff --git a/.travis.yml b/.travis.yml index 33d4eb9fa..adcd00f67 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,11 +18,21 @@ env: - API_HOST_VAR=API_HOST_$TRAVIS_BRANCH - API_HOST=${!API_HOST_VAR} - API_HOST=${API_HOST:-$API_HOST_STAGING} + - ASSET_HOST_master=https://assets.scratch.mit.edu + - ASSET_HOST_STAGING=https://assets.scratch.ly + - ASSET_HOST_VAR=ASSET_HOST_$TRAVIS_BRANCH + - ASSET_HOST=${!ASSET_HOST_VAR} + - ASSET_HOST=${ASSET_HOST:-$ASSET_HOST_STAGING} - ROOT_URL_master=https://scratch.mit.edu - ROOT_URL_STAGING=https://scratch.ly - ROOT_URL_VAR=ROOT_URL_$TRAVIS_BRANCH - ROOT_URL=${!ROOT_URL_VAR} - ROOT_URL=${ROOT_URL:-$ROOT_URL_STAGING} + - PROJECT_HOST_master=https://projects.scratch.mit.edu + - PROJECT_HOST_STAGING=https://projects.scratch.ly + - PROJECT_HOST_VAR=PROJECT_HOST_$TRAVIS_BRANCH + - PROJECT_HOST=${!PROJECT_HOST_VAR} + - PROJECT_HOST=${PROJECT_HOST:-$PROJECT_HOST_STAGING} - PATH=$PATH:$PWD/test/integration/node_modules/chromedriver/bin - AWS_ACCESS_KEY_ID=$EB_AWS_ACCESS_KEY_ID - AWS_SECRET_ACCESS_KEY=$EB_AWS_SECRET_ACCESS_KEY diff --git a/src/views/preview/presentation.jsx b/src/views/preview/presentation.jsx index bfebb7ec6..bffa0f829 100644 --- a/src/views/preview/presentation.jsx +++ b/src/views/preview/presentation.jsx @@ -28,6 +28,7 @@ const projectShape = require('./projectshape.jsx').projectShape; require('./preview.scss'); const PreviewPresentation = ({ + assetHost, backpackOptions, comments, editable, @@ -41,6 +42,7 @@ const PreviewPresentation = ({ loveCount, originalInfo, parentInfo, + projectHost, projectId, projectInfo, remixes, @@ -125,11 +127,13 @@ const PreviewPresentation = ({
@@ -351,6 +355,7 @@ const PreviewPresentation = ({ PreviewPresentation.propTypes = { addToStudioOpen: PropTypes.bool, + assetHost: PropTypes.string, backpackOptions: PropTypes.shape({ host: PropTypes.string, visible: PropTypes.bool @@ -378,6 +383,7 @@ PreviewPresentation.propTypes = { onUpdate: PropTypes.func, originalInfo: projectShape, parentInfo: projectShape, + projectHost: PropTypes.string, projectId: PropTypes.string, projectInfo: projectShape, projectStudios: PropTypes.arrayOf(PropTypes.object), diff --git a/src/views/preview/preview.jsx b/src/views/preview/preview.jsx index a9073ba03..9c49b6d5d 100644 --- a/src/views/preview/preview.jsx +++ b/src/views/preview/preview.jsx @@ -297,6 +297,7 @@ class Preview extends React.Component { ); @@ -345,6 +349,7 @@ class Preview extends React.Component { } Preview.propTypes = { + assetHost: PropTypes.string.isRequired, comments: PropTypes.arrayOf(PropTypes.object), faved: PropTypes.bool, fullScreen: PropTypes.bool, @@ -362,6 +367,7 @@ Preview.propTypes = { parent: projectShape, playerMode: PropTypes.bool, projectInfo: projectShape, + projectHost: PropTypes.string.isRequired, projectStudios: PropTypes.arrayOf(PropTypes.object), remixes: PropTypes.arrayOf(PropTypes.object), replies: PropTypes.objectOf(PropTypes.array), @@ -387,6 +393,8 @@ Preview.propTypes = { }; Preview.defaultProps = { + assetHost: process.env.ASSET_HOST, + projectHost: process.env.PROJECT_HOST, sessionStatus: sessionActions.Status.NOT_FETCHED, user: {} }; diff --git a/webpack.config.js b/webpack.config.js index fca3baceb..ca7377562 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -165,7 +165,9 @@ module.exports = { 'process.env.NODE_ENV': '"' + (process.env.NODE_ENV || 'development') + '"', 'process.env.SENTRY_DSN': '"' + (process.env.SENTRY_DSN || '') + '"', 'process.env.API_HOST': '"' + (process.env.API_HOST || 'https://api.scratch.mit.edu') + '"', + 'process.env.ASSET_HOST': '"' + (process.env.ASSET_HOST || 'https://assets.scratch.mit.edu') + '"', 'process.env.BACKPACK_HOST': '"' + (process.env.BACKPACK_HOST || 'https://backpack.scratch.mit.edu') + '"', + 'process.env.PROJECT_HOST': '"' + (process.env.PROJECT_HOST || 'https://projects.scratch.mit.edu') + '"', 'process.env.SCRATCH_ENV': '"' + (process.env.SCRATCH_ENV || 'development') + '"' }), new webpack.optimize.CommonsChunkPlugin({ From a3c929db3d61144f8a972273966a2d19f39b8b79 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Thu, 16 Aug 2018 17:32:24 -0400 Subject: [PATCH 3/3] Finish setup of backpack, assets, projects hosts --- .travis.yml | 5 +++++ README.md | 2 ++ src/views/preview/preview.jsx | 18 +++++++++++------- 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/.travis.yml b/.travis.yml index adcd00f67..10b3be82e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -23,6 +23,11 @@ env: - ASSET_HOST_VAR=ASSET_HOST_$TRAVIS_BRANCH - ASSET_HOST=${!ASSET_HOST_VAR} - ASSET_HOST=${ASSET_HOST:-$ASSET_HOST_STAGING} + - BACKPACK_HOST_master=https://backpack.scratch.mit.edu + - BACKPACK_HOST_STAGING=https://backpack.scratch.ly + - BACKPACK_HOST_VAR=BACKPACK_HOST_$TRAVIS_BRANCH + - BACKPACK_HOST=${!BACKPACK_HOST_VAR} + - BACKPACK_HOST=${BACKPACK_HOST:-$BACKPACK_HOST_STAGING} - ROOT_URL_master=https://scratch.mit.edu - ROOT_URL_STAGING=https://scratch.ly - ROOT_URL_VAR=ROOT_URL_$TRAVIS_BRANCH diff --git a/README.md b/README.md index 917786707..25e52a316 100644 --- a/README.md +++ b/README.md @@ -84,7 +84,9 @@ To stop the process that is making the site available to your web browser (creat | Variable | Default | Description | | --------------- | ---------------------------------- | ---------------------------------------------- | | `API_HOST` | `https://api.scratch.mit.edu` | Hostname for API requests | +| `ASSETS_HOST` | `https://assets.scratch.mit.edu` | Hostname for asset requests | | `BACKPACK_HOST` | `https://backpack.scratch.mit.edu` | Hostname for backpack requests | +| `PROJECTS_HOST` | `https://projects.scratch.mit.edu` | Hostname for project requests | | `SENTRY_DSN` | `''` | DSN for Sentry | | `FALLBACK` | `''` | Pass-through location for old site | | `GA_TRACKER` | `''` | Where to log Google Analytics data | diff --git a/src/views/preview/preview.jsx b/src/views/preview/preview.jsx index 9c49b6d5d..d221c2513 100644 --- a/src/views/preview/preview.jsx +++ b/src/views/preview/preview.jsx @@ -288,17 +288,13 @@ class Preview extends React.Component { ); } render () { - const backpackOptions = { - host: process.env.BACKPACK_HOST, - visible: true - }; return ( this.props.playerMode ?