From 956465586ff36c62c5605cd435633c2c4624778f Mon Sep 17 00:00:00 2001 From: Ashley Date: Fri, 5 Jan 2024 16:26:58 +0000 Subject: [PATCH] add school proxy stuff yeah 4r3wedtgerdf --- .../init/pages-channel-and-download.js | 35 +++++++++++++------ 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/src/libpoketube/init/pages-channel-and-download.js b/src/libpoketube/init/pages-channel-and-download.js index f8c61591..36fe32e8 100644 --- a/src/libpoketube/init/pages-channel-and-download.js +++ b/src/libpoketube/init/pages-channel-and-download.js @@ -90,7 +90,11 @@ module.exports = function (app, config, renderTemplate) { const { fetch } = await import("undici"); const search = require("google-it"); + var media_proxy = config.media_proxy; + if (req.useragent.source.includes("Pardus")) { + var media_proxy = "https://media-proxy.ashley0143.xyz"; + } var uaos = req.useragent.os; var IsOldWindows; @@ -151,7 +155,7 @@ module.exports = function (app, config, renderTemplate) { IsOldWindows, tab, continuation, - media_proxy_url: config.media_proxy, + media_proxy_url: media_proxy, results: "", q: query, summary: "", @@ -198,9 +202,9 @@ module.exports = function (app, config, renderTemplate) { const search = require("google-it"); - if (req.query.lucky === 'true') { - res.redirect('/im-feeling-lucky?query=' + query) - } + if (req.query.lucky === "true") { + res.redirect("/im-feeling-lucky?query=" + query); + } var uaos = req.useragent.os; var IsOldWindows; @@ -257,13 +261,22 @@ module.exports = function (app, config, renderTemplate) { app.get("/channel/", async (req, res) => { const { fetch } = await import("undici"); try { - - var ID = req.query.id; - - if (ID.endsWith('@youtube.com')) { - ID = ID.slice(0, -'@youtube.com'.length); + var media_proxy = config.media_proxy; + + if (req.useragent.source.includes("Pardus")) { + var media_proxy = "https://media-proxy.ashley0143.xyz"; } - const tab = req.query.tab; + + var ID = req.query.id; + + if (ID.endsWith("@youtube.com")) { + ID = ID.slice(0, -"@youtube.com".length); + } + + if (ID.endsWith("@poketube.fun")) { + ID = ID.slice(0, -"@poketube.fun".length); + } + const tab = req.query.tab; const cache = {}; try { @@ -368,7 +381,7 @@ module.exports = function (app, config, renderTemplate) { cinv, convert, turntomins, - media_proxy_url: config.media_proxy, + media_proxy_url: media_proxy, dnoreplace, getThumbnailUrl, continuation,