fix(demo): harden cross-platform demo imports

Rebase official Demo timelines against the browser timezone, bound stalled downloads, and roll back partial batches across Desktop, CLI Web, and Web WASM. Document the platform cleanup hook's established best-effort boundary.
This commit is contained in:
digua committed 2026-07-26 01:43:43 +08:00
1 parent 9e7c76fb89
commit dc20320041
12 files changed
+395 -42

No files matched your search

+7 -2
View File
@@ -407,8 +407,9 @@ export function registerImportRoutes(
// ==================== Demo Import ====================
server.post<{ Body: { locale?: string } }>('/_web/demo/import', async (request, reply) => {
const locale = (request.body as any)?.locale === 'cn' ? 'cn' : 'en'
server.post<{ Body: { locale?: string; timeZone?: string } }>('/_web/demo/import', async (request, reply) => {
const locale = request.body?.locale === 'cn' ? 'cn' : 'en'
const targetTimeZone = typeof request.body?.timeZone === 'string' ? request.body.timeZone : undefined
const nativeBinding = resolveNativeBinding()
reply.raw.writeHead(200, {
@@ -424,7 +425,11 @@ export function registerImportRoutes(
const result = await importDemoSessions({
locale,
tempPrefix: 'cli-demo-',
targetTimeZone,
importFile: (filePath) => streamImport(dbManager, filePath, { nativeBinding }),
deleteSession: (sessionId) => {
dbManager.deleteSessionDatabaseFiles(sessionId)
},
onProgress: (progress) => sendEvent('progress', progress),
})
sendEvent('result', result)