diff --git a/src/app/api/admin/data_migration/import/route.ts b/src/app/api/admin/data_migration/import/route.ts index 96b33d0..c8c6c1d 100644 --- a/src/app/api/admin/data_migration/import/route.ts +++ b/src/app/api/admin/data_migration/import/route.ts @@ -151,6 +151,28 @@ export async function POST(req: NextRequest) { } catch (err) { console.error(`导入用户 ${username} 失败:`, err); } + } else if (storageType === 'postgres') { + // Postgres 存储:使用 createUserWithHashedPassword 方法 + try { + if (typeof storage.createUserWithHashedPassword === 'function') { + await storage.createUserWithHashedPassword( + username, + user.passwordV2, // 已经是hash过的密码 + role, + createdAt, + userV2?.tags, + userV2?.oidcSub, + userV2?.enabledApis, + userV2?.banned + ); + importedCount++; + console.log(`用户 ${username} 导入成功 (Postgres)`); + } else { + console.error(`Postgres storage 缺少 createUserWithHashedPassword 方法`); + } + } catch (err) { + console.error(`导入用户 ${username} 失败:`, err); + } } else { // Redis 存储:直接设置用户信息 const userInfoKey = `user:${username}:info`; diff --git a/src/app/music/page.tsx b/src/app/music/page.tsx index 60d0e52..14cc9ac 100644 --- a/src/app/music/page.tsx +++ b/src/app/music/page.tsx @@ -359,6 +359,13 @@ export default function MusicPage() { } }, [playRecords, pendingSongToPlay]); + // 同步音量状态到 audio 元素 + useEffect(() => { + if (audioRef.current) { + audioRef.current.volume = volume / 100; + } + }, [volume]); + // 执行前端 transform(用于 Cloudflare 环境) const executeTransform = (data: any) => { if (data && typeof data === 'object' && data.__transform) {