mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-10 06:08:34 +01:00
add more redirects :3
This commit is contained in:
parent
c80793cb2e
commit
cdd0cbf72b
1 changed files with 18 additions and 7 deletions
|
@ -108,15 +108,26 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
const poketube_universe_value = "poketube_smart_search";
|
const poketube_universe_value = "poketube_smart_search";
|
||||||
|
|
||||||
if (query?.includes("youtube.com/watch?v=")) {
|
if (query) {
|
||||||
try {
|
let redirectTo = null;
|
||||||
var videoid = query?.split("v=");
|
|
||||||
|
|
||||||
res.redirect("/watch?v=" + videoid[1]);
|
if (query.includes("youtube.com/watch?v=")) {
|
||||||
} catch {
|
redirectTo = "/watch?v=";
|
||||||
return;
|
} else if (query.includes("channel:")) {
|
||||||
}
|
redirectTo = "/channel?id=";
|
||||||
|
} else if (query.includes("video:")) {
|
||||||
|
redirectTo = "/watch?v=";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (redirectTo) {
|
||||||
|
try {
|
||||||
|
const id = query.split(":")[1];
|
||||||
|
res.redirect(`${redirectTo}${id}`);
|
||||||
|
} catch {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (query && query.startsWith("!") && query.length > 2) {
|
if (query && query.startsWith("!") && query.length > 2) {
|
||||||
res.redirect("https://lite.duckduckgo.com/lite/?q=" + query);
|
res.redirect("https://lite.duckduckgo.com/lite/?q=" + query);
|
||||||
|
|
Loading…
Reference in a new issue