diff --git a/app/src/app.js b/app/src/app.js index dcd8859..e23c5f2 100755 --- a/app/src/app.js +++ b/app/src/app.js @@ -10,10 +10,10 @@ import dateFormat from 'date-fns/format' import Raven from 'raven-js'; import RavenVue from 'raven-js/plugins/vue'; -Raven - .config('REMOVED') - .addPlugin(RavenVue, Vue) - .install(); +// Raven +// .config('REMOVED') +// .addPlugin(RavenVue, Vue) +// .install(); const dateFormatPlugin = { install () { diff --git a/app/src/router/index.js b/app/src/router/index.js index 3983994..b7d8eef 100755 --- a/app/src/router/index.js +++ b/app/src/router/index.js @@ -95,7 +95,7 @@ export function createRouter () { path: 'vmix', component: SettingsVmixView, meta: { - navbarTitle: 'vMix', + navbarTitle: 'Connect to vMix', }, }, ] diff --git a/app/src/store/actions.js b/app/src/store/actions.js index 2f2e288..76d3174 100755 --- a/app/src/store/actions.js +++ b/app/src/store/actions.js @@ -9,6 +9,7 @@ import supportedLocales from '../data/locales' import RemoteEventBus from '../components/RemoteEventBus' import ChromelessWindowManager from '../components/ChromelessWindowManager' import get from 'lodash.get' +import vmixSetup from '../util/vmixSetup' export default { SET_LOCALE_FROM_USER_DEFAULT: ({ commit, dispatch, state }) => { @@ -72,6 +73,25 @@ export default { } }, + REFRESH_VMIX_SETUP_STATUS: ({commit, dispatch, state}) => { + let { + checkIfExtensionInstalled, + testWebControllerConnectivity, + } = vmixSetup; + + checkIfExtensionInstalled() + .then(function(installed) { + commit('SET_VMIX_CHROME_EXTENSION_INSTALLED', {installed}); + }); + testWebControllerConnectivity( + (state.integrations.vmix.webControllerAddress || '').trim().replace(/\/$/, "") + '/API' + ) + .then(function(connected) { + console.log("HElLO"); + console.log(connected); + commit('SET_VMIX_WEB_CONTROLLER_CONNECTED', {connected}); + }) + }, // ensure data for rendering given list type diff --git a/app/src/store/index.js b/app/src/store/index.js index 4c52ac8..9d99d9d 100755 --- a/app/src/store/index.js +++ b/app/src/store/index.js @@ -96,6 +96,13 @@ export function createStore () { socket: { isConnected: false, }, + integrations: { + vmix: { + chromeExtensionInstalled: null, + webControllerAddress: '', + webControllerConnected: null, + }, + }, }, actions, mutations, diff --git a/app/src/store/mutations.js b/app/src/store/mutations.js index 344965f..ce333ca 100755 --- a/app/src/store/mutations.js +++ b/app/src/store/mutations.js @@ -162,6 +162,18 @@ export default { }, + SET_VMIX_CHROME_EXTENSION_INSTALLED: (state, { installed }) => { + state.integrations.vmix.chromeExtensionInstalled = Boolean(installed); + }, + SET_VMIX_WEB_CONTROLLER_ADDRESS: (state, { webControllerAddress }) => { + state.integrations.vmix.webControllerAddress = webControllerAddress; + }, + SET_VMIX_WEB_CONTROLLER_CONNECTED: (state, { connected }) => { + state.integrations.vmix.webControllerConnected = Boolean(connected); + }, + RESET_WEB_CONTROLLER_CONNECTED_STATUS: (state) => { + state.integrations.vmix.webControllerConnected = null; + }, SET_ACTIVE_TYPE: (state, { type }) => { diff --git a/app/src/util/vmixSetup.js b/app/src/util/vmixSetup.js new file mode 100644 index 0000000..63a7b7f --- /dev/null +++ b/app/src/util/vmixSetup.js @@ -0,0 +1,30 @@ +const chromeExtensionId = 'fckappdcgnijafmmjkcmicdidflhelfe'; + +const checkIfExtensionInstalled = function () { + return new Promise(function(resolve, reject) { + chrome.runtime.sendMessage( + chromeExtensionId, + { + getExtensionVersion: true, + }, + function(version) { + resolve(Boolean(version)); + } + ); + }); +} + +const testWebControllerConnectivity = function (path) { + return new Promise(function(resolve, reject) { + chrome.runtime.sendMessage( + chromeExtensionId, + {path}, + function(response) { + resolve(response && response.success && response.code && response.code == 200); + // reject('Cannot connect to vMix. Make sure Web Controller is enabled in vMix and that you\'ve copied over the website address correctly.'); + } + ); + }) +}; + +export default {checkIfExtensionInstalled, testWebControllerConnectivity} \ No newline at end of file diff --git a/app/src/views/SettingsView.vue b/app/src/views/SettingsView.vue index ce8c7a1..26adc4d 100755 --- a/app/src/views/SettingsView.vue +++ b/app/src/views/SettingsView.vue @@ -132,14 +132,17 @@ export default { } - \ No newline at end of file diff --git a/app/src/views/settings/SettingsVmixView.vue b/app/src/views/settings/SettingsVmixView.vue index 1e4c7cb..d5a0d1e 100755 --- a/app/src/views/settings/SettingsVmixView.vue +++ b/app/src/views/settings/SettingsVmixView.vue @@ -1,80 +1,146 @@ + + +