From a97bded7f522d7ebe30b68b92535f3d0a513ea7d Mon Sep 17 00:00:00 2001 From: biglyderv Date: Mon, 25 Nov 2024 14:12:44 -0500 Subject: [PATCH] some stuff --- form/comment.js | 15 +++++++++++++++ index.js | 3 +++ views/main.ejs | 6 +++--- 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/form/comment.js b/form/comment.js index ba4088a..53e197a 100644 --- a/form/comment.js +++ b/form/comment.js @@ -34,6 +34,21 @@ let main = new Route([auth], async function (req, res, input) { content, 'false' ]); + } else if (targetType == 'video') { + let v = await db.all('SELECT * FROM video WHERE id = ?', [ + targetId + ]); + + if (v.length == 0) return; + + await db.run('INSERT INTO message (username, targetType, targetId, date, content, read) VALUES (?,?,?,?,?,?)', [ + v[0].username, + 'video comment', + u, + +new Date(), + content, + 'false' + ]); } res.send({ 'message': 'Comment sent', redirect: u }); diff --git a/index.js b/index.js index be99a57..72974bc 100644 --- a/index.js +++ b/index.js @@ -10,10 +10,13 @@ const app = express(); const upload = multer({ dest: 'uploads/' }); app.use(cookieParser()); + app.use('/static', express.static('static')); app.use('/videos', express.static('videos')); app.use('/pfp', express.static('pfp')); + app.engine('.ejs', ejs.__express); + app.set('views', './views'); app.set('view engine', 'ejs'); diff --git a/views/main.ejs b/views/main.ejs index 3c5e989..d3fdf18 100644 --- a/views/main.ejs +++ b/views/main.ejs @@ -2,15 +2,15 @@

Follow Feed