From 0a78520be59ccb72cf571b3516090d69c64422f5 Mon Sep 17 00:00:00 2001 From: Sewmina Date: Tue, 3 Jun 2025 06:22:12 +0530 Subject: [PATCH] profanity --- package-lock.json | 10 ++++++++++ package.json | 1 + src/components/GlobalChat.tsx | 8 ++++---- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index 8bc9e0e..6fc4352 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8,6 +8,7 @@ "name": "duelfi", "version": "0.1.0", "dependencies": { + "@2toad/profanity": "^3.1.1", "@coral-xyz/anchor": "^0.31.0", "@fontsource/manrope": "^5.2.5", "@privy-io/react-auth": "^2.7.2", @@ -37,6 +38,15 @@ "typescript": "^5" } }, + "node_modules/@2toad/profanity": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@2toad/profanity/-/profanity-3.1.1.tgz", + "integrity": "sha512-07ny4pCSa4gDrcJ4vZ/WWmiM90+8kv/clXfnDvThf9IJq0GldpjRVdzHCfMwGDs2Y/8eClmTGzKb5tEfUWy/uA==", + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/@adraffy/ens-normalize": { "version": "1.10.1", "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", diff --git a/package.json b/package.json index 865cfc9..5adc9a4 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "lint": "next lint" }, "dependencies": { + "@2toad/profanity": "^3.1.1", "@coral-xyz/anchor": "^0.31.0", "@fontsource/manrope": "^5.2.5", "@privy-io/react-auth": "^2.7.2", diff --git a/src/components/GlobalChat.tsx b/src/components/GlobalChat.tsx index e818611..f982ffd 100644 --- a/src/components/GlobalChat.tsx +++ b/src/components/GlobalChat.tsx @@ -5,7 +5,7 @@ import { usePrivy } from '@privy-io/react-auth'; import { io, Socket } from 'socket.io-client'; import { fetchUserById } from '@/shared/data_fetcher'; import { ChatBubbleLeftIcon, XMarkIcon } from '@heroicons/react/24/outline'; - +import { profanity } from '@2toad/profanity'; interface ChatMessage { id: string; user: string; @@ -139,7 +139,7 @@ export default function GlobalChat() { if (isCollapsed) { return ( -
+
{notification && (
{notification.username}
@@ -157,7 +157,7 @@ export default function GlobalChat() { } return ( -
+

Global Chat

@@ -191,7 +191,7 @@ export default function GlobalChat() { {new Date(msg.timestamp).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}
-
{msg.message}
+
{profanity.censor(msg.message)}
))}