dashcam 1.3.2-beta → 1.3.4-beta
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 +16 -2
- package/lib/permissions.js +9 -1
- package/lib/recorder.js +5 -3
- package/package.json +1 -1
package/bin/dashcam.js
CHANGED
|
@@ -101,7 +101,13 @@ async function recordingAction(options, command) {
|
|
|
101
101
|
|
|
102
102
|
// Check screen recording permissions (macOS only)
|
|
103
103
|
const { ensurePermissions } = await import('../lib/permissions.js');
|
|
104
|
-
const hasPermissions = await
|
|
104
|
+
const hasPermissions = await Promise.race([
|
|
105
|
+
ensurePermissions(),
|
|
106
|
+
new Promise((resolve) => setTimeout(() => {
|
|
107
|
+
logger.warn('Permission check timed out, assuming permissions granted');
|
|
108
|
+
resolve(true);
|
|
109
|
+
}, 2000))
|
|
110
|
+
]);
|
|
105
111
|
if (!hasPermissions) {
|
|
106
112
|
log('\n⚠️ Cannot start recording without screen recording permission.');
|
|
107
113
|
process.exit(1);
|
|
@@ -111,7 +117,13 @@ async function recordingAction(options, command) {
|
|
|
111
117
|
log('Starting recording in background...');
|
|
112
118
|
|
|
113
119
|
try {
|
|
114
|
-
|
|
120
|
+
|
|
121
|
+
const timeoutPromise = new Promise((_, reject) =>
|
|
122
|
+
setTimeout(() => reject(new Error('Recording start timed out after 10 seconds')), 10000)
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
// Add timeout to prevent hanging
|
|
126
|
+
const startRecordingPromise = processManager.startRecording({
|
|
115
127
|
fps: parseInt(options.fps) || 30,
|
|
116
128
|
audio: options.audio,
|
|
117
129
|
output: options.output,
|
|
@@ -119,6 +131,8 @@ async function recordingAction(options, command) {
|
|
|
119
131
|
description: options.description,
|
|
120
132
|
project: options.project || options.k // Support both -p and -k for project
|
|
121
133
|
});
|
|
134
|
+
|
|
135
|
+
const result = await Promise.race([startRecordingPromise, timeoutPromise]);
|
|
122
136
|
|
|
123
137
|
log(`✅ Recording started successfully (PID: ${result.pid})`);
|
|
124
138
|
log(`Output: ${result.outputPath}`);
|
package/lib/permissions.js
CHANGED
|
@@ -17,7 +17,7 @@ async function checkScreenRecordingPermission() {
|
|
|
17
17
|
// Try to capture a single frame to test permissions
|
|
18
18
|
// This is a quick test that will fail immediately if permissions are denied
|
|
19
19
|
const { stderr } = await execa('screencapture', ['-x', '-t', 'png', '/tmp/dashcam_permission_test.png'], {
|
|
20
|
-
timeout:
|
|
20
|
+
timeout: 1000,
|
|
21
21
|
reject: false
|
|
22
22
|
});
|
|
23
23
|
|
|
@@ -66,6 +66,14 @@ function showPermissionInstructions() {
|
|
|
66
66
|
* Check permissions and show instructions if needed
|
|
67
67
|
*/
|
|
68
68
|
async function ensurePermissions() {
|
|
69
|
+
const platform = os.platform();
|
|
70
|
+
|
|
71
|
+
// Skip permission check entirely on Windows to avoid any potential blocking
|
|
72
|
+
if (platform === 'win32') {
|
|
73
|
+
logger.debug('Windows platform detected, skipping permission check');
|
|
74
|
+
return true;
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
const result = await checkScreenRecordingPermission();
|
|
70
78
|
|
|
71
79
|
if (!result.hasPermission) {
|
package/lib/recorder.js
CHANGED
|
@@ -430,16 +430,18 @@ export async function startRecording({
|
|
|
430
430
|
logger.debug('Starting application tracking...');
|
|
431
431
|
applicationTracker.start();
|
|
432
432
|
|
|
433
|
-
// Start log tracking for this recording
|
|
433
|
+
// Start log tracking for this recording (don't await to avoid blocking)
|
|
434
434
|
const recorderId = path.basename(outputPath).replace('.webm', '');
|
|
435
435
|
logger.debug('Starting log tracking...', { recorderId });
|
|
436
|
-
|
|
436
|
+
logsTrackerManager.startNew({
|
|
437
437
|
recorderId,
|
|
438
438
|
screenId: '1', // Default screen ID for CLI
|
|
439
439
|
directory: path.dirname(outputPath)
|
|
440
|
+
}).catch(error => {
|
|
441
|
+
logger.warn('Failed to start log tracking', { error: error.message });
|
|
440
442
|
});
|
|
441
443
|
|
|
442
|
-
// Set recording start time
|
|
444
|
+
// Set recording start time immediately
|
|
443
445
|
// This ensures the timeline starts when the tracker is ready to capture events
|
|
444
446
|
recordingStartTime = Date.now();
|
|
445
447
|
logger.info('Recording timeline started', {
|