UI-UX/src/lib/tos.ts
iye 74a7b0ea16
All checks were successful
Build and Deploy / build-and-deploy (push) Successful in 4m21s
feat(ui): polish hero/logo/cards + bump TOS version + drop missing-video flags
- Hero eyebrow: "Top 12 · Virtual Idol Debut Project"
  → "Top 12 · Cyber Star Debut Survival"
- Hero video: attempt unmuted autoplay first, fall back to muted on
  browser autoplay-policy block (sound button reflects actual state).
- Logo: replace with cropped v2 art, drop purple drop-shadow glow.
- ArtistCard: drop non-top12 opacity dim AND the top dark gradient
  overlay — new high-quality portraits look better fully exposed.
- mock-data: 003/010/017/027/033 solo videos are present in v2,
  cleared MISSING_VIDEO set so the video section renders for them.
- tos: bump TOS_VERSION to 3 — videos/portraits overwritten on TOS,
  this cache-busts older URLs in browsers and CDNs.

TOS uploads (handled separately): hero-pv.mp4, 5 solo videos
(003/010/017/027/033), 7 cover images, 6/036 atmosphere images.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-15 17:02:29 +08:00

24 lines
990 B
TypeScript

/**
* TOS 资源 URL 拼接工具
*
* 用法:
* tosUrl("portraits/001.webp")
* → https://cyberstar.tos-cn-shanghai.volces.com/cyber-star/portraits/001.webp?v=2
*
* 环境变量 NEXT_PUBLIC_TOS_DOMAIN 配置:
* .env.local / .env.production → 完整的桶 + 路径前缀 (含 scheme, 不含末尾 /)
* 未设置时 fallback 到相对路径 (/path/...), 适合本地用 public/ 静态文件托管的场景。
*
* 缓存版本号 TOS_VERSION:每次有 TOS 文件被原地覆盖更新(图片/视频),
* 把这个数字 +1。浏览器和 CDN 会把带新版本号的 URL 当作全新资源,
* 立即看到更新后的内容,不必等 TTL 过期或手动 invalidate。
*/
const TOS_BASE = (process.env.NEXT_PUBLIC_TOS_DOMAIN ?? "").replace(/\/+$/, "");
const TOS_VERSION = "3";
export function tosUrl(path: string): string {
const clean = path.replace(/^\/+/, "");
const base = TOS_BASE ? `${TOS_BASE}/${clean}` : `/${clean}`;
return `${base}?v=${TOS_VERSION}`;
}