adding file size limit

This commit is contained in:
localhost 2025-01-17 16:33:27 +01:00
parent 2aca36295a
commit 6ceace0126
1 changed files with 6 additions and 0 deletions

View File

@ -134,6 +134,12 @@ app.ws('/download/:id/:quality', async (ws, req) => {
const videoWriteStream = fs.createWriteStream(`./output/${req.params.id}_video.mp4`) const videoWriteStream = fs.createWriteStream(`./output/${req.params.id}_video.mp4`)
let videoTotal = videoFormat.content_length; let videoTotal = videoFormat.content_length;
if (videoTotal > (1_048_576 * 150)) {
ws.send('Is this content considered high risk? If so, please email me at admin@preservetube.com.')
ws.send('This video is too large, and unfortunately, Preservetube does not have unlimited storage.')
return ws.close()
}
let videoDownloaded = 0; let videoDownloaded = 0;
let videoStartTime = Date.now(); let videoStartTime = Date.now();
const videoPrecentages = [] const videoPrecentages = []