feat(tools): 관리자 화면에서 ffmpeg/yt-dlp 최신 버전 재설치
오래된 ffmpeg/yt-dlp 로 다운로드·변환이 실패할 때 관리자 대시보드에서 최신 버전으로 재설치할 수 있게 한다. 재설치 바이너리는 data 볼륨 하위 data/bin 에 두어 컨테이너 재생성에도 유지하고, 바이너리 해석 시 PATH 보다 우선 사용한다. - src/paths.ts: binDir(data/bin) 추가 - src/editor.ts: binDir 우선 ffmpeg 해석 + getFfprobePath/resetFfmpegResolution - src/youtube.ts: binDir 우선 yt-dlp 해석 + resetYtDlpResolution - src/tools.ts(신규): 버전 조회 + 최신 재설치(GitHub yt-dlp, johnvansickle ffmpeg) - src/routes/op.ts: GET /op/tools, POST /op/tools/:name/update - views/op/dashboard.ejs, public/dashboard.js, public/styles.css: 도구 관리 UI - Dockerfile: ffmpeg 정적 빌드(.tar.xz) 해제용 xz-utils 추가 Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
This commit is contained in:
@@ -79,4 +79,53 @@
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// 도구 관리(ffmpeg / yt-dlp)
|
||||
function renderTool(name, tool) {
|
||||
var card = document.querySelector('.toolCard[data-tool="' + name + '"]')
|
||||
if (!card) return
|
||||
var versionEl = card.querySelector('[data-field="version"]')
|
||||
var pathEl = card.querySelector('[data-field="path"]')
|
||||
if (!tool || !tool.available) {
|
||||
versionEl.textContent = '설치되지 않음'
|
||||
pathEl.textContent = ''
|
||||
return
|
||||
}
|
||||
versionEl.textContent = (tool.version || '버전 미상') + (tool.managed ? ' · 직접 설치본' : '')
|
||||
pathEl.textContent = tool.path || ''
|
||||
}
|
||||
|
||||
function loadTools() {
|
||||
fetch('/op/tools').then(function (r) { return r.json() }).then(function (j) {
|
||||
if (!j.ok) return
|
||||
renderTool('yt-dlp', j.tools.ytDlp)
|
||||
renderTool('ffmpeg', j.tools.ffmpeg)
|
||||
}).catch(function () {})
|
||||
}
|
||||
|
||||
document.querySelectorAll('[data-action="update-tool"]').forEach(function (btn) {
|
||||
btn.addEventListener('click', function () {
|
||||
var name = btn.getAttribute('data-name')
|
||||
var card = btn.closest('.toolCard')
|
||||
var statusEl = card.querySelector('[data-field="status"]')
|
||||
btn.disabled = true
|
||||
statusEl.textContent = '재설치 중… (수십 초 걸릴 수 있습니다)'
|
||||
fetch('/op/tools/' + encodeURIComponent(name) + '/update', { method: 'POST' })
|
||||
.then(function (r) { return r.json() })
|
||||
.then(function (j) {
|
||||
if (j.ok) {
|
||||
statusEl.textContent = '완료'
|
||||
renderTool(name, j.tool)
|
||||
} else {
|
||||
statusEl.textContent = '실패: ' + (j.message || '알 수 없는 오류')
|
||||
}
|
||||
})
|
||||
.catch(function (err) {
|
||||
statusEl.textContent = '실패: ' + (err && err.message ? err.message : '요청 오류')
|
||||
})
|
||||
.then(function () { btn.disabled = false })
|
||||
})
|
||||
})
|
||||
|
||||
if (document.querySelector('.toolsSection')) loadTools()
|
||||
})()
|
||||
|
||||
Reference in New Issue
Block a user