From 75bfa149c0660ca83e2d69a390636ffe1116a374 Mon Sep 17 00:00:00 2001 From: Ashley Date: Mon, 23 Oct 2023 14:49:24 +0000 Subject: [PATCH] add new popular page --- src/libpoketube/init/pages-404-and-main.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/libpoketube/init/pages-404-and-main.js b/src/libpoketube/init/pages-404-and-main.js index a9d49c31..e469c827 100644 --- a/src/libpoketube/init/pages-404-and-main.js +++ b/src/libpoketube/init/pages-404-and-main.js @@ -45,6 +45,11 @@ module.exports = function (app, config, renderTemplate) { ); const t = getJson(await invtrend.text()); + const invpopular = await fetch( + `https://invid-api.poketube.fun/api/v1/popular` + ); + const p = getJson(await invpopular.text()); + let j = null; if (req.query.mobilesearch) { const query = req.query.mobilesearch; @@ -59,6 +64,7 @@ module.exports = function (app, config, renderTemplate) { renderTemplate(res, req, "discover.ejs", { tab: req.query.tab, isMobile: req.useragent.isMobile, + p, mobilesearch: req.query.mobilesearch, inv: t, turntomins, @@ -74,7 +80,7 @@ module.exports = function (app, config, renderTemplate) { const rendermainpage = () => { if (req.useragent.isMobile) { - return res.redirect("/app?tab=search"); + return res.redirect("/app"); } return renderTemplate(res, req, "landing.ejs", {