- new storeDb.ts: DB+FS layer (folders w/ parent_id, videos w/ global id)
- depth cap: sub-folder cannot have children (enforced in createFolder)
- video id: editable anytime (changeVideoId), uniqueness via PK
- routes:
- public /folder/:topName[/:subName], /video/:topName[/:subName]/:videoId
- admin /op/folder/:topName[/:subName], id-based /op/folders/:id/*
and /op/videos/:id/* (rename/changeId/delete/save + idAvailable check)
- views: breadcrumb + subFolder grid; 플레이리스트 추가 button shows at 2단계
- client JS: id-based mutation endpoints, share URL data attribute,
in-site player pushes share URL to address bar
- store.ts slimmed to Account + readAccounts (FS layer moved to storeDb)
- pickIntId accepts numeric JSON bodies
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
118 lines
4.6 KiB
Plaintext
118 lines
4.6 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="secondaryButton" id="addSubFolderBtn">하위 폴더 추가</button>
|
|
<% } %>
|
|
<a class="primaryButton" href="<%= editorHref %>">영상 추가</a>
|
|
<% if (isSubFolder) { %>
|
|
<a class="primaryButton" href="<%= playlistHref %>">플레이리스트 추가</a>
|
|
<% } %>
|
|
</div>
|
|
</section>
|
|
|
|
<% if (!isSubFolder && subFolders && subFolders.length > 0) { %>
|
|
<section class="folderGrid" id="subFolderGrid">
|
|
<% 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 && (isSubFolder || !subFolders || subFolders.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">▶</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>
|
|
|
|
<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>
|