filter out disabled on latest and search

This commit is contained in:
localhost 2026-04-25 20:11:24 +02:00
parent d06a0e212a
commit 2a833c12b7
2 changed files with 6 additions and 4 deletions

View File

@ -14,12 +14,13 @@ app.get('/latest', async ({ set }) => {
}
const json = await db.selectFrom('videos')
.where('disabled', '=', false)
.select(['id', 'title', 'thumbnail', 'published', 'archived', 'channel', 'channelId', 'channelAvatar', 'channelVerified'])
.orderBy('archived desc')
.limit(51)
.execute()
const html = await m(eta.render('./latest', {
const html = await m(eta.render('./latest', {
data: json,
title: 'Latest | PreserveTube',
}))
@ -56,7 +57,7 @@ app.get('/sitemap-index.xml', async ({ set }) => {
return sitemapIndexXML
})
app.get('/sitemap-:index.xml', async ({ set, params: { index }, error, path }) => {
app.get('/sitemap-:index.xml', async ({ set, params: { index }, error, path }) => {
const indexNum = path.replace('/sitemap-', '').replace('.xml', '')
const cachedSitemap = await redis.get(`sitemap-${indexNum}`);
if (cachedSitemap) {

View File

@ -32,9 +32,10 @@ app.get('/search', async ({ headers, query: { search }, set, redirect, error })
const videos = await db.selectFrom('videos')
.selectAll()
.where('title', 'ilike', `%${search}%`)
.where('disabled', '=', false)
.execute()
const html = await m(eta.render('./search', {
const html = await m(eta.render('./search', {
data: videos,
title: 'Search | PreserveTube',
}))