mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-08-07 22:44:10 +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 () => {
|
handler: async () => {
|
||||||
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)!
|
const trayWindow = windowManager.get(IWindowList.TRAY_WINDOW)!
|
||||||
// macOS use builtin clipboard is OK
|
// 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) {
|
if (img !== false) {
|
||||||
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
||||||
const [pasteText, shortUrl] = await pasteTemplate(pasteStyle, img[0], db.get(configPaths.settings.customLink))
|
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)) {
|
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
|
||||||
windowManager.get(IWindowList.SETTING_WINDOW)!.webContents.send('updateGallery')
|
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')
|
trayWindow.webContents.send('uploadFiles')
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -237,8 +237,9 @@ class UploadTaskQueueManager {
|
|||||||
const input = [task.filePath]
|
const input = [task.filePath]
|
||||||
const rawInput = cloneDeep(input)
|
const rawInput = cloneDeep(input)
|
||||||
|
|
||||||
let imgs: ImgInfo[] | false = false
|
const res = await uploader.setWebContents(webContents).uploadReturnCtx(input)
|
||||||
imgs = await uploader.setWebContents(webContents).upload(input)
|
const imgs = res[0] ? res[0] : false
|
||||||
|
const backupImgs = res[1] ? res[1] : false
|
||||||
|
|
||||||
if (imgs !== false && imgs.length > 0) {
|
if (imgs !== false && imgs.length > 0) {
|
||||||
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
const pasteStyle = db.get(configPaths.settings.pasteStyle) || IPasteStyle.MARKDOWN
|
||||||
@@ -267,6 +268,13 @@ class UploadTaskQueueManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleCopyUrl(pasteText)
|
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 {
|
return {
|
||||||
url: handleUrlEncodeWithSetting(inserted.imgUrl!),
|
url: handleUrlEncodeWithSetting(inserted.imgUrl!),
|
||||||
|
|||||||
@@ -221,7 +221,7 @@
|
|||||||
|
|
||||||
<!-- Task Queue Manager Modal -->
|
<!-- Task Queue Manager Modal -->
|
||||||
<transition name="modal">
|
<transition name="modal">
|
||||||
<div v-if="taskDialogVisible" class="modal-overlay" @click="taskDialogVisible = false">
|
<div v-if="taskDialogVisible" class="modal-overlay">
|
||||||
<div class="modal-container task-queue-modal" @click.stop>
|
<div class="modal-container task-queue-modal" @click.stop>
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
<div class="modal-header-text">
|
<div class="modal-header-text">
|
||||||
@@ -349,9 +349,9 @@
|
|||||||
<input
|
<input
|
||||||
v-model.number="uploadInterval"
|
v-model.number="uploadInterval"
|
||||||
type="number"
|
type="number"
|
||||||
min="0.1"
|
min="1"
|
||||||
max="99999"
|
max="99999"
|
||||||
step="0.1"
|
step="1"
|
||||||
class="setting-input"
|
class="setting-input"
|
||||||
:disabled="taskQueueStatus.config.isRunning"
|
:disabled="taskQueueStatus.config.isRunning"
|
||||||
@change="updateInterval"
|
@change="updateInterval"
|
||||||
@@ -1132,7 +1132,6 @@ async function clearFinishedTasks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function updateInterval() {
|
async function updateInterval() {
|
||||||
uploadInterval.value = Math.max(100, Math.min(60000, uploadInterval.value))
|
|
||||||
await window.electron.triggerRPC(IRPCActionType.UPLOAD_TASK_SET_INTERVAL, uploadInterval.value)
|
await window.electron.triggerRPC(IRPCActionType.UPLOAD_TASK_SET_INTERVAL, uploadInterval.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user