Skip to content

armgit / meet

Public Imported from GitHub
0

Open source video conferencing app powered by LiveKit. Built with Django and React.

๐Ÿ”’๏ธ(frontend) validate emoji in notifications to prevent forbidden emoji

lebaudantoine4955f3eea786
diff --git a/src/frontend/src/features/notifications/MainNotificationToast.tsx b/src/frontend/src/features/notifications/MainNotificationToast.tsx
index 0cbeb71f..81520967 100644
--- a/src/frontend/src/features/notifications/MainNotificationToast.tsx
+++ b/src/frontend/src/features/notifications/MainNotificationToast.tsx
@@ -7,7 +7,10 @@ import { NotificationDuration } from './NotificationDuration'
import { Div } from '@/primitives'
import { ChatMessage, isMobileBrowser } from '@livekit/components-core'
import { useNotificationSound } from '@/features/notifications/hooks/useSoundNotification'
-import { Reaction } from '@/features/rooms/livekit/components/controls/ReactionsToggle'
+import {
+ EMOJIS,
+ Reaction,
+} from '@/features/rooms/livekit/components/controls/ReactionsToggle'
import {
ANIMATION_DURATION,
ReactionPortals,
@@ -44,7 +47,7 @@ export const MainNotificationToast = () => {
}, [room, triggerNotificationSound])
const handleEmoji = (emoji: string, participant: Participant) => {
- if (!emoji) return
+ if (!emoji || !EMOJIS.includes(emoji)) return
const id = instanceIdRef.current++
setReactions((prev) => [
...prev,
diff --git a/src/frontend/src/features/rooms/livekit/components/controls/ReactionsToggle.tsx b/src/frontend/src/features/rooms/livekit/components/controls/ReactionsToggle.tsx
index 1d480984..4bfa88e6 100644
--- a/src/frontend/src/features/rooms/livekit/components/controls/ReactionsToggle.tsx
+++ b/src/frontend/src/features/rooms/livekit/components/controls/ReactionsToggle.tsx
@@ -13,7 +13,8 @@ import {
import { Toolbar as RACToolbar } from 'react-aria-components'
import { Participant } from 'livekit-client'
-const EMOJIS = ['๐Ÿ‘', '๐Ÿ‘Ž', '๐Ÿ‘', 'โค๏ธ', '๐Ÿ˜‚', '๐Ÿ˜ฎ', '๐ŸŽ‰']
+// eslint-disable-next-line react-refresh/only-export-components
+export const EMOJIS = ['๐Ÿ‘', '๐Ÿ‘Ž', '๐Ÿ‘', 'โค๏ธ', '๐Ÿ˜‚', '๐Ÿ˜ฎ', '๐ŸŽ‰']
export interface Reaction {
id: number
@@ -144,7 +145,6 @@ export const ReactionsToggle = () => {
</div>
)}
</div>
-
<ReactionPortals reactions={reactions} />
</>
)