Skip to content
Snippets Groups Projects
Commit 29c84c84 authored by Brian Peiris's avatar Brian Peiris
Browse files

thread html prefix through for avatar selector iframe

parent 167c5746
No related branches found
No related tags found
No related merge requests found
......@@ -7,12 +7,12 @@ class ProfileEntryPanel extends Component {
static propTypes = {
store: PropTypes.object,
messages: PropTypes.object,
finished: PropTypes.func
finished: PropTypes.func,
htmlPrefix: PropTypes.string
}
constructor(props) {
super(props);
window.store = this.props.store;
this.state = {
display_name: this.props.store.state.profile.display_name,
avatar_id: this.props.store.state.profile.avatar_id,
......@@ -77,10 +77,7 @@ class ProfileEntryPanel extends Component {
ref={inp => this.nameInput = inp}/>
<iframe
className="profile-entry__avatar-selector"
src={
/* HACK: Have to account for the smoke test server like this. Feels wrong though. */
`${/smoke/i.test(location.hostname) ? 'smoke-' : ''}avatar-selector.html#avatar_id=${this.state.avatar_id}`
}
src={`${this.props.htmlPrefix}avatar-selector.html#avatar_id=${this.state.avatar_id}`}
ref={ifr => this.avatarSelector = ifr}></iframe>
<input className="profile-entry__form-submit" type="submit" value={formatMessage({ id: "profile.save" }) }/>
</div>
......
......@@ -61,7 +61,8 @@ class UIRoot extends Component {
forcedVREntryType: PropTypes.string,
enableScreenSharing: PropTypes.bool,
store: PropTypes.object,
scene: PropTypes.object
scene: PropTypes.object,
htmlPrefix: PropTypes.object
};
state = {
......@@ -661,7 +662,11 @@ class UIRoot extends Component {
<div className={dialogBoxContentsClassNames}>{dialogContents}</div>
{this.state.showProfileEntry && (
<ProfileEntryPanel finished={this.onProfileFinished} store={this.props.store} />
<ProfileEntryPanel
finished={this.onProfileFinished}
store={this.props.store}
htmlPrefix={this.props.htmlPrefix}
/>
)}
</div>
)}
......
......@@ -13,7 +13,7 @@
<% } %>
</head>
<body>
<body data-html-prefix="<%= HTML_PREFIX %>">
<audio id="test-tone" src="./assets/sfx/tone.ogg"></audio>
<a-scene
......
......@@ -218,6 +218,7 @@ function mountUI(scene) {
const disableAutoExitOnConcurrentLoad = qsTruthy("allow_multi");
const forcedVREntryType = qs.vr_entry_type || null;
const enableScreenSharing = qsTruthy("enable_screen_sharing");
const htmlPrefix = document.body.dataset.htmlPrefix || "";
const uiRoot = ReactDOM.render(
<UIRoot
......@@ -229,7 +230,8 @@ function mountUI(scene) {
disableAutoExitOnConcurrentLoad,
forcedVREntryType,
enableScreenSharing,
store
store,
htmlPrefix
}}
/>,
document.getElementById("ui-root")
......
......@@ -9,6 +9,8 @@ const HTMLWebpackPlugin = require("html-webpack-plugin");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const _ = require("lodash");
const SMOKE_PREFIX = "smoke-";
function createHTTPSConfig() {
if (process.env.NODE_ENV === "production") {
return false;
......@@ -218,6 +220,7 @@ const config = {
// expose these variables to the lodash template
// ex: <%= ORIGIN_TRIAL_TOKEN %>
imports: {
HTML_PREFIX: process.env.GENERATE_SMOKE_TESTS ? SMOKE_PREFIX : "",
NODE_ENV: process.env.NODE_ENV,
ORIGIN_TRIAL_EXPIRES: process.env.ORIGIN_TRIAL_EXPIRES,
ORIGIN_TRIAL_TOKEN: process.env.ORIGIN_TRIAL_TOKEN
......@@ -238,14 +241,14 @@ module.exports = () => {
const smokeConfig = Object.assign({}, config, {
// Set the public path for to point to the correct assets on the smoke-test build.
output: Object.assign({}, config.output, {
publicPath: process.env.BASE_ASSETS_PATH.replace("://", "://smoke-")
publicPath: process.env.BASE_ASSETS_PATH.replace("://", `://${SMOKE_PREFIX}`)
}),
// For this config
plugins: config.plugins.map(plugin => {
if (plugin instanceof HTMLWebpackPlugin) {
return new HTMLWebpackPlugin(
Object.assign({}, plugin.options, {
filename: "smoke-" + plugin.options.filename
filename: SMOKE_PREFIX + plugin.options.filename
})
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment