diff --git a/package.json b/package.json index 103c6344..473e9288 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "lowdb": "^1.0.0", "md5": "^2.2.1", "melody.css": "^1.0.2", - "picgo": "^1.1.12", + "picgo": "^1.1.13", "qiniu": "^7.1.1", "request": "^2.83.0", "request-promise": "^4.2.2", diff --git a/src/main/utils/picgoCoreIPC.js b/src/main/utils/picgoCoreIPC.js index c6b1037f..841a3bbe 100644 --- a/src/main/utils/picgoCoreIPC.js +++ b/src/main/utils/picgoCoreIPC.js @@ -82,7 +82,7 @@ const handlePluginInstall = (ipcMain, STORE_PATH, CONFIG_PATH) => { picgo.on('installSuccess', notice => { event.sender.send('installSuccess', notice.body[0].replace(/picgo-plugin-/, '')) }) - pluginHandler.install([`picgo-plugin-${msg}`]) + pluginHandler.install([msg]) picgo.cmd.program.removeAllListeners() }) } @@ -94,7 +94,19 @@ const handlePluginUninstall = (ipcMain, STORE_PATH, CONFIG_PATH) => { picgo.on('uninstallSuccess', notice => { event.sender.send('uninstallSuccess', notice.body[0].replace(/picgo-plugin-/, '')) }) - pluginHandler.uninstall([`picgo-plugin-${msg}`]) + pluginHandler.uninstall([msg]) + picgo.cmd.program.removeAllListeners() + }) +} + +const handlePluginUpdate = (ipcMain, STORE_PATH, CONFIG_PATH) => { + ipcMain.on('updatePlugin', (event, msg) => { + const picgo = new PicGo(CONFIG_PATH) + const pluginHandler = new PluginHandler(picgo) + picgo.on('updateSuccess', notice => { + event.sender.send('updateSuccess', notice.body[0].replace(/picgo-plugin-/, '')) + }) + pluginHandler.update([msg]) picgo.cmd.program.removeAllListeners() }) } @@ -105,4 +117,5 @@ export default (app, ipcMain) => { handleGetPluginList(ipcMain, STORE_PATH, CONFIG_PATH) handlePluginInstall(ipcMain, STORE_PATH, CONFIG_PATH) handlePluginUninstall(ipcMain, STORE_PATH, CONFIG_PATH) + handlePluginUpdate(ipcMain, STORE_PATH, CONFIG_PATH) } diff --git a/src/renderer/pages/PicGoSetting.vue b/src/renderer/pages/PicGoSetting.vue index 968545fa..ef10a65b 100644 --- a/src/renderer/pages/PicGoSetting.vue +++ b/src/renderer/pages/PicGoSetting.vue @@ -26,6 +26,11 @@ > 点击设置 + + 点击设置 + @@ -163,6 +168,33 @@ 确定 + + + + + + + + 取消 + 确定 + + - 取消 - 确定 + 取消 + 确定 @@ -223,12 +255,14 @@ export default { keyBindingVisible: false, customLinkVisible: false, checkUpdateVisible: false, + proxyVisible: false, customLink: { value: this.$db.read().get('settings.customLink').value() || '$url' }, shortKey: { upload: this.$db.read().get('settings.shortKey.upload').value() }, + proxy: this.$db.read().get('picBed.proxy').value() || undefined, rules: { value: [ { validator: customLinkRule, trigger: 'blur' } @@ -280,6 +314,20 @@ export default { } }) }, + cancelProxy () { + this.proxyVisible = false + this.proxy = this.$db.read().get('picBed.proxy').value() || undefined + }, + confirmProxy () { + this.proxyVisible = false + this.$db.read().set('picBed.proxy', this.proxy).write() + const successNotification = new window.Notification('设置代理', { + body: '设置成功' + }) + successNotification.onclick = () => { + return true + } + }, updateHelperChange (val) { this.$db.read().set('settings.showUpdateTip', val).write() }, diff --git a/src/renderer/pages/Plugin.vue b/src/renderer/pages/Plugin.vue index 546bd21f..e89df999 100644 --- a/src/renderer/pages/Plugin.vue +++ b/src/renderer/pages/Plugin.vue @@ -48,7 +48,7 @@