From 813c7206d8e181a5cf0a6905e9fea2a3fa1174e1 Mon Sep 17 00:00:00 2001 From: 3136352472 <3136352472> Date: Fri, 17 Apr 2020 17:02:43 +0800 Subject: [PATCH] update --- lib/tray.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) 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 () {