deckide 3.5.11 → 3.5.13

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/bin/deckide.js CHANGED
@@ -317,8 +317,8 @@ if (command === 'auth') {
317
317
  const genUser = user || 'admin';
318
318
  const genPassword = password || crypto.randomBytes(16).toString('base64url');
319
319
 
320
- if (password && password.length < 8) {
321
- console.error('Error: password must be at least 8 characters.');
320
+ if (password && password.length < 12) {
321
+ console.error('Error: password must be at least 12 characters.');
322
322
  process.exit(1);
323
323
  }
324
324
 
@@ -370,13 +370,14 @@ if (command === 'logs') {
370
370
  if (follow) {
371
371
  const tail = spawn('tail', ['-f', logFile], { stdio: 'inherit' });
372
372
  tail.on('exit', () => process.exit(0));
373
+ await new Promise(() => {}); // Block until tail exits
373
374
  } else {
374
375
  const lines = fs.readFileSync(logFile, 'utf-8');
375
376
  // Show last 50 lines
376
377
  const arr = lines.split('\n');
377
378
  console.log(arr.slice(-51).join('\n'));
379
+ process.exit(0);
378
380
  }
379
- if (!args.includes('-f') && !args.includes('--follow')) process.exit(0);
380
381
  }
381
382
 
382
383
  // ── deckide stop ──
@@ -11,10 +11,14 @@ export function createTerminalRouter(db, decks, terminals) {
11
11
  const router = new Hono();
12
12
  function appendToTerminalBuffer(session, data) {
13
13
  const newBuffer = session.buffer + data;
14
- session.buffer =
15
- newBuffer.length > TERMINAL_BUFFER_LIMIT
16
- ? newBuffer.slice(newBuffer.length - TERMINAL_BUFFER_LIMIT)
17
- : newBuffer;
14
+ if (newBuffer.length > TERMINAL_BUFFER_LIMIT) {
15
+ const excess = newBuffer.length - TERMINAL_BUFFER_LIMIT;
16
+ session.buffer = newBuffer.slice(excess);
17
+ session.bufferBase += excess;
18
+ }
19
+ else {
20
+ session.buffer = newBuffer;
21
+ }
18
22
  }
19
23
  function getNextTerminalIndex(deckId) {
20
24
  const current = deckTerminalCounters.get(deckId) ?? 0;
@@ -116,6 +120,7 @@ export function createTerminalRouter(db, decks, terminals) {
116
120
  createdAt,
117
121
  sockets: new Set(),
118
122
  buffer: '',
123
+ bufferBase: 0,
119
124
  lastActive: Date.now(),
120
125
  write: (data) => { try {
121
126
  term.write(data);
package/dist/websocket.js CHANGED
@@ -88,9 +88,12 @@ export function setupWebSocketServer(server, terminals) {
88
88
  const wss = new WebSocketServer({ server });
89
89
  const WS_ALLOWED_ORIGINS = new Set([
90
90
  `http://localhost:${PORT}`,
91
- 'http://localhost:5173',
92
- 'http://localhost:3000',
93
91
  ]);
92
+ // Add dev origins only in development mode
93
+ if (NODE_ENV !== 'production') {
94
+ WS_ALLOWED_ORIGINS.add('http://localhost:5173');
95
+ WS_ALLOWED_ORIGINS.add('http://localhost:3000');
96
+ }
94
97
  // Allow configured CORS origin for WebSocket too
95
98
  if (CORS_ORIGIN && CORS_ORIGIN !== '*') {
96
99
  WS_ALLOWED_ORIGINS.add(CORS_ORIGIN);
@@ -146,14 +149,27 @@ export function setupWebSocketServer(server, terminals) {
146
149
  session.sockets.add(socket);
147
150
  session.lastActive = Date.now();
148
151
  // Send buffer content if available
149
- // bufferOffset: client sends how many bytes it already received, so we only send the delta
152
+ // bufferOffset: absolute character count the client already received
153
+ // bufferBase: absolute position of buffer[0] (chars dropped from start)
150
154
  const offsetParam = url.searchParams.get('bufferOffset');
151
- const clientBufferOffset = offsetParam ? Math.max(0, parseInt(offsetParam, 10) || 0) : 0;
155
+ const clientOffset = offsetParam ? Math.max(0, parseInt(offsetParam, 10) || 0) : 0;
152
156
  if (session.buffer) {
153
157
  try {
154
- const bufferToSend = clientBufferOffset > 0
155
- ? session.buffer.slice(clientBufferOffset)
156
- : session.buffer;
158
+ const bufferStart = session.bufferBase;
159
+ const bufferEnd = session.bufferBase + session.buffer.length;
160
+ let bufferToSend;
161
+ if (clientOffset <= bufferStart) {
162
+ // Client's last position is before (or at) what we have — send everything
163
+ bufferToSend = session.buffer;
164
+ }
165
+ else if (clientOffset >= bufferEnd) {
166
+ // Client is fully up to date
167
+ bufferToSend = '';
168
+ }
169
+ else {
170
+ // Send only the delta
171
+ bufferToSend = session.buffer.slice(clientOffset - bufferStart);
172
+ }
157
173
  if (bufferToSend) {
158
174
  socket.send(bufferToSend);
159
175
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deckide",
3
- "version": "3.5.11",
3
+ "version": "3.5.13",
4
4
  "description": "Deck IDE - Browser-based IDE with terminal, file explorer, and git integration",
5
5
  "type": "module",
6
6
  "bin": {