pisse aus meinem arsch
This commit is contained in:
@@ -758,8 +758,8 @@ export default router => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Broadcast new_item event for live grid updates (only if auto-approved)
|
// Broadcast new_item event for live grid updates (only if auto-approved and public)
|
||||||
if (!isApprovalRequired) {
|
if (!isApprovalRequired && targetVisibility === 0) {
|
||||||
try {
|
try {
|
||||||
await db`SELECT pg_notify('new_item', ${JSON.stringify({
|
await db`SELECT pg_notify('new_item', ${JSON.stringify({
|
||||||
id: itemid,
|
id: itemid,
|
||||||
@@ -775,8 +775,8 @@ export default router => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Push to Matrix Channel (only if auto-approved)
|
// Push to Matrix Channel (only if auto-approved and public)
|
||||||
if (!isApprovalRequired) {
|
if (!isApprovalRequired && targetVisibility === 0) {
|
||||||
try {
|
try {
|
||||||
const self = router.self;
|
const self = router.self;
|
||||||
const matrixCfg = cfg.clients?.find(c => c.type === 'matrix');
|
const matrixCfg = cfg.clients?.find(c => c.type === 'matrix');
|
||||||
|
|||||||
@@ -114,7 +114,7 @@ export default (router, tpl) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const f0ck = await db`
|
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
|
from "items" i
|
||||||
left join tags_assign ta on ta.item_id = i.id and ta.tag_id in (1, 2)
|
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
|
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);
|
console.error('[MOD APPROVE] Failed to notify user:', err);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const isPublic = (f0ck[0].visibility || 0) === 0;
|
||||||
|
|
||||||
|
if (isPublic) {
|
||||||
// Push to Discord Webhook (Direct)
|
// Push to Discord Webhook (Direct)
|
||||||
try {
|
try {
|
||||||
const discordClient = cfg.clients.find(c => c.type === 'discord');
|
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);
|
console.error('[MOD APPROVE] new_item notify failed:', err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Move files to public location
|
// Move files to public location
|
||||||
const movePaths = [
|
const movePaths = [
|
||||||
|
|||||||
@@ -211,6 +211,7 @@ db.listen('motd', (payload) => {
|
|||||||
db.listen('new_item', (payload) => {
|
db.listen('new_item', (payload) => {
|
||||||
try {
|
try {
|
||||||
const data = JSON.parse(payload);
|
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`);
|
console.log(`[SSE] Broadcasting new_item (id: ${data.id}) to ${clients.size} clients`);
|
||||||
for (const client of clients) {
|
for (const client of clients) {
|
||||||
client.send({ type: 'new_item', data });
|
client.send({ type: 'new_item', data });
|
||||||
|
|||||||
@@ -717,7 +717,8 @@ export const handleUpload = async (req, res, self) => {
|
|||||||
// Auto-tagging from embedded metadata was removed — the user must select suggestions explicitly.
|
// 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 {
|
try {
|
||||||
const discordClient = cfg.clients.find(c => c.type === 'discord');
|
const discordClient = cfg.clients.find(c => c.type === 'discord');
|
||||||
if (discordClient && discordClient.webhook_url) {
|
if (discordClient && discordClient.webhook_url) {
|
||||||
@@ -741,9 +742,10 @@ export const handleUpload = async (req, res, self) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(`[BACKGROUND ERROR] Discord notification failed:`, err);
|
console.error(`[BACKGROUND ERROR] Discord notification failed:`, err);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Broadcast new_item event for live grid updates (only if auto-approved)
|
// Broadcast new_item event for live grid updates (only if auto-approved and public)
|
||||||
if (!manualApproval) {
|
if (!manualApproval && targetVisibility === 0) {
|
||||||
try {
|
try {
|
||||||
await db`SELECT pg_notify('new_item', ${JSON.stringify({
|
await db`SELECT pg_notify('new_item', ${JSON.stringify({
|
||||||
id: itemid,
|
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 {
|
try {
|
||||||
const matrixCfg = cfg.clients.find(c => c.type === 'matrix');
|
const matrixCfg = cfg.clients.find(c => c.type === 'matrix');
|
||||||
if (matrixCfg?.notification_channel_id && self?.bot?.clients) {
|
if (matrixCfg?.notification_channel_id && self?.bot?.clients) {
|
||||||
@@ -774,6 +777,7 @@ export const handleUpload = async (req, res, self) => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('[UPLOAD] Matrix notification error:', err);
|
console.error('[UPLOAD] Matrix notification error:', err);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Staff Notifications
|
// Staff Notifications
|
||||||
if (manualApproval) {
|
if (manualApproval) {
|
||||||
|
|||||||
Reference in New Issue
Block a user