remove message length limit

This commit is contained in:
legop3
2026-06-05 00:57:59 -04:00
parent e9f41e6d62
commit 9a8604ea82
+12 -2
View File
@@ -17,7 +17,11 @@ function createHandlers({ sendSystemMessage }) {
const clean = normalized.trim(); const clean = normalized.trim();
if (!clean) return cb({ error: 'Message required' }); if (!clean) return cb({ error: 'Message required' });
if (!withinRateLimit(socket.id)) return cb({ error: 'Slow down' }); if (!withinRateLimit(socket.id)) return cb({ error: 'Slow down' });
if (clean.length > 400) return cb({ error: 'Message too long' }); // This service no longer enforces a character-count ceiling for chat text.
// The chat layer only rejects empty, rate-limited, or moderated content so
// users can send long messages without hitting an arbitrary local cap.
// Transport-specific integrations may still constrain their own payloads
// where an external API or rover-side feature has a real hard limit.
if (hasProfanity(clean)) return cb({ error: 'Message blocked' }); if (hasProfanity(clean)) return cb({ error: 'Message blocked' });
const roverId = resolveRoverId(socket?.id); const roverId = resolveRoverId(socket?.id);
@@ -50,7 +54,13 @@ function createHandlers({ sendSystemMessage }) {
function sendExternalMessage({ text, nickname = 'Discord', role = 'admin', roverId = null, discordGuildId = null, discordGuildName = null, discordGuildIconUrl = null, discordChannelId = null, discordUserId = null, discordUserName = null, discordUserAvatarUrl = null, bot = false, profileImage = null }) { function sendExternalMessage({ text, nickname = 'Discord', role = 'admin', roverId = null, discordGuildId = null, discordGuildName = null, discordGuildIconUrl = null, discordChannelId = null, discordUserId = null, discordUserName = null, discordUserAvatarUrl = null, bot = false, profileImage = null }) {
const normalized = normalizeUserText(text); const normalized = normalizeUserText(text);
const clean = normalized.trim(); const clean = normalized.trim();
if (!clean || clean.length > 400) throw new Error('Message invalid'); // Direct socket chat and bridged external chat intentionally share the
// same validation posture: an empty message is invalid, but message length
// is not capped here. Keeping the character limit out of this service lets
// chat accept long user messages while the downstream integrations that
// have hard platform limits, such as Discord replies or rover TTS, continue
// to enforce their own transport-specific safeguards.
if (!clean) throw new Error('Message invalid');
if (hasProfanity(clean)) throw new Error('Message blocked'); if (hasProfanity(clean)) throw new Error('Message blocked');
if (isKeymash(clean)) throw new Error('Message looks like spam'); if (isKeymash(clean)) throw new Error('Message looks like spam');
if (isPrivateClosedRoverId(roverId)) throw new Error('Private rover chat is closed'); if (isPrivateClosedRoverId(roverId)) throw new Error('Private rover chat is closed');