hgfd
This commit is contained in:
@@ -7,6 +7,7 @@ import { getEnableItemSlugs } from '../../settings.mjs';
|
|||||||
import { applyWordFilter } from '../../wordfilter.mjs';
|
import { applyWordFilter } from '../../wordfilter.mjs';
|
||||||
import queue from '../../queue.mjs';
|
import queue from '../../queue.mjs';
|
||||||
import path from "path";
|
import path from "path";
|
||||||
|
import f0cklib from "../../routeinc/f0cklib.mjs";
|
||||||
|
|
||||||
// ──────────────────────────────────────────────────────────────────────
|
// ──────────────────────────────────────────────────────────────────────
|
||||||
// In-memory job progress map (keyed by jobId string)
|
// In-memory job progress map (keyed by jobId string)
|
||||||
@@ -503,6 +504,26 @@ export default router => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Broadcast new_item event for live grid updates (only if auto-approved)
|
||||||
|
if (!isApprovalRequired) {
|
||||||
|
f0cklib.clearCountCache();
|
||||||
|
try {
|
||||||
|
await db`SELECT pg_notify('new_item', ${JSON.stringify({
|
||||||
|
id: itemid,
|
||||||
|
dest: filename,
|
||||||
|
mime: 'video/youtube',
|
||||||
|
username: req.session.user,
|
||||||
|
display_name: req.session.display_name || null,
|
||||||
|
tag_id: effectiveRating ? (effectiveRating === 'sfw' ? 1 : (effectiveRating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3))) : 0,
|
||||||
|
is_oc: !!is_oc,
|
||||||
|
slug: itemSlug,
|
||||||
|
visibility: targetVisibility
|
||||||
|
})})`;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[UPLOAD-URL] YouTube new_item notify failed:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return res.json({
|
return res.json({
|
||||||
success: true,
|
success: true,
|
||||||
msg: isApprovalRequired ? 'YouTube video embedded! Pending admin approval.' : 'YouTube video embedded!',
|
msg: isApprovalRequired ? 'YouTube video embedded! Pending admin approval.' : 'YouTube video embedded!',
|
||||||
|
|||||||
@@ -406,6 +406,25 @@ export const handleUpload = async (req, res, self) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!manualApproval) {
|
||||||
|
f0cklib.clearCountCache();
|
||||||
|
try {
|
||||||
|
await db`SELECT pg_notify('new_item', ${JSON.stringify({
|
||||||
|
id: itemid,
|
||||||
|
dest: filename,
|
||||||
|
mime: 'video/youtube',
|
||||||
|
username: req.session.user,
|
||||||
|
display_name: req.session.display_name || null,
|
||||||
|
tag_id: effectiveRating ? (effectiveRating === 'sfw' ? 1 : (effectiveRating === 'nsfw' ? 2 : (cfg.nsfl_tag_id || 3))) : 0,
|
||||||
|
is_oc: !!is_oc,
|
||||||
|
slug: itemSlug,
|
||||||
|
visibility: targetVisibility
|
||||||
|
})})`;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('[UPLOAD] YouTube new_item notify failed:', err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const itemRoute = itemSlug ? `/${itemSlug}` : `/${itemid}`;
|
const itemRoute = itemSlug ? `/${itemSlug}` : `/${itemid}`;
|
||||||
const successMsg = manualApproval ? 'Upload successful! Your upload is pending admin approval.' : 'Upload successful! Your upload is now live.';
|
const successMsg = manualApproval ? 'Upload successful! Your upload is pending admin approval.' : 'Upload successful! Your upload is now live.';
|
||||||
return sendJson(res, {
|
return sendJson(res, {
|
||||||
|
|||||||
Reference in New Issue
Block a user