1
0
Fork 0
mirror of https://git.sr.ht/~cadence/cloudtube synced 2026-05-26 12:32:25 +00:00

Normalise info for both channels and search

This commit is contained in:
Cadence Ember 2021-01-12 14:53:30 +13:00
parent ac28332ac0
commit c419aa90da
No known key found for this signature in database
GPG key ID: BC1C2C61CF521B17
3 changed files with 28 additions and 11 deletions

View file

@ -2,6 +2,7 @@ const {render} = require("pinski/plugins")
const constants = require("../utils/constants")
const {fetchChannel} = require("../utils/youtube")
const {getUser} = require("../utils/getuser")
const converters = require("../utils/converters")
module.exports = [
{
@ -12,10 +13,11 @@ module.exports = [
const data = await fetchChannel(id, settings.instance)
const subscribed = user.isSubscribed(id)
const instanceOrigin = settings.instance
// apply watched status
// normalise info, apply watched status
const watchedVideos = user.getWatchedVideos()
if (data.latestVideos) {
data.latestVideos.forEach(video => {
converters.normaliseVideoInfo(video)
video.watched = watchedVideos.includes(video.videoId)
})
}