Files
make_video_site/views/folder.ejs
Claude (owner) 0ec6b06b57 feat: 영상 ID 를 폴더 안에서만 유일하게 (UNIQUE(folder_id, id))
폴더가 다르면 같은 영상 ID(예: 1,2,3,4)를 재사용할 수 있도록 변경.
ID 가 더 이상 전역 PK 가 아니므로 모든 영상 조회를 폴더 스코프로 전환:
- db: videos PK→UNIQUE(folder_id,id) + 기존 DB 자동 마이그레이션
- storeDb: getVideo→getVideoInFolder(folderId,id) + getVideoByIdGlobal 폴백
- public/op/editor/youtube: 재생·썸네일·편집·삭제·rename 모두 폴더 스코프
- 썸네일을 경로기반 URL(/file/video/<폴더>/<id>/thumb)로 전환
- 클라이언트 mutation 요청에 folderId 동봉

Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
2026-06-06 16:19:02 +09:00

71 lines
2.6 KiB
Plaintext

<!doctype html>
<html lang="ko">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title><%= folder.name %> · 비디오 사이트</title>
<link rel="stylesheet" href="/static/styles.css" />
</head>
<body class="siteBody">
<header class="publicNav">
<a class="navBrand" href="/">
<span class="navLogo">🎬</span>
<span class="navTitle">비디오 사이트</span>
</a>
<a class="secondaryButton" href="/op">관리자</a>
</header>
<%
// 현재 폴더까지의 경로 prefix (영상/하위폴더 URL 조립용)
var folderPathEnc = breadcrumb.map(function (s) { return encodeURIComponent(s) }).join('/')
var parentHref = isSubFolder ? '/folder/' + encodeURIComponent(breadcrumb[0]) : '/'
var parentLabel = isSubFolder ? '← ' + breadcrumb[0] : '← 폴더 목록'
%>
<main class="pageWrap">
<section class="hero">
<a class="muted" href="<%= parentHref %>"><%= parentLabel %></a>
<h1>📁 <%= breadcrumb.join(' / ') %></h1>
</section>
<% if (!isSubFolder) { %>
<section class="folderGrid">
<% if ((!subFolders || subFolders.length === 0) && videos.length === 0) { %>
<p class="muted">아직 하위 폴더가 없습니다.</p>
<% } %>
<% (subFolders || []).forEach(function (sf) { %>
<a class="folderCard" href="/folder/<%= folderPathEnc %>/<%= encodeURIComponent(sf.name) %>">
<span class="folderIcon">📁</span>
<span class="folderName"><%= sf.name %></span>
</a>
<% }) %>
</section>
<% } %>
<section class="videoGrid">
<% if (videos.length === 0 && isSubFolder) { %>
<p class="muted">이 폴더에 영상이 없습니다.</p>
<% } %>
<% videos.forEach(function (v) {
var shareUrl = '/video/' + folderPathEnc + '/' + encodeURIComponent(v.id)
%>
<a class="videoCard" href="<%= shareUrl %>"
data-video-id="<%= v.id %>" data-share-url="<%= shareUrl %>">
<div class="videoThumb">
<img class="videoThumbImg" src="/file/video/<%= folderPathEnc %>/<%= encodeURIComponent(v.id) %>/thumb" alt="" loading="lazy" onerror="this.style.display='none'" />
<span class="videoThumbPlay">▶</span>
</div>
<div class="videoTitle"><%= v.title %></div>
</a>
<% }) %>
</section>
</main>
<div class="ctxMenu" id="ctxMenu" hidden>
<button type="button" data-action="copyUrl">영상 주소 복사</button>
</div>
<script src="/static/public-folder.js"></script>
</body>
</html>