🐛 Fix: gallery db bug

This commit is contained in:
PiEgg
2021-08-01 14:50:25 +08:00
parent 6ddd660d89
commit f1eb7f4d70
18 changed files with 145 additions and 56 deletions

View File

@@ -32,7 +32,7 @@ export default {
const img = await uploader.setWebContents(trayWindow.webContents).upload()
if (img !== false) {
const pasteStyle = db.get('settings.pasteStyle') || 'markdown'
handleCopyUrl(pasteTemplate(pasteStyle, img[0]))
handleCopyUrl(pasteTemplate(pasteStyle, img[0], db.get('settings.customLink')))
const notification = new Notification({
title: '上传成功',
body: img[0].imgUrl!,

View File

@@ -28,7 +28,7 @@ import {
} from '#/events/constants'
import { GalleryDB } from 'apis/core/datastore'
import { IObject } from '@picgo/store/dist/types'
import { IObject, IFilter } from '@picgo/store/dist/types'
// eslint-disable-next-line
const requireFunc = typeof __webpack_require__ === 'function' ? __non_webpack_require__ : require
@@ -283,10 +283,10 @@ const handleImportLocalPlugin = () => {
}
const handlePicGoGalleryDB = () => {
ipcMain.on(PICGO_GET_DB, async (event: IpcMainEvent, callbackId: string) => {
ipcMain.on(PICGO_GET_DB, async (event: IpcMainEvent, filter: IFilter, callbackId: string) => {
const dbStore = GalleryDB.getInstance()
const res = await dbStore.get()
event.sender.send(PICGO_GET_CONFIG, res, callbackId)
const res = await dbStore.get(filter)
event.sender.send(PICGO_GET_DB, res, callbackId)
})
ipcMain.on(PICGO_INSERT_DB, async (event: IpcMainEvent, value: IObject, callbackId: string) => {