This commit is contained in:
ashley 2025-04-06 19:22:36 +00:00
parent 7188bfdf03
commit 4b33b38e1f

View File

@ -23,7 +23,6 @@ var ping = require("ping");
const sha384 = modules.hash;
const splash = [
"Woke!",
"Gay gay homosexaul gay!",
@ -131,10 +130,7 @@ const splash = [
"stallmansupport.org!!!",
"does include nya~!!!",
"actually stable! :3",
]
];
function getJson(str) {
try {
@ -153,13 +149,16 @@ module.exports = function (app, config, renderTemplate) {
tab = `/?type=${capitalizeFirstLetter(req.query.tab)}`;
}
const invtrend = await fetch(
`${config.invapi}/trending${tab}`
);
const invtrend = await fetch(`${config.invapi}/trending${tab}`, {
headers: { "User-Agent": config.useragent },
});
const t = getJson(await invtrend.text());
const invpopular = await fetch(
`https://invid-api.poketube.fun/bHj665PpYhUdPWuKPfZuQGoX/api/v1/popular`
`https://invid-api.poketube.fun/bHj665PpYhUdPWuKPfZuQGoX/api/v1/popular`,
{
headers: { "User-Agent": config.useragent },
}
);
const p = getJson(await invpopular.text());
@ -190,18 +189,15 @@ module.exports = function (app, config, renderTemplate) {
const uaos = req.useragent.os;
const random = splash[Math.floor(Math.random() * splash.length)];
const browser = req.useragent.browser;
const isOldWindows = (uaos === "Windows 7" || uaos === "Windows 8") && browser === "Firefox";
const isOldWindows =
(uaos === "Windows 7" || uaos === "Windows 8") &&
browser === "Firefox";
var proxyurl = config.p_url;
const secure = [
"poketube.fun",
"localhost" //
].includes(req.hostname);
const verify = [
"poketube.fun",
"poke.ashley0143.xyz",
"localhost"
].includes(req.hostname);
const secure = ["poketube.fun", "localhost"].includes(req.hostname);
const verify = ["poketube.fun", "poke.ashley0143.xyz", "localhost"].includes(
req.hostname
);
const rendermainpage = () => {
if (req.useragent.isMobile) {
@ -210,13 +206,13 @@ module.exports = function (app, config, renderTemplate) {
return renderTemplate(res, req, "landing.ejs", {
secure,
embedtype:req.query.embedtype,
banner:config.banner,
DisablePokeChan:req.query.DisablePokeChan,
embedtype: req.query.embedtype,
banner: config.banner,
DisablePokeChan: req.query.DisablePokeChan,
verify,
isOldWindows,
proxyurl,
random
random,
});
};
@ -225,10 +221,10 @@ module.exports = function (app, config, renderTemplate) {
if (isvld && req.params.v.length >= 10) {
return res.redirect(`/watch?v=${req.params.v}`);
} else {
res.status(404)
res.status(404);
return renderTemplate(res, req, "404.ejs", {
isOldWindows,
random
random,
});
}
}