Update mood handling in FalukantService and enhance Socket.io configuration in store
- Modified mood assignment in FalukantService to conditionally wrap mood data in an object based on moodId presence, improving data structure consistency. - Refactored Socket.io initialization in the store to dynamically set the secure option based on the URL scheme, enhancing connection security in production environments.
This commit is contained in:
@@ -3035,7 +3035,7 @@ class FalukantService extends BaseService {
|
|||||||
gender: char2.gender,
|
gender: char2.gender,
|
||||||
firstName: firstNameMap.get(char2.firstName) || 'Unknown',
|
firstName: firstNameMap.get(char2.firstName) || 'Unknown',
|
||||||
nobleTitle: titleMap.get(char2.titleOfNobility) || '',
|
nobleTitle: titleMap.get(char2.titleOfNobility) || '',
|
||||||
mood: moodMap.get(char2.moodId) || null,
|
mood: char2.moodId ? { tr: moodMap.get(char2.moodId) || null } : null,
|
||||||
moodId: char2.moodId,
|
moodId: char2.moodId,
|
||||||
traits: traitsMap.get(char2.id) || []
|
traits: traitsMap.get(char2.id) || []
|
||||||
} : null,
|
} : null,
|
||||||
|
|||||||
53
check-websocket-services.sh
Executable file
53
check-websocket-services.sh
Executable file
@@ -0,0 +1,53 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
echo "=== WebSocket-Services Diagnose ==="
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "1. Prüfe Backend-Service-Status:"
|
||||||
|
sudo systemctl status yourpart-backend --no-pager -l | head -20
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "2. Prüfe Daemon-Service-Status:"
|
||||||
|
sudo systemctl status yourpart-daemon --no-pager -l | head -20
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "3. Prüfe Backend-Logs (letzte 30 Zeilen):"
|
||||||
|
sudo journalctl -u yourpart-backend -n 30 --no-pager | grep -E "(Socket|HTTPS|TLS|Port|4443|2020)" || echo "Keine relevanten Logs gefunden"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "4. Prüfe Daemon-Logs (letzte 30 Zeilen):"
|
||||||
|
sudo journalctl -u yourpart-daemon -n 30 --no-pager | grep -E "(Daemon|WSS|TLS|Port|4551|connection)" || echo "Keine relevanten Logs gefunden"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "5. Prüfe, welche Ports lauschen:"
|
||||||
|
echo " Port 2020 (API):"
|
||||||
|
sudo netstat -tlnp 2>/dev/null | grep ":2020 " || echo " ❌ Port 2020 lauscht nicht"
|
||||||
|
echo " Port 4443 (Socket.io):"
|
||||||
|
sudo netstat -tlnp 2>/dev/null | grep ":4443 " || echo " ❌ Port 4443 lauscht nicht"
|
||||||
|
echo " Port 4551 (Daemon):"
|
||||||
|
sudo netstat -tlnp 2>/dev/null | grep ":4551 " || echo " ❌ Port 4551 lauscht nicht"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "6. Prüfe Firewall-Regeln:"
|
||||||
|
sudo ufw status | grep -E "(4443|4551)" || echo " Keine Firewall-Regeln für diese Ports gefunden"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "7. Prüfe Backend-Umgebungsvariablen:"
|
||||||
|
sudo systemctl show yourpart-backend --property=Environment --no-pager | grep -E "(SOCKET_IO|TLS)" || echo " Keine Socket.io TLS-Variablen gefunden"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "8. Prüfe Daemon-Umgebungsvariablen:"
|
||||||
|
sudo systemctl show yourpart-daemon --property=Environment --no-pager | grep -E "(DAEMON|TLS)" || echo " Keine Daemon TLS-Variablen gefunden"
|
||||||
|
echo ""
|
||||||
|
|
||||||
|
echo "9. Teste TLS-Zertifikate:"
|
||||||
|
if [ -f "/etc/letsencrypt/live/www.your-part.de/privkey.pem" ]; then
|
||||||
|
echo " ✅ Privkey gefunden"
|
||||||
|
else
|
||||||
|
echo " ❌ Privkey nicht gefunden"
|
||||||
|
fi
|
||||||
|
if [ -f "/etc/letsencrypt/live/www.your-part.de/fullchain.pem" ]; then
|
||||||
|
echo " ✅ Fullchain gefunden"
|
||||||
|
else
|
||||||
|
echo " ❌ Fullchain nicht gefunden"
|
||||||
|
fi
|
||||||
@@ -213,10 +213,17 @@ const store = createStore({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const socket = io(socketIoUrl, {
|
// Socket.io-Konfiguration: In Produktion mit HTTPS verwenden wir wss://
|
||||||
secure: true,
|
const socketOptions = {
|
||||||
transports: ['websocket', 'polling']
|
transports: ['websocket', 'polling']
|
||||||
});
|
};
|
||||||
|
|
||||||
|
// Wenn HTTPS verwendet wird, muss secure: true gesetzt sein
|
||||||
|
if (socketIoUrl.startsWith('https://')) {
|
||||||
|
socketOptions.secure = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const socket = io(socketIoUrl, socketOptions);
|
||||||
|
|
||||||
socket.on('connect', () => {
|
socket.on('connect', () => {
|
||||||
state.backendRetryCount = 0; // Reset retry counter on successful connection
|
state.backendRetryCount = 0; // Reset retry counter on successful connection
|
||||||
|
|||||||
Reference in New Issue
Block a user