feat(media): 动图迁移至七牛云CDN(qn.585998.xyz/华南); normalize.ts按videos/images分流; bump MEDIA_CACHE_BUST
This commit is contained in:
@@ -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}`;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user