This commit is contained in:
legop3
2026-04-28 03:34:08 -04:00
parent c4a80202fc
commit bef54d0f2e
8 changed files with 413 additions and 159 deletions
@@ -15,6 +15,11 @@ function buildRequesterLabel(socket) {
return getNickname(socket) || socket?.data?.user?.username || socket?.id || 'unknown';
}
function normalizeReplayTitle(value) {
if (typeof value !== 'string') return '';
return value.trim().slice(0, 120);
}
io.on('connection', (socket) => {
socket.on('replay:trigger', (payload = {}, cb = () => {}) => {
if (getMode() === MODES.LOCKDOWN) {
@@ -37,6 +42,7 @@ io.on('connection', (socket) => {
return;
}
const requester = buildRequesterLabel(socket);
const title = normalizeReplayTitle(payload?.title);
const attempt = tryTriggerReplay({ by: { source: 'web', requester } });
if (!attempt.ok) {
cb({ error: 'Replay cooldown active', remainingMs: attempt.remainingMs, state: attempt.state });
@@ -48,6 +54,7 @@ io.on('connection', (socket) => {
payload: {
channelId,
requester,
title,
sources,
requestedBy: { socketId: socket.id },
},