diff --git a/src/app/api/admin/data_migration/export/route.ts b/src/app/api/admin/data_migration/export/route.ts index 7ce6b5b..dd3bc48 100644 --- a/src/app/api/admin/data_migration/export/route.ts +++ b/src/app/api/admin/data_migration/export/route.ts @@ -249,8 +249,8 @@ async function getUserPasswordV2(username: string): Promise { return null; } - // D1 存储:使用 getUserPasswordHash 方法 - if (storageType === 'd1') { + // D1/Turso 存储:使用 getUserPasswordHash 方法 + if (storageType === 'd1' || storageType === 'turso') { if (typeof storage.getUserPasswordHash === 'function') { return await storage.getUserPasswordHash(username); } diff --git a/src/app/api/admin/data_migration/import/route.ts b/src/app/api/admin/data_migration/import/route.ts index d368e63..34ca9e1 100644 --- a/src/app/api/admin/data_migration/import/route.ts +++ b/src/app/api/admin/data_migration/import/route.ts @@ -180,8 +180,8 @@ export async function POST(req: NextRequest) { const createdAt = userV2?.created_at || Date.now(); // 根据存储类型使用不同的导入方法 - if (storageType === 'd1') { - // D1 存储:使用 createUserWithHashedPassword 方法 + if (storageType === 'd1' || storageType === 'turso') { + // D1/Turso 存储:使用 createUserWithHashedPassword 方法 if (typeof storage.createUserWithHashedPassword === 'function') { await storage.createUserWithHashedPassword( username, @@ -193,9 +193,9 @@ export async function POST(req: NextRequest) { userV2?.enabledApis, userV2?.banned ); - console.log(`用户 ${username} 导入成功 (D1)`); + console.log(`用户 ${username} 导入成功 (${storageType})`); } else { - console.error(`D1 storage 缺少 createUserWithHashedPassword 方法`); + console.error(`${storageType} storage 缺少 createUserWithHashedPassword 方法`); return false; } } else if (storageType === 'postgres') {