diff --git a/scripts/default.env b/scripts/default.env index a1186bbf1f20d84c6883a36bedea1e6ac88e4e7c..b5dbe2c7c9ec3b22eba8d36f07c2fbd700bf0cb0 100644 --- a/scripts/default.env +++ b/scripts/default.env @@ -3,3 +3,4 @@ ORIGIN_TRIAL_TOKEN="ArEZ0vY0uMo3pj+oY8Up4u4Hy8QolJwKxG4/2WRhSPnTZRrviiGhzP6/y72nBdsIhdEyoundxqg//KLbs2vGnQoAAABkeyJvcmlnaW4iOiJodHRwczovL3JldGljdWx1bS5pbzo0NDMiLCJmZWF0dXJlIjoiV2ViVlIxLjFNNjIiLCJleHBpcnkiOjE1MjYzNDg2MjEsImlzU3ViZG9tYWluIjp0cnVlfQ==" ORIGIN_TRIAL_EXPIRES="2018-05-15" JANUS_SERVER="wss://prod-janus.reticulum.io" +DEV_RETICULUM_SERVER="dev.reticulum.io" diff --git a/src/hub.js b/src/hub.js index 382d4b56c04de413a64c78aba13d5d33848f420a..a92326daf84d8f1319e3c6e19100af9b66cbbd6f 100644 --- a/src/hub.js +++ b/src/hub.js @@ -329,8 +329,10 @@ const onReady = async () => { console.log(`Hub ID: ${hubId}`); const socketProtocol = document.location.protocol === "https:" ? "wss:" : "ws:"; - const socketPort = qs.phx_port || document.location.port; - const socketHost = qs.phx_host || document.location.hostname; + const socketPort = qs.phx_port || (process.env.NODE_ENV === "production" ? document.location.port : 443); + const socketHost = + qs.phx_host || + (process.env.NODE_ENV === "production" ? document.location.hostname : process.env.DEV_RETICULUM_SERVER); const socketUrl = `${socketProtocol}//${socketHost}${socketPort ? `:${socketPort}` : ""}/socket`; console.log(`Phoenix Channel URL: ${socketUrl}`); diff --git a/src/react-components/home-root.js b/src/react-components/home-root.js index d91dfdbed6e726a785cbb8744d35e3dab066085c..231d8b747cbfda01c463310f716ca78d0438f53c 100644 --- a/src/react-components/home-root.js +++ b/src/react-components/home-root.js @@ -19,9 +19,9 @@ const messages = localeData[lang] || localeData.en; const ENVIRONMENT_URLS = [ "https://asset-bundles-prod.reticulum.io/rooms/meetingroom/MeetingRoom.bundle.json", - "https://asset-bundles-prod.reticulum.io/rooms/theater/TheaterMeshes.bundle.json", - "https://asset-bundles-prod.reticulum.io/rooms/atrium/AtriumMeshes.bundle.json", - "https://asset-bundles-prod.reticulum.io/rooms/courtyard/CourtyardMeshes.bundle.json" + "https://asset-bundles-prod.reticulum.io/rooms/theater/Theater.bundle.json", + "https://asset-bundles-prod.reticulum.io/rooms/atrium/Atrium.bundle.json", + "https://asset-bundles-prod.reticulum.io/rooms/courtyard/Courtyard.bundle.json" ]; class HomeRoot extends Component { diff --git a/src/react-components/hub-create-panel.js b/src/react-components/hub-create-panel.js index 32fd19b4edfcb343b0cada0d4f0abf0052344d8e..8b172cbf527d9d2548e39ae9bc4c460c706178d5 100644 --- a/src/react-components/hub-create-panel.js +++ b/src/react-components/hub-create-panel.js @@ -38,14 +38,25 @@ class HubCreatePanel extends Component { hub: { name: this.state.name, default_environment_gltf_bundle_url: environment.bundle_url } }; - const res = await fetch("/api/v1/hubs", { + let createUrl = "/api/v1/hubs"; + + if (process.env.NODE_ENV === "development") { + createUrl = `https://${process.env.DEV_RETICULUM_SERVER}${createUrl}`; + } + + const res = await fetch(createUrl, { body: JSON.stringify(payload), headers: { "content-type": "application/json" }, method: "POST" }); const hub = await res.json(); - document.location = hub.url; + + if (process.env.NODE_ENV === "production") { + document.location = hub.url; + } else { + document.location = `/hub.html?hub_id=${hub.hub_id}`; + } }; isHubNameValid = () => { diff --git a/src/telemetry.js b/src/telemetry.js index 6eed4d002b96c507dcdaea78b6a5ab58f9791441..9fa4ae9ce79009d203fb4992cd6d643460633794 100644 --- a/src/telemetry.js +++ b/src/telemetry.js @@ -2,6 +2,6 @@ import Raven from "raven-js"; export default function registerTelemetry() { if (process.env.NODE_ENV === "production") { - Raven.config("https://f571beaf5cee4e3085e0bf436f3eb158@sentry.io/256771").install(); + Raven.config("https://013d6a364fed43cdb0539a61d520597a@sentry.prod.mozaws.net/370").install(); } } diff --git a/webpack.config.js b/webpack.config.js index ad98143b501e72b300362f7086a452485e92adec..3f5bf9001ac96086c8a3b43099b692b8566ce30d 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -87,7 +87,7 @@ const config = { mode: "development", devtool: process.env.NODE_ENV === "production" ? "source-map" : "inline-source-map", devServer: { - open: true, + open: false, https: createHTTPSConfig(), host: "0.0.0.0", useLocalIp: true, @@ -218,7 +218,8 @@ const config = { new webpack.DefinePlugin({ "process.env": JSON.stringify({ NODE_ENV: process.env.NODE_ENV, - JANUS_SERVER: process.env.JANUS_SERVER + JANUS_SERVER: process.env.JANUS_SERVER, + DEV_RETICULUM_SERVER: process.env.DEV_RETICULUM_SERVER }) }) ]