diff --git a/src/index.ejs b/src/index.ejs index fe6dc257..d544ce03 100644 --- a/src/index.ejs +++ b/src/index.ejs @@ -6,7 +6,7 @@ <% if (htmlWebpackPlugin.options.nodeModules) { %> <% } %> @@ -14,7 +14,7 @@
diff --git a/src/main/preload.js b/src/main/preload.js index 0b913b3c..f03fb36b 100644 --- a/src/main/preload.js +++ b/src/main/preload.js @@ -1,5 +1,11 @@ const electron = require('electron') +const path = require('path') +const mod = require('module') global.ipcRenderer = electron.ipcRenderer global.shell = electron.shell global.clipboard = electron.clipboard -global.process = process +global.node_env = process.env.NODE_ENV +global.platform = process.platform +global.path = path +global.mod = mod +global.static_path = path.join(__dirname, '/static').replace(/\\/g, '\\\\') diff --git a/src/renderer/router/index.ts b/src/renderer/router/index.ts index b0e66b8a..ac82a23d 100644 --- a/src/renderer/router/index.ts +++ b/src/renderer/router/index.ts @@ -9,6 +9,7 @@ import PreferencesAppearance from '@/components/Preferences/Appearance.vue' import PreferencesNotification from '@/components/Preferences/Notification.vue' import PreferencesAccount from '@/components/Preferences/Account.vue' import PreferencesLanguage from '@/components/Preferences/Language.vue' +import PreferencesNetwork from '@/components/Preferences/Network.vue' import GlobalHeader from '@/components/GlobalHeader.vue' import Settings from '@/components/Settings.vue' import SettingsGeneral from '@/components/Settings/General.vue' @@ -28,6 +29,7 @@ import TimelineSpaceContentsDirectMessages from '@/components/TimelineSpace/Cont import TimelineSpaceContentsListsIndex from '@/components/TimelineSpace/Contents/Lists/Index.vue' import TimelineSpaceContentsListsEdit from '@/components/TimelineSpace/Contents/Lists/Edit.vue' import TimelineSpaceContentsListsShow from '@/components/TimelineSpace/Contents/Lists/Show.vue' +import TimelineSpaceContentsFollowRequests from '@/components/TimelineSpace/Contents/FollowRequests.vue' Vue.use(Router) @@ -72,7 +74,7 @@ const router = new Router({ { path: 'network', name: 'network', - component: require('@/components/Preferences/Network').default + component: PreferencesNetwork }, { path: 'language', @@ -123,7 +125,7 @@ const router = new Router({ { path: 'follow-requests', name: 'follow-requests', - component: require('@/components/TimelineSpace/Contents/FollowRequests').default + component: TimelineSpaceContentsFollowRequests }, { path: 'favourites', diff --git a/src/renderer/store/Preferences/General.ts b/src/renderer/store/Preferences/General.ts index 26d7ce66..398bcbb1 100644 --- a/src/renderer/store/Preferences/General.ts +++ b/src/renderer/store/Preferences/General.ts @@ -4,6 +4,9 @@ import { RootState } from '@/store' import { Sound } from '~/src/types/sound' import { Timeline } from '~/src/types/timeline' import { BaseConfig, General, Other } from '~/src/types/preference' +import { MyWindow } from '~/src/types/global' + +const win = window as MyWindow export type GeneralState = { general: General @@ -141,7 +144,7 @@ const actions: ActionTree = { const getters: GetterTree = { notDarwin: () => { - return process.platform !== 'darwin' + return win.platform !== 'darwin' } } diff --git a/src/renderer/store/index.ts b/src/renderer/store/index.ts index 49365d6c..1ffe5382 100644 --- a/src/renderer/store/index.ts +++ b/src/renderer/store/index.ts @@ -30,8 +30,8 @@ export interface RootState { } export default new Vuex.Store({ - strict: win.process.env.NODE_ENV !== 'production', - plugins: win.process.env.NODE_ENV !== 'production' ? [createLogger({})] : [], + strict: win.node_env !== 'production', + plugins: win.node_env !== 'production' ? [createLogger({})] : [], modules: { App, GlobalHeader, diff --git a/src/types/global.ts b/src/types/global.ts index c20a705c..375a8b99 100644 --- a/src/types/global.ts +++ b/src/types/global.ts @@ -4,5 +4,7 @@ export interface MyWindow extends Window { shell: Shell ipcRenderer: IpcRenderer clipboard: Clipboard - process: NodeJS.Process + node_env: string + platform: string + static_path: string }