diff --git a/package.json b/package.json index 013212c..9aba92e 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/main/utils/init.ts b/src/main/utils/init.ts index 0a23ffa..5908373 100644 --- a/src/main/utils/init.ts +++ b/src/main/utils/init.ts @@ -95,7 +95,11 @@ async function cleanup(): Promise { 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 { 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 + } } } } diff --git a/src/renderer/src/pages/mihomo.tsx b/src/renderer/src/pages/mihomo.tsx index 7f00b2c..a79d84c 100644 --- a/src/renderer/src/pages/mihomo.tsx +++ b/src/renderer/src/pages/mihomo.tsx @@ -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 {