1
0
Fork 0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2026-06-01 06:56:48 +00:00

Add shorts identification by thumbnails

This commit is contained in:
Cadence Ember 2026-05-27 22:52:13 +12:00
parent 095dc3f918
commit 21c3f624b0
7 changed files with 235 additions and 5 deletions

View file

@ -13,6 +13,7 @@ module.exports = [
let channels = []
let missingChannelCount = 0
let refreshed = null
const settings = user.getSettingsOrDefaults()
if (user.token) {
// trigger a background refresh, needed if they came back from being inactive
refresher.skipWaiting()
@ -26,7 +27,7 @@ module.exports = [
// get videos
if (channels.length) {
hasSubscriptions = true
videos = db.prepare(`SELECT Videos.* FROM Videos INNER JOIN Subscriptions ON Videos.authorID = Subscriptions.ucid WHERE token = ? ORDER BY published DESC LIMIT 60`).all(user.token)
videos = db.prepare(`SELECT Videos.* FROM Videos INNER JOIN Subscriptions ON Videos.authorID = Subscriptions.ucid WHERE token = ? AND (short IS NULL OR short <= ?) ORDER BY published DESC LIMIT 60`).all(user.token, +settings.show_shorts + 1)
.map(video => {
video.publishedText = timeToPastText(video.published * 1000)
video.watched = watchedVideos.includes(video.videoId)
@ -37,7 +38,6 @@ module.exports = [
const filters = user.getFilters()
;({videos} = applyVideoFilters(videos, filters))
}
const settings = user.getSettingsOrDefaults()
const instanceOrigin = settings.instance
return render(200, "pug/subscriptions.pug", {req, url, settings, hasSubscriptions, videos, channels, missingChannelCount, refreshed, timeToPastText, instanceOrigin})
}