修改自适应
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user