mirror of
https://codeberg.org/ashley/poke
synced 2025-06-04 21:42:10 +00:00
p2
This commit is contained in:
parent
7188bfdf03
commit
4b33b38e1f
@ -23,7 +23,6 @@ var ping = require("ping");
|
|||||||
|
|
||||||
const sha384 = modules.hash;
|
const sha384 = modules.hash;
|
||||||
|
|
||||||
|
|
||||||
const splash = [
|
const splash = [
|
||||||
"Woke!",
|
"Woke!",
|
||||||
"Gay gay homosexaul gay!",
|
"Gay gay homosexaul gay!",
|
||||||
@ -131,10 +130,7 @@ const splash = [
|
|||||||
"stallmansupport.org!!!",
|
"stallmansupport.org!!!",
|
||||||
"does include nya~!!!",
|
"does include nya~!!!",
|
||||||
"actually stable! :3",
|
"actually stable! :3",
|
||||||
]
|
];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function getJson(str) {
|
function getJson(str) {
|
||||||
try {
|
try {
|
||||||
@ -153,13 +149,16 @@ module.exports = function (app, config, renderTemplate) {
|
|||||||
tab = `/?type=${capitalizeFirstLetter(req.query.tab)}`;
|
tab = `/?type=${capitalizeFirstLetter(req.query.tab)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
const invtrend = await fetch(
|
const invtrend = await fetch(`${config.invapi}/trending${tab}`, {
|
||||||
`${config.invapi}/trending${tab}`
|
headers: { "User-Agent": config.useragent },
|
||||||
);
|
});
|
||||||
const t = getJson(await invtrend.text());
|
const t = getJson(await invtrend.text());
|
||||||
|
|
||||||
const invpopular = await fetch(
|
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());
|
const p = getJson(await invpopular.text());
|
||||||
|
|
||||||
@ -190,18 +189,15 @@ module.exports = function (app, config, renderTemplate) {
|
|||||||
const uaos = req.useragent.os;
|
const uaos = req.useragent.os;
|
||||||
const random = splash[Math.floor(Math.random() * splash.length)];
|
const random = splash[Math.floor(Math.random() * splash.length)];
|
||||||
const browser = req.useragent.browser;
|
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;
|
var proxyurl = config.p_url;
|
||||||
|
|
||||||
const secure = [
|
const secure = ["poketube.fun", "localhost"].includes(req.hostname);
|
||||||
"poketube.fun",
|
const verify = ["poketube.fun", "poke.ashley0143.xyz", "localhost"].includes(
|
||||||
"localhost" //
|
req.hostname
|
||||||
].includes(req.hostname);
|
);
|
||||||
const verify = [
|
|
||||||
"poketube.fun",
|
|
||||||
"poke.ashley0143.xyz",
|
|
||||||
"localhost"
|
|
||||||
].includes(req.hostname);
|
|
||||||
|
|
||||||
const rendermainpage = () => {
|
const rendermainpage = () => {
|
||||||
if (req.useragent.isMobile) {
|
if (req.useragent.isMobile) {
|
||||||
@ -210,13 +206,13 @@ module.exports = function (app, config, renderTemplate) {
|
|||||||
|
|
||||||
return renderTemplate(res, req, "landing.ejs", {
|
return renderTemplate(res, req, "landing.ejs", {
|
||||||
secure,
|
secure,
|
||||||
embedtype:req.query.embedtype,
|
embedtype: req.query.embedtype,
|
||||||
banner:config.banner,
|
banner: config.banner,
|
||||||
DisablePokeChan:req.query.DisablePokeChan,
|
DisablePokeChan: req.query.DisablePokeChan,
|
||||||
verify,
|
verify,
|
||||||
isOldWindows,
|
isOldWindows,
|
||||||
proxyurl,
|
proxyurl,
|
||||||
random
|
random,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -225,10 +221,10 @@ module.exports = function (app, config, renderTemplate) {
|
|||||||
if (isvld && req.params.v.length >= 10) {
|
if (isvld && req.params.v.length >= 10) {
|
||||||
return res.redirect(`/watch?v=${req.params.v}`);
|
return res.redirect(`/watch?v=${req.params.v}`);
|
||||||
} else {
|
} else {
|
||||||
res.status(404)
|
res.status(404);
|
||||||
return renderTemplate(res, req, "404.ejs", {
|
return renderTemplate(res, req, "404.ejs", {
|
||||||
isOldWindows,
|
isOldWindows,
|
||||||
random
|
random,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user