mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08:13 -05:00
🔨 Refactor: simplify some functions
This commit is contained in:
parent
f8a886cefc
commit
ca162a4c4c
@ -1,7 +1,7 @@
|
|||||||
import db from '~/main/apis/core/datastore'
|
import db from '~/main/apis/core/datastore'
|
||||||
import { autoUpdater } from 'electron-updater'
|
import { autoUpdater } from 'electron-updater'
|
||||||
|
|
||||||
const checkVersion = async () => {
|
const updateChecker = async () => {
|
||||||
let showTip = db.get('settings.showUpdateTip')
|
let showTip = db.get('settings.showUpdateTip')
|
||||||
if (showTip === undefined) {
|
if (showTip === undefined) {
|
||||||
db.set('settings.showUpdateTip', true)
|
db.set('settings.showUpdateTip', true)
|
||||||
@ -10,12 +10,8 @@ const checkVersion = async () => {
|
|||||||
if (showTip) {
|
if (showTip) {
|
||||||
try {
|
try {
|
||||||
await autoUpdater.checkForUpdatesAndNotify()
|
await autoUpdater.checkForUpdatesAndNotify()
|
||||||
} catch (err) {
|
} catch (err) {}
|
||||||
return false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default checkVersion
|
export default updateChecker
|
||||||
|
@ -2736,32 +2736,20 @@ function handleBatchCopyInfo () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function handleBatchCopyLink (type: string) {
|
async function handleBatchCopyLink (type: string) {
|
||||||
if (selectedItems.length === 0) {
|
if (!selectedItems.length) {
|
||||||
ElMessage.warning($T('MANAGE_BUCKET_BATCH_COPY_URL_ERROR_MSG'))
|
ElMessage.warning($T('MANAGE_BUCKET_BATCH_COPY_URL_ERROR_MSG'))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const result = [] as string[]
|
const result = [] as string[]
|
||||||
for (let i = 0; i < selectedItems.length; i++) {
|
for (const item of selectedItems) {
|
||||||
const item = selectedItems[i]
|
|
||||||
if (!item.isDir) {
|
if (!item.isDir) {
|
||||||
if (type !== 'preSignedUrl') {
|
const preSignedUrl = type === 'preSignedUrl' ? await getPreSignedUrl(item) : null
|
||||||
result.push(await formatLink(item.url, item.fileName, type, manageStore.config.settings.customPasteFormat))
|
const url = await formatLink(preSignedUrl || item.url, item.fileName, type, manageStore.config.settings.customPasteFormat)
|
||||||
} else {
|
result.push(url)
|
||||||
getPreSignedUrl(item).then(async (url: string) => {
|
}
|
||||||
result.push(await formatLink(url, item.fileName, type, manageStore.config.settings.customPasteFormat))
|
}
|
||||||
}).then(() => {
|
|
||||||
if (result.length === selectedItems.length) {
|
|
||||||
clipboard.writeText(result.join('\n'))
|
clipboard.writeText(result.join('\n'))
|
||||||
ElMessage.success(`${$T('MANAGE_BUCKET_BATCH_COPY_URL_MSG_A')} ${result.length} ${$T('MANAGE_BUCKET_BATCH_COPY_URL_MSG_B')}`)
|
ElMessage.success(`${$T('MANAGE_BUCKET_BATCH_COPY_URL_MSG_A')} ${result.length} ${$T('MANAGE_BUCKET_BATCH_COPY_URL_MSG_B')}`)
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (type !== 'preSignedUrl') {
|
|
||||||
clipboard.writeText(result.join('\n'))
|
|
||||||
ElMessage.success(`${$T('MANAGE_BUCKET_BATCH_COPY_URL_MSG_A')} ${result.length} ${$T('MANAGE_BUCKET_BATCH_COPY_URL_MSG_B')}`)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function cancelLoading () {
|
function cancelLoading () {
|
||||||
|
Loading…
Reference in New Issue
Block a user