fix(download): constrain playlist list height (#130)

* fix(download): constrain playlist list height

* fix(ci): handle ffmpeg timeout on windows
This commit is contained in:
Nexmoe
2026-01-16 21:58:33 +08:00
committed by GitHub
parent 3d39c9751f
commit 59aee07913
2 changed files with 18 additions and 7 deletions

View File

@@ -329,15 +329,21 @@ function formatBytes(bytes) {
return `${Math.round(bytes / 1024)} KB`
}
function checkBinary(filePath, args, label) {
function checkBinary(filePath, args, label, options = {}) {
const timeoutMs =
typeof options.timeoutMs === 'number'
? options.timeoutMs
: os.platform() === 'win32'
? 20000
: 8000
const result = spawnSync(filePath, args, {
encoding: 'utf8',
timeout: 8000,
timeout: timeoutMs,
windowsHide: true
})
if (result.error) {
return { ok: false, message: result.error.message }
return { ok: false, message: result.error.message, code: result.error.code }
}
if (result.status !== 0) {
@@ -459,10 +465,15 @@ async function downloadFfmpegWindows(config) {
fs.copyFileSync(sourcePath, outputPath)
const validation = checkBinary(outputPath, ['-version'], 'ffmpeg')
if (!validation.ok) {
safeUnlink(outputPath)
throw new Error(`Downloaded ${output} failed version check: ${validation.message}`)
if (validation.code === 'ETIMEDOUT') {
log(`Downloaded ${output} version check timed out; keeping binary`, 'warn')
} else {
safeUnlink(outputPath)
throw new Error(`Downloaded ${output} failed version check: ${validation.message}`)
}
} else {
log(`Downloaded ${output} successfully`, 'success')
}
log(`Downloaded ${output} successfully`, 'success')
// Cleanup
fs.unlinkSync(tempZip)

View File

@@ -91,7 +91,7 @@ export function PlaylistDownload({
</div>
</div>
<ScrollArea className="flex-1 w-full rounded-md border">
<ScrollArea className="flex-1 w-full rounded-md border max-h-[45vh]">
<div className="p-1">
{playlistInfo.entries.map((entry) => {
const isSelected = selectedEntryIds.has(entry.id)