Show a big scary warning when using non-production versions

This commit is contained in:
Marks Polakovs 2020-09-19 14:07:21 +01:00
parent 168ac48d70
commit 3fca235aa2
4 changed files with 18 additions and 1 deletions

1
.env
View file

@ -1,5 +1,6 @@
HOST=local-development.ury.org.uk
REACT_APP_VERSION=$npm_package_version
REACT_APP_HOMEPAGE=$npm_package_homepage
REACT_APP_MYRADIO_NONAPI_BASE=https://ury.org.uk/myradio-staging
REACT_APP_MYRADIO_BASE=https://ury.org.uk/api-staging/v2
REACT_APP_BROADCAST_API_BASE=https://ury.org.uk/webstudio/api/v1

1
.gitignore vendored
View file

@ -28,6 +28,7 @@ yarn-error.log*
.mypy_cache/
env/
env.ci/
venv/
serverconfig.ini

2
Jenkinsfile vendored
View file

@ -71,7 +71,7 @@ pipeline {
}
steps {
sh 'sed -i -e \'s/ury.org.uk\\/webstudio-dev/ury.org.uk\\/webstudio/\' package.json'
sh 'REACT_APP_GIT_SHA=`git rev-parse --short HEAD` yarn build'
sh 'REACT_APP_GIT_SHA=`git rev-parse --short HEAD` REACT_APP_PRODUCTION=true yarn build'
sshagent(credentials: ['ury']) {
sh 'rsync -av --delete-after build/ deploy@ury:/usr/local/www/webstudio'
}

View file

@ -3,6 +3,20 @@ import Modal from "react-modal";
import { getLatestNewsItem, NewsEntry } from "../api";
import { Button } from "reactstrap";
function DevWarning() {
if (process.env.REACT_APP_PRODUCTION === "true") {
return null;
}
return (
<div style={{ color: "white", backgroundColor: "#960000" }}>
<h1>Development Version</h1>
<strong>You are using a development version of WebStudio.</strong> This version is NOT tested and may have severe bugs and performance problems.<br />
<em><strong>DO NOT BROADCAST LIVE SHOWS USING THIS VERSION!</strong></em><br />
For the latest and greatest tested WebStudio, go to <a href={process.env.REACT_APP_HOMEPAGE}>{process.env.REACT_APP_HOMEPAGE}</a>.
</div>
);
}
export function PisModal({
close,
isOpen,
@ -35,6 +49,7 @@ export function PisModal({
return (
<Modal isOpen={isOpen} onRequestClose={close}>
<DevWarning />
<h1>Presenter News</h1>
{(news === "loading" || news === "not_loaded") && (
<p>Loading the news...</p>