feat(media): 动图迁移至七牛云CDN(qn.585998.xyz/华南); normalize.ts按videos/images分流; bump MEDIA_CACHE_BUST

This commit is contained in:
2026-08-03 20:11:52 +08:00
parent 16621d9c07
commit 00eab3b865
2 changed files with 12 additions and 3 deletions

View File

@@ -17,9 +17,18 @@ const MEDIA_BASE_URL = (
process.env.MEDIA_BASE_URL || 'http://localhost:3000/media'
).replace(/\/$/, '');
// 动图(GIF)已迁移至七牛云 CDN华南节点静态图(JPG)仍走自托管。
const QINIU_GIF_BASE_URL = (
process.env.QINIU_GIF_BASE_URL || 'https://qn.585998.xyz'
).replace(/\/$/, '');
function toMediaUrl(path: string): string {
if (!path) return '';
if (/^https?:\/\//.test(path)) return path;
// 动图走七牛 CDN静态图走原服务器
if (path.startsWith('videos/')) {
return `${QINIU_GIF_BASE_URL}/${path}`;
}
return `${MEDIA_BASE_URL}/${path}`;
}