mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-30 02:56:20 -05:00
Revert "Send fastly token to gui"
This commit is contained in:
parent
0b68a9269e
commit
e896c60f9a
5 changed files with 55 additions and 78 deletions
|
@ -11,18 +11,9 @@ class Storage extends ScratchStorage {
|
|||
super();
|
||||
this.addWebSource(
|
||||
[this.AssetType.Project],
|
||||
this.getProjectGetConfig.bind(this)
|
||||
projectAsset => `${PROJECT_HOST}/${projectAsset.assetId}`
|
||||
);
|
||||
}
|
||||
setProjectToken (projectToken) {
|
||||
this.projectToken = projectToken;
|
||||
}
|
||||
getProjectGetConfig (projectAsset) {
|
||||
const path = `${PROJECT_HOST}/${projectAsset.assetId}`;
|
||||
const qs = this.projectToken ? `?token=${this.projectToken}` : '';
|
||||
return path + qs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
const storage = new Storage();
|
||||
|
|
|
@ -40,23 +40,19 @@ class EmbedView extends React.Component {
|
|||
);
|
||||
}
|
||||
|
||||
if (this.props.projectInfo && this.props.projectInfo.project_token){
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Meta projectInfo={this.props.projectInfo} />
|
||||
<IntlGUI
|
||||
assetHost={this.props.assetHost}
|
||||
basePath="/"
|
||||
className="gui"
|
||||
projectHost={this.props.projectHost}
|
||||
projectId={this.state.projectId}
|
||||
projectTitle={this.props.projectInfo.title}
|
||||
projectToken={this.props.projectInfo.project_token}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
return (
|
||||
<React.Fragment>
|
||||
<Meta projectInfo={this.props.projectInfo} />
|
||||
<IntlGUI
|
||||
assetHost={this.props.assetHost}
|
||||
basePath="/"
|
||||
className="gui"
|
||||
projectHost={this.props.projectHost}
|
||||
projectId={this.state.projectId}
|
||||
projectTitle={this.props.projectInfo.title}
|
||||
/>
|
||||
</React.Fragment>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -359,7 +359,6 @@ const PreviewPresentation = ({
|
|||
isFullScreen={isFullScreen}
|
||||
previewInfoVisible="false"
|
||||
projectHost={projectHost}
|
||||
projectToken={projectInfo.project_token}
|
||||
projectId={projectId}
|
||||
onGreenFlag={onGreenFlag}
|
||||
onProjectLoaded={onProjectLoaded}
|
||||
|
|
|
@ -142,16 +142,13 @@ class Preview extends React.Component {
|
|||
this.props.sessionStatus === sessionActions.Status.FETCHED) ||
|
||||
(this.state.projectId !== prevState.projectId))) {
|
||||
this.fetchCommunityData();
|
||||
this.getProjectData(this.state.projectId, true /* Show cloud/username alerts */);
|
||||
if (this.state.justShared) {
|
||||
this.setState({ // eslint-disable-line react/no-did-update-set-state
|
||||
justShared: false
|
||||
});
|
||||
}
|
||||
}
|
||||
if (this.props.projectInfo.id !== prevProps.projectInfo.id) {
|
||||
storage.setProjectToken(this.props.projectInfo.project_token);
|
||||
this.loadProjectData(this.state.projectId, true /* Show cloud/username alerts */);
|
||||
}
|
||||
if (this.state.projectId === '0' && this.state.projectId !== prevState.projectId) {
|
||||
this.props.resetProject();
|
||||
if (this.state.justRemixed || this.state.justShared) {
|
||||
|
@ -199,8 +196,7 @@ class Preview extends React.Component {
|
|||
|
||||
// Switching out of editor mode, refresh data that comes from project json
|
||||
if (this.props.playerMode && !prevProps.playerMode) {
|
||||
storage.setProjectToken(this.props.projectInfo.project_token);
|
||||
this.loadProjectData(
|
||||
this.getProjectData(
|
||||
this.state.projectId,
|
||||
false // Do not show cloud/username alerts again
|
||||
);
|
||||
|
@ -327,7 +323,7 @@ class Preview extends React.Component {
|
|||
}
|
||||
}
|
||||
}
|
||||
loadProjectData (projectId, showAlerts) {
|
||||
getProjectData (projectId, showAlerts) {
|
||||
if (projectId <= 0) return 0;
|
||||
storage
|
||||
.load(storage.AssetType.Project, projectId, storage.DataFormat.JSON)
|
||||
|
@ -833,46 +829,43 @@ class Preview extends React.Component {
|
|||
/>
|
||||
</Page> :
|
||||
<React.Fragment>
|
||||
{this.props.projectInfo && this.props.projectInfo.project_token && (
|
||||
<IntlGUI
|
||||
assetHost={this.props.assetHost}
|
||||
authorId={this.props.authorId}
|
||||
authorThumbnailUrl={this.props.authorThumbnailUrl}
|
||||
authorUsername={this.props.authorUsername}
|
||||
backpackHost={this.props.backpackHost}
|
||||
backpackVisible={this.props.canUseBackpack}
|
||||
basePath="/"
|
||||
canCreateCopy={this.props.canCreateCopy}
|
||||
canCreateNew={this.props.canCreateNew}
|
||||
canEditTitle={this.props.canEditTitleInEditor}
|
||||
canRemix={this.props.canRemix}
|
||||
canSave={this.props.canSave}
|
||||
canShare={this.props.canShare}
|
||||
className="gui"
|
||||
cloudHost={this.props.cloudHost}
|
||||
enableCommunity={this.props.enableCommunity}
|
||||
hasCloudPermission={this.props.isScratcher}
|
||||
isShared={this.props.isShared}
|
||||
projectHost={this.props.projectHost}
|
||||
projectToken={this.props.projectToken}
|
||||
projectId={this.state.projectId}
|
||||
projectTitle={this.props.projectInfo.title}
|
||||
renderLogin={this.renderLogin}
|
||||
onClickLogo={this.handleClickLogo}
|
||||
onGreenFlag={this.handleGreenFlag}
|
||||
onLogOut={this.props.handleLogOut}
|
||||
onOpenRegistration={this.props.handleOpenRegistration}
|
||||
onProjectLoaded={this.handleProjectLoaded}
|
||||
onRemixing={this.handleIsRemixing}
|
||||
onSetLanguage={this.handleSetLanguage}
|
||||
onShare={this.handleShare}
|
||||
onToggleLoginOpen={this.props.handleToggleLoginOpen}
|
||||
onUpdateProjectData={this.handleUpdateProjectData}
|
||||
onUpdateProjectId={this.handleUpdateProjectId}
|
||||
onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail}
|
||||
onUpdateProjectTitle={this.handleUpdateProjectTitle}
|
||||
/>
|
||||
)}
|
||||
<IntlGUI
|
||||
assetHost={this.props.assetHost}
|
||||
authorId={this.props.authorId}
|
||||
authorThumbnailUrl={this.props.authorThumbnailUrl}
|
||||
authorUsername={this.props.authorUsername}
|
||||
backpackHost={this.props.backpackHost}
|
||||
backpackVisible={this.props.canUseBackpack}
|
||||
basePath="/"
|
||||
canCreateCopy={this.props.canCreateCopy}
|
||||
canCreateNew={this.props.canCreateNew}
|
||||
canEditTitle={this.props.canEditTitleInEditor}
|
||||
canRemix={this.props.canRemix}
|
||||
canSave={this.props.canSave}
|
||||
canShare={this.props.canShare}
|
||||
className="gui"
|
||||
cloudHost={this.props.cloudHost}
|
||||
enableCommunity={this.props.enableCommunity}
|
||||
hasCloudPermission={this.props.isScratcher}
|
||||
isShared={this.props.isShared}
|
||||
projectHost={this.props.projectHost}
|
||||
projectId={this.state.projectId}
|
||||
projectTitle={this.props.projectInfo.title}
|
||||
renderLogin={this.renderLogin}
|
||||
onClickLogo={this.handleClickLogo}
|
||||
onGreenFlag={this.handleGreenFlag}
|
||||
onLogOut={this.props.handleLogOut}
|
||||
onOpenRegistration={this.props.handleOpenRegistration}
|
||||
onProjectLoaded={this.handleProjectLoaded}
|
||||
onRemixing={this.handleIsRemixing}
|
||||
onSetLanguage={this.handleSetLanguage}
|
||||
onShare={this.handleShare}
|
||||
onToggleLoginOpen={this.props.handleToggleLoginOpen}
|
||||
onUpdateProjectData={this.handleUpdateProjectData}
|
||||
onUpdateProjectId={this.handleUpdateProjectId}
|
||||
onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail}
|
||||
onUpdateProjectTitle={this.handleUpdateProjectTitle}
|
||||
/>
|
||||
{this.props.registrationOpen && (
|
||||
this.props.useScratch3Registration ? (
|
||||
<Scratch3Registration
|
||||
|
@ -951,7 +944,6 @@ Preview.propTypes = {
|
|||
parent: projectShape,
|
||||
playerMode: PropTypes.bool,
|
||||
projectHost: PropTypes.string.isRequired,
|
||||
projectToken: PropTypes.string.isRequired,
|
||||
projectInfo: projectShape,
|
||||
projectNotAvailable: PropTypes.bool,
|
||||
projectStudios: PropTypes.arrayOf(PropTypes.object),
|
||||
|
|
|
@ -31,6 +31,5 @@ export const projectShape = shape({
|
|||
remix: shape({
|
||||
parent: number,
|
||||
root: number
|
||||
}),
|
||||
project_token: string
|
||||
})
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue