feat(stream): canonical folder-path video file URL

영상 파일 스트림 정규 주소를 재생 페이지와 동일한 폴더 경로 규칙으로 변경:
  /api/video/:topName[/:subName]/:videoId
경로의 폴더 부분이 영상 위치와 일치할 때만 200, 불일치 시 404.
재생 페이지(/video/...)와 ID 기반 레거시 스트림(/file/video/:id,
/api/video/:id/file)은 그대로 유지(외부 공유 호환).

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This commit is contained in:
Claude (owner)
2026-06-02 01:07:20 +09:00
parent 34c040c15d
commit 7105349a45
5 changed files with 56 additions and 16 deletions

View File

@@ -11,7 +11,11 @@
var url = shareUrl || ('/file/video/' + encodeURIComponent(videoId))
history.pushState({ player: true, videoId: videoId }, '', url)
titleEl.textContent = title || ''
video.src = '/api/video/' + encodeURIComponent(videoId) + '/file'
// 파일 스트림 URL 은 공유 URL(/video/폴더/.../아이디)의 /video/ 를
// /api/video/ 로 바꾼 폴더 경로 기반 주소. shareUrl 이 없으면 레거시 폴백.
video.src = shareUrl
? shareUrl.replace(/^\/video\//, '/api/video/')
: ('/file/video/' + encodeURIComponent(videoId))
overlay.hidden = false
video.play().catch(function () { /* 자동재생 막힘 무시 */ })
}