Free, Open Source, Self-Hosted WhatsApp API Gateway
TypeScript apibotgatewayself-hostedwhatsappwhatsapp-apiwhatsapp-automationwhatsapp-botwhatsapp-gatewaywhatsapp-gateway-apiwhatsapp-webwhatsapp-web-api
fix(dashboard): guard the infrastructure route and revoke attachment preview URLs (#508)
Yudhi Armyndharisdaae2fe58e96
diff --git a/dashboard/src/App.tsx b/dashboard/src/App.tsxindex 51becba75..b32e1a952 100644--- a/dashboard/src/App.tsx+++ b/dashboard/src/App.tsx@@ -111,7 +111,7 @@ function AppContent() {{role === 'admin' && <Route path="api-keys" element={<ApiKeys />} />}<Route path="logs" element={<Logs />} /><Route path="message-tester" element={<MessageTester />} />- <Route path="infrastructure" element={<Infrastructure />} />+ {role === 'admin' && <Route path="infrastructure" element={<Infrastructure />} />}{role === 'admin' && <Route path="plugins" element={<Plugins />} />}<Route path="*" element={<Navigate to="/" replace />} /></Route>diff --git a/dashboard/src/pages/Chats.tsx b/dashboard/src/pages/Chats.tsxindex 0245348c6..fd3e419d9 100644--- a/dashboard/src/pages/Chats.tsx+++ b/dashboard/src/pages/Chats.tsx@@ -180,6 +180,15 @@ export function Chats() {}}, [selectedSessionId, loadChats]);+ // Revoke the object URL created for an image-attachment preview once it is replaced, cleared, or+ // the page unmounts. The cleanup runs with the previous value on every change, so this single+ // effect covers all paths (new file, remove, session switch) — otherwise each preview leaks a+ // blob held for the lifetime of the document.+ useEffect(() => {+ if (!previewUrl) return;+ return () => URL.revokeObjectURL(previewUrl);+ }, [previewUrl]);+const markChatRead = useCallback((chatId: string) => {void sessionApi.markChatRead(selectedSessionId, chatId).catch(err => {