From b38fb151ac6c1379b0e053f133537ee55ce9bca2 Mon Sep 17 00:00:00 2001 From: biglyderv Date: Mon, 25 Nov 2024 14:12:44 -0500 Subject: [PATCH] add following feed --- client/main.js | 8 ++++++-- views/main.ejs | 4 ++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/client/main.js b/client/main.js index 58fe4d8..c15c5f4 100644 --- a/client/main.js +++ b/client/main.js @@ -6,11 +6,15 @@ let db = await initDb(); let main = new Route([auth], async function (req, res, input) { let { username } = input; - let videos = await db.all('SELECT * FROM video ORDER BY date DESC LIMIT 10', [ + let videos = await db.all('SELECT * FROM video ORDER BY date DESC LIMIT 20', [ + ]); + let videosFollow = await db.all('SELECT * FROM video WHERE username IN (SELECT target FROM follow WHERE username = ?) ORDER BY date DESC LIMIT 20', [ + username ]); return res.render('main', { username, - videos + videos, + videosFollow }); }); diff --git a/views/main.ejs b/views/main.ejs index 1794cbf..bb7918d 100644 --- a/views/main.ejs +++ b/views/main.ejs @@ -18,6 +18,10 @@ <%- include ('guidelines.ejs') -%> +

Follow Feed

+
+ <%- include('videos.ejs', {videos: videosFollow}) -%> +

Recent Videos

<%- include('videos.ejs') -%>