-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
executable file
·41 lines (37 loc) · 1.14 KB
/
main.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import Vue from 'vue'
import Preference from './Preference.vue'
import store from '../../store'
import electron from 'electron'
const webFrame = electron.webFrame
const mainBroswerWindow = electron.remote.BrowserWindow.fromId(1)
const mainDb = mainBroswerWindow.mainDb
const session = electron.remote.session.defaultSession
const autoLaunch = electron.remote.require('./native/autoLaunch')
webFrame.setZoomFactor(1)
webFrame.setVisualZoomLevelLimits(1, 1)
webFrame.setLayoutZoomLevelLimits(0, 0)
async function getConfig() {
const proxyConfig = await mainDb.getProxyConfig()
const serverConfig = await mainDb.getServerConfig()
const cacheSize = await session.getCacheSize()
const downloadConfig = await mainDb.getDownloadConfig()
const hotkeyConfig = await mainDb.getHotKeyConfig()
const isAutoLaunch = autoLaunch.isEnabled()
return {
proxyConfig,
serverConfig,
cacheSize,
downloadConfig,
hotkeyConfig,
isAutoLaunch,
}
}
async function render () {
const res = await getConfig()
await store.commit('SAVR_CON',res)
new Vue({
store,
render: h => h(Preference)
}).$mount('#preference')
}
render()