jawoll
This commit is contained in:
@ -47,6 +47,7 @@ router.get(/^\/(audio\/?|image\/?|video\/?)?(p\/\d+)?$/, async (req, res) => {
|
||||
},
|
||||
last: query[query.length - 1].id,
|
||||
filter: mime ? mime : undefined,
|
||||
themes: cfg.websrv.themes,
|
||||
theme: (typeof req.cookies.theme !== "undefined" && cfg.websrv.themes.includes(req.cookies.theme)) ? req.cookies.theme : cfg.websrv.themes[0]
|
||||
};
|
||||
|
||||
@ -105,7 +106,7 @@ router.get(/^\/((audio\/|video\/|image\/)?[0-9]+)$/, async (req, res) => {
|
||||
dest: `${cfg.websrv.paths.images}/${query.dest}`,
|
||||
mime: query.mime,
|
||||
size: lib.formatSize(query.size),
|
||||
timestamp: lib.timeAgo(new Date(query.stamp * 1000).toISOString()),
|
||||
timestamp: lib.timeAgo(new Date(query.stamp * 1e3).toISOString()),
|
||||
tags: tags
|
||||
},
|
||||
title: `${query.id} - f0ck.me`,
|
||||
@ -119,14 +120,17 @@ router.get(/^\/((audio\/|video\/|image\/)?[0-9]+)$/, async (req, res) => {
|
||||
link: `/${mime ? mime + "/" : ""}`
|
||||
},
|
||||
filter: mime ? mime : undefined,
|
||||
theme: (typeof req.cookies.theme !== "undefined" && cfg.websrv.themes.includes(req.cookies.theme)) ? req.cookies.theme : cfg.websrv.themes[0]
|
||||
themes: cfg.websrv.themes,
|
||||
theme: (typeof req.cookies.theme !== "undefined" && cfg.websrv.themes.includes(req.cookies.theme)) ? req.cookies.theme : cfg.websrv.themes[0],
|
||||
lul: cfg.websrv.phrases[~~(Math.random() * cfg.websrv.phrases.length)]
|
||||
};
|
||||
res.reply({ body: tpl.render("views/item", data) });
|
||||
});
|
||||
|
||||
router.get(/^\/(contact|help|about)$/, (req, res) => {
|
||||
router.get(/^\/(about)$/, (req, res) => {
|
||||
res.reply({
|
||||
body: tpl.render(`views/${req.url.split[0]}`, {
|
||||
themes: cfg.websrv.themes,
|
||||
theme: (typeof req.cookies.theme !== "undefined" && cfg.websrv.themes.includes(req.cookies.theme)) ? req.cookies.theme : cfg.websrv.themes[0]
|
||||
})
|
||||
});
|
||||
|
14
src/inc/routes/theme.mjs
Normal file
14
src/inc/routes/theme.mjs
Normal file
@ -0,0 +1,14 @@
|
||||
import router from "../router.mjs";
|
||||
import cfg from "../../../config.json";
|
||||
|
||||
router.get(/^\/theme\//, async (req, res) => {
|
||||
let theme = req.url.split[1] ?? cfg.websrv.themes[0];
|
||||
if(!cfg.websrv.themes.includes(theme))
|
||||
theme = cfg.websrv.themes[0];
|
||||
|
||||
return res.writeHead(301, {
|
||||
"Cache-Control": "no-cache, public",
|
||||
"Set-Cookie": `theme=${theme}; Path=/`,
|
||||
"Location": req.headers.referer ?? "/"
|
||||
}).end();
|
||||
});
|
@ -51,7 +51,7 @@ export default async bot => {
|
||||
//meta = JSON.parse((await exec(`youtube-dl -f "bestvideo[ext=mp4,filesize<${maxfilesize}k]+bestaudio/best" --skip-download --dump-json "${link}"`)).stdout);
|
||||
}
|
||||
catch(err) {
|
||||
e.reply("666 - kein b0ck!");
|
||||
e.reply("(╯° °)╯︵ ┻━┻)");
|
||||
console.error(err);
|
||||
return;
|
||||
}
|
||||
@ -59,7 +59,7 @@ export default async bot => {
|
||||
let filename = `${uuid}.${meta.ext}`;
|
||||
|
||||
//e.reply(`downloading ${uuid}...`);
|
||||
e.reply(`[charging the f0cker] downloading: ${uuid}.${meta.ext}`);
|
||||
e.reply(`[charging the f0cker] downloading: ${uuid}`);
|
||||
|
||||
// download data
|
||||
const start = new Date();
|
||||
|
Reference in New Issue
Block a user