From df22fb2036efb22257d5418a93b04848678954f4 Mon Sep 17 00:00:00 2001 From: hunter-dev Date: Mon, 24 Aug 2026 20:36:29 +0800 Subject: [PATCH] =?UTF-8?q?D=20=E5=B7=A5=E7=A8=8B=E5=8C=96=EF=BC=9ACSP?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E7=AD=96=E7=95=A5+=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=BF=81=E7=A7=BB+UI=E9=9B=86=E6=88=90(C1-C7)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/desktop/src/main/index.ts | 6 ++++++ apps/desktop/src/renderer/index.html | 3 ++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/desktop/src/main/index.ts b/apps/desktop/src/main/index.ts index 60c7145..23f6fce 100644 --- a/apps/desktop/src/main/index.ts +++ b/apps/desktop/src/main/index.ts @@ -4,6 +4,7 @@ import nodePath from 'node:path'; import { fileURLToPath } from 'node:url'; import { VaultService } from './services/vault-service.js'; import { registerIpc } from './ipc/handlers.js'; +import { MigrationService } from './services/migration-service.js'; import { IPC } from '@hunter/shared'; const __dirname = nodePath.dirname(fileURLToPath(import.meta.url)); @@ -32,6 +33,11 @@ function createWindow() { app.whenReady().then(async () => { const vault = new VaultService(); await vault.init(); // 确保有当前库 + // 旧版数据迁移检测(FR-D1/D2/D3):幂等,无旧数据则跳过 + const migrator = new MigrationService(app.getPath('userData')); + const oldDataDir = nodePath.join(app.getPath('userData'), 'legacy-data'); + const r = await migrator.migrate(oldDataDir, vault.fileService?.getRoot() ?? '').catch(() => null); + if (r?.migrated) console.log('[MIGRATION] migrated', r.count, 'items'); registerIpc(vault); createWindow(); app.on('activate', () => { if (BrowserWindow.getAllWindows().length === 0) createWindow(); }); diff --git a/apps/desktop/src/renderer/index.html b/apps/desktop/src/renderer/index.html index 98e0b05..0b91e42 100644 --- a/apps/desktop/src/renderer/index.html +++ b/apps/desktop/src/renderer/index.html @@ -3,10 +3,11 @@ + 狩夜人笔记
- + \ No newline at end of file