From 84c93a21e8eb81d0a28e53c0aac9452391f778b1 Mon Sep 17 00:00:00 2001 From: Violet <110205356+Violets-puragtory@users.noreply.github.com> Date: Thu, 24 Aug 2023 13:48:41 +0000 Subject: [PATCH] Removing the converter, moving it to a seperate project --- index.js | 33 +----------------------- static/converter/index.html | 51 ------------------------------------- 2 files changed, 1 insertion(+), 83 deletions(-) delete mode 100644 static/converter/index.html diff --git a/index.js b/index.js index 2e8bd5f..1ba0307 100644 --- a/index.js +++ b/index.js @@ -3,22 +3,11 @@ const ytdl = require('ytdl-core'), path = require('path'), express = require('express'), ffmpeg = require('fluent-ffmpeg'), - bodyParser = require('body-parser'), - multer = require('multer') + bodyParser = require('body-parser') const PORT = process.env.PORT || 8080 const app = express() -const storage = multer.diskStorage({ - destination: function (req, file, cb) { - cb(null, 'uploads/') - }, - filename: function (req, file, cb) { - const uniqueSuffix = Date.now() + '-' + Math.round(Math.random() * 1E9) - cb(null, file.fieldname + '-' + uniqueSuffix + '-' + file.originalname) - } -}) - app.use(bodyParser.urlencoded({ extended: false })) var jsonParser = bodyParser.json() @@ -43,26 +32,6 @@ app.get("/download", (req, res) => { }); -const upload = multer({ limits: { fieldSize: 100_000_000 }, storage: storage }) - -app.post("/convert", upload.single('video'), (req, res) => { - console.log(req.file.path) - const filename = req.body.filename - const vid = req.file.path - const format = req.body.format - - var proc = new ffmpeg({ source: vid }) - .format(format) - .pipe(res) - .on("end", () => { - console.log("AAAA") - fs.unlinkSync(req.file.path) - }) - - res.header('Content-Disposition', `attachment; filename="${filename}.${format}"`); -}); - - app.use(express.static(path.join(__dirname, 'static'))) app.listen(PORT, function () { diff --git a/static/converter/index.html b/static/converter/index.html deleted file mode 100644 index 338f300..0000000 --- a/static/converter/index.html +++ /dev/null @@ -1,51 +0,0 @@ - - - -
- - - - - - - - -v0.3
-Please consider hosting the project yourself! (Check github for more details)
-Check out the Github page to - learn how to host it yourself, how it works, report bugs, and more.
- - - \ No newline at end of file