mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-03-13 00:18:13 -04:00
🎨 Style(custom): use underscore (_) for unused variables
This commit is contained in:
parent
16d6a19051
commit
c102ac5158
@ -38,7 +38,7 @@ import { configPaths } from '~/universal/utils/configPaths'
|
|||||||
const waitForRename = (window: BrowserWindow, id: number): Promise<string|null> => {
|
const waitForRename = (window: BrowserWindow, id: number): Promise<string|null> => {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
const windowId = window.id
|
const windowId = window.id
|
||||||
ipcMain.once(`${RENAME_FILE_NAME}${id}`, (evt: Event, newName: string) => {
|
ipcMain.once(`${RENAME_FILE_NAME}${id}`, (_: Event, newName: string) => {
|
||||||
resolve(newName)
|
resolve(newName)
|
||||||
window.close()
|
window.close()
|
||||||
})
|
})
|
||||||
|
@ -155,7 +155,7 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('bindOrUnbindShortKey', (evt: IpcMainEvent, item: IShortKeyConfig, from: string) => {
|
ipcMain.on('bindOrUnbindShortKey', (_: IpcMainEvent, item: IShortKeyConfig, from: string) => {
|
||||||
const result = shortKeyHandler.bindOrUnbindShortKey(item, from)
|
const result = shortKeyHandler.bindOrUnbindShortKey(item, from)
|
||||||
if (result) {
|
if (result) {
|
||||||
const notification = new Notification({
|
const notification = new Notification({
|
||||||
@ -174,11 +174,11 @@ export default {
|
|||||||
|
|
||||||
// Gallery image cloud delete IPC
|
// Gallery image cloud delete IPC
|
||||||
|
|
||||||
ipcMain.on('logDeleteMsg', async (evt: IpcMainEvent, msg: string, logLevel: ILogType) => {
|
ipcMain.on('logDeleteMsg', async (_: IpcMainEvent, msg: string, logLevel: ILogType) => {
|
||||||
logger[logLevel](msg)
|
logger[logLevel](msg)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('delete-sftp-file', async (_evt: IpcMainInvokeEvent, config: ISftpPlistConfig, fileName: string) => {
|
ipcMain.handle('delete-sftp-file', async (_: IpcMainInvokeEvent, config: ISftpPlistConfig, fileName: string) => {
|
||||||
try {
|
try {
|
||||||
const client = SSHClient.instance
|
const client = SSHClient.instance
|
||||||
await client.connect(config)
|
await client.connect(config)
|
||||||
@ -193,17 +193,17 @@ export default {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('delete-aws-s3-file', async (_evt: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
ipcMain.handle('delete-aws-s3-file', async (_: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
||||||
const result = await removeFileFromS3InMain(configMap)
|
const result = await removeFileFromS3InMain(configMap)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('delete-doge-file', async (_evt: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
ipcMain.handle('delete-doge-file', async (_: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
||||||
const result = await removeFileFromDogeInMain(configMap)
|
const result = await removeFileFromDogeInMain(configMap)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('delete-huaweicloud-file', async (_evt: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
ipcMain.handle('delete-huaweicloud-file', async (_: IpcMainInvokeEvent, configMap: IStringKeyMap) => {
|
||||||
const result = await removeFileFromHuaweiInMain(configMap)
|
const result = await removeFileFromHuaweiInMain(configMap)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
@ -212,27 +212,23 @@ export default {
|
|||||||
|
|
||||||
ipcMain.handle('migrateFromPicGo', async () => {
|
ipcMain.handle('migrateFromPicGo', async () => {
|
||||||
const picGoConfigPath = STORE_PATH.replace('piclist', 'picgo')
|
const picGoConfigPath = STORE_PATH.replace('piclist', 'picgo')
|
||||||
const fileToMigration = [
|
const files = [
|
||||||
'data.json',
|
'data.json',
|
||||||
'data.bak.json',
|
'data.bak.json',
|
||||||
'picgo.db',
|
'picgo.db',
|
||||||
'picgo.bak.db'
|
'picgo.bak.db'
|
||||||
]
|
]
|
||||||
const targetFileNames = [
|
|
||||||
'data.json',
|
|
||||||
'data.bak.json',
|
|
||||||
'piclist.db',
|
|
||||||
'piclist.bak.db'
|
|
||||||
]
|
|
||||||
try {
|
try {
|
||||||
for (let i = 0; i < fileToMigration.length; i++) {
|
await Promise.all(files.map(async file => {
|
||||||
if (fs.existsSync(path.join(picGoConfigPath, fileToMigration[i]))) {
|
const sourcePath = path.join(picGoConfigPath, file)
|
||||||
fs.removeSync(path.join(STORE_PATH, targetFileNames[i]))
|
const targetPath = path.join(STORE_PATH, file.replace('picgo', 'piclist'))
|
||||||
fs.copyFileSync(path.join(picGoConfigPath, fileToMigration[i]), path.join(STORE_PATH, targetFileNames[i]))
|
await fs.remove(targetPath)
|
||||||
}
|
await fs.copy(sourcePath, targetPath, { overwrite: true })
|
||||||
}
|
}
|
||||||
|
))
|
||||||
return true
|
return true
|
||||||
} catch (e) {
|
} catch (err: any) {
|
||||||
|
logger.error(err)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -247,13 +243,13 @@ export default {
|
|||||||
notification.show()
|
notification.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('autoStart', (evt: IpcMainEvent, val: boolean) => {
|
ipcMain.on('autoStart', (_: IpcMainEvent, val: boolean) => {
|
||||||
app.setLoginItemSettings({
|
app.setLoginItemSettings({
|
||||||
openAtLogin: val
|
openAtLogin: val
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('getShortUrl', async (evt: IpcMainInvokeEvent, url: string) => {
|
ipcMain.handle('getShortUrl', async (_: IpcMainInvokeEvent, url: string) => {
|
||||||
const shortUrl = await generateShortUrl(url)
|
const shortUrl = await generateShortUrl(url)
|
||||||
return shortUrl
|
return shortUrl
|
||||||
})
|
})
|
||||||
@ -347,7 +343,7 @@ export default {
|
|||||||
evt.returnValue = picBeds
|
evt.returnValue = picBeds
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on(TOGGLE_SHORTKEY_MODIFIED_MODE, (evt: IpcMainEvent, val: boolean) => {
|
ipcMain.on(TOGGLE_SHORTKEY_MODIFIED_MODE, (_: IpcMainEvent, val: boolean) => {
|
||||||
bus.emit(TOGGLE_SHORTKEY_MODIFIED_MODE, val)
|
bus.emit(TOGGLE_SHORTKEY_MODIFIED_MODE, val)
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -385,7 +381,7 @@ export default {
|
|||||||
window
|
window
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
ipcMain.on(SHOW_PLUGIN_PAGE_MENU, (evt: IpcMainEvent, plugin: IPicGoPlugin) => {
|
ipcMain.on(SHOW_PLUGIN_PAGE_MENU, (_: IpcMainEvent, plugin: IPicGoPlugin) => {
|
||||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
const menu = buildPluginPageMenu(plugin)
|
const menu = buildPluginPageMenu(plugin)
|
||||||
menu.popup({
|
menu.popup({
|
||||||
@ -404,22 +400,22 @@ export default {
|
|||||||
window?.close()
|
window?.close()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
ipcMain.on(OPEN_USER_STORE_FILE, (evt: IpcMainEvent, filePath: string) => {
|
ipcMain.on(OPEN_USER_STORE_FILE, (_: IpcMainEvent, filePath: string) => {
|
||||||
const abFilePath = path.join(STORE_PATH, filePath)
|
const abFilePath = path.join(STORE_PATH, filePath)
|
||||||
shell.openPath(abFilePath)
|
shell.openPath(abFilePath)
|
||||||
})
|
})
|
||||||
ipcMain.on(OPEN_URL, (evt: IpcMainEvent, url: string) => {
|
ipcMain.on(OPEN_URL, (_: IpcMainEvent, url: string) => {
|
||||||
shell.openExternal(url)
|
shell.openExternal(url)
|
||||||
})
|
})
|
||||||
ipcMain.on(RELOAD_APP, () => {
|
ipcMain.on(RELOAD_APP, () => {
|
||||||
app.relaunch()
|
app.relaunch()
|
||||||
app.exit(0)
|
app.exit(0)
|
||||||
})
|
})
|
||||||
ipcMain.on(SET_MINI_WINDOW_POS, (evt: IpcMainEvent, pos: IMiniWindowPos) => {
|
ipcMain.on(SET_MINI_WINDOW_POS, (_: IpcMainEvent, pos: IMiniWindowPos) => {
|
||||||
const window = BrowserWindow.getFocusedWindow()
|
const window = BrowserWindow.getFocusedWindow()
|
||||||
window?.setBounds(pos)
|
window?.setBounds(pos)
|
||||||
})
|
})
|
||||||
ipcMain.on(HIDE_DOCK, (_evt: IpcMainEvent, val: boolean) => {
|
ipcMain.on(HIDE_DOCK, (_: IpcMainEvent, val: boolean) => {
|
||||||
if (val) {
|
if (val) {
|
||||||
app.dock.hide()
|
app.dock.hide()
|
||||||
} else {
|
} else {
|
||||||
|
@ -217,7 +217,7 @@ class AliyunApi {
|
|||||||
const urlPrefix = configMap.customUrl || `https://${bucket}.${region}.aliyuncs.com`
|
const urlPrefix = configMap.customUrl || `https://${bucket}.${region}.aliyuncs.com`
|
||||||
let marker
|
let marker
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -264,7 +264,7 @@ class AliyunApi {
|
|||||||
const urlPrefix = configMap.customUrl || `https://${bucket}.${region}.aliyuncs.com`
|
const urlPrefix = configMap.customUrl || `https://${bucket}.${region}.aliyuncs.com`
|
||||||
let marker
|
let marker
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -154,7 +154,7 @@ class GithubApi {
|
|||||||
const { bucketName: repo, customUrl: branch, prefix, cancelToken, cdnUrl } = configMap
|
const { bucketName: repo, customUrl: branch, prefix, cancelToken, cdnUrl } = configMap
|
||||||
const slicedPrefix = prefix.replace(/(^\/+|\/+$)/g, '')
|
const slicedPrefix = prefix.replace(/(^\/+|\/+$)/g, '')
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -205,7 +205,7 @@ class GithubApi {
|
|||||||
const { bucketName: repo, customUrl: branch, prefix, cancelToken, cdnUrl } = configMap
|
const { bucketName: repo, customUrl: branch, prefix, cancelToken, cdnUrl } = configMap
|
||||||
const slicedPrefix = prefix.replace(/(^\/+|\/+$)/g, '')
|
const slicedPrefix = prefix.replace(/(^\/+|\/+$)/g, '')
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -99,7 +99,7 @@ class ImgurApi {
|
|||||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||||
const { bucketConfig: { Location: albumHash }, cancelToken } = configMap
|
const { bucketConfig: { Location: albumHash }, cancelToken } = configMap
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -93,7 +93,7 @@ class LocalApi {
|
|||||||
const { prefix, customUrl = '', cancelToken } = configMap
|
const { prefix, customUrl = '', cancelToken } = configMap
|
||||||
const urlPrefix = customUrl.replace(/\/+$/, '')
|
const urlPrefix = customUrl.replace(/\/+$/, '')
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -140,7 +140,7 @@ class LocalApi {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -252,7 +252,7 @@ class QiniuApi {
|
|||||||
let marker = undefined as any
|
let marker = undefined as any
|
||||||
const slicedPrefix = prefix.slice(1)
|
const slicedPrefix = prefix.slice(1)
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -308,7 +308,7 @@ class QiniuApi {
|
|||||||
let marker = undefined as any
|
let marker = undefined as any
|
||||||
const slicedPrefix = prefix.slice(1)
|
const slicedPrefix = prefix.slice(1)
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -247,7 +247,7 @@ class S3plistApi {
|
|||||||
const urlPrefix = configMap.customUrl || `https://${bucket}.s3.amazonaws.com`
|
const urlPrefix = configMap.customUrl || `https://${bucket}.s3.amazonaws.com`
|
||||||
let marker
|
let marker
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -305,7 +305,7 @@ class S3plistApi {
|
|||||||
const urlPrefix = configMap.customUrl || `https://${bucket}.s3.amazonaws.com`
|
const urlPrefix = configMap.customUrl || `https://${bucket}.s3.amazonaws.com`
|
||||||
let marker
|
let marker
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -173,7 +173,7 @@ class SftpApi {
|
|||||||
const { prefix, customUrl, cancelToken } = configMap
|
const { prefix, customUrl, cancelToken } = configMap
|
||||||
const urlPrefix = customUrl || `${this.host}:${this.port}`
|
const urlPrefix = customUrl || `${this.host}:${this.port}`
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -244,7 +244,7 @@ class SftpApi {
|
|||||||
webPath = webPath.replace(/^\/+|\/+$/, '')
|
webPath = webPath.replace(/^\/+|\/+$/, '')
|
||||||
}
|
}
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -76,7 +76,7 @@ class SmmsApi {
|
|||||||
const { cancelToken } = configMap
|
const { cancelToken } = configMap
|
||||||
let marker = 1
|
let marker = 1
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -129,7 +129,7 @@ class TcyunApi {
|
|||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
let marker
|
let marker
|
||||||
|
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -174,7 +174,7 @@ class TcyunApi {
|
|||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
let marker
|
let marker
|
||||||
|
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -129,7 +129,7 @@ class UpyunApi {
|
|||||||
const slicedPrefix = prefix.slice(1)
|
const slicedPrefix = prefix.slice(1)
|
||||||
const urlPrefix = configMap.customUrl || `http://${bucket}.test.upcdn.net`
|
const urlPrefix = configMap.customUrl || `http://${bucket}.test.upcdn.net`
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -182,7 +182,7 @@ class UpyunApi {
|
|||||||
const urlPrefix = configMap.customUrl || `http://${bucket}.test.upcdn.net`
|
const urlPrefix = configMap.customUrl || `http://${bucket}.test.upcdn.net`
|
||||||
let marker = ''
|
let marker = ''
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -119,7 +119,7 @@ class WebdavplistApi {
|
|||||||
const { prefix, customUrl, cancelToken } = configMap
|
const { prefix, customUrl, cancelToken } = configMap
|
||||||
const urlPrefix = customUrl || this.endpoint
|
const urlPrefix = customUrl || this.endpoint
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on(cancelDownloadLoadingFileList, (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on(cancelDownloadLoadingFileList, (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
ipcMain.removeAllListeners(cancelDownloadLoadingFileList)
|
||||||
@ -164,7 +164,7 @@ class WebdavplistApi {
|
|||||||
webPath = webPath.replace(/^\/+|\/+$/, '')
|
webPath = webPath.replace(/^\/+|\/+$/, '')
|
||||||
}
|
}
|
||||||
const cancelTask = [false]
|
const cancelTask = [false]
|
||||||
ipcMain.on('cancelLoadingFileList', (_evt: IpcMainEvent, token: string) => {
|
ipcMain.on('cancelLoadingFileList', (_: IpcMainEvent, token: string) => {
|
||||||
if (token === cancelToken) {
|
if (token === cancelToken) {
|
||||||
cancelTask[0] = true
|
cancelTask[0] = true
|
||||||
ipcMain.removeAllListeners('cancelLoadingFileList')
|
ipcMain.removeAllListeners('cancelLoadingFileList')
|
||||||
|
@ -11,58 +11,58 @@ export const manageIpcList = {
|
|||||||
listen () {
|
listen () {
|
||||||
manageCoreIPC.listen()
|
manageCoreIPC.listen()
|
||||||
|
|
||||||
ipcMain.handle('getBucketList', async (_evt: IpcMainInvokeEvent, currentPicBed: string) => {
|
ipcMain.handle('getBucketList', async (_: IpcMainInvokeEvent, currentPicBed: string) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.getBucketList()
|
return manage.getBucketList()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('createBucket', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('createBucket', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.createBucket(param)
|
return manage.createBucket(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('getBucketFileList', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('getBucketFileList', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.getBucketFileList(param)
|
return manage.getBucketFileList(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('getBucketDomain', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('getBucketDomain', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
const result = await manage.getBucketDomain(param)
|
const result = await manage.getBucketDomain(param)
|
||||||
return result
|
return result
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('setBucketAclPolicy', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('setBucketAclPolicy', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.setBucketAclPolicy(param)
|
return manage.setBucketAclPolicy(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('renameBucketFile', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('renameBucketFile', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.renameBucketFile(param)
|
return manage.renameBucketFile(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('deleteBucketFile', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('deleteBucketFile', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.deleteBucketFile(param)
|
return manage.deleteBucketFile(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('deleteBucketFolder', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('deleteBucketFolder', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.deleteBucketFolder(param)
|
return manage.deleteBucketFolder(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('getBucketListBackstage', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.on('getBucketListBackstage', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.getBucketListBackstage(param)
|
return manage.getBucketListBackstage(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('getBucketListRecursively', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.on('getBucketListRecursively', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.getBucketListRecursively(param)
|
return manage.getBucketListRecursively(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('convertPathToBase64', async (_evt: IpcMainInvokeEvent, filePath: string) => {
|
ipcMain.handle('convertPathToBase64', async (_: IpcMainInvokeEvent, filePath: string) => {
|
||||||
const res = fs.readFileSync(filePath, 'base64')
|
const res = fs.readFileSync(filePath, 'base64')
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
@ -78,7 +78,7 @@ export const manageIpcList = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('getPreSignedUrl', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('getPreSignedUrl', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.getPreSignedUrl(param)
|
return manage.getPreSignedUrl(param)
|
||||||
})
|
})
|
||||||
@ -91,17 +91,17 @@ export const manageIpcList = {
|
|||||||
return UpDownTaskQueue.getInstance().getAllDownloadTask()
|
return UpDownTaskQueue.getInstance().getAllDownloadTask()
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('uploadBucketFile', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.on('uploadBucketFile', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.uploadBucketFile(param)
|
return manage.uploadBucketFile(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('downloadBucketFile', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.on('downloadBucketFile', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.downloadBucketFile(param)
|
return manage.downloadBucketFile(param)
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('createBucketFolder', async (_evt: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
ipcMain.handle('createBucketFolder', async (_: IpcMainInvokeEvent, currentPicBed: string, param: IStringKeyMap) => {
|
||||||
const manage = new ManageApi(currentPicBed)
|
const manage = new ManageApi(currentPicBed)
|
||||||
return manage.createBucketFolder(param)
|
return manage.createBucketFolder(param)
|
||||||
})
|
})
|
||||||
@ -133,7 +133,7 @@ export const manageIpcList = {
|
|||||||
return app.getPath('downloads')
|
return app.getPath('downloads')
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('OpenDownloadedFolder', async (_evt: IpcMainInvokeEvent, path: string | undefined) => {
|
ipcMain.on('OpenDownloadedFolder', async (_: IpcMainInvokeEvent, path: string | undefined) => {
|
||||||
if (path) {
|
if (path) {
|
||||||
shell.showItemInFolder(path)
|
shell.showItemInFolder(path)
|
||||||
} else {
|
} else {
|
||||||
@ -141,11 +141,11 @@ export const manageIpcList = {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.on('OpenLocalFile', async (_evt: IpcMainInvokeEvent, fullPath: string) => {
|
ipcMain.on('OpenLocalFile', async (_: IpcMainInvokeEvent, fullPath: string) => {
|
||||||
fs.existsSync(fullPath) ? shell.showItemInFolder(fullPath) : shell.openPath(path.dirname(fullPath))
|
fs.existsSync(fullPath) ? shell.showItemInFolder(fullPath) : shell.openPath(path.dirname(fullPath))
|
||||||
})
|
})
|
||||||
|
|
||||||
ipcMain.handle('downloadFileFromUrl', async (_evt: IpcMainInvokeEvent, urls: string[]) => {
|
ipcMain.handle('downloadFileFromUrl', async (_: IpcMainInvokeEvent, urls: string[]) => {
|
||||||
const res = await downloadFileFromUrl(urls)
|
const res = await downloadFileFromUrl(urls)
|
||||||
return res
|
return res
|
||||||
})
|
})
|
||||||
|
@ -49,7 +49,7 @@ onBeforeMount(() => {
|
|||||||
$bus.on(SHOW_INPUT_BOX, initInputBoxValue)
|
$bus.on(SHOW_INPUT_BOX, initInputBoxValue)
|
||||||
})
|
})
|
||||||
|
|
||||||
function ipcEventHandler (evt: IpcRendererEvent, options: IShowInputBoxOption) {
|
function ipcEventHandler (_: IpcRendererEvent, options: IShowInputBoxOption) {
|
||||||
initInputBoxValue(options)
|
initInputBoxValue(options)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2462,7 +2462,7 @@ async function handleFolderBatchDownload (item: any) {
|
|||||||
const downloadFileTransferStore = useDownloadFileTransferStore()
|
const downloadFileTransferStore = useDownloadFileTransferStore()
|
||||||
downloadFileTransferStore.resetDownloadFileTransferList()
|
downloadFileTransferStore.resetDownloadFileTransferList()
|
||||||
ipcRenderer.send('getBucketListRecursively', configMap.alias, paramGet)
|
ipcRenderer.send('getBucketListRecursively', configMap.alias, paramGet)
|
||||||
ipcRenderer.on(refreshDownloadFileTransferList, (evt: IpcRendererEvent, data) => {
|
ipcRenderer.on(refreshDownloadFileTransferList, (_: IpcRendererEvent, data) => {
|
||||||
downloadFileTransferStore.refreshDownloadFileTransferList(data)
|
downloadFileTransferStore.refreshDownloadFileTransferList(data)
|
||||||
})
|
})
|
||||||
downloadInterval = setInterval(() => {
|
downloadInterval = setInterval(() => {
|
||||||
@ -2838,7 +2838,7 @@ async function getBucketFileListBackStage () {
|
|||||||
param.webPath = configMap.webPath
|
param.webPath = configMap.webPath
|
||||||
}
|
}
|
||||||
ipcRenderer.send('getBucketListBackstage', configMap.alias, param)
|
ipcRenderer.send('getBucketListBackstage', configMap.alias, param)
|
||||||
ipcRenderer.on('refreshFileTransferList', (evt: IpcRendererEvent, data) => {
|
ipcRenderer.on('refreshFileTransferList', (_: IpcRendererEvent, data) => {
|
||||||
fileTransferStore.refreshFileTransferList(data)
|
fileTransferStore.refreshFileTransferList(data)
|
||||||
})
|
})
|
||||||
fileTransferInterval = setInterval(() => {
|
fileTransferInterval = setInterval(() => {
|
||||||
|
@ -2481,7 +2481,7 @@ function handleMiniWindowOntop (val: ICheckBoxValueType) {
|
|||||||
$message.info($T('TIPS_NEED_RELOAD'))
|
$message.info($T('TIPS_NEED_RELOAD'))
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleMiniIconPath (evt: Event) {
|
async function handleMiniIconPath (_: Event) {
|
||||||
const result = await invokeToMain('openFileSelectDialog')
|
const result = await invokeToMain('openFileSelectDialog')
|
||||||
if (result && result[0]) {
|
if (result && result[0]) {
|
||||||
form.customMiniIcon = result[0]
|
form.customMiniIcon = result[0]
|
||||||
|
@ -337,7 +337,7 @@ onBeforeMount(async () => {
|
|||||||
ipcRenderer.on('hideLoading', () => {
|
ipcRenderer.on('hideLoading', () => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
ipcRenderer.on(PICGO_HANDLE_PLUGIN_DONE, (evt: IpcRendererEvent, fullName: string) => {
|
ipcRenderer.on(PICGO_HANDLE_PLUGIN_DONE, (_: IpcRendererEvent, fullName: string) => {
|
||||||
pluginList.value.forEach(item => {
|
pluginList.value.forEach(item => {
|
||||||
if (item.fullName === fullName || (item.name === fullName)) {
|
if (item.fullName === fullName || (item.name === fullName)) {
|
||||||
item.ing = false
|
item.ing = false
|
||||||
@ -345,7 +345,7 @@ onBeforeMount(async () => {
|
|||||||
})
|
})
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
ipcRenderer.on('pluginList', (evt: IpcRendererEvent, list: IPicGoPlugin[]) => {
|
ipcRenderer.on('pluginList', (_: IpcRendererEvent, list: IPicGoPlugin[]) => {
|
||||||
pluginList.value = list
|
pluginList.value = list
|
||||||
pluginNameList.value = list.map(item => item.fullName)
|
pluginNameList.value = list.map(item => item.fullName)
|
||||||
for (const item of pluginList.value) {
|
for (const item of pluginList.value) {
|
||||||
@ -353,7 +353,7 @@ onBeforeMount(async () => {
|
|||||||
}
|
}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
ipcRenderer.on('installPlugin', (evt: IpcRendererEvent, { success, body }: {
|
ipcRenderer.on('installPlugin', (_: IpcRendererEvent, { success, body }: {
|
||||||
success: boolean,
|
success: boolean,
|
||||||
body: string
|
body: string
|
||||||
}) => {
|
}) => {
|
||||||
@ -365,7 +365,7 @@ onBeforeMount(async () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
ipcRenderer.on('updateSuccess', (evt: IpcRendererEvent, plugin: string) => {
|
ipcRenderer.on('updateSuccess', (_: IpcRendererEvent, plugin: string) => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
pluginList.value.forEach(item => {
|
pluginList.value.forEach(item => {
|
||||||
if (item.fullName === plugin) {
|
if (item.fullName === plugin) {
|
||||||
@ -377,7 +377,7 @@ onBeforeMount(async () => {
|
|||||||
handleReload()
|
handleReload()
|
||||||
getPluginList()
|
getPluginList()
|
||||||
})
|
})
|
||||||
ipcRenderer.on('uninstallSuccess', (evt: IpcRendererEvent, plugin: string) => {
|
ipcRenderer.on('uninstallSuccess', (_: IpcRendererEvent, plugin: string) => {
|
||||||
loading.value = false
|
loading.value = false
|
||||||
pluginList.value = pluginList.value.filter(item => {
|
pluginList.value = pluginList.value.filter(item => {
|
||||||
if (item.fullName === plugin) { // restore Uploader & Transformer after uninstalling
|
if (item.fullName === plugin) { // restore Uploader & Transformer after uninstalling
|
||||||
@ -393,13 +393,13 @@ onBeforeMount(async () => {
|
|||||||
})
|
})
|
||||||
pluginNameList.value = pluginNameList.value.filter(item => item !== plugin)
|
pluginNameList.value = pluginNameList.value.filter(item => item !== plugin)
|
||||||
})
|
})
|
||||||
ipcRenderer.on(PICGO_CONFIG_PLUGIN, (evt: IpcRendererEvent, _currentType: 'plugin' | 'transformer' | 'uploader', _configName: string, _config: any) => {
|
ipcRenderer.on(PICGO_CONFIG_PLUGIN, (_: IpcRendererEvent, _currentType: 'plugin' | 'transformer' | 'uploader', _configName: string, _config: any) => {
|
||||||
currentType.value = _currentType
|
currentType.value = _currentType
|
||||||
configName.value = _configName
|
configName.value = _configName
|
||||||
config.value = _config
|
config.value = _config
|
||||||
dialogVisible.value = true
|
dialogVisible.value = true
|
||||||
})
|
})
|
||||||
ipcRenderer.on(PICGO_HANDLE_PLUGIN_ING, (evt: IpcRendererEvent, fullName: string) => {
|
ipcRenderer.on(PICGO_HANDLE_PLUGIN_ING, (_: IpcRendererEvent, fullName: string) => {
|
||||||
pluginList.value.forEach(item => {
|
pluginList.value.forEach(item => {
|
||||||
if (item.fullName === fullName || (item.name === fullName)) {
|
if (item.fullName === fullName || (item.name === fullName)) {
|
||||||
item.ing = true
|
item.ing = true
|
||||||
@ -407,7 +407,7 @@ onBeforeMount(async () => {
|
|||||||
})
|
})
|
||||||
loading.value = true
|
loading.value = true
|
||||||
})
|
})
|
||||||
ipcRenderer.on(PICGO_TOGGLE_PLUGIN, (evt: IpcRendererEvent, fullName: string, enabled: boolean) => {
|
ipcRenderer.on(PICGO_TOGGLE_PLUGIN, (_: IpcRendererEvent, fullName: string, enabled: boolean) => {
|
||||||
const plugin = pluginList.value.find(item => item.fullName === fullName)
|
const plugin = pluginList.value.find(item => item.fullName === fullName)
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
plugin.enabled = enabled
|
plugin.enabled = enabled
|
||||||
|
@ -190,7 +190,7 @@ async function confirmKeyBinding () {
|
|||||||
const config = Object.assign({}, list.value[currentIndex.value])
|
const config = Object.assign({}, list.value[currentIndex.value])
|
||||||
config.key = shortKey.value
|
config.key = shortKey.value
|
||||||
sendToMain('updateShortKey', config, oldKey, config.from)
|
sendToMain('updateShortKey', config, oldKey, config.from)
|
||||||
ipcRenderer.once('updateShortKeyResponse', (evt: IpcRendererEvent, result) => {
|
ipcRenderer.once('updateShortKeyResponse', (_: IpcRendererEvent, result) => {
|
||||||
if (result) {
|
if (result) {
|
||||||
keyBindingVisible.value = false
|
keyBindingVisible.value = false
|
||||||
list.value[currentIndex.value].key = shortKey.value
|
list.value[currentIndex.value].key = shortKey.value
|
||||||
|
Loading…
Reference in New Issue
Block a user