current live version
Some checks failed
fetch npm modules / f0ck the f0cker (push) Failing after 1s

This commit is contained in:
Flummi 2024-12-28 12:43:34 +01:00
parent 70df109d1b
commit 65be5dc3e8
3 changed files with 12 additions and 7 deletions

View File

@ -10,7 +10,7 @@ const auth = async (req, res, next) => {
};
export default (router, tpl) => {
router.get(/\/user\/(?<user>.*)/, async (req, res) => {
router.get(/\/user\/(?<user>.*)/, lib.loggedin, async (req, res) => {
const user = decodeURIComponent(req.params.user);
const query = await db`
@ -82,6 +82,9 @@ export default (router, tpl) => {
router.get(/^\/?(?:\/tag\/(?<tag>.+?))?(?:\/user\/(?<user>.+?)\/(?<mode>f0cks|favs))?(?:\/(?<mime>image|audio|video))?(?:\/p\/(?<page>\d+))?(?:\/(?<itemid>\d+))?$/, async (req, res) => {
const mode = req.params.itemid ? 'item' : 'index';
if(mode === 'item' && !req.session)
return res.redirect('/login');
const data = await (req.params.itemid ? f0cklib.getf0ck : f0cklib.getf0cks)({
user: req.params.user,
tag: req.params.tag,

View File

@ -1,8 +1,9 @@
import cfg from "../../inc/config.mjs";
import lib from "../lib.mjs";
import f0cklib from "../routeinc/f0cklib.mjs";
export default (router, tpl) => {
router.get(/^\/random$/, async (req, res) => {
router.get(/^\/random$/, lib.loggedin, async (req, res) => {
let referer = req.headers.referer ?? '';
let opts = {};

View File

@ -73,7 +73,7 @@ export default async bot => {
// is instagram
try {
// @flummi -> is there a variable for the actual work directory so it doesn't have to be hardcoded?
const meta = JSON.parse((await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
const meta = JSON.parse((await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
ext = meta.ext;
} catch(err) {
const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"];
@ -88,7 +88,7 @@ export default async bot => {
else {
// is not instagram
try {
const meta = JSON.parse((await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
const meta = JSON.parse((await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' --skip-download --dump-json "${link}"`)).stdout);
ext = meta.ext;
} catch(err) {
const tmphead = (await fetch(link, { method: "HEAD" })).headers["content-type"];
@ -112,7 +112,7 @@ export default async bot => {
if(link.match(regex.instagram)) {
try {
// add --cookies <path-to-cookies-file> on local instance if you want to avoid getting rate limited
source = (await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
source = (await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
} catch(err) {
if(e.type == 'tg')
return await e.editMessageText(msg.result.chat.id, msg.result.message_id, "instagram dl error");
@ -122,7 +122,8 @@ export default async bot => {
else if(link.match(regex.imgur)) {
// imghure via torsocks
try {
await queue.exec(`torsocks wget ${link} -O ./tmp/${uuid}.${ext}`);
//await queue.exec(`torsocks wget ${link} -O ./tmp/${uuid}.${ext}`);
await queue.exec(`curl -x ${cfg.main.socks} ${link} --output ./tmp/${uuid}.${ext}`);
source = `./tmp/${uuid}.${ext}`;
} catch(err) {
console.error('err:', err);
@ -133,7 +134,7 @@ export default async bot => {
}
else {
try {
source = (await queue.exec(`yt-dlp ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
source = (await queue.exec(`yt-dlp --proxy ${cfg.main.socks} -f 'bv*[height<=720]+ba/b[height<=720] / wv*+ba/w' "${link}" --max-filesize ${maxfilesize / 1024}k --postprocessor-args "ffmpeg:-bitexact" -o "./tmp/${uuid}.%(ext)s" --print after_move:filepath --merge-output-format "mp4"`)).stdout.trim();
} catch(err) {
console.error('err:', err);
if(e.type == 'tg')