mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-08 21:38:13 -05:00
Fixed: #166 & add showNotification for guiApi
This commit is contained in:
parent
8704e212bf
commit
0abdb3cf00
@ -82,6 +82,24 @@ class GuiApi {
|
|||||||
}
|
}
|
||||||
return []
|
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
|
export default GuiApi
|
||||||
|
@ -49,13 +49,19 @@ const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
|
|||||||
if (plugin.guiMenu) {
|
if (plugin.guiMenu) {
|
||||||
menu = plugin.guiMenu(picgo)
|
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 = {
|
const obj = {
|
||||||
name: pluginList[i].replace(/picgo-plugin-/, ''),
|
name: pluginList[i].replace(/picgo-plugin-/, ''),
|
||||||
author: pluginPKG.author.name || pluginPKG.author,
|
author: pluginPKG.author.name || pluginPKG.author,
|
||||||
description: pluginPKG.description,
|
description: pluginPKG.description,
|
||||||
logo: 'file://' + path.join(pluginPath, 'logo.png').split(path.sep).join('/'),
|
logo: 'file://' + path.join(pluginPath, 'logo.png').split(path.sep).join('/'),
|
||||||
version: pluginPKG.version,
|
version: pluginPKG.version,
|
||||||
gui: pluginPKG.gui || false,
|
gui,
|
||||||
config: {
|
config: {
|
||||||
plugin: {
|
plugin: {
|
||||||
name: pluginList[i].replace(/picgo-plugin-/, ''),
|
name: pluginList[i].replace(/picgo-plugin-/, ''),
|
||||||
@ -70,7 +76,7 @@ const handleGetPluginList = (ipcMain, STORE_PATH, CONFIG_PATH) => {
|
|||||||
config: handleConfigWithFunction(getConfig(uploaderName, 'transformer', picgo))
|
config: handleConfigWithFunction(getConfig(uploaderName, 'transformer', picgo))
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
enabled: picgo.getConfig(`plugins.${pluginList[i]}`),
|
enabled: picgo.getConfig(`picgoPlugins.${pluginList[i]}`),
|
||||||
homepage: pluginPKG.homepage ? pluginPKG.homepage : '',
|
homepage: pluginPKG.homepage ? pluginPKG.homepage : '',
|
||||||
guiMenu: menu,
|
guiMenu: menu,
|
||||||
ing: false
|
ing: false
|
||||||
|
@ -219,7 +219,7 @@ export default {
|
|||||||
label: '启用插件',
|
label: '启用插件',
|
||||||
enabled: !plugin.enabled,
|
enabled: !plugin.enabled,
|
||||||
click () {
|
click () {
|
||||||
_this.$db.read().set(`plugins.picgo-plugin-${plugin.name}`, true).write()
|
_this.$db.read().set(`picgoPlugins.picgo-plugin-${plugin.name}`, true).write()
|
||||||
plugin.enabled = true
|
plugin.enabled = true
|
||||||
_this.getPicBeds()
|
_this.getPicBeds()
|
||||||
}
|
}
|
||||||
@ -227,7 +227,7 @@ export default {
|
|||||||
label: '禁用插件',
|
label: '禁用插件',
|
||||||
enabled: plugin.enabled,
|
enabled: plugin.enabled,
|
||||||
click () {
|
click () {
|
||||||
_this.$db.read().set(`plugins.picgo-plugin-${plugin.name}`, false).write()
|
_this.$db.read().set(`picgoPlugins.picgo-plugin-${plugin.name}`, false).write()
|
||||||
plugin.enabled = false
|
plugin.enabled = false
|
||||||
_this.getPicBeds()
|
_this.getPicBeds()
|
||||||
if (plugin.config.transformer.name) {
|
if (plugin.config.transformer.name) {
|
||||||
@ -398,6 +398,12 @@ export default {
|
|||||||
},
|
},
|
||||||
handleSearchResult (item) {
|
handleSearchResult (item) {
|
||||||
const name = item.package.name.replace(/picgo-plugin-/, '')
|
const name = item.package.name.replace(/picgo-plugin-/, '')
|
||||||
|
let gui = false
|
||||||
|
if (item.package.keywords && item.package.keywords.length > 0) {
|
||||||
|
if (item.package.keywords.includes('picgo-gui-plugin')) {
|
||||||
|
gui = true
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
name: name,
|
name: name,
|
||||||
author: item.package.author.name,
|
author: item.package.author.name,
|
||||||
@ -407,7 +413,7 @@ export default {
|
|||||||
homepage: item.package.links ? item.package.links.homepage : '',
|
homepage: item.package.links ? item.package.links.homepage : '',
|
||||||
hasInstall: this.pluginNameList.some(plugin => plugin === item.package.name.replace(/picgo-plugin-/, '')),
|
hasInstall: this.pluginNameList.some(plugin => plugin === item.package.name.replace(/picgo-plugin-/, '')),
|
||||||
version: item.package.version,
|
version: item.package.version,
|
||||||
gui: item.package.gui || false,
|
gui,
|
||||||
ing: false // installing or uninstalling
|
ing: false // installing or uninstalling
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user