@miraj181/ipingyou 2.0.6 → 2.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@miraj181/ipingyou",
3
- "version": "2.0.6",
3
+ "version": "2.0.8",
4
4
  "description": "SecureLink-CLI — Secure peer-to-peer remote access via SSH & Cloudflare Tunnels",
5
5
  "main": "src/cli.js",
6
6
  "bin": {
package/src/lib/chat.js CHANGED
@@ -190,6 +190,7 @@ const HTML_CONTENT = `
190
190
  input.focus();
191
191
 
192
192
  const encPayload = await encryptPayload({ type: 'join', sender: username });
193
+ ws.send(JSON.stringify({ type: 'join_event', username })); // Send unencrypted name for sidebar
193
194
  ws.send(JSON.stringify({ type: 'e2e', payload: encPayload }));
194
195
  };
195
196
 
@@ -291,8 +292,8 @@ export async function startChatServer(onClose) {
291
292
  // E2E messages just get forwarded to all clients
292
293
  broadcastMsg(data);
293
294
  } else if (data.type === 'join_event') {
294
- // For updating participant count dynamically if we wanted to extract sender,
295
- // but since E2E hides sender, we rely on connection count
295
+ clients.set(ws, data.username || `User_${Math.floor(Math.random()*1000)}`);
296
+ broadcastState();
296
297
  } else if (data.type === 'host_close') {
297
298
  broadcastMsg({ type: 'close' });
298
299
  server.close();
@@ -304,18 +305,11 @@ export async function startChatServer(onClose) {
304
305
  });
305
306
 
306
307
  ws.on('close', () => {
307
- // Since we can't read the encrypted username, we just update state
308
308
  clients.delete(ws);
309
309
  broadcastState();
310
310
  });
311
311
  });
312
312
 
313
- // When connection opens, just assign a generic ID to count them
314
- wss.on('connection', (ws) => {
315
- clients.set(ws, `User_${Math.floor(Math.random()*1000)}`);
316
- broadcastState();
317
- });
318
-
319
313
  server.listen(0, '127.0.0.1', () => {
320
314
  const port = server.address().port;
321
315
  resolve({ port, server });
@@ -124,14 +124,14 @@ async function resolveUID(uid, password, silent = false) {
124
124
  }
125
125
 
126
126
  if (!payloadConfig.url.startsWith('https://')) {
127
- spinner.fail('Decrypted data is not a valid tunnel URL (incorrect password)');
127
+ if (spinner) spinner.fail('Decrypted data is not a valid tunnel URL (incorrect password)');
128
128
  return null;
129
129
  }
130
130
 
131
- spinner.succeed(`Resolved: ${chalk.dim(payloadConfig.url)} ${chalk.green('[decrypted locally]')}`);
131
+ if (spinner) spinner.succeed(`Resolved: ${chalk.dim(payloadConfig.url)} ${chalk.green('[decrypted locally]')}`);
132
132
  return payloadConfig;
133
133
  } catch (err) {
134
- spinner.fail(`Broker lookup failed: ${err.message}`);
134
+ if (spinner) spinner.fail(`Broker lookup failed: ${err.message}`);
135
135
  return null;
136
136
  }
137
137
  }