mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-07-24 15:19:37 +08:00
🐛 Fix(custom): fix delete bug when using in render process
This commit is contained in:
14
src/renderer/utils/deleteLog.ts
Normal file
14
src/renderer/utils/deleteLog.ts
Normal 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)
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
@@ -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[]>([])
|
||||
|
||||
Reference in New Issue
Block a user