mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-20 07:39:53 +08:00
Fixed: #166 & add showNotification for guiApi
This commit is contained in:
@@ -82,6 +82,24 @@ class GuiApi {
|
||||
}
|
||||
return []
|
||||
}
|
||||
|
||||
/**
|
||||
* For notification
|
||||
* @param {Object} options
|
||||
*/
|
||||
showNotification (options) {
|
||||
if (options === undefined) {
|
||||
options = {
|
||||
title: '',
|
||||
body: ''
|
||||
}
|
||||
}
|
||||
const notification = new Notification({
|
||||
title: options.title,
|
||||
body: options.body
|
||||
})
|
||||
notification.show()
|
||||
}
|
||||
}
|
||||
|
||||
export default GuiApi
|
||||
|
||||
@@ -49,13 +49,19 @@ const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
|
||||
if (plugin.guiMenu) {
|
||||
menu = plugin.guiMenu(picgo)
|
||||
}
|
||||
let gui = false
|
||||
if (pluginPKG.keywords && pluginPKG.keywords.length > 0) {
|
||||
if (pluginPKG.keywords.includes('picgo-gui-plugin')) {
|
||||
gui = true
|
||||
}
|
||||
}
|
||||
const obj = {
|
||||
name: pluginList[i].replace(/picgo-plugin-/, ''),
|
||||
author: pluginPKG.author.name || pluginPKG.author,
|
||||
description: pluginPKG.description,
|
||||
logo: 'file://' + path.join(pluginPath, 'logo.png').split(path.sep).join('/'),
|
||||
version: pluginPKG.version,
|
||||
gui: pluginPKG.gui || false,
|
||||
gui,
|
||||
config: {
|
||||
plugin: {
|
||||
name: pluginList[i].replace(/picgo-plugin-/, ''),
|
||||
@@ -70,7 +76,7 @@ const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
|
||||
config: handleConfigWithFunction(getConfig(uploaderName, 'transformer', picgo))
|
||||
}
|
||||
},
|
||||
enabled: picgo.getConfig(`plugins.${pluginList[i]}`),
|
||||
enabled: picgo.getConfig(`picgoPlugins.${pluginList[i]}`),
|
||||
homepage: pluginPKG.homepage ? pluginPKG.homepage : '',
|
||||
guiMenu: menu,
|
||||
ing: false
|
||||
|
||||
Reference in New Issue
Block a user