add following feed

This commit is contained in:
biglyderv 2024-10-23 21:52:45 -04:00
parent a9267bf944
commit 220aba76dc
2 changed files with 10 additions and 2 deletions

View file

@ -6,11 +6,15 @@ let db = await initDb();
let main = new Route([auth], async function (req, res, input) { let main = new Route([auth], async function (req, res, input) {
let { username } = 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', { return res.render('main', {
username, username,
videos videos,
videosFollow
}); });
}); });

View file

@ -18,6 +18,10 @@
<%- include ('guidelines.ejs') -%> <%- include ('guidelines.ejs') -%>
</details> </details>
</div> </div>
<h1 class='content-header'>Follow Feed</h1>
<div class=' videos'>
<%- include('videos.ejs', {videos: videosFollow}) -%>
</div>
<h1 class='content-header'>Recent Videos</h1> <h1 class='content-header'>Recent Videos</h1>
<div class=' videos'> <div class=' videos'>
<%- include('videos.ejs') -%> <%- include('videos.ejs') -%>