优化界面布局

This commit is contained in:
CN-JS-HuiBai
2026-04-04 13:30:00 +08:00
parent 7eec653233
commit b76044ef0d
4 changed files with 61 additions and 18 deletions

View File

@@ -495,16 +495,30 @@ const clearDownloadCache = () => {
if (!fs.existsSync(tmpDir)) return;
const files = fs.readdirSync(tmpDir);
for (const file of files) {
if (file.startsWith('s3-input-') && file.endsWith('.tmp')) {
if (file.startsWith('s3-input-') && (file.endsWith('.tmp') || file.endsWith('.downloading'))) {
const filePath = path.join(tmpDir, file);
fs.rmSync(filePath, { force: true });
} else if (file.startsWith('hls-')) {
}
}
} catch (err) {
console.error('Failed to clear download cache:', err);
throw err;
}
};
const clearTranscodeCache = () => {
const tmpDir = CACHE_DIR;
try {
if (!fs.existsSync(tmpDir)) return;
const files = fs.readdirSync(tmpDir);
for (const file of files) {
if (file.startsWith('hls-')) {
const filePath = path.join(tmpDir, file);
fs.rmSync(filePath, { recursive: true, force: true });
}
}
} catch (err) {
console.error('Failed to clear download cache:', err);
console.error('Failed to clear transcode cache:', err);
throw err;
}
};
@@ -618,6 +632,16 @@ app.post('/api/clear-download-cache', (req, res) => {
}
});
app.post('/api/clear-transcode-cache', (req, res) => {
try {
clearTranscodeCache();
res.json({ message: 'Transcode cache cleared' });
} catch (error) {
console.error('Error clearing transcode cache:', error);
res.status(500).json({ error: 'Failed to clear transcode cache', detail: error.message });
}
});
app.post('/api/stop-transcode', (req, res) => {
try {
const { key } = req.body;