Revert "Send fastly token to gui"

This commit is contained in:
picklesrus 2022-05-24 17:01:54 -04:00 committed by GitHub
parent 0b68a9269e
commit e896c60f9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 55 additions and 78 deletions

View file

@ -11,18 +11,9 @@ class Storage extends ScratchStorage {
super(); super();
this.addWebSource( this.addWebSource(
[this.AssetType.Project], [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(); const storage = new Storage();

View file

@ -40,7 +40,6 @@ class EmbedView extends React.Component {
); );
} }
if (this.props.projectInfo && this.props.projectInfo.project_token){
return ( return (
<React.Fragment> <React.Fragment>
<Meta projectInfo={this.props.projectInfo} /> <Meta projectInfo={this.props.projectInfo} />
@ -51,13 +50,10 @@ class EmbedView extends React.Component {
projectHost={this.props.projectHost} projectHost={this.props.projectHost}
projectId={this.state.projectId} projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title} projectTitle={this.props.projectInfo.title}
projectToken={this.props.projectInfo.project_token}
/> />
</React.Fragment> </React.Fragment>
); );
} }
return null;
}
} }
EmbedView.propTypes = { EmbedView.propTypes = {

View file

@ -359,7 +359,6 @@ const PreviewPresentation = ({
isFullScreen={isFullScreen} isFullScreen={isFullScreen}
previewInfoVisible="false" previewInfoVisible="false"
projectHost={projectHost} projectHost={projectHost}
projectToken={projectInfo.project_token}
projectId={projectId} projectId={projectId}
onGreenFlag={onGreenFlag} onGreenFlag={onGreenFlag}
onProjectLoaded={onProjectLoaded} onProjectLoaded={onProjectLoaded}

View file

@ -142,16 +142,13 @@ class Preview extends React.Component {
this.props.sessionStatus === sessionActions.Status.FETCHED) || this.props.sessionStatus === sessionActions.Status.FETCHED) ||
(this.state.projectId !== prevState.projectId))) { (this.state.projectId !== prevState.projectId))) {
this.fetchCommunityData(); this.fetchCommunityData();
this.getProjectData(this.state.projectId, true /* Show cloud/username alerts */);
if (this.state.justShared) { if (this.state.justShared) {
this.setState({ // eslint-disable-line react/no-did-update-set-state this.setState({ // eslint-disable-line react/no-did-update-set-state
justShared: false 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) { if (this.state.projectId === '0' && this.state.projectId !== prevState.projectId) {
this.props.resetProject(); this.props.resetProject();
if (this.state.justRemixed || this.state.justShared) { 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 // Switching out of editor mode, refresh data that comes from project json
if (this.props.playerMode && !prevProps.playerMode) { if (this.props.playerMode && !prevProps.playerMode) {
storage.setProjectToken(this.props.projectInfo.project_token); this.getProjectData(
this.loadProjectData(
this.state.projectId, this.state.projectId,
false // Do not show cloud/username alerts again 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; if (projectId <= 0) return 0;
storage storage
.load(storage.AssetType.Project, projectId, storage.DataFormat.JSON) .load(storage.AssetType.Project, projectId, storage.DataFormat.JSON)
@ -833,7 +829,6 @@ class Preview extends React.Component {
/> />
</Page> : </Page> :
<React.Fragment> <React.Fragment>
{this.props.projectInfo && this.props.projectInfo.project_token && (
<IntlGUI <IntlGUI
assetHost={this.props.assetHost} assetHost={this.props.assetHost}
authorId={this.props.authorId} authorId={this.props.authorId}
@ -854,7 +849,6 @@ class Preview extends React.Component {
hasCloudPermission={this.props.isScratcher} hasCloudPermission={this.props.isScratcher}
isShared={this.props.isShared} isShared={this.props.isShared}
projectHost={this.props.projectHost} projectHost={this.props.projectHost}
projectToken={this.props.projectToken}
projectId={this.state.projectId} projectId={this.state.projectId}
projectTitle={this.props.projectInfo.title} projectTitle={this.props.projectInfo.title}
renderLogin={this.renderLogin} renderLogin={this.renderLogin}
@ -872,7 +866,6 @@ class Preview extends React.Component {
onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail} onUpdateProjectThumbnail={this.props.handleUpdateProjectThumbnail}
onUpdateProjectTitle={this.handleUpdateProjectTitle} onUpdateProjectTitle={this.handleUpdateProjectTitle}
/> />
)}
{this.props.registrationOpen && ( {this.props.registrationOpen && (
this.props.useScratch3Registration ? ( this.props.useScratch3Registration ? (
<Scratch3Registration <Scratch3Registration
@ -951,7 +944,6 @@ Preview.propTypes = {
parent: projectShape, parent: projectShape,
playerMode: PropTypes.bool, playerMode: PropTypes.bool,
projectHost: PropTypes.string.isRequired, projectHost: PropTypes.string.isRequired,
projectToken: PropTypes.string.isRequired,
projectInfo: projectShape, projectInfo: projectShape,
projectNotAvailable: PropTypes.bool, projectNotAvailable: PropTypes.bool,
projectStudios: PropTypes.arrayOf(PropTypes.object), projectStudios: PropTypes.arrayOf(PropTypes.object),

View file

@ -31,6 +31,5 @@ export const projectShape = shape({
remix: shape({ remix: shape({
parent: number, parent: number,
root: number root: number
}), })
project_token: string
}); });