add new popular page

This commit is contained in:
Ashley 2023-10-23 14:49:24 +00:00
parent dad91089b9
commit 75bfa149c0

View file

@ -45,6 +45,11 @@ module.exports = function (app, config, renderTemplate) {
); );
const t = getJson(await invtrend.text()); 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; let j = null;
if (req.query.mobilesearch) { if (req.query.mobilesearch) {
const query = req.query.mobilesearch; const query = req.query.mobilesearch;
@ -59,6 +64,7 @@ module.exports = function (app, config, renderTemplate) {
renderTemplate(res, req, "discover.ejs", { renderTemplate(res, req, "discover.ejs", {
tab: req.query.tab, tab: req.query.tab,
isMobile: req.useragent.isMobile, isMobile: req.useragent.isMobile,
p,
mobilesearch: req.query.mobilesearch, mobilesearch: req.query.mobilesearch,
inv: t, inv: t,
turntomins, turntomins,
@ -74,7 +80,7 @@ module.exports = function (app, config, renderTemplate) {
const rendermainpage = () => { const rendermainpage = () => {
if (req.useragent.isMobile) { if (req.useragent.isMobile) {
return res.redirect("/app?tab=search"); return res.redirect("/app");
} }
return renderTemplate(res, req, "landing.ejs", { return renderTemplate(res, req, "landing.ejs", {