diff --git a/public/scripts/content-moderation.js b/public/scripts/content-moderation.js index 10c007e..579313e 100644 --- a/public/scripts/content-moderation.js +++ b/public/scripts/content-moderation.js @@ -332,21 +332,21 @@ class ContentModeration { switch(contentType) { case 'explicit': title = '🚫 Conteúdo Explícito Detectado'; - message = 'Este conteúdo pode conter material explícito ou inadequado. Tem certeza que deseja visualizar?'; + message = 'Este conteúdo pode conter material explícito ou inadequado.'; icon = ` `; break; case 'spam': title = '🚫 Possível Spam/Golpe Detectado'; - message = 'Este conteúdo pode ser spam ou tentativa de golpe. Deseja visualizar mesmo assim?'; + message = 'Este conteúdo pode ser spam ou tentativa de golpe.'; icon = ` `; break; case 'offensive': title = '🚫 Conteúdo Ofensivo Detectado'; - message = 'Este conteúdo contém linguagem ofensiva. Deseja visualizar mesmo assim?'; + message = 'Este conteúdo contém linguagem ofensiva.'; icon = ` `; @@ -354,26 +354,48 @@ class ContentModeration { } dialog.innerHTML = ` -
${icon}
-
${title}
-
${message}
-
- - +
+
${icon}
+
${title}
+
${message}
+
+ ${file.type.startsWith('image/') ? + `Preview` : + file.type.startsWith('video/') ? + `` : + `
${file.name}
` + } +
+
+

⚠️ Este conteúdo foi identificado como potencialmente perigoso.

+
+
+ + + +
`; document.body.appendChild(dialog); - const viewButton = dialog.querySelector('.warning-button.view'); - const rejectButton = dialog.querySelector('.warning-button.reject'); + const showButton = dialog.querySelector('.warning-button.show'); + const closeButton = dialog.querySelector('.warning-button.close'); + const blockButton = dialog.querySelector('.warning-button.block'); + const preview = dialog.querySelector('.warning-preview'); - viewButton.onclick = () => { - document.body.removeChild(dialog); - resolve(true); + showButton.onclick = () => { + preview.classList.remove('blurred'); + showButton.style.display = 'none'; }; - rejectButton.onclick = () => { + closeButton.onclick = () => { + document.body.removeChild(dialog); + resolve(false); + }; + + blockButton.onclick = () => { + localStorage.setItem('blockDangerousContent', 'true'); document.body.removeChild(dialog); resolve(false); }; @@ -399,19 +421,19 @@ class ContentModeration { let icon, text; switch(contentType) { case 'explicit': - icon = ` + icon = ` `; text = 'Conteúdo Explícito Detectado'; break; case 'spam': - icon = ` + icon = ` `; text = 'Possível Spam/Golpe Detectado'; break; case 'offensive': - icon = ` + icon = ` `; text = 'Conteúdo Ofensivo Detectado'; @@ -430,9 +452,47 @@ class ContentModeration { processPushNotification(notification) { const text = notification.body || ''; - if (this.hasBlockedWordsWithSubstitutions(text) || this.isSpam(text)) { - notification.body = '🚫 CONTEÚDO BLOQUEADO'; + // Verifica se o texto contém conteúdo ofensivo + const spamCheck = this.isSpam(text); + + if (spamCheck.isSpam) { + // Substitui o texto ofensivo por uma mensagem genérica + notification.title = 'Aviso de Moderação'; notification.icon = '/images/warning-icon.png'; + + // Mensagens específicas para cada tipo de conteúdo + switch(spamCheck.contentType) { + case 'explicit': + notification.body = '🚫 Conteúdo Explícito Bloqueado'; + break; + case 'spam': + notification.body = '🚫 Possível Spam/Golpe Detectado'; + break; + case 'offensive': + notification.body = '🚫 Conteúdo Ofensivo Detectado'; + break; + case 'scam': + notification.body = '🚫 Possível Golpe Detectado'; + break; + default: + notification.body = '🚫 Conteúdo Bloqueado'; + } + + // Adiciona um timestamp para evitar duplicatas + notification.tag = `blocked-${Date.now()}`; + + // Adiciona opções extras para a notificação + notification.options = { + ...notification.options, + requireInteraction: true, + vibrate: [200, 100, 200], + actions: [ + { + action: 'close', + title: 'Fechar' + } + ] + }; } return notification;