폴더가 다르면 같은 영상 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>
126 lines
5.0 KiB
Plaintext
126 lines
5.0 KiB
Plaintext
<!doctype html>
|
|
<html lang="ko">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
<title>관리자 · <%= breadcrumb.join(' / ') %></title>
|
|
<link rel="stylesheet" href="/static/styles.css" />
|
|
</head>
|
|
<body class="siteBody">
|
|
<%- include('../partials/navbar', { userId }) %>
|
|
|
|
<%
|
|
var folderPathEnc = breadcrumb.map(function (s) { return encodeURIComponent(s) }).join('/')
|
|
var parentHref = isSubFolder ? '/op/folder/' + encodeURIComponent(breadcrumb[0]) : '/op/dashboard'
|
|
var parentLabel = isSubFolder ? '← ' + breadcrumb[0] : '← 폴더 목록'
|
|
var editorHref = '/op/folder/' + folderPathEnc + '/video/editor'
|
|
var playlistHref = '/op/folder/' + folderPathEnc + '/playlist/new'
|
|
%>
|
|
|
|
<main class="pageWrap">
|
|
<section class="dashboardHeader">
|
|
<div>
|
|
<a class="muted" href="<%= parentHref %>"><%= parentLabel %></a>
|
|
<h1>📁 <%= breadcrumb.join(' / ') %></h1>
|
|
</div>
|
|
<div class="dashboardActions">
|
|
<% if (!isSubFolder) { %>
|
|
<button type="button" class="primaryButton" id="addSubFolderBtn">하위 폴더 추가</button>
|
|
<% } %>
|
|
<a class="primaryButton" href="<%= editorHref %>">영상 추가</a>
|
|
<% if (isSubFolder) { %>
|
|
<a class="primaryButton" href="<%= playlistHref %>">플레이리스트 추가</a>
|
|
<% } %>
|
|
</div>
|
|
</section>
|
|
|
|
<% if (!isSubFolder) { %>
|
|
<section class="folderGrid" id="subFolderGrid">
|
|
<% if (!subFolders || subFolders.length === 0) { %>
|
|
<p class="muted">아직 하위 폴더가 없습니다. 우측 상단에서 하위 폴더를 추가하세요. (영상도 이 폴더에 바로 추가할 수 있습니다.)</p>
|
|
<% } %>
|
|
<% (subFolders || []).forEach(function (sf) { %>
|
|
<div class="folderCard adminFolder" data-folder-id="<%= sf.id %>" data-name="<%= sf.name %>">
|
|
<a class="folderCardLink" href="/op/folder/<%= folderPathEnc %>/<%= encodeURIComponent(sf.name) %>">
|
|
<span class="folderIcon">📁</span>
|
|
<span class="folderName"><%= sf.name %></span>
|
|
</a>
|
|
</div>
|
|
<% }) %>
|
|
</section>
|
|
<% } %>
|
|
|
|
<section class="videoGrid" id="videoGrid">
|
|
<% if (videos.length === 0) { %>
|
|
<p class="muted">이 폴더에 영상이 없습니다. 우측 상단에서 영상을 추가하세요.</p>
|
|
<% } %>
|
|
<% videos.forEach(function (v) {
|
|
var shareUrl = '/video/' + folderPathEnc + '/' + encodeURIComponent(v.id)
|
|
%>
|
|
<div class="videoCard adminVideo"
|
|
data-id="<%= v.id %>"
|
|
data-video-id="<%= v.id %>"
|
|
data-title="<%= v.title %>"
|
|
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>
|
|
<% if (v.sourceType === 'youtube') { %>
|
|
<div class="muted">YouTube</div>
|
|
<% } %>
|
|
</div>
|
|
<% }) %>
|
|
</section>
|
|
</main>
|
|
|
|
<div class="ctxMenu" id="ctxMenu" hidden>
|
|
<button type="button" data-action="edit">수정</button>
|
|
<button type="button" data-action="rename">이름 변경</button>
|
|
<button type="button" data-action="changeId">ID 변경</button>
|
|
<button type="button" data-action="copyUrl">영상 주소 복사</button>
|
|
<button type="button" data-action="delete" class="dangerLink">삭제</button>
|
|
</div>
|
|
|
|
<div class="ctxMenu" id="folderCtxMenu" hidden>
|
|
<button type="button" data-action="rename">이름 변경</button>
|
|
<button type="button" data-action="delete" class="dangerLink">삭제</button>
|
|
</div>
|
|
|
|
<div class="playerOverlay" id="playerOverlay" hidden>
|
|
<div class="playerModal" role="dialog" aria-modal="true">
|
|
<button type="button" class="playerClose" id="playerClose" aria-label="닫기">✕</button>
|
|
<div class="playerTitle" id="playerTitle"></div>
|
|
<video id="playerVideo" controls preload="metadata"></video>
|
|
</div>
|
|
</div>
|
|
|
|
<% if (!isSubFolder) { %>
|
|
<div class="modalOverlay" id="addSubFolderModal" hidden>
|
|
<div class="modalCard">
|
|
<h2>하위 폴더 추가</h2>
|
|
<label>
|
|
<span>폴더 이름</span>
|
|
<input type="text" id="addSubFolderInput" autofocus />
|
|
</label>
|
|
<div class="modalActions">
|
|
<button type="button" class="secondaryButton" id="addSubFolderCancel">취소</button>
|
|
<button type="button" class="primaryButton" id="addSubFolderConfirm">생성</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<% } %>
|
|
|
|
<script>
|
|
window.__OP__ = {
|
|
folderId: <%- jsonForScript(folder.id) %>,
|
|
folderPath: <%- jsonForScript(breadcrumb) %>,
|
|
isSubFolder: <%- jsonForScript(isSubFolder) %>
|
|
}
|
|
</script>
|
|
<script src="/static/folder.js"></script>
|
|
<script src="/static/player.js"></script>
|
|
</body>
|
|
</html>
|