incognitolm commited on
Commit
08380b7
·
1 Parent(s): 6242a4d

Remove IP limit from signin

Browse files
Files changed (1) hide show
  1. server/wsHandler.js +2 -8
server/wsHandler.js CHANGED
@@ -23,14 +23,6 @@ export async function handleWsMessage(ws, msg, wsClients) {
23
  return safeSend(ws, { type: 'error', message: 'turnstile:required' });
24
  }
25
 
26
- if (!client.userId && msg.type !== 'ping' && msg.type !== 'turnstile:verify') {
27
- const allowed = await consumeGuestRequest(client.ip || 'unknown');
28
- if (!allowed) return safeSend(ws, {
29
- type: 'guest:rateLimit',
30
- message: 'Guest request limit exceeded',
31
- });
32
- }
33
-
34
  const h = handlers[msg.type];
35
  if (h) return h(ws, msg, client, wsClients);
36
  safeSend(ws, { type: 'error', message: `Unknown: ${msg.type}` });
@@ -160,6 +152,8 @@ const handlers = {
160
  'chat:send': async (ws, msg, client) => {
161
  const { sessionId, content, tools } = msg;
162
  if (!client.userId) {
 
 
163
  if (!sessionStore.tempCanSend(client.tempId)) return safeSend(ws, { type: 'chat:limitReached' });
164
  sessionStore.tempBump(client.tempId);
165
  }
 
23
  return safeSend(ws, { type: 'error', message: 'turnstile:required' });
24
  }
25
 
 
 
 
 
 
 
 
 
26
  const h = handlers[msg.type];
27
  if (h) return h(ws, msg, client, wsClients);
28
  safeSend(ws, { type: 'error', message: `Unknown: ${msg.type}` });
 
152
  'chat:send': async (ws, msg, client) => {
153
  const { sessionId, content, tools } = msg;
154
  if (!client.userId) {
155
+ const allowed = await consumeGuestRequest(client.ip || 'unknown');
156
+ if (!allowed) return safeSend(ws, { type: 'guest:rateLimit', message: 'Guest request limit exceeded' });
157
  if (!sessionStore.tempCanSend(client.tempId)) return safeSend(ws, { type: 'chat:limitReached' });
158
  sessionStore.tempBump(client.tempId);
159
  }