diff --git a/frontend/src/components/immersive-editor/RemoteInstanceEditorWrapper.vue b/frontend/src/components/immersive-editor/RemoteInstanceEditorWrapper.vue
new file mode 100644
index 0000000000..3079d4604d
--- /dev/null
+++ b/frontend/src/components/immersive-editor/RemoteInstanceEditorWrapper.vue
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
diff --git a/frontend/src/pages/device/Editor/index.vue b/frontend/src/pages/device/Editor/index.vue
new file mode 100644
index 0000000000..9d798e6022
--- /dev/null
+++ b/frontend/src/pages/device/Editor/index.vue
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/frontend/src/pages/device/Editor/routes.js b/frontend/src/pages/device/Editor/routes.js
new file mode 100644
index 0000000000..0cfe6dd8ec
--- /dev/null
+++ b/frontend/src/pages/device/Editor/routes.js
@@ -0,0 +1,13 @@
+import DeviceEditor from './index.vue'
+
+export default [
+ {
+ path: '/device/:id/editor',
+ name: 'device-editor',
+ component: DeviceEditor,
+ meta: {
+ title: 'Device - Editor',
+ layout: 'plain'
+ }
+ }
+]
diff --git a/frontend/src/routes.js b/frontend/src/routes.js
index f150bcda9a..a710e20a0c 100644
--- a/frontend/src/routes.js
+++ b/frontend/src/routes.js
@@ -7,9 +7,10 @@ import PageNotFound from './pages/PageNotFound.vue'
import AccountRoutes from './pages/account/routes.js'
import AdminRoutes from './pages/admin/routes.js'
+import DeviceEditorRoutes from './pages/device/Editor/routes.js'
import DeviceRoutes from './pages/device/routes.js'
import HelpRoutes from './pages/help/routes.js'
-import EditorRoutes from './pages/instance/Editor/routes.js'
+import InstanceEditorRoutes from './pages/instance/Editor/routes.js'
import InstanceRoutes from './pages/instance/routes.js'
import TeamRoutes from './pages/team/routes.js'
@@ -30,7 +31,8 @@ const routes = [
...TeamRoutes,
...AdminRoutes,
...HelpRoutes,
- ...EditorRoutes,
+ ...InstanceEditorRoutes,
+ ...DeviceEditorRoutes,
{
name: 'page-not-found',
path: '/:pathMatch(.*)*',
diff --git a/frontend/src/store/modules/context/index.js b/frontend/src/store/modules/context/index.js
index 4fd17294c0..9551af5c45 100644
--- a/frontend/src/store/modules/context/index.js
+++ b/frontend/src/store/modules/context/index.js
@@ -1,6 +1,7 @@
const initialState = () => ({
route: null,
- instance: null
+ instance: null,
+ device: null
})
const meta = {
@@ -76,6 +77,7 @@ const mutations = {
state.route = route
},
SET_INSTANCE (state, instance) { state.instance = instance },
+ SET_DEVICE (state, device) { state.device = device },
CLEAR_INSTANCE (state) { state.instance = null }
}
@@ -84,6 +86,7 @@ const actions = {
commit('UPDATE_ROUTE', route)
},
setInstance ({ commit }, instance) { commit('SET_INSTANCE', instance) },
+ setDevice ({ commit }, device) { commit('SET_DEVICE', device) },
clearInstance ({ commit }) { commit('CLEAR_INSTANCE') }
}
diff --git a/frontend/src/store/modules/product/assistant/index.js b/frontend/src/store/modules/product/assistant/index.js
index 65df4244cf..d1a1471168 100644
--- a/frontend/src/store/modules/product/assistant/index.js
+++ b/frontend/src/store/modules/product/assistant/index.js
@@ -85,8 +85,26 @@ const getters = {
immersiveInstance: (state, getters, rootState) => {
return rootState.context.instance
},
+ immersiveDevice: (state, getters, rootState) => {
+ return rootState.context.device
+ },
hasUserSelection: (state) => {
return state.selectedNodes.length
+ },
+ allowedInboundOrigins: (state, getters) => {
+ const allowedOrigins = [window.origin]
+
+ if (getters.immersiveInstance?.url) {
+ allowedOrigins.push(getters.immersiveInstance.url)
+ }
+
+ if (getters.immersiveDevice?.editor?.url) {
+ // todo this might not be needed because it's just the path to the editor tunnel, not an actual origin
+ // and the only origin we might receive messages is the current window origin
+ allowedOrigins.push(getters.immersiveDevice.editor.url)
+ }
+
+ return allowedOrigins
}
}
@@ -131,10 +149,11 @@ const mutations = {
const actions = {
async handleMessage ({ commit, getters, dispatch }, payload) {
- if (payload.origin !== getters.immersiveInstance.url) {
+ if (!getters.allowedInboundOrigins.includes(payload.origin)) {
console.warn('Received message from unknown origin. Ignoring.')
return
}
+
switch (true) {
case payload.data.type === 'assistant-ready':
commit('SET_VERSION', payload.data.version)