Files
make_video_site/views/op/editor.ejs
Claude (owner) 55ce30733b feat(videos): inline ID edit with live availability check
영상 편집 페이지에 영상 ID 입력란을 추가했다. 입력 시 250ms 디바운스로
/op/videos/idAvailable 를 호출해 중복/형식을 실시간 확인하고, 변경
버튼으로 /op/videos/:id/changeId 를 호출한 뒤 새 ID 의 편집 페이지로
location.replace 한다. 공유 주소 복사 버튼도 함께 노출한다.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-31 23:51:18 +09:00

91 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">
<%
var folderPathEnc = breadcrumb.map(function (s) { return encodeURIComponent(s) }).join('/')
var folderHref = '/op/folder/' + folderPathEnc
var folderLabel = breadcrumb.join(' / ')
%>
<header class="editorNav">
<div class="editorNavLeft">
<a class="muted" href="<%= folderHref %>">← <%= folderLabel %></a>
<input type="text" id="titleInput" class="titleInput" placeholder="영상 제목" value="<%= video ? video.title : '' %>" />
</div>
<div class="editorNavRight">
<button type="button" class="primaryButton" id="saveBtn">저장</button>
</div>
</header>
<main class="editorMain">
<section class="editorStage">
<div id="dropZone" class="dropZone" <% if (video) { %>hidden<% } %>>
<p class="dropTitle">영상 추가</p>
<p class="muted">파일을 드래그&드롭하거나, 아래에서 직접 선택하거나, YouTube 주소를 붙여넣으세요.</p>
<input type="file" id="fileInput" accept="video/*" />
<div class="ytRow">
<input type="text" id="ytUrl" placeholder="https://www.youtube.com/watch?v=..." />
<button type="button" class="secondaryButton" id="ytProbeBtn">확인</button>
<button type="button" class="primaryButton" id="ytStartBtn" disabled>가져오기</button>
</div>
<p id="probeInfo" class="muted"></p>
<progress id="downloadProgress" value="0" max="100" hidden></progress>
<p id="uploadStatus" class="muted"></p>
</div>
<div id="videoPanel" class="videoPanel" <% if (!video) { %>hidden<% } %>>
<div class="videoIdRow">
<label for="videoIdInput">영상 ID</label>
<input type="text" id="videoIdInput" autocomplete="off" spellcheck="false"
value="<%= video ? video.id : '' %>" />
<span id="idStatus" class="idStatus muted"></span>
<button type="button" class="secondaryButton" id="changeIdBtn" disabled>변경</button>
<button type="button" class="secondaryButton" id="copyShareBtn">공유 주소 복사</button>
</div>
<video id="editVideo" controls preload="metadata"
<% if (video) { %>src="/api/video/<%= encodeURIComponent(video.id) %>/file?edited=0"<% } %>></video>
<div class="trimTimeline">
<div class="trimTimelineHeader">
<span class="timeReadout" id="timeReadout">00:00.0 / 00:00.0</span>
<div class="trimTimelineActions">
<button type="button" data-mark="start" title="현재 시점을 시작점으로">[&nbsp;시작점</button>
<button type="button" data-mark="end" title="현재 시점을 끝점으로">끝점&nbsp;]</button>
<button type="button" data-action="playSelection" title="선택 구간만 재생">▶ 선택 재생</button>
<button type="button" data-action="reset" title="자르기 초기화">초기화</button>
</div>
</div>
<div class="trimBar" id="trimBar">
<div class="trimRangeFill" id="trimRangeFill"></div>
<div class="trimHandle trimHandleStart" id="trimHandleStart" data-handle="start" title="시작 핸들"></div>
<div class="trimHandle trimHandleEnd" id="trimHandleEnd" data-handle="end" title="끝 핸들"></div>
<div class="trimPlayhead" id="trimPlayhead"></div>
</div>
<div class="trimNumericRow">
<label>시작(초) <input type="number" id="startSec" step="0.1" min="0" value="<%= video && video.trim ? video.trim.startSec : 0 %>" /></label>
<span class="trimDuration" id="trimDuration">선택: 0.0초</span>
<label>끝(초, 비우면 끝까지) <input type="number" id="endSec" step="0.1" min="0" value="<%= video && video.trim && video.trim.endSec != null ? video.trim.endSec : '' %>" /></label>
</div>
<p class="muted">재생바의 양쪽 파란 핸들을 끌어 구간을 정합니다. 타임라인을 클릭하면 그 지점으로 이동. 저장하면 ffmpeg 가 원본을 보존한 채 편집본을 만듭니다.</p>
</div>
</div>
</section>
</main>
<script>
window.__EDITOR__ = {
folderPath: <%- jsonForScript(breadcrumb) %>,
folderId: <%- jsonForScript(folder.id) %>,
video: <%- jsonForScript(video) %>
}
</script>
<script src="/static/editor.js"></script>
</body>
</html>