From e006667ed4b1058fb9e4e1c692b26dbb2e2d5b30 Mon Sep 17 00:00:00 2001 From: Ashley Date: Sun, 13 Nov 2022 14:00:40 +0100 Subject: [PATCH] add /shorts --- src/libpoketube/init/pages-redir.js | 41 ++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/src/libpoketube/init/pages-redir.js b/src/libpoketube/init/pages-redir.js index 0991b8e0..39a1b513 100644 --- a/src/libpoketube/init/pages-redir.js +++ b/src/libpoketube/init/pages-redir.js @@ -1,4 +1,13 @@ - const { fetcher,core, wiki,musicInfo, modules, version, initlog, init,} = require("../libpoketube-initsys.js"); +const { + fetcher, + core, + wiki, + musicInfo, + modules, + version, + initlog, + init, +} = require("../libpoketube-initsys.js"); const { IsJsonString, convert, @@ -11,18 +20,24 @@ const { const sha384 = modules.hash; -module.exports = function (app,config, renderTemplate) { - +module.exports = function (app, config, renderTemplate) { + app.get("/hashtag/:id", (req, res) => { + if (!req.params.id) { + return res.redirect("/"); + } -app.get("/hashtag/:id", (req, res) => { - if (!req.params.id) { - return res.redirect("/"); - } + return res.redirect(`/search?query=${req.params.id}&from=hashtag`); + }); - return res.redirect(`/search?query=${req.params.id}&from=hashtag`); -}); + app.get("/shorts/:id", (req, res) => { + if (!req.params.id) { + return res.redirect("/"); + } -app.get("/video/upload", (req, res) => { - res.redirect("https://youtube.com/upload"); -}); -} \ No newline at end of file + return res.redirect(`/watch?v=${req.params.id}&from=short`); + }); + + app.get("/video/upload", (req, res) => { + res.redirect("https://youtube.com/upload"); + }); +};