poke/src/libpoketube/init/pages-redir.js

84 lines
1.7 KiB
JavaScript
Raw Normal View History

2022-11-13 14:00:40 +01:00
const {
fetcher,
core,
wiki,
musicInfo,
modules,
version,
initlog,
init,
} = require("../libpoketube-initsys.js");
2022-11-09 17:53:26 +01:00
const {
IsJsonString,
convert,
getFirstLine,
capitalizeFirstLetter,
turntomins,
getRandomInt,
getRandomArbitrary,
} = require("../ptutils/libpt-coreutils.js");
const sha384 = modules.hash;
2022-11-13 14:00:40 +01:00
module.exports = function (app, config, renderTemplate) {
app.get("/hashtag/:id", (req, res) => {
if (!req.params.id) {
return res.redirect("/");
}
return res.redirect(`/search?query=${req.params.id}&from=hashtag`);
});
2022-11-09 17:53:26 +01:00
2022-11-13 14:00:40 +01:00
app.get("/shorts/:id", (req, res) => {
if (!req.params.id) {
return res.redirect("/");
}
2022-11-09 17:53:26 +01:00
2022-11-13 14:00:40 +01:00
return res.redirect(`/watch?v=${req.params.id}&from=short`);
});
2022-11-09 17:53:26 +01:00
2022-12-24 13:30:31 +01:00
app.get("/v/:id", (req, res) => {
if (!req.params.id) {
return res.redirect("/");
}
return res.redirect(`/watch?v=${req.params.id}&from=v_url`);
});
app.get("/c/:id", (req, res) => {
if (!req.params.id) {
return res.redirect("/");
}
return res.redirect(`/channel?id=${req.params.id}&from=c_channel_url`);
});
2022-11-13 14:00:40 +01:00
app.get("/video/upload", (req, res) => {
res.redirect("https://youtube.com/upload");
});
2022-12-15 16:53:01 +01:00
2023-06-13 20:31:59 +02:00
app.get("/discover", (req, res) => {
res.redirect("/app");
});
2022-12-15 16:53:01 +01:00
app.get("/sex", (req, res) => {
res.redirect("https://poketube.fun/watch?v=dQw4w9WgXcQ&e=f");
});
2023-01-05 16:43:55 +01:00
app.get("/gaming", (req, res) => {
res.redirect("/discover?tab=gaming");
});
2023-02-23 17:04:35 +01:00
app.get("/custom-theme", (req, res) => {
res.redirect("/customize");
});
2022-12-15 16:53:01 +01:00
app.get("/results", (req, res) => {
if (!req.query.search_query) {
return res.redirect("/");
}
return res.redirect("/search?query=" + req.query.search_query);
});
2022-11-13 14:00:40 +01:00
};