twitter spaces and a ton of improvements
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
export function t(color, tt) {
|
||||
function t(color, tt) {
|
||||
return color + tt + "\x1b[0m"
|
||||
}
|
||||
export function Reset(tt) {
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
import { createHmac, createHash, randomUUID } from "crypto";
|
||||
import { createHmac, randomUUID } from "crypto";
|
||||
|
||||
export function encrypt(str, salt) {
|
||||
return createHmac("sha256", salt).update(str).digest("hex");
|
||||
}
|
||||
export function md5(string) {
|
||||
return createHash('md5').update(string).digest('hex');
|
||||
}
|
||||
export function UUID() {
|
||||
return randomUUID();
|
||||
}
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
import loc from "../../localization/manager.js";
|
||||
|
||||
export function internalError(res) {
|
||||
res.status(501).json({ status: "error", text: "Internal Server Error" });
|
||||
}
|
||||
export function errorUnsupported(lang) {
|
||||
return loc(lang, 'ErrorUnsupported');
|
||||
}
|
||||
|
||||
@@ -30,6 +30,14 @@ export function apiJSON(type, obj) {
|
||||
return { status: 500, body: { status: "error", text: "Internal Server Error" } };
|
||||
}
|
||||
}
|
||||
export function metadataManager(obj) {
|
||||
let keys = Object.keys(obj);
|
||||
let tags = ["album", "composer", "genre", "copyright", "encoded_by", "title", "language", "artist", "album_artist", "performer", "disc", "publisher", "track", "encoder", "compilation", "date", "creation_time", "comment"]
|
||||
let commands = []
|
||||
|
||||
for (let i in keys) { if (tags.includes(keys[i])) commands.push('-metadata', `${keys[i]}=${obj[keys[i]]}`) }
|
||||
return commands;
|
||||
}
|
||||
export function msToTime(d) {
|
||||
let milliseconds = parseInt((d % 1000) / 100, 10),
|
||||
seconds = parseInt((d / 1000) % 60, 10),
|
||||
@@ -49,11 +57,11 @@ export function cleanURL(url, host) {
|
||||
if (url.includes('youtube.com/shorts/')) {
|
||||
url = url.split('?')[0].replace('shorts/', 'watch?v=');
|
||||
}
|
||||
if (host == "youtube") {
|
||||
if (host === "youtube") {
|
||||
url = url.split('&')[0];
|
||||
} else {
|
||||
url = url.split('?')[0];
|
||||
if (url.substring(url.length - 1) == "/") {
|
||||
if (url.substring(url.length - 1) === "/") {
|
||||
url = url.substring(0, url.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user