修改自适应

This commit is contained in:
CN-JS-HuiBai
2026-04-02 17:15:16 +08:00
parent ac01354b59
commit f99417fcc5
2 changed files with 85 additions and 22 deletions

View File

@@ -40,10 +40,15 @@ app.get('/api/videos', async (req, res) => {
const response = await s3Client.send(command);
// Filter out non-mp4 files for this boilerplate
// Filter for common video formats
const videoExtensions = ['.mp4', '.avi', '.mov', '.mkv', '.webm', '.flv', '.wmv', '.m4v'];
const videos = (response.Contents || [])
.map(item => item.Key)
.filter(key => key && key.toLowerCase().endsWith('.mp4'));
.filter(key => {
if (!key) return false;
const lowerKey = key.toLowerCase();
return videoExtensions.some(ext => lowerKey.endsWith(ext));
});
res.json({ videos });
} catch (error) {