🐛 Fix: bug of gallery db for plugin

This commit is contained in:
PiEgg
2021-08-01 15:44:59 +08:00
parent f1eb7f4d70
commit 96a63ea11a
5 changed files with 26 additions and 19 deletions

View File

@@ -150,20 +150,24 @@ class GuiApi implements IGuiApi {
return new Proxy<DBStore>(GalleryDB.getInstance(), {
get (target, prop: keyof DBStore) {
if (prop === 'removeById') {
return new Promise((resolve) => {
const guiApi = GuiApi.getInstance()
guiApi.showMessageBox({
title: '警告',
message: '有插件正在试图删除一些相册文件,是否继续',
type: 'info',
buttons: ['Yes', 'No']
}).then(res => {
if (res.result === 0) {
resolve(Reflect.get(target, prop))
} else {
resolve(() => {})
}
})
return new Proxy(GalleryDB.getInstance().removeById, {
apply (target, ctx, args) {
return new Promise((resolve) => {
const guiApi = GuiApi.getInstance()
guiApi.showMessageBox({
title: '警告',
message: '有插件正在试图删除一些相册图片,是否继续',
type: 'info',
buttons: ['Yes', 'No']
}).then(res => {
if (res.result === 0) {
resolve(Reflect.apply(target, ctx, args))
} else {
resolve(undefined)
}
})
})
}
})
}
return Reflect.get(target, prop)

View File

@@ -155,9 +155,13 @@ export default class extends Vue {
picBed: IPicBedType[] = []
@Watch('$route')
handleRouteUpdate (to: any, from: any) {
console.log(to, from)
if (from.name === 'gallery') {
this.clearChoosedList()
}
if (to.name === 'gallery') {
this.updateGallery()
}
}
async created () {
ipcRenderer.on('updateGallery', (event: IpcRendererEvent) => {

View File

@@ -268,7 +268,8 @@ export default class extends Vue {
_this.configName = plugin.config[i].fullName || plugin.config[i].name
_this.dialogVisible = true
_this.config = plugin.config[i].config
}
},
enabled: plugin.enabled
}
menu.push(obj)
}
@@ -477,9 +478,6 @@ export default class extends Vue {
goAwesomeList () {
remote.shell.openExternal('https://github.com/PicGo/Awesome-PicGo')
}
saveConfig (data: IObj) {
ipcRenderer.send('picgoSaveData', data)
}
handleImportLocalPlugin () {
ipcRenderer.send('importLocalPlugin')
this.loading = true

View File

@@ -11,6 +11,7 @@ export default class extends Vue {
[config]: value
}
}
console.log(PICGO_SAVE_CONFIG, config, value)
ipcRenderer.send(PICGO_SAVE_CONFIG, config)
}
getConfig<T> (key?: string): Promise<T | undefined> {