From 6ceace01267645f64383fe671669965eabab797f Mon Sep 17 00:00:00 2001 From: localhost Date: Fri, 17 Jan 2025 16:33:27 +0100 Subject: [PATCH] adding file size limit --- index.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/index.js b/index.js index f89b77b..e334ec7 100644 --- a/index.js +++ b/index.js @@ -134,6 +134,12 @@ app.ws('/download/:id/:quality', async (ws, req) => { const videoWriteStream = fs.createWriteStream(`./output/${req.params.id}_video.mp4`) 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 videoStartTime = Date.now(); const videoPrecentages = []