Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
scratch-www
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
xpstem
scratch-www
Commits
7ac90afb
Unverified
Commit
7ac90afb
authored
Dec 06, 2018
by
chrisgarrity
Committed by
GitHub
Dec 06, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2406 from chrisgarrity/issue/2388-embed-project
show embed view
parents
b4985430
1a1122d9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
2 deletions
+51
-2
bin/configure-fastly.js
bin/configure-fastly.js
+46
-0
src/routes.json
src/routes.json
+1
-1
src/views/preview/project-view.jsx
src/views/preview/project-view.jsx
+4
-1
No files found.
bin/configure-fastly.js
View file @
7ac90afb
...
...
@@ -217,6 +217,52 @@ async.auto({
if
(
err
)
return
cb
(
err
);
cb
(
null
,
redirectResults
);
});
}],
embedRedirectHeaders
:
[
'
version
'
,
function
(
cb
,
results
)
{
async
.
auto
({
requestCondition
:
function
(
cb2
)
{
var
condition
=
{
name
:
'
routes/projects/embed (request)
'
,
statement
:
'
req.url ~ "^/projects/embed/(
\\
d+)"
'
,
type
:
'
REQUEST
'
,
priority
:
10
};
fastly
.
setCondition
(
results
.
version
,
condition
,
cb2
);
},
responseCondition
:
function
(
cb2
)
{
var
condition
=
{
name
:
'
routes/projects/embed (response)
'
,
statement
:
'
req.url ~ "^/projects/embed/(
\\
d+)"
'
,
type
:
'
RESPONSE
'
,
priority
:
10
};
fastly
.
setCondition
(
results
.
version
,
condition
,
cb2
);
},
responseObject
:
[
'
requestCondition
'
,
function
(
cb2
,
redirectResults
)
{
var
responseObject
=
{
name
:
'
redirects/projects/embed
'
,
status
:
301
,
response
:
'
Moved Permanently
'
,
request_condition
:
redirectResults
.
requestCondition
.
name
};
fastly
.
setResponseObject
(
results
.
version
,
responseObject
,
cb2
);
}],
redirectHeader
:
[
'
responseCondition
'
,
function
(
cb2
,
redirectResults
)
{
var
header
=
{
name
:
'
redirects/projects/embed
'
,
action
:
'
set
'
,
ignore_if_set
:
0
,
type
:
'
RESPONSE
'
,
dst
:
'
http.Location
'
,
src
:
'
"/projects/" + re.group.1 + "/embed"
'
,
response_condition
:
redirectResults
.
responseCondition
.
name
};
fastly
.
setFastlyHeader
(
results
.
version
,
header
,
cb2
);
}]
},
function
(
err
,
redirectResults
)
{
if
(
err
)
return
cb
(
err
);
cb
(
null
,
redirectResults
);
});
}]
},
function
(
err
,
results
)
{
if
(
err
)
throw
new
Error
(
err
);
...
...
src/routes.json
View file @
7ac90afb
...
...
@@ -199,7 +199,7 @@
},
{
"name"
:
"projects"
,
"pattern"
:
"^/projects(/editor|(/
\\
d+(/editor|/fullscreen)?)?)?/?(
\\
?.*)?$"
,
"pattern"
:
"^/projects(/editor|(/
\\
d+(/editor|/fullscreen
|/embed
)?)?)?/?(
\\
?.*)?$"
,
"routeAlias"
:
"/projects/?$"
,
"view"
:
"preview/preview"
,
"title"
:
"Scratch Project"
...
...
src/views/preview/project-view.jsx
View file @
7ac90afb
...
...
@@ -883,13 +883,16 @@ module.exports.initGuiState = guiInitialState => {
const
parts
=
pathname
.
split
(
'
/
'
).
filter
(
Boolean
);
// parts[0]: 'projects'
// parts[1]: either :id or 'editor'
// parts[2]: undefined if no :id, otherwise either 'editor'
or 'fullscreen
'
// parts[2]: undefined if no :id, otherwise either 'editor'
, 'fullscreen' or 'embed
'
if
(
parts
.
indexOf
(
'
editor
'
)
===
-
1
)
{
guiInitialState
=
GUI
.
initPlayer
(
guiInitialState
);
}
if
(
parts
.
indexOf
(
'
fullscreen
'
)
!==
-
1
)
{
guiInitialState
=
GUI
.
initFullScreen
(
guiInitialState
);
}
if
(
parts
.
indexOf
(
'
embed
'
)
!==
-
1
)
{
guiInitialState
=
GUI
.
initEmbedded
(
guiInitialState
);
}
return
guiInitialState
;
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment