mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-17 00:14:39 -05:00
add 143 easter egg
This commit is contained in:
parent
05c6b9de6c
commit
9028e48cd7
1 changed files with 46 additions and 38 deletions
48
server.js
48
server.js
|
@ -19,11 +19,13 @@
|
|||
*/
|
||||
|
||||
const { fetcher, core, wiki, musicInfo, modules } = require("./src/libpoketube/loader.js")
|
||||
const { IsJsonString, convert, getFirstLine, capitalizeFirstLetter, turntomins } = require("./src/libpoketube/ptutils/libpt-coreutils.js");
|
||||
const { IsJsonString, convert, getFirstLine, capitalizeFirstLetter, turntomins, getRandomInt, getRandomArbitrary } = require("./src/libpoketube/ptutils/libpt-coreutils.js");
|
||||
|
||||
const templateDir = modules.path.resolve(`${process.cwd()}${modules.path.sep}html`);
|
||||
const templateDir = modules.path.resolve(
|
||||
`${process.cwd()}${modules.path.sep}html`
|
||||
);
|
||||
|
||||
const sha384 = modules.hash
|
||||
const sha384 = modules.hash;
|
||||
|
||||
var app = modules.express();
|
||||
app.engine("html", require("ejs").renderFile);
|
||||
|
@ -278,9 +280,9 @@ app.get("/music", async function (req, res) {
|
|||
renderTemplate(res, req, "poketube-music.ejs", {
|
||||
url: url_e,
|
||||
info: song,
|
||||
color: await modules.getColors(
|
||||
`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`
|
||||
).then((colors) => colors[0].hex()),
|
||||
color: await modules
|
||||
.getColors(`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`)
|
||||
.then((colors) => colors[0].hex()),
|
||||
engagement: engagement,
|
||||
process: process,
|
||||
ip: ip,
|
||||
|
@ -324,9 +326,9 @@ app.get("/download", async function (req, res) {
|
|||
k: k,
|
||||
video: json,
|
||||
date: k.Video.uploadDate,
|
||||
color: await modules.getColors(
|
||||
`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`
|
||||
).then((colors) => colors[0].hex()),
|
||||
color: await modules
|
||||
.getColors(`https://i.ytimg.com/vi/${v}/maxresdefault.jpg`)
|
||||
.then((colors) => colors[0].hex()),
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -363,7 +365,6 @@ app.get("/search", async (req, res) => {
|
|||
.summary(query + " ")
|
||||
.then((summary_) => (summary_.title !== "Not found." ? summary_ : "none"));
|
||||
|
||||
|
||||
renderTemplate(res, req, "search.ejs", {
|
||||
j,
|
||||
continuation,
|
||||
|
@ -377,7 +378,9 @@ app.get("/channel/", async (req, res) => {
|
|||
const tab = req.query.tab;
|
||||
|
||||
// about
|
||||
const bout = await modules.fetch(config.tubeApi + `channel?id=${ID}&tab=about`);
|
||||
const bout = await modules.fetch(
|
||||
config.tubeApi + `channel?id=${ID}&tab=about`
|
||||
);
|
||||
const h = await bout.text();
|
||||
const k = JSON.parse(modules.toJson(h));
|
||||
|
||||
|
@ -443,7 +446,14 @@ app.get("/privacy", function (req, res) {
|
|||
});
|
||||
|
||||
app.get("/143", function (req, res) {
|
||||
var number_easteregg = getRandomArbitrary(0, 150);
|
||||
|
||||
if (number_easteregg == "143") {
|
||||
renderTemplate(res, req, "143.ejs");
|
||||
}
|
||||
if (number_easteregg != "143") {
|
||||
return res.redirect("/");
|
||||
}
|
||||
});
|
||||
|
||||
app.get("/domains", function (req, res) {
|
||||
|
@ -603,15 +613,15 @@ app.get("/", async function (req, res) {
|
|||
|
||||
if (!req.query.tab) var tab = "";
|
||||
|
||||
const invtrend = await modules.fetch(
|
||||
`https://vid.puffyan.us/api/v1/trending${tab}`
|
||||
).then((res) => res.text());
|
||||
const invtrend = await modules
|
||||
.fetch(`https://vid.puffyan.us/api/v1/trending${tab}`)
|
||||
.then((res) => res.text());
|
||||
|
||||
const t = JSON.parse(invtrend);
|
||||
|
||||
if(req.query.mobilesearch) {
|
||||
if (req.query.mobilesearch) {
|
||||
var query = req.query.mobilesearch;
|
||||
tab = "search"
|
||||
tab = "search";
|
||||
if (req.query.continuation) {
|
||||
var continuation = req.query.continuation;
|
||||
}
|
||||
|
@ -625,19 +635,17 @@ tab = "search"
|
|||
|
||||
const text = await search.text();
|
||||
var j = JSON.parse(modules.toJson(text));
|
||||
|
||||
|
||||
}
|
||||
|
||||
renderTemplate(res, req, "main.ejs", {
|
||||
k: k,
|
||||
tab: req.query.tab,
|
||||
isMobile: req.useragent.isMobile,
|
||||
mobilesearch:req.query.mobilesearch,
|
||||
mobilesearch: req.query.mobilesearch,
|
||||
inv: t,
|
||||
turntomins,
|
||||
continuation,
|
||||
j
|
||||
j,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue