diff --git a/lib/tray.js b/lib/tray.js index 67e7d91..280e17d 100644 --- a/lib/tray.js +++ b/lib/tray.js @@ -178,6 +178,26 @@ ipcMain.on('put-in-tray', (event) => { mainwin.MainWindow.reload() } }, { + label: "检查更新", + click: function () { + let git_url = "https://git.ouxuan.net/3136352472/ouxuan.oa.git"; + + let workingDirPath = path.join(__dirname, "../"); + const simpleGit = require('simple-git')(workingDirPath); + simpleGit.checkIsRepo(function (err, ok) { + if (ok) { + simpleGit.pull(function (r, d) { + if (d.files.length > 0) { + app.quit() + app.relaunch(); + } + }) + } else { + dialog.showErrorBox(`更新时发生错误`, workingDirPath, err); + } + }); + } + }, { label: "退出", click: function () {