修复postgres导入
This commit is contained in:
@@ -151,6 +151,28 @@ export async function POST(req: NextRequest) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`导入用户 ${username} 失败:`, 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 {
|
} else {
|
||||||
// Redis 存储:直接设置用户信息
|
// Redis 存储:直接设置用户信息
|
||||||
const userInfoKey = `user:${username}:info`;
|
const userInfoKey = `user:${username}:info`;
|
||||||
|
|||||||
@@ -359,6 +359,13 @@ export default function MusicPage() {
|
|||||||
}
|
}
|
||||||
}, [playRecords, pendingSongToPlay]);
|
}, [playRecords, pendingSongToPlay]);
|
||||||
|
|
||||||
|
// 同步音量状态到 audio 元素
|
||||||
|
useEffect(() => {
|
||||||
|
if (audioRef.current) {
|
||||||
|
audioRef.current.volume = volume / 100;
|
||||||
|
}
|
||||||
|
}, [volume]);
|
||||||
|
|
||||||
// 执行前端 transform(用于 Cloudflare 环境)
|
// 执行前端 transform(用于 Cloudflare 环境)
|
||||||
const executeTransform = (data: any) => {
|
const executeTransform = (data: any) => {
|
||||||
if (data && typeof data === 'object' && data.__transform) {
|
if (data && typeof data === 'object' && data.__transform) {
|
||||||
|
|||||||
Reference in New Issue
Block a user