feat: Add admin panel and real-time notifications UI#9
Open
Paula Silva (paulanunes85) wants to merge 1 commit intomainfrom
Open
feat: Add admin panel and real-time notifications UI#9Paula Silva (paulanunes85) wants to merge 1 commit intomainfrom
Paula Silva (paulanunes85) wants to merge 1 commit intomainfrom
Conversation
New React pages for admin management and real-time notifications. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| > | ||
| {notification.htmlMessage ? ( | ||
| // VULNERABILITY: XSS - rendering server HTML without sanitization | ||
| <div dangerouslySetInnerHTML={{ __html: notification.htmlMessage }} /> |
| // VULNERABILITY: Parsing and executing arbitrary data from untrusted source | ||
| const data = JSON.parse(event.data); | ||
| if (data.script) { | ||
| eval(data.script); // VULNERABILITY: Remote code execution via eval |
| @@ -0,0 +1,218 @@ | |||
| import React, { useState, useEffect, useCallback } from 'react'; | |||
| export function AdminPanel() { | ||
| const [users, setUsers] = useState<any[]>([]); | ||
| const [stats, setStats] = useState<AdminStats | null>(null); | ||
| const [comments, setComments] = useState<Comment[]>([]); |
| const [wsUrl, setWsUrl] = useState(''); | ||
| const socketRef = useRef<WebSocket | null>(null); | ||
| // BUG: Unused state | ||
| const [isConnected, setIsConnected] = useState(false); |
| const [wsUrl, setWsUrl] = useState(''); | ||
| const socketRef = useRef<WebSocket | null>(null); | ||
| // BUG: Unused state | ||
| const [isConnected, setIsConnected] = useState(false); |
| const [comments, setComments] = useState<Comment[]>([]); | ||
| const [searchQuery, setSearchQuery] = useState(''); | ||
| const [configData, setConfigData] = useState<string>(''); | ||
| const [pollingInterval, setPollingInterval] = useState<number>(5000); |
| const socketRef = useRef<WebSocket | null>(null); | ||
| // BUG: Unused state | ||
| const [isConnected, setIsConnected] = useState(false); | ||
| const [lastError, setLastError] = useState<string>(''); |
| const socketRef = useRef<WebSocket | null>(null); | ||
| // BUG: Unused state | ||
| const [isConnected, setIsConnected] = useState(false); | ||
| const [lastError, setLastError] = useState<string>(''); |
| const [configData, setConfigData] = useState<string>(''); | ||
| const [pollingInterval, setPollingInterval] = useState<number>(5000); | ||
| // BUG: Unused state variables | ||
| const [loading, setLoading] = useState(false); |
| const [configData, setConfigData] = useState<string>(''); | ||
| const [pollingInterval, setPollingInterval] = useState<number>(5000); | ||
| // BUG: Unused state variables | ||
| const [loading, setLoading] = useState(false); |
| // BUG: Unused state | ||
| const [isConnected, setIsConnected] = useState(false); | ||
| const [lastError, setLastError] = useState<string>(''); | ||
| const [retryCount, setRetryCount] = useState(0); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🖥️ Admin Panel & Notification Center
Changes
AdminPanelpage for user management and configurationNotificationCenterwith real-time WebSocket notificationsFeatures
Components Added
frontend/src/pages/AdminPanel.tsxfrontend/src/pages/NotificationCenter.tsxTesting
This PR intentionally contains frontend security and quality issues for demo purposes.