fix: resolve smtp authentication error and notification issues
All checks were successful
Build and Deploy / build-and-push (push) Successful in 2m12s

- Stripped literal quotes from SMTP credentials in nodemailer config to prevent '535 Incorrect auth data' in Docker Swarm.

- Reduced notification polling interval from 60s to 10s for real-time updates.

- Fixed browser autoplay block for audio notifications by properly initializing the audio context.
This commit is contained in:
Cauê Faleiros
2026-03-10 14:37:24 -03:00
parent d3587344a3
commit ab35cf9126
2 changed files with 18 additions and 6 deletions

View File

@@ -46,12 +46,24 @@ export const Layout: React.FC<{ children: React.ReactNode }> = ({ children }) =>
const unreadCount = notifications.filter(n => !n.is_read).length;
const previousUnreadCountRef = React.useRef(0);
const isInitialLoadRef = React.useRef(true);
// Pre-initialize audio to ensure it's loaded and ready
const audioRef = React.useRef<HTMLAudioElement | null>(null);
useEffect(() => {
// Determine base path correctly whether in prod or dev
const basePath = import.meta.env.PROD ? '' : 'http://localhost:3001';
audioRef.current = new Audio(`${basePath}/audio/notification.mp3`);
audioRef.current.volume = 0.5;
}, []);
const playNotificationSound = () => {
if (currentUser?.sound_enabled !== false) {
const audio = new Audio('/audio/notification.mp3');
audio.volume = 0.5;
audio.play().catch(e => console.log('Audio play failed:', e));
if (currentUser?.sound_enabled !== false && audioRef.current) {
// Reset time to 0 to allow rapid replays
audioRef.current.currentTime = 0;
const playPromise = audioRef.current.play();
if (playPromise !== undefined) {
playPromise.catch(e => console.log('Audio play blocked by browser policy:', e));
}
}
};