dashcam 1.0.1-beta.24 → 1.0.1-beta.25
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 +14 -4
- package/lib/processManager.js +3 -2
- package/lib/systemInfo.js +141 -0
- package/lib/uploader.js +11 -5
- package/package.json +2 -1
package/bin/dashcam.js
CHANGED
|
@@ -417,12 +417,22 @@ program
|
|
|
417
417
|
|
|
418
418
|
console.log('Recording stopped successfully');
|
|
419
419
|
|
|
420
|
-
// Wait
|
|
420
|
+
// Wait for upload to complete (background process handles this)
|
|
421
421
|
logger.debug('Waiting for background upload to complete...');
|
|
422
|
-
|
|
422
|
+
console.log('⏳ Uploading recording...');
|
|
423
|
+
|
|
424
|
+
// Wait up to 2 minutes for upload result to appear
|
|
425
|
+
const maxWaitForUpload = 120000; // 2 minutes
|
|
426
|
+
const startWaitForUpload = Date.now();
|
|
427
|
+
let uploadResult = null;
|
|
428
|
+
|
|
429
|
+
while (!uploadResult && (Date.now() - startWaitForUpload) < maxWaitForUpload) {
|
|
430
|
+
uploadResult = processManager.readUploadResult();
|
|
431
|
+
if (!uploadResult) {
|
|
432
|
+
await new Promise(resolve => setTimeout(resolve, 1000)); // Check every second
|
|
433
|
+
}
|
|
434
|
+
}
|
|
423
435
|
|
|
424
|
-
// Try to read the upload result from the background process
|
|
425
|
-
const uploadResult = processManager.readUploadResult();
|
|
426
436
|
logger.debug('Upload result read attempt', { found: !!uploadResult, shareLink: uploadResult?.shareLink });
|
|
427
437
|
|
|
428
438
|
if (uploadResult && uploadResult.shareLink) {
|
package/lib/processManager.js
CHANGED
|
@@ -160,8 +160,9 @@ class ProcessManager {
|
|
|
160
160
|
logger.info('Stopping active recording process', { pid });
|
|
161
161
|
process.kill(pid, 'SIGINT');
|
|
162
162
|
|
|
163
|
-
// Wait for the process to actually finish
|
|
164
|
-
|
|
163
|
+
// Wait for the process to actually finish and upload
|
|
164
|
+
// Increase timeout to allow for upload to complete
|
|
165
|
+
const maxWaitTime = 120000; // 2 minutes max to allow for upload
|
|
165
166
|
const startWait = Date.now();
|
|
166
167
|
|
|
167
168
|
while (this.isProcessRunning(pid) && (Date.now() - startWait) < maxWaitTime) {
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import si from 'systeminformation';
|
|
2
|
+
import { logger } from './logger.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Collects comprehensive system information including CPU, memory, OS, and graphics data.
|
|
6
|
+
* This matches the data format expected by the Dashcam backend (same as desktop app).
|
|
7
|
+
*
|
|
8
|
+
* @returns {Promise<Object>} System information object
|
|
9
|
+
*/
|
|
10
|
+
export async function getSystemInfo() {
|
|
11
|
+
try {
|
|
12
|
+
logger.debug('Collecting system information...');
|
|
13
|
+
|
|
14
|
+
// Collect only essential system information quickly
|
|
15
|
+
// Graphics info can be very slow, so we skip it or use a short timeout
|
|
16
|
+
const [cpu, mem, osInfo, system] = await Promise.all([
|
|
17
|
+
si.cpu(),
|
|
18
|
+
si.mem(),
|
|
19
|
+
si.osInfo(),
|
|
20
|
+
si.system()
|
|
21
|
+
]);
|
|
22
|
+
|
|
23
|
+
// Try to get graphics info with a very short timeout (optional)
|
|
24
|
+
let graphics = { controllers: [], displays: [] };
|
|
25
|
+
try {
|
|
26
|
+
graphics = await Promise.race([
|
|
27
|
+
si.graphics(),
|
|
28
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('Graphics timeout')), 2000))
|
|
29
|
+
]);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
logger.debug('Graphics info timed out, using empty graphics data');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const systemInfo = {
|
|
35
|
+
cpu: {
|
|
36
|
+
manufacturer: cpu.manufacturer,
|
|
37
|
+
brand: cpu.brand,
|
|
38
|
+
vendor: cpu.vendor,
|
|
39
|
+
family: cpu.family,
|
|
40
|
+
model: cpu.model,
|
|
41
|
+
stepping: cpu.stepping,
|
|
42
|
+
revision: cpu.revision,
|
|
43
|
+
voltage: cpu.voltage,
|
|
44
|
+
speed: cpu.speed,
|
|
45
|
+
speedMin: cpu.speedMin,
|
|
46
|
+
speedMax: cpu.speedMax,
|
|
47
|
+
cores: cpu.cores,
|
|
48
|
+
physicalCores: cpu.physicalCores,
|
|
49
|
+
processors: cpu.processors,
|
|
50
|
+
socket: cpu.socket,
|
|
51
|
+
cache: cpu.cache
|
|
52
|
+
},
|
|
53
|
+
mem: {
|
|
54
|
+
total: mem.total,
|
|
55
|
+
free: mem.free,
|
|
56
|
+
used: mem.used,
|
|
57
|
+
active: mem.active,
|
|
58
|
+
available: mem.available,
|
|
59
|
+
swaptotal: mem.swaptotal,
|
|
60
|
+
swapused: mem.swapused,
|
|
61
|
+
swapfree: mem.swapfree
|
|
62
|
+
},
|
|
63
|
+
os: {
|
|
64
|
+
platform: osInfo.platform,
|
|
65
|
+
distro: osInfo.distro,
|
|
66
|
+
release: osInfo.release,
|
|
67
|
+
codename: osInfo.codename,
|
|
68
|
+
kernel: osInfo.kernel,
|
|
69
|
+
arch: osInfo.arch,
|
|
70
|
+
hostname: osInfo.hostname,
|
|
71
|
+
fqdn: osInfo.fqdn,
|
|
72
|
+
codepage: osInfo.codepage,
|
|
73
|
+
logofile: osInfo.logofile,
|
|
74
|
+
build: osInfo.build,
|
|
75
|
+
servicepack: osInfo.servicepack,
|
|
76
|
+
uefi: osInfo.uefi
|
|
77
|
+
},
|
|
78
|
+
graphics: {
|
|
79
|
+
controllers: graphics.controllers?.map(controller => ({
|
|
80
|
+
vendor: controller.vendor,
|
|
81
|
+
model: controller.model,
|
|
82
|
+
bus: controller.bus,
|
|
83
|
+
vram: controller.vram,
|
|
84
|
+
vramDynamic: controller.vramDynamic
|
|
85
|
+
})),
|
|
86
|
+
displays: graphics.displays?.map(display => ({
|
|
87
|
+
vendor: display.vendor,
|
|
88
|
+
model: display.model,
|
|
89
|
+
main: display.main,
|
|
90
|
+
builtin: display.builtin,
|
|
91
|
+
connection: display.connection,
|
|
92
|
+
resolutionX: display.resolutionX,
|
|
93
|
+
resolutionY: display.resolutionY,
|
|
94
|
+
sizeX: display.sizeX,
|
|
95
|
+
sizeY: display.sizeY,
|
|
96
|
+
pixelDepth: display.pixelDepth,
|
|
97
|
+
currentResX: display.currentResX,
|
|
98
|
+
currentResY: display.currentResY,
|
|
99
|
+
currentRefreshRate: display.currentRefreshRate
|
|
100
|
+
}))
|
|
101
|
+
},
|
|
102
|
+
system: {
|
|
103
|
+
manufacturer: system.manufacturer,
|
|
104
|
+
model: system.model,
|
|
105
|
+
version: system.version,
|
|
106
|
+
serial: system.serial,
|
|
107
|
+
uuid: system.uuid,
|
|
108
|
+
sku: system.sku,
|
|
109
|
+
virtual: system.virtual
|
|
110
|
+
}
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
logger.verbose('System information collected', {
|
|
114
|
+
cpuBrand: cpu.brand,
|
|
115
|
+
totalMemoryGB: (mem.total / (1024 * 1024 * 1024)).toFixed(2),
|
|
116
|
+
os: `${osInfo.distro} ${osInfo.release}`,
|
|
117
|
+
graphicsControllers: graphics.controllers?.length || 0,
|
|
118
|
+
displays: graphics.displays?.length || 0
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
return systemInfo;
|
|
122
|
+
} catch (error) {
|
|
123
|
+
logger.error('Failed to collect system information:', {
|
|
124
|
+
message: error.message,
|
|
125
|
+
stack: error.stack
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
// Return minimal system info as fallback
|
|
129
|
+
return {
|
|
130
|
+
cpu: { brand: 'Unknown', cores: 0 },
|
|
131
|
+
mem: { total: 0 },
|
|
132
|
+
os: {
|
|
133
|
+
platform: process.platform,
|
|
134
|
+
arch: process.arch,
|
|
135
|
+
release: process.version
|
|
136
|
+
},
|
|
137
|
+
graphics: { controllers: [], displays: [] },
|
|
138
|
+
system: { manufacturer: 'Unknown', model: 'Unknown' }
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
}
|
package/lib/uploader.js
CHANGED
|
@@ -5,6 +5,7 @@ import { logger, logFunctionCall } from './logger.js';
|
|
|
5
5
|
import path from 'path';
|
|
6
6
|
import { auth } from './auth.js';
|
|
7
7
|
import got from 'got';
|
|
8
|
+
import { getSystemInfo } from './systemInfo.js';
|
|
8
9
|
|
|
9
10
|
class Uploader {
|
|
10
11
|
constructor() {
|
|
@@ -200,6 +201,15 @@ export async function upload(filePath, metadata = {}) {
|
|
|
200
201
|
hasProject: !!metadata.project
|
|
201
202
|
});
|
|
202
203
|
|
|
204
|
+
// Collect system information
|
|
205
|
+
logger.debug('Collecting system information...');
|
|
206
|
+
const systemInfo = await getSystemInfo();
|
|
207
|
+
logger.verbose('System information collected for upload', {
|
|
208
|
+
cpuBrand: systemInfo.cpu?.brand,
|
|
209
|
+
osDistro: systemInfo.os?.distro,
|
|
210
|
+
totalMemGB: systemInfo.mem?.total ? (systemInfo.mem.total / (1024 * 1024 * 1024)).toFixed(2) : 'unknown'
|
|
211
|
+
});
|
|
212
|
+
|
|
203
213
|
// Handle project ID - use provided project or fetch first available project
|
|
204
214
|
let projectId = metadata.project;
|
|
205
215
|
if (!projectId) {
|
|
@@ -229,11 +239,7 @@ export async function upload(filePath, metadata = {}) {
|
|
|
229
239
|
duration: metadata.duration || 0,
|
|
230
240
|
apps: metadata.apps && metadata.apps.length > 0 ? metadata.apps : ['Screen Recording'], // Use tracked apps or fallback
|
|
231
241
|
title: metadata.title || defaultTitle,
|
|
232
|
-
system:
|
|
233
|
-
platform: process.platform,
|
|
234
|
-
arch: process.arch,
|
|
235
|
-
nodeVersion: process.version
|
|
236
|
-
},
|
|
242
|
+
system: systemInfo, // Include system information
|
|
237
243
|
clientStartDate: metadata.clientStartDate || Date.now() // Use actual recording start time
|
|
238
244
|
};
|
|
239
245
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dashcam",
|
|
3
|
-
"version": "1.0.1-beta.
|
|
3
|
+
"version": "1.0.1-beta.25",
|
|
4
4
|
"description": "Minimal CLI version of Dashcam desktop app",
|
|
5
5
|
"main": "bin/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"mask-sensitive-data": "^0.11.5",
|
|
48
48
|
"node-fetch": "^2.7.0",
|
|
49
49
|
"open": "^9.1.0",
|
|
50
|
+
"systeminformation": "^5.18.15",
|
|
50
51
|
"tail": "^2.2.6",
|
|
51
52
|
"winston": "^3.11.0",
|
|
52
53
|
"ws": "^8.18.3"
|