🐛 Fix(custom): fix delete bug when using in render process

This commit is contained in:
Kuingsmile
2025-07-31 23:23:51 +08:00
parent b7d7badda9
commit 89976c73a9
36 changed files with 78 additions and 729 deletions

View File

@@ -0,0 +1,14 @@
import { ILogType, IRPCActionType } from '#/types/enum'
export const deleteLog = (fileName?: string, type?: string, isSuccess = true, msg?: string) => {
window.electron.sendRPC(
IRPCActionType.GALLERY_LOG_DELETE_MSG,
msg || `Delete ${fileName} on ${type} success`,
isSuccess ? ILogType.success : ILogType.error
)
}
export const deleteFailedLog = (fileName: string, type: string, error: any) => {
deleteLog(fileName, type, false)
window.electron.sendRPC(IRPCActionType.GALLERY_LOG_DELETE_MSG, error, ILogType.error)
}

View File

@@ -3,12 +3,20 @@ import { RELEASE_URL, RELEASE_URL_BACKUP } from '#/utils/static'
export const getLatestVersion = async (): Promise<string> => {
try {
const { data: normalList } = await window.node.axios.get(RELEASE_URL)
const response = await fetch(RELEASE_URL)
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const normalList = await response.json()
return normalList[0].name
} catch (err) {
console.error('Error fetching latest version: ', err)
try {
const { data } = await window.node.axios.get(`${RELEASE_URL_BACKUP}/latest.yml`)
const response = await fetch(`${RELEASE_URL_BACKUP}/latest.yml`)
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`)
}
const data = await response.text()
const r = window.node.yaml.load(data) as IStringKeyMap
return r.version
} catch (err) {

View File

@@ -3,7 +3,7 @@ import { ref } from 'vue'
import { IRPCActionType } from '#/types/enum'
import { IPicBedType } from '#/types/types'
console.log('global.ts loaded', window.node.https)
console.log('global.ts loaded', window.node.crypto.randomBytes(16).toString('hex'))
const osGlobal = ref<string>(window.electron.sendRpcSync(IRPCActionType.GET_PLATFORM))
const picBedGlobal = ref<IPicBedType[]>([])