mirror of
https://codeberg.org/ashley/poke.git
synced 2024-11-26 09:58:14 +01:00
lint code :3
This commit is contained in:
parent
d451a834a2
commit
d4521153b1
1 changed files with 283 additions and 279 deletions
|
@ -141,8 +141,8 @@ function lightOrDark(color) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isDntEnabled(req) {
|
function isDntEnabled(req) {
|
||||||
const dntHeader = req.header('DNT');
|
const dntHeader = req.header("DNT");
|
||||||
return dntHeader && (dntHeader === '1' || dntHeader === 'true');
|
return dntHeader && (dntHeader === "1" || dntHeader === "true");
|
||||||
}
|
}
|
||||||
|
|
||||||
function IsInArray(array, id) {
|
function IsInArray(array, id) {
|
||||||
|
@ -203,10 +203,11 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
const secure = ["poketube.fun"].includes(req.hostname);
|
const secure = ["poketube.fun"].includes(req.hostname);
|
||||||
const verify = req.hostname === "poketube.sudovanilla.com";
|
const verify = req.hostname === "poketube.sudovanilla.com";
|
||||||
|
|
||||||
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then((data) => {
|
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then(
|
||||||
|
(data) => {
|
||||||
try {
|
try {
|
||||||
const k = data?.video;
|
const k = data?.video;
|
||||||
const channel_uploads = data?.channel_uploads
|
const channel_uploads = data?.channel_uploads;
|
||||||
const json = data?.json;
|
const json = data?.json;
|
||||||
const engagement = data?.engagement;
|
const engagement = data?.engagement;
|
||||||
const inv_comments = data?.comments || "Disabled";
|
const inv_comments = data?.comments || "Disabled";
|
||||||
|
@ -218,7 +219,6 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
d = desc.toString().replace(/\n/g, " <br> ");
|
d = desc.toString().replace(/\n/g, " <br> ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const descriptionString = String(inv_vid?.description);
|
const descriptionString = String(inv_vid?.description);
|
||||||
|
|
||||||
function extractInfo(regex) {
|
function extractInfo(regex) {
|
||||||
|
@ -234,12 +234,10 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
const reddit = extractInfo(REDDIT_REGEX);
|
const reddit = extractInfo(REDDIT_REGEX);
|
||||||
const instagram = extractInfo(INSTAGRAM_REGEX);
|
const instagram = extractInfo(INSTAGRAM_REGEX);
|
||||||
|
|
||||||
|
|
||||||
var proxyurl = config.p_url;
|
var proxyurl = config.p_url;
|
||||||
var vidurl = u.url;
|
var vidurl = u.url;
|
||||||
var isvidious = u.isInvidiousURL;
|
var isvidious = u.isInvidiousURL;
|
||||||
var mediaproxy = config.media_proxy
|
var mediaproxy = config.media_proxy;
|
||||||
|
|
||||||
|
|
||||||
if (inv_vid?.genre === "Music") {
|
if (inv_vid?.genre === "Music") {
|
||||||
var vidurl = u.losslessurl;
|
var vidurl = u.losslessurl;
|
||||||
|
@ -250,7 +248,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
if (req.useragent.source.includes("Pardus")) {
|
if (req.useragent.source.includes("Pardus")) {
|
||||||
var vidurl = "https://iv.ggtyler.dev";
|
var vidurl = "https://iv.ggtyler.dev";
|
||||||
var mediaproxy = "https://nyc1.pokejan.ggtyler.dev/"
|
var mediaproxy = "https://nyc1.pokejan.ggtyler.dev/";
|
||||||
var isvidious = true;
|
var isvidious = true;
|
||||||
var isSchoolProxy = "";
|
var isSchoolProxy = "";
|
||||||
}
|
}
|
||||||
|
@ -260,7 +258,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
let comments = "";
|
let comments = "";
|
||||||
let nnn = "";
|
let nnn = "";
|
||||||
|
|
||||||
const dnt_val = isDntEnabled(req)
|
const dnt_val = isDntEnabled(req);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
inv_vid?.error ===
|
inv_vid?.error ===
|
||||||
|
@ -272,6 +270,12 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (inv_vid.error) {
|
||||||
|
renderTemplate(res, req, "404.ejs", {
|
||||||
|
v,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
var uaos = req.useragent.os;
|
var uaos = req.useragent.os;
|
||||||
const browser = req.useragent.browser;
|
const browser = req.useragent.browser;
|
||||||
const IsOldWindows =
|
const IsOldWindows =
|
||||||
|
@ -344,7 +348,8 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
|
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/lite", async (req, res) => {
|
app.get("/lite", async (req, res) => {
|
||||||
|
@ -367,10 +372,11 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
const secure = ["poketube.fun"].includes(req.hostname);
|
const secure = ["poketube.fun"].includes(req.hostname);
|
||||||
const verify = req.hostname === "poketube.sudovanilla.com";
|
const verify = req.hostname === "poketube.sudovanilla.com";
|
||||||
|
|
||||||
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then((data) => {
|
INNERTUBE.getYouTubeApiVideo(f, v, contentlang, contentregion).then(
|
||||||
|
(data) => {
|
||||||
try {
|
try {
|
||||||
const k = data?.video;
|
const k = data?.video;
|
||||||
const channel_uploads = data?.channel_uploads
|
const channel_uploads = data?.channel_uploads;
|
||||||
const json = data?.json;
|
const json = data?.json;
|
||||||
const engagement = data?.engagement;
|
const engagement = data?.engagement;
|
||||||
const inv_comments = data?.comments || "Disabled";
|
const inv_comments = data?.comments || "Disabled";
|
||||||
|
@ -382,7 +388,6 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
d = desc.toString().replace(/\n/g, " <br> ");
|
d = desc.toString().replace(/\n/g, " <br> ");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const descriptionString = String(inv_vid?.description);
|
const descriptionString = String(inv_vid?.description);
|
||||||
|
|
||||||
function extractInfo(regex) {
|
function extractInfo(regex) {
|
||||||
|
@ -398,12 +403,10 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
const reddit = extractInfo(REDDIT_REGEX);
|
const reddit = extractInfo(REDDIT_REGEX);
|
||||||
const instagram = extractInfo(INSTAGRAM_REGEX);
|
const instagram = extractInfo(INSTAGRAM_REGEX);
|
||||||
|
|
||||||
|
|
||||||
var proxyurl = config.p_url;
|
var proxyurl = config.p_url;
|
||||||
var vidurl = u.url;
|
var vidurl = u.url;
|
||||||
var isvidious = u.isInvidiousURL;
|
var isvidious = u.isInvidiousURL;
|
||||||
var mediaproxy = config.media_proxy
|
var mediaproxy = config.media_proxy;
|
||||||
|
|
||||||
|
|
||||||
if (inv_vid?.genre === "Music") {
|
if (inv_vid?.genre === "Music") {
|
||||||
var vidurl = u.losslessurl;
|
var vidurl = u.losslessurl;
|
||||||
|
@ -414,7 +417,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
|
|
||||||
if (req.useragent.source.includes("Pardus")) {
|
if (req.useragent.source.includes("Pardus")) {
|
||||||
var vidurl = "https://iv.ggtyler.dev";
|
var vidurl = "https://iv.ggtyler.dev";
|
||||||
var mediaproxy = "https://media-proxy.ashley0143.xyz"
|
var mediaproxy = "https://media-proxy.ashley0143.xyz";
|
||||||
var isvidious = true;
|
var isvidious = true;
|
||||||
var isSchoolProxy = "";
|
var isSchoolProxy = "";
|
||||||
}
|
}
|
||||||
|
@ -424,7 +427,7 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
let comments = "";
|
let comments = "";
|
||||||
let nnn = "";
|
let nnn = "";
|
||||||
|
|
||||||
const dnt_val = isDntEnabled(req)
|
const dnt_val = isDntEnabled(req);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
inv_vid?.error ===
|
inv_vid?.error ===
|
||||||
|
@ -504,7 +507,8 @@ module.exports = function (app, config, renderTemplate) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
|
return res.redirect(`/watch?v=${req.query.v}&fx=1&err=${error}`);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get("/music", async function (req, res) {
|
app.get("/music", async function (req, res) {
|
||||||
|
|
Loading…
Reference in a new issue