fix somethin lel

This commit is contained in:
Ashley 2022-12-16 22:18:03 +00:00
parent 349cc76dfa
commit 1cbb9d29df

View file

@ -68,50 +68,39 @@ async function lyricsFinder(e = "", d = "") {
}
function lightOrDark(color) {
// Variables for red, green, blue values
var r, g, b, hsp;
// Check the format of the color, HEX or RGB?
if (color.match(/^rgb/)) {
// If RGB --> store the red, green, blue values in separate variables
color = color.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/);
color = color.match(
/^rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*(\d+(?:\.\d+)?))?\)$/
);
r = color[1];
g = color[2];
b = color[3];
}
else {
} else {
// If hex --> Convert it to RGB: http://gist.github.com/983661
color = +("0x" + color.slice(1).replace(
color.length < 5 && /./g, '$&$&'));
color = +("0x" + color.slice(1).replace(color.length < 5 && /./g, "$&$&"));
r = color >> 16;
g = color >> 8 & 255;
g = (color >> 8) & 255;
b = color & 255;
}
// HSP (Highly Sensitive Poo) equation from http://alienryderflex.com/hsp.html
hsp = Math.sqrt(
0.299 * (r * r) +
0.587 * (g * g) +
0.114 * (b * b)
);
hsp = Math.sqrt(0.299 * (r * r) + 0.587 * (g * g) + 0.114 * (b * b));
// Using the HSP value, determine whether the color is light or dark
if (hsp > 127.5) {
return 'light';
}
else {
return 'dark';
return "light";
} else {
return "dark";
}
}
module.exports = function (app, config, renderTemplate) {
app.get("/encryption", async function (req, res) {
var v = req.query.v;
@ -172,10 +161,9 @@ module.exports = function (app, config, renderTemplate) {
const ip = JSON.parse(jj);
const isvld = await core.isvalidvideo(v);
if (isvld) {
core.video(v).then((data) => {
if (data) {
const k = data.video;
const json = data.json;
const engagement = data.engagement;
@ -183,7 +171,6 @@ module.exports = function (app, config, renderTemplate) {
const inv_vid = data.vid;
if (data.video) {
if (json) {
if (json.Title) {
if (!data.comments) inv_comments = "Disabled";
@ -237,17 +224,17 @@ module.exports = function (app, config, renderTemplate) {
inv_vid,
lyrics: "",
});
} }
}
});
}
}
} else {
res.redirect("/");
}
});
} else {
res.redirect("/");
}
});
app.get("/lite", async function (req, res) {
/*
@ -271,9 +258,7 @@ module.exports = function (app, config, renderTemplate) {
const ip = JSON.parse(jj);
const isvld = await core.isvalidvideo(v);
if (isvld) {
core.video(v).then((data) => {
const k = data.video;
const json = data.json;
@ -335,8 +320,6 @@ module.exports = function (app, config, renderTemplate) {
});
}
});
} else {
res.redirect("/");
}