mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 15:47:53 -05:00
Make version dependent on xml call
Fixes #1351 by including a call to `version.xml` to get the most up-to-date offline build version, defaulting to the current version, `456.0.3`. This also fixes #1352 by switching the route to `/download`, with a redirect from `/scratch2download/`
This commit is contained in:
parent
348fd2d860
commit
6e3c255fa7
3 changed files with 48 additions and 8 deletions
|
@ -168,8 +168,8 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "download",
|
"name": "download",
|
||||||
"pattern": "^/scratch2download/",
|
"pattern": "^/download/",
|
||||||
"routeAlias": "/scratch2download/?$",
|
"routeAlias": "/download/?$",
|
||||||
"view": "download/download",
|
"view": "download/download",
|
||||||
"title": "Scratch Offline Editor"
|
"title": "Scratch Offline Editor"
|
||||||
},
|
},
|
||||||
|
@ -252,6 +252,12 @@
|
||||||
"routeAlias": "/explore(?!/ajax)",
|
"routeAlias": "/explore(?!/ajax)",
|
||||||
"redirect": "/explore/studios/all"
|
"redirect": "/explore/studios/all"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "download-redirect",
|
||||||
|
"pattern": "^/scratch2download/?$",
|
||||||
|
"routeAlias": "/scratch2download",
|
||||||
|
"view": "/download"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "microworld-art",
|
"name": "microworld-art",
|
||||||
"pattern": "^/microworlds/art",
|
"pattern": "^/microworlds/art",
|
||||||
|
|
|
@ -4,6 +4,7 @@ var render = require('../../lib/render.jsx');
|
||||||
var FormattedHTMLMessage = require('react-intl').FormattedHTMLMessage;
|
var FormattedHTMLMessage = require('react-intl').FormattedHTMLMessage;
|
||||||
var FormattedMessage = require('react-intl').FormattedMessage;
|
var FormattedMessage = require('react-intl').FormattedMessage;
|
||||||
|
|
||||||
|
var api = require('../../lib/api');
|
||||||
var Page = require('../../components/page/www/page.jsx');
|
var Page = require('../../components/page/www/page.jsx');
|
||||||
var TitleBanner = require('../../components/title-banner/title-banner.jsx');
|
var TitleBanner = require('../../components/title-banner/title-banner.jsx');
|
||||||
var FlexRow = require('../../components/flex-row/flex-row.jsx');
|
var FlexRow = require('../../components/flex-row/flex-row.jsx');
|
||||||
|
@ -14,7 +15,33 @@ require('../../components/forms/button.scss');
|
||||||
|
|
||||||
var Download = React.createClass({
|
var Download = React.createClass({
|
||||||
type: 'Download',
|
type: 'Download',
|
||||||
|
getInitialState: function () {
|
||||||
|
return {
|
||||||
|
swfVersion: '456.0.3'
|
||||||
|
};
|
||||||
|
},
|
||||||
|
componentDidMount: function () {
|
||||||
|
api({
|
||||||
|
host: '',
|
||||||
|
uri: '/scratchr2/static/sa/version.xml',
|
||||||
|
responseType: 'string'
|
||||||
|
}, function (err, body) {
|
||||||
|
if (err) return;
|
||||||
|
|
||||||
|
var doc = new DOMParser().parseFromString(body, 'text/xml');
|
||||||
|
return this.setState({
|
||||||
|
swfVersion: doc.getElementsByTagName('versionNumber')[0].childNodes[0].nodeValue
|
||||||
|
});
|
||||||
|
}.bind(this));
|
||||||
|
},
|
||||||
render: function () {
|
render: function () {
|
||||||
|
var downloadUrls = {
|
||||||
|
mac: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.dmg',
|
||||||
|
mac105: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.air',
|
||||||
|
windows: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.exe',
|
||||||
|
linux: '/scratchr2/static/sa/Scratch-'+ this.state.swfVersion + '.air'
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="download">
|
<div className="download">
|
||||||
<TitleBanner className="masthead">
|
<TitleBanner className="masthead">
|
||||||
|
@ -95,25 +122,25 @@ var Download = React.createClass({
|
||||||
<ul className="installation-downloads">
|
<ul className="installation-downloads">
|
||||||
<li className="installation-downloads-item">
|
<li className="installation-downloads-item">
|
||||||
<FormattedMessage id='download.macOSX' /> -
|
<FormattedMessage id='download.macOSX' /> -
|
||||||
{' '}<a href="http://get.adobe.com/air/">
|
{' '}<a href={downloadUrls.mac}>
|
||||||
<FormattedMessage id='download.download' />
|
<FormattedMessage id='download.download' />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="installation-downloads-item">
|
<li className="installation-downloads-item">
|
||||||
<FormattedMessage id='download.macOlder' /> -
|
<FormattedMessage id='download.macOlder' /> -
|
||||||
{' '}<a href="http://airdownload.adobe.com/air/mac/download/2.6/AdobeAIR.zip">
|
{' '}<a href={downloadUrls.mac105}>
|
||||||
<FormattedMessage id='download.download' />
|
<FormattedMessage id='download.download' />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="installation-downloads-item">
|
<li className="installation-downloads-item">
|
||||||
<FormattedMessage id='download.windows' /> -
|
<FormattedMessage id='download.windows' /> -
|
||||||
{' '}<a href="http://get.adobe.com/air/">
|
{' '}<a href={downloadUrls.windows}>
|
||||||
<FormattedMessage id='download.download' />
|
<FormattedMessage id='download.download' />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li className="installation-downloads-item">
|
<li className="installation-downloads-item">
|
||||||
<FormattedMessage id='download.linux' /> -
|
<FormattedMessage id='download.linux' /> -
|
||||||
{' '}<a href="http://airdownload.adobe.com/air/lin/download/2.6/AdobeAIRInstaller.bin">
|
{' '}<a href={downloadUrls.linux}>
|
||||||
<FormattedMessage id='download.download' />
|
<FormattedMessage id='download.download' />
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
@ -150,7 +177,14 @@ var Download = React.createClass({
|
||||||
<span className="nav-spacer"></span>
|
<span className="nav-spacer"></span>
|
||||||
<h2><FormattedMessage id='download.updatesTitle' /></h2>
|
<h2><FormattedMessage id='download.updatesTitle' /></h2>
|
||||||
<p><FormattedMessage id='download.updatesBody' /></p>
|
<p><FormattedMessage id='download.updatesBody' /></p>
|
||||||
<p><FormattedMessage id='download.currentVersion' /></p>
|
<p>
|
||||||
|
<FormattedMessage
|
||||||
|
id='download.currentVersion'
|
||||||
|
values={{
|
||||||
|
version: this.state.swfVersion
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section id="other">
|
<section id="other">
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
"download.scratchCards": "Scratch Cards",
|
"download.scratchCards": "Scratch Cards",
|
||||||
"download.updatesTitle": "Updates",
|
"download.updatesTitle": "Updates",
|
||||||
"download.updatesBody": "The Offline Editor can update itself (with user permission). It will check for updates at startup or you can use the \"Check for updates\" command in the file menu.",
|
"download.updatesBody": "The Offline Editor can update itself (with user permission). It will check for updates at startup or you can use the \"Check for updates\" command in the file menu.",
|
||||||
"download.currentVersion": "The current version is 454.",
|
"download.currentVersion": "The current version is {version}.",
|
||||||
"download.otherVersionsTitle": "Other Versions of Scratch",
|
"download.otherVersionsTitle": "Other Versions of Scratch",
|
||||||
"download.otherVersionsOlder": "If you have an older computer, or cannot install the Scratch 2.0 offline editor, you can try installing <a href=\"http://scratch.mit.edu/scratch_1.4/\">Scratch 1.4</a>.",
|
"download.otherVersionsOlder": "If you have an older computer, or cannot install the Scratch 2.0 offline editor, you can try installing <a href=\"http://scratch.mit.edu/scratch_1.4/\">Scratch 1.4</a>.",
|
||||||
"download.otherVersionsAdmin": "If you are a network administrator: a Scratch 2.0 MSI has been created and maintained by a member of the community and hosted for public download <a href=\"http://llk.github.io/scratch-msi/\">here</a>.",
|
"download.otherVersionsAdmin": "If you are a network administrator: a Scratch 2.0 MSI has been created and maintained by a member of the community and hosted for public download <a href=\"http://llk.github.io/scratch-msi/\">here</a>.",
|
||||||
|
|
Loading…
Reference in a new issue