From e01174182c0fd177327fff2b287ddeb0ce1512c9 Mon Sep 17 00:00:00 2001 From: ashley Date: Mon, 15 Jul 2024 20:07:20 +0000 Subject: [PATCH] hm --- .../init/pages-channel-and-download.js | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index 5f8820fb..aa593997 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -317,21 +317,23 @@ var [tj, shorts, playlist, stream, c] = await Promise.all([ - - if (continuation) { - const currentAuthorId = String(cinv.authorId).trim(); - const firstVideoAuthorId = String(tj.videos[0].authorId).trim(); - - if (currentAuthorId.localeCompare(firstVideoAuthorId) !== 0) { - res.status(400).send("Continuation does not match the channel :c"); - } + if (tj) { + if (continuation) { + const currentAuthorId = String(cinv.authorId).trim(); + const firstVideoAuthorId = String(tj.videos[0].authorId).trim(); + + if (currentAuthorId.localeCompare(firstVideoAuthorId) !== 0) { + res.status(400).send("Continuation does not match the channel :c"); + return; // Exit the function after sending the response } + } - const ChannelFirstVideoObject = await fetch( - `${config.invapi}/videos/${tj.videos[0].videoId}` - ) - .then((res) => res.text()) - .then((txt) => getJson(txt)); + var ChannelFirstVideoObject = await fetch( + `${config.invapi}/videos/${tj.videos[0].videoId}` + ) + .then((res) => res.text()) + .then((txt) => getJson(txt)); +} renderTemplate(res, req, "channel.ejs", { ID,