mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-09-05 15:37:21 +08:00
🐛 Fix(custom): fix delete bug when using in render process
This commit is contained in:
@@ -29,6 +29,11 @@ import { isMacOSVersionGreaterThanOrEqualTo } from '~/utils/getMacOSVersion'
|
||||
import pasteTemplate from '~/utils/pasteTemplate'
|
||||
import { hideMiniWindow, openMainWindow, openMiniWindow } from '~/utils/windowHelper'
|
||||
|
||||
import menubarPng from '../../../../../resources/menubar.png?asset'
|
||||
import menubarNewDarwinTemplate from '../../../../../resources/menubar-newdarwinTemplate.png?asset'
|
||||
import menubarNodarwin from '../../../../../resources/menubar-nodarwin.png?asset'
|
||||
import uploadPng from '../../../../../resources/upload.png?asset'
|
||||
import uploadDarkPng from '../../../../../resources/upload-dark.png?asset'
|
||||
let contextMenu: Menu | null
|
||||
|
||||
export function setDockMenu () {
|
||||
@@ -219,9 +224,9 @@ export function createContextMenu () {
|
||||
const getTrayIcon = () => {
|
||||
if (process.platform === 'darwin') {
|
||||
const isMacOSGreaterThan11 = isMacOSVersionGreaterThanOrEqualTo('11')
|
||||
return isMacOSGreaterThan11 ? './resources/menubar-newdarwinTemplate.png' : './resources/menubar.png'
|
||||
return isMacOSGreaterThan11 ? menubarNewDarwinTemplate : menubarPng
|
||||
} else {
|
||||
return './resources/menubar-nodarwin.png'
|
||||
return menubarNodarwin
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,9 +296,9 @@ export function createTray (tooltip: string) {
|
||||
|
||||
tray.on('drag-enter', () => {
|
||||
if (nativeTheme.shouldUseDarkColors) {
|
||||
tray!.setImage('./resources/upload-dark.png')
|
||||
tray!.setImage(uploadDarkPng)
|
||||
} else {
|
||||
tray!.setImage('./resources/upload.png')
|
||||
tray!.setImage(uploadPng)
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@ import { IBrowserWindowOptions } from '#/types/types'
|
||||
import { configPaths } from '#/utils/configPaths'
|
||||
import { T } from '~/i18n'
|
||||
|
||||
import logo from '../../../../../resources/logo.png?asset'
|
||||
import {
|
||||
MANUAL_WINDOW_URL,
|
||||
MINI_WINDOW_URL,
|
||||
@@ -111,7 +112,7 @@ if (process.platform !== 'darwin') {
|
||||
settingWindowOptions.frame = false
|
||||
settingWindowOptions.backgroundColor = '#3f3c37'
|
||||
settingWindowOptions.transparent = false
|
||||
settingWindowOptions.icon = '.resources/logo.png'
|
||||
settingWindowOptions.icon = '../../../../../resources/logo.png'
|
||||
}
|
||||
|
||||
const miniWindowOptions = {
|
||||
@@ -123,7 +124,7 @@ const miniWindowOptions = {
|
||||
skipTaskbar: true,
|
||||
resizable: false,
|
||||
transparent: process.platform !== 'linux',
|
||||
icon: './resources/logo.png',
|
||||
icon: logo,
|
||||
webPreferences: {
|
||||
sandbox: false,
|
||||
preload: preloadPath,
|
||||
@@ -172,7 +173,7 @@ const toolboxWindowOptions = {
|
||||
resizable: false,
|
||||
title: `PicList ${T('TOOLBOX')}`,
|
||||
vibrancy: 'ultra-dark',
|
||||
icon: './resources/logo.png',
|
||||
icon: logo,
|
||||
webPreferences: {
|
||||
sandbox: false,
|
||||
backgroundThrottling: false,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import qiniu from 'qiniu'
|
||||
|
||||
import { IQiniuConfig, PartialKeys } from '#/types/types'
|
||||
import { deleteFailedLog, deleteLog } from '~/utils/deleteLog'
|
||||
|
||||
interface IConfigMap {
|
||||
fileName: string
|
||||
config: PartialKeys<IQiniuConfig, 'path'>
|
||||
@@ -12,10 +13,10 @@ export default class QiniuApi {
|
||||
fileName,
|
||||
config: { accessKey, secretKey, bucket, path }
|
||||
} = configMap
|
||||
const mac = new window.node.qiniu.auth.digest.Mac(accessKey, secretKey)
|
||||
const qiniuConfig = new window.node.qiniu.conf.Config()
|
||||
const mac = new qiniu.auth.digest.Mac(accessKey, secretKey)
|
||||
const qiniuConfig = new qiniu.conf.Config()
|
||||
try {
|
||||
const bucketManager = new window.node.qiniu.rs.BucketManager(mac, qiniuConfig)
|
||||
const bucketManager = new qiniu.rs.BucketManager(mac, qiniuConfig)
|
||||
const formattedPath = path?.replace(/^\/+|\/+$/, '') || ''
|
||||
const key = path === '/' || !path ? fileName : `${formattedPath}/${fileName}`
|
||||
const res = (await new Promise((resolve, reject) => {
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
import ALLApi from 'apis/delete/allApi'
|
||||
|
||||
import { IRPCActionType, IRPCType } from '#/types/enum'
|
||||
import { IIPCEvent } from '#/types/rpc'
|
||||
import { ImgInfo } from '#/types/types'
|
||||
|
||||
export default [
|
||||
{
|
||||
action: IRPCActionType.DELETE_ALL_API,
|
||||
handler: async (_: IIPCEvent, args:[item: ImgInfo]) => {
|
||||
return await ALLApi.delete(args[0])
|
||||
},
|
||||
type: IRPCType.INVOKE
|
||||
}
|
||||
]
|
||||
@@ -4,6 +4,7 @@ import { IRPCActionType, IRPCType } from '#/types/enum'
|
||||
import { IIPCEvent } from '#/types/rpc'
|
||||
import { IStringKeyMap } from '#/types/types'
|
||||
import { RPCRouter } from '~/events/rpc/router'
|
||||
import deleteRoutes from '~/events/rpc/routes/picbed/delete'
|
||||
import {
|
||||
deleteUploaderConfig,
|
||||
getUploaderConfigList,
|
||||
@@ -94,6 +95,8 @@ const picbedRoutes = [
|
||||
}
|
||||
]
|
||||
|
||||
picbedRouter.addBatch(picbedRoutes)
|
||||
const picBedsRoutes = [...picbedRoutes, ...deleteRoutes]
|
||||
|
||||
picbedRouter.addBatch(picBedsRoutes)
|
||||
|
||||
export { picbedRouter }
|
||||
|
||||
Reference in New Issue
Block a user