fix: profile_upsert payload binding

This commit is contained in:
root
2026-10-17 12:05:56 +08:00
parent 7331111379
commit 500d59ba58
4 changed files with 61 additions and 0 deletions
+14
View File
@@ -319,6 +319,20 @@ const server = http.createServer(async (req, res) => {
});
}
// 个人信息证件照:经图床网关直传 COS,返回访问 URL
if (req.method === 'POST' && route === '/api/profile_photo') {
const body = await readJson(req);
if (!LSKY_API || !LSKY_TOKEN) return send(400, false, '未配置图床,无法上传证件照');
try {
const buf = Buffer.from(body.data_b64 || '', 'base64');
if (!buf.length) return send(400, false, '空文件');
const up = await lskyUpload(buf, body.file_name || 'profile-photo.png', body.mime || 'image/png');
return send(200, true, { url: sanitizeImageUrl(up.url) });
} catch (e) {
return send(500, false, '证件照上传失败: ' + e.message);
}
}
// 附件上传(原始二进制 PUT):无 base64 膨胀;图床上传改为后台异步,保存立即返回
if (req.method === 'PUT' && route === '/sync/attachment/raw') {
const q = url.searchParams;