mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-05-11 18:10:32 +08:00
🐛 Fix(custom): fix an issue task interval can't set to lower than 100s and secondary upoload not take effect
This commit is contained in:
@@ -31,7 +31,9 @@ const trayRoutes = [
|
||||
handler: async () => {
|
||||
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)!
|
||||
// macOS use builtin clipboard is OK
|
||||
const img = await uploader.setWebContents(trayWindow.webContents).uploadWithBuildInClipboard()
|
||||
const res = await uploader.setWebContents(trayWindow.webContents).uploadWithBuildInClipboardReturnCtx()
|
||||
const img = res[0] ? res[0] : false
|
||||
const backupImgs = res[1] ? res[1] : false
|
||||
if (img !== false) {
|
||||
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
||||
const [pasteText, shortUrl] = await pasteTemplate(pasteStyle, img[0], db.get(configPaths.settings.customLink))
|
||||
@@ -55,6 +57,13 @@ const trayRoutes = [
|
||||
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents.send('updateGallery')
|
||||
}
|
||||
if (backupImgs && backupImgs.length > 0) {
|
||||
await GalleryDB.getInstance().insert(backupImgs[0])
|
||||
trayWindow.webContents.send('uploadFiles')
|
||||
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents?.send('updateGallery')
|
||||
}
|
||||
}
|
||||
}
|
||||
trayWindow.webContents.send('uploadFiles')
|
||||
},
|
||||
|
||||
@@ -237,8 +237,9 @@ class UploadTaskQueueManager {
|
||||
const input = [task.filePath]
|
||||
const rawInput = cloneDeep(input)
|
||||
|
||||
let imgs: ImgInfo[] | false = false
|
||||
imgs = await uploader.setWebContents(webContents).upload(input)
|
||||
const res = await uploader.setWebContents(webContents).uploadReturnCtx(input)
|
||||
const imgs = res[0] ? res[0] : false
|
||||
const backupImgs = res[1] ? res[1] : false
|
||||
|
||||
if (imgs !== false && imgs.length > 0) {
|
||||
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
||||
@@ -267,6 +268,13 @@ class UploadTaskQueueManager {
|
||||
}
|
||||
|
||||
handleCopyUrl(pasteText)
|
||||
if (backupImgs && backupImgs.length > 0) {
|
||||
await GalleryDB.getInstance().insert(backupImgs[0])
|
||||
windowManager.get(IWindowList.TRAY_WINDOW)?.webContents?.send('uploadFiles')
|
||||
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents?.send('updateGallery')
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
url: handleUrlEncodeWithSetting(inserted.imgUrl!),
|
||||
|
||||
Reference in New Issue
Block a user