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