Merge branch 'new-guest-access' of github.com:vector-im/riot-web into new-guest-access
This commit is contained in:
commit
a2378db837
4 changed files with 158 additions and 54 deletions
|
@ -22,6 +22,8 @@ import MatrixClientPeg from 'matrix-react-sdk/lib/MatrixClientPeg';
|
|||
import sdk from 'matrix-react-sdk';
|
||||
import GeminiScrollbar from 'react-gemini-scrollbar';
|
||||
import request from 'browser-request';
|
||||
import { _t } from 'matrix-react-sdk/lib/languageHandler';
|
||||
import sanitizeHtml from 'sanitize-html';
|
||||
|
||||
module.exports = React.createClass({
|
||||
displayName: 'HomePage',
|
||||
|
@ -38,44 +40,44 @@ module.exports = React.createClass({
|
|||
|
||||
getInitialState: function() {
|
||||
return {
|
||||
page: ""
|
||||
iframeSrc: '',
|
||||
page: '',
|
||||
};
|
||||
},
|
||||
|
||||
componentWillMount: function() {
|
||||
if (this.props.teamToken && this.props.teamServerUrl) {
|
||||
return;
|
||||
this.setState({
|
||||
iframeSrc: `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`
|
||||
});
|
||||
}
|
||||
else {
|
||||
// we use request() to inline the homepage into the react component
|
||||
// so that it can inherit CSS and theming easily rather than mess around
|
||||
// with iframes and trying to synchronise document.stylesheets.
|
||||
|
||||
// we use request() to inline the homepage into the react component
|
||||
// so that it can inherit CSS and theming easily rather than mess around
|
||||
// with iframes and trying to synchronise document.stylesheets.
|
||||
let src = this.props.homePageUrl || '/home.html';
|
||||
|
||||
let src = this.props.homePageUrl || '/home.html';
|
||||
request(
|
||||
{ method: "GET", url: src },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
console.log(error);
|
||||
this.setState({ page: "Couldn't load home page" });
|
||||
}
|
||||
|
||||
request(
|
||||
{ method: "GET", url: src },
|
||||
(err, response, body) => {
|
||||
if (err || response.status < 200 || response.status >= 300) {
|
||||
console.log(error);
|
||||
this.setState({ page: "Couldn't load home page" });
|
||||
body = body.replace(/_t\(['"]([\s\S]*?)['"]\)/mg, (match, g1)=>{ return sanitizeHtml(_t(g1)) });
|
||||
this.setState({ page: body });
|
||||
}
|
||||
|
||||
// We parse the JSON ourselves rather than use the JSON
|
||||
// parameter, since this throws a parse error on empty
|
||||
// which breaks if there's no config.json and we're
|
||||
// loading from the filesystem (see above).
|
||||
this.setState({ page: body });
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
},
|
||||
|
||||
render: function() {
|
||||
if (this.props.teamToken && this.props.teamServerUrl) {
|
||||
src = `${this.props.teamServerUrl}/static/${this.props.teamToken}/home.html`;
|
||||
if (this.state.iframeSrc) {
|
||||
return (
|
||||
<div className="mx_HomePage">
|
||||
<iframe src={ src } />
|
||||
<iframe src={ this.state.iframeSrc } />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -128,5 +128,32 @@
|
|||
"Today": "Today",
|
||||
"Yesterday": "Yesterday",
|
||||
"Welcome page": "Welcome page",
|
||||
"With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!": "With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!"
|
||||
"With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!": "With your current browser, the look and feel of the application may be completely incorrect, and some or all features may not function. If you want to try it anyway you can continue, but you are on your own in terms of any issues you may encounter!",
|
||||
"Welcome to Riot.im": "Welcome to Riot.im",
|
||||
"Decentralised, encrypted chat & collaboration powered by": "Decentralised, encrypted chat & collaboration powered by",
|
||||
"Search the room directory": "Search the room directory",
|
||||
"Chat with Riot Bot": "Chat with Riot Bot",
|
||||
"Get started with some tips from Riot Bot!": "Get started with some tips from Riot Bot!",
|
||||
"General discussion about Matrix": "General discussion about Matrix",
|
||||
"Discussion of all things Matrix!": "Discussion of all things Matrix!",
|
||||
"Riot/Web & Desktop chat": "Riot/Web & Desktop chat",
|
||||
"Riot/iOS & matrix-ios-sdk chat": "Riot/iOS & matrix-ios-sdk chat",
|
||||
"Riot/Android & matrix-android-sdk chat": "Riot/Android & matrix-android-sdk chat",
|
||||
"Matrix technical discussions": "Matrix technical discussions",
|
||||
"Running Matrix services": "Running Matrix services",
|
||||
"Community-run support for Synapse": "Community-run support for Synapse",
|
||||
"Admin support for Dendrite": "Admin support for Dendrite",
|
||||
"Announcements about Synapse releases": "Announcements about Synapse releases",
|
||||
"Support for those using and running matrix-appservice-irc": "Support for those using and running matrix-appservice-irc",
|
||||
"Building services on Matrix": "Building services on Matrix",
|
||||
"Support for those using the Matrix spec": "Support for those using the Matrix spec",
|
||||
"Design and implementation of E2E in Matrix": "Design and implementation of E2E in Matrix",
|
||||
"Implementing VR services with Matrix": "Implementing VR services with Matrix",
|
||||
"Implementing VoIP services with Matrix": "Implementing VoIP services with Matrix",
|
||||
"Discussion of the Identity Service API": "Discussion of the Identity Service API",
|
||||
"Support for those using, running and writing other bridges": "Support for those using, running and writing other bridges",
|
||||
"Contributing code to Matrix and Riot": "Contributing code to Matrix and Riot",
|
||||
"Dev chat for the Riot/Web dev team": "Dev chat for the Riot/Web dev team",
|
||||
"Dev chat for the Dendrite dev team": "Dev chat for the Dendrite dev team",
|
||||
"Co-ordination for Riot/Web translators": "Co-ordination for Riot/Web translators"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue