This commit is contained in:
pompurin404 2024-08-21 09:56:26 +08:00
parent 93155cedfb
commit 75d064f4e1
No known key found for this signature in database
3 changed files with 14 additions and 4 deletions

View File

@ -1,6 +1,6 @@
{
"name": "mihomo-party",
"version": "1.0.1",
"version": "1.0.2",
"description": "Mihomo Party",
"main": "./out/main/index.js",
"author": "mihomo-party",

View File

@ -95,7 +95,11 @@ async function cleanup(): Promise<void> {
const files = await readdir(dataDir())
for (const file of files) {
if (file.endsWith('.exe') || file.endsWith('.dmg')) {
await rm(path.join(dataDir(), file))
try {
await rm(path.join(dataDir(), file))
} catch {
// ignore
}
}
}
// logs
@ -105,7 +109,11 @@ async function cleanup(): Promise<void> {
const date = new Date(log.split('.')[0])
const diff = Date.now() - date.getTime()
if (diff > maxLogDays * 24 * 60 * 60 * 1000) {
await rm(path.join(logDir(), log))
try {
await rm(path.join(logDir(), log))
} catch {
// ignore
}
}
}
}

View File

@ -73,7 +73,9 @@ const Mihomo: React.FC = () => {
try {
setUpgrading(true)
await mihomoUpgrade()
PubSub.publish('mihomo-core-changed')
setTimeout(() => {
PubSub.publish('mihomo-core-changed')
}, 2000)
} catch (e) {
alert(e)
} finally {