Fix: a Custom Power-up crashed the server (activity log without event type)

alerts.js named redeem alerts for the log from a map without custom_power_up, so
logActivity got event_type undefined -> SQLite NOT NULL error -> uncaught -> the
process exited (the video alert never reached the overlay). Add custom_power_up,
fall back to a generic type, and never let a failed activity-log write crash the server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Bashy 2026-11-22 16:34:57 +02:00
parent a32a55c264
commit 38b2bef2ec
2 changed files with 5 additions and 3 deletions

View file

@ -32,7 +32,9 @@ function dispatchEvent(eventType, eventDetail = null, username = null, data = nu
console.log(`[dispatch] Fired action ${action.id} (${action.name}) — event: ${eventType}, user: ${username}`);
}
db.logActivity(eventType, eventDetail, username, data, fired, replay);
// the log must never take the server down (a bad row once crashed it mid-stream)
try { db.logActivity(eventType || 'unknown', eventDetail, username, data, fired, replay); }
catch (e) { console.error(`[dispatch] activity log failed (${eventType}):`, e.message); }
}
module.exports = { dispatchEvent };