support iframes for RTS urls

This commit is contained in:
Matthew Hodgson 2017-05-30 21:52:43 +01:00
parent 64a67583e0
commit 1e1a43c78f
1 changed files with 19 additions and 9 deletions

View File

@ -43,16 +43,16 @@ module.exports = React.createClass({
}, },
componentWillMount: function() { componentWillMount: function() {
if (this.props.teamToken && this.props.teamServerUrl) {
return;
}
// we use request() to inline the homepage into the react component // we use request() to inline the homepage into the react component
// so that it can inherit CSS and theming easily rather than mess around // so that it can inherit CSS and theming easily rather than mess around
// with iframes and trying to synchronise document.stylesheets. // with iframes and trying to synchronise document.stylesheets.
let src = this.props.homePageUrl || '/home.html'; let src = this.props.homePageUrl || '/home.html';
if (this.props.teamToken && this.props.teamServerUrl) {
src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`;
}
request( request(
{ method: "GET", url: src }, { method: "GET", url: src },
(err, response, body) => { (err, response, body) => {
@ -71,6 +71,15 @@ module.exports = React.createClass({
}, },
render: function() { render: function() {
if (this.props.teamToken && this.props.teamServerUrl) {
src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`;
return (
<div className="mx_HomePage">
<iframe src={ src } />
</div>
);
}
else {
return ( return (
<GeminiScrollbar autoshow={true} className="mx_HomePage"> <GeminiScrollbar autoshow={true} className="mx_HomePage">
<div className="mx_HomePage_body" dangerouslySetInnerHTML={{ __html: this.state.page }}> <div className="mx_HomePage_body" dangerouslySetInnerHTML={{ __html: this.state.page }}>
@ -78,4 +87,5 @@ module.exports = React.createClass({
</GeminiScrollbar> </GeminiScrollbar>
); );
} }
}
}); });