jesus christ

This commit is contained in:
DeSqBlocki committed 2025-12-06 18:07:19 +01:00
1 parent d97600122e
commit 49309d6733
9 files changed
+505 -295

No files matched your search

+27 -24
View File
@@ -130,12 +130,15 @@ exports.status = async (req, res) => {
.sort({ failed_at: -1 })
.toArray();
const settings =
(await db.collection("settings").findOne({ _id: "global" })) || {};
console.log;
res.render("status", {
title: "Queue Status",
queued,
processing,
finished: done,
failed,
global: settings,
});
};
@@ -166,31 +169,31 @@ exports.statusData = async (req, res) => {
.sort({ failed_at: -1 })
.toArray();
// ===========================
// FILE SIZE FOR DONE
// ===========================
for (let job of done) {
try {
const filePath = path.join(process.env.OUTPUT_DIR, `${job.filename}.mp4`);
const stats = fs.statSync(filePath);
job.fileSize = stats.size;
} catch {
job.fileSize = null;
// File sizes
const OUTPUT_DIR = process.env.OUTPUT_DIR || "/mnt/media/WIP";
for (const list of [processing, done]) {
for (const job of list) {
try {
const stat = fs.statSync(path.join(OUTPUT_DIR, `${job.filename}.mp4`));
job.fileSize = stat.size;
} catch {
job.fileSize = null;
}
}
}
// ===========================
// FILE SIZE FOR PROCESSING
// ===========================
for (let job of processing) {
try {
const filePath = path.join(process.env.OUTPUT_DIR, `${job.filename}.mp4`);
const stats = fs.statSync(filePath);
job.fileSize = stats.size;
} catch {
job.fileSize = null;
}
}
// Fetch global settings
const settings = await db.collection("settings").findOne({ _id: "global" }) || {};
settings.captcha_blocked = !!settings.captcha_blocked;
res.json({ queued, processing, done, failed });
// Send JSON including global
res.json({
queued,
processing,
done,
failed,
global: settings,
});
};