pisse aus meinem arsch

This commit is contained in:
2026-08-07 22:18:32 +02:00
parent c9f5dc02fa
commit c22ae5bde0
4 changed files with 104 additions and 95 deletions

View File

@@ -758,8 +758,8 @@ export default router => {
}
}
// Broadcast new_item event for live grid updates (only if auto-approved)
if (!isApprovalRequired) {
// Broadcast new_item event for live grid updates (only if auto-approved and public)
if (!isApprovalRequired && targetVisibility === 0) {
try {
await db`SELECT pg_notify('new_item', ${JSON.stringify({
id: itemid,
@@ -775,8 +775,8 @@ export default router => {
}
}
// Push to Matrix Channel (only if auto-approved)
if (!isApprovalRequired) {
// Push to Matrix Channel (only if auto-approved and public)
if (!isApprovalRequired && targetVisibility === 0) {
try {
const self = router.self;
const matrixCfg = cfg.clients?.find(c => c.type === 'matrix');

View File

@@ -114,7 +114,7 @@ export default (router, tpl) => {
}
const f0ck = await db`
select i.dest, i.mime, i.username, i.id, ta.tag_id
select i.dest, i.mime, i.username, i.id, i.visibility, ta.tag_id
from "items" i
left join tags_assign ta on ta.item_id = i.id and ta.tag_id in (1, 2)
where i.id = ${id} and i.active = false
@@ -156,6 +156,9 @@ export default (router, tpl) => {
console.error('[MOD APPROVE] Failed to notify user:', err);
}
const isPublic = (f0ck[0].visibility || 0) === 0;
if (isPublic) {
// Push to Discord Webhook (Direct)
try {
const discordClient = cfg.clients.find(c => c.type === 'discord');
@@ -217,6 +220,7 @@ export default (router, tpl) => {
console.error('[MOD APPROVE] new_item notify failed:', err);
}
}
}
// Move files to public location
const movePaths = [

View File

@@ -211,6 +211,7 @@ db.listen('motd', (payload) => {
db.listen('new_item', (payload) => {
try {
const data = JSON.parse(payload);
if (data.visibility && data.visibility !== 0) return;
console.log(`[SSE] Broadcasting new_item (id: ${data.id}) to ${clients.size} clients`);
for (const client of clients) {
client.send({ type: 'new_item', data });

View File

@@ -717,7 +717,8 @@ export const handleUpload = async (req, res, self) => {
// Auto-tagging from embedded metadata was removed — the user must select suggestions explicitly.
// Discord Webhook
// Discord Webhook (only for public uploads)
if (targetVisibility === 0) {
try {
const discordClient = cfg.clients.find(c => c.type === 'discord');
if (discordClient && discordClient.webhook_url) {
@@ -741,9 +742,10 @@ export const handleUpload = async (req, res, self) => {
} catch (err) {
console.error(`[BACKGROUND ERROR] Discord notification failed:`, err);
}
}
// Broadcast new_item event for live grid updates (only if auto-approved)
if (!manualApproval) {
// Broadcast new_item event for live grid updates (only if auto-approved and public)
if (!manualApproval && targetVisibility === 0) {
try {
await db`SELECT pg_notify('new_item', ${JSON.stringify({
id: itemid,
@@ -759,7 +761,8 @@ export const handleUpload = async (req, res, self) => {
}
}
// Push to Matrix Channel
// Push to Matrix Channel (only if auto-approved and public)
if (!manualApproval && targetVisibility === 0) {
try {
const matrixCfg = cfg.clients.find(c => c.type === 'matrix');
if (matrixCfg?.notification_channel_id && self?.bot?.clients) {
@@ -774,6 +777,7 @@ export const handleUpload = async (req, res, self) => {
} catch (err) {
console.error('[UPLOAD] Matrix notification error:', err);
}
}
// Staff Notifications
if (manualApproval) {