dashcam 1.0.1-beta.4 → 1.0.1-beta.5

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/dashcam.js CHANGED
@@ -181,8 +181,8 @@ program
181
181
  log('📹 Watch your recording:', uploadResult.shareLink);
182
182
  }
183
183
 
184
- // Clean up process files
185
- processManager.cleanup();
184
+ // Clean up process files, but preserve upload result for stop command
185
+ processManager.cleanup({ preserveResult: true });
186
186
  } catch (error) {
187
187
  logError('Error during shutdown:', error.message);
188
188
  logger.error('Error during shutdown:', error);
@@ -299,7 +299,6 @@ program
299
299
  }
300
300
 
301
301
  console.log('Recording stopped successfully');
302
- console.log('Output saved to:', result.outputPath);
303
302
 
304
303
  // Check if files still exist - if not, background process already uploaded
305
304
  const filesExist = fs.existsSync(result.outputPath) &&
@@ -307,15 +306,21 @@ program
307
306
  (!result.snapshotPath || fs.existsSync(result.snapshotPath));
308
307
 
309
308
  if (!filesExist) {
310
- console.log('✅ Recording was already uploaded by background process');
309
+ // Files were deleted, meaning background process uploaded
310
+ // Wait for the upload result to be written
311
+ logger.debug('Waiting for upload result from background process');
312
+ await new Promise(resolve => setTimeout(resolve, 2000));
311
313
 
312
314
  // Try to read the upload result from the background process
313
315
  const uploadResult = processManager.readUploadResult();
316
+ logger.debug('Upload result read attempt', { found: !!uploadResult, shareLink: uploadResult?.shareLink });
317
+
314
318
  if (uploadResult && uploadResult.shareLink) {
315
- console.log('✅ Recording stopped and uploaded');
316
319
  console.log('📹 Watch your recording:', uploadResult.shareLink);
320
+ // Clean up the result file now that we've read it
321
+ processManager.cleanup();
317
322
  } else {
318
- console.log('✅ Recording stopped and uploaded');
323
+ console.log('✅ Recording uploaded (share link not available)');
319
324
  logger.warn('Upload result not available from background process');
320
325
  }
321
326
 
@@ -337,7 +342,6 @@ program
337
342
  snapshotPath: result.snapshotPath
338
343
  });
339
344
 
340
- console.log('✅ Upload complete!');
341
345
  console.log('📹 Watch your recording:', uploadResult.shareLink);
342
346
  } catch (uploadError) {
343
347
  console.error('Upload failed:', uploadError.message);
@@ -50,11 +50,18 @@ class ProcessManager {
50
50
 
51
51
  writeUploadResult(result) {
52
52
  try {
53
+ logger.info('Writing upload result to file', { path: RESULT_FILE, shareLink: result.shareLink });
53
54
  fs.writeFileSync(RESULT_FILE, JSON.stringify({
54
55
  ...result,
55
56
  timestamp: Date.now()
56
57
  }, null, 2));
57
- logger.debug('Wrote upload result to file', { shareLink: result.shareLink });
58
+ logger.info('Successfully wrote upload result to file');
59
+ // Verify it was written
60
+ if (fs.existsSync(RESULT_FILE)) {
61
+ logger.info('Verified upload result file exists');
62
+ } else {
63
+ logger.error('Upload result file does not exist after write!');
64
+ }
58
65
  } catch (error) {
59
66
  logger.error('Failed to write upload result file', { error });
60
67
  }
@@ -104,7 +111,8 @@ class ProcessManager {
104
111
  const status = this.readStatus();
105
112
 
106
113
  if (!pid || !this.isProcessRunning(pid)) {
107
- this.cleanup();
114
+ // Clean up but preserve upload result in case the background process just finished uploading
115
+ this.cleanup({ preserveResult: true });
108
116
  return false;
109
117
  }
110
118
 
@@ -116,11 +124,12 @@ class ProcessManager {
116
124
  return this.readStatus();
117
125
  }
118
126
 
119
- cleanup() {
127
+ cleanup(options = {}) {
128
+ const { preserveResult = false } = options;
120
129
  try {
121
130
  if (fs.existsSync(PID_FILE)) fs.unlinkSync(PID_FILE);
122
131
  if (fs.existsSync(STATUS_FILE)) fs.unlinkSync(STATUS_FILE);
123
- if (fs.existsSync(RESULT_FILE)) fs.unlinkSync(RESULT_FILE);
132
+ if (!preserveResult && fs.existsSync(RESULT_FILE)) fs.unlinkSync(RESULT_FILE);
124
133
  } catch (error) {
125
134
  logger.error('Failed to cleanup process files', { error });
126
135
  }
@@ -174,8 +183,8 @@ class ProcessManager {
174
183
  hasApps: result.apps?.length > 0
175
184
  });
176
185
 
177
- // Cleanup process files
178
- this.cleanup();
186
+ // Cleanup process files but preserve upload result for stop command
187
+ this.cleanup({ preserveResult: true });
179
188
 
180
189
  return result;
181
190
  } catch (recorderError) {
@@ -193,7 +202,7 @@ class ProcessManager {
193
202
  logs: []
194
203
  };
195
204
 
196
- this.cleanup();
205
+ this.cleanup({ preserveResult: true });
197
206
  return result;
198
207
  }
199
208
  } else {
package/lib/uploader.js CHANGED
@@ -440,9 +440,13 @@ export async function upload(filePath, metadata = {}) {
440
440
  });
441
441
 
442
442
  logExit();
443
+
444
+ // Replace app.dashcam.io with app.testdriver.ai in the share link
445
+ const shareLink = newReplay.replay.shareLink?.replace('app.dashcam.io', 'app.testdriver.ai') || newReplay.replay.shareLink;
446
+
443
447
  return {
444
448
  replay: newReplay.replay,
445
- shareLink: newReplay.replay.shareLink
449
+ shareLink: shareLink
446
450
  };
447
451
  }
448
452
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dashcam",
3
- "version": "1.0.1-beta.4",
3
+ "version": "1.0.1-beta.5",
4
4
  "description": "Minimal CLI version of Dashcam desktop app",
5
5
  "main": "bin/index.js",
6
6
  "bin": {