Partly finished: plugin system

This commit is contained in:
Molunerfinn
2018-12-24 16:05:30 +08:00
parent ae9d8eee13
commit f7dc41a927
11 changed files with 122 additions and 59 deletions

View File

@@ -18,6 +18,7 @@ const getPicBeds = (app) => {
visible: visible ? visible.visible : true
}
})
picgo.cmd.program.removeAllListeners()
return picBeds
}

View File

@@ -114,9 +114,14 @@ const handlePluginUpdate = (ipcMain, CONFIG_PATH) => {
const handleGetPicBedConfig = (ipcMain, CONFIG_PATH) => {
ipcMain.on('getPicBedConfig', (event, type) => {
const picgo = new PicGo(CONFIG_PATH)
const config = handleConfigWithFunction(picgo.helper.uploader.get(type).config(picgo))
const name = picgo.helper.uploader.get(type).name || type
event.sender.send('getPicBedConfig', config, name)
if (picgo.helper.uploader.get(type).config) {
const config = handleConfigWithFunction(picgo.helper.uploader.get(type).config(picgo))
event.sender.send('getPicBedConfig', config, name)
} else {
event.sender.send('getPicBedConfig', [], name)
}
picgo.cmd.program.removeAllListeners()
})
}