diff --git a/src/main/store/index.js b/src/main/store/index.js index 31dd60075..3b3f70565 100644 --- a/src/main/store/index.js +++ b/src/main/store/index.js @@ -1,6 +1,7 @@ /* eslint-disable guard-for-in */ import { app, ipcMain, shell } from 'electron'; import { join } from 'path'; +import { platform } from 'os'; import Vue from 'vue'; import Vuex from 'vuex'; import modules from './modules'; @@ -45,6 +46,7 @@ async function load() { const mod = { state: { root, + platform: platform(), online: false, }, plugins, @@ -53,6 +55,7 @@ async function load() { path: state => (...paths) => join(state.root, ...paths), }, mutations: { + platform(state, p) { state.platform = p; }, online(state, o) { state.online = o; }, root(state, r) { state.root = r; }, }, @@ -99,6 +102,7 @@ async function load() { console.log(`Successfully init modules. Total Time is ${Date.now() - startingTime}ms.`); newStore.commit('root', root); + newStore.commit('platform', platform()); console.log('Done loading store!'); diff --git a/src/universal/store/index.js b/src/universal/store/index.js index 4dd2c976d..c5c02548b 100644 --- a/src/universal/store/index.js +++ b/src/universal/store/index.js @@ -10,11 +10,13 @@ export default { state: { root: '', online: false, + platform: '', }, modules, mutations: { online(state, o) { state.online = o; }, root(state, r) { state.root = r; }, + platform(state, p) { state.platform = p; }, }, getters: { }, diff --git a/src/universal/store/store.d.ts b/src/universal/store/store.d.ts index 0341300a0..c5fe36ba6 100644 --- a/src/universal/store/store.d.ts +++ b/src/universal/store/store.d.ts @@ -33,9 +33,14 @@ interface BaseState { * launcher root data folder path */ root: string + online: boolean + platform: NodeJS.Platform } interface BaseMutations { root(state: State, root: string): void + online(state: State, online: boolean): void + platform(state: State, platform: NodeJS.Platform): void + } type Mutations = VersionModule.Mutations &