diff --git a/main.js b/main.js index 5df7dd8..5e0ed06 100644 --- a/main.js +++ b/main.js @@ -1,6 +1,6 @@ const path = require('path') const { Monitor, CHANGED_TYPES } = require('./monitor') -const { app, Menu, Notification, Tray, nativeImage, BrowserWindow, ipcMain } = require('electron') +const { app, Menu, Notification, Tray, nativeImage, BrowserWindow, ipcMain, shell } = require('electron') const { isDev, getIpcStoreKey } = require('./tool') const { store, STORE_KEY } = require('./store') const logger = require('electron-log') @@ -157,7 +157,7 @@ function initMenuBar () { }) } }, - { label: 'Help', role: 'help' }, + { label: 'Help', role: 'help', click: () => shell.openExternal('https://github.com/reply2future/dmonitor/issues') }, { type: 'separator' }, { label: 'Quit', role: 'quit' } ] @@ -179,6 +179,7 @@ function initListeners () { app.whenReady() .then(() => { logger.info('It\'s time to initialize') + store.set(STORE_KEY.appInfo, `${app.getName()}:${app.getVersion()}`) }) .then(initListeners) .then(initMenuBar) diff --git a/preference.html b/preference.html index 6295b45..f458ef0 100644 --- a/preference.html +++ b/preference.html @@ -17,6 +17,11 @@ + + diff --git a/preload.js b/preload.js index 2627daa..8da3bbd 100644 --- a/preload.js +++ b/preload.js @@ -11,5 +11,6 @@ contextBridge.exposeInMainWorld('api', { setStore: (key, value) => { store.set(key, value) ipcRenderer.send(getIpcStoreKey(key), value) - } + }, + getAppInfo: () => store.get(STORE_KEY.appInfo) }) diff --git a/renderer.js b/renderer.js index cb2a7b7..f04b044 100644 --- a/renderer.js +++ b/renderer.js @@ -14,3 +14,6 @@ autoLaunch.addEventListener('change', (event) => { }) autoLaunch.checked = window.api.getStore(window.api.STORE_KEY.autoLaunch, false) + +const info = document.querySelector('#info') +info.innerHTML = window.api.getAppInfo() diff --git a/store.js b/store.js index a0aad4f..3126d65 100644 --- a/store.js +++ b/store.js @@ -3,7 +3,8 @@ const store = new Store() const STORE_KEY = { silentTimeHr: 'silentTimeHr', - autoLaunch: 'autoLaunch' + autoLaunch: 'autoLaunch', + appInfo: 'appInfo' } module.exports = { store, STORE_KEY }