dashcam 0.8.4 → 1.0.1-beta.10

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.
Files changed (55) hide show
  1. package/.dashcam/cli-config.json +3 -0
  2. package/.dashcam/recording.log +135 -0
  3. package/.dashcam/web-config.json +11 -0
  4. package/.github/RELEASE.md +59 -0
  5. package/.github/workflows/publish.yml +43 -0
  6. package/BACKWARD_COMPATIBILITY.md +177 -0
  7. package/LOG_TRACKING_GUIDE.md +225 -0
  8. package/README.md +709 -155
  9. package/bin/dashcam-background.js +177 -0
  10. package/bin/dashcam.cjs +8 -0
  11. package/bin/dashcam.js +696 -0
  12. package/bin/index.js +63 -0
  13. package/examples/execute-script.js +152 -0
  14. package/examples/simple-test.js +37 -0
  15. package/lib/applicationTracker.js +311 -0
  16. package/lib/auth.js +222 -0
  17. package/lib/binaries.js +21 -0
  18. package/lib/config.js +34 -0
  19. package/lib/extension-logs/helpers.js +182 -0
  20. package/lib/extension-logs/index.js +347 -0
  21. package/lib/extension-logs/manager.js +344 -0
  22. package/lib/ffmpeg.js +155 -0
  23. package/lib/logTracker.js +23 -0
  24. package/lib/logger.js +118 -0
  25. package/lib/logs/index.js +488 -0
  26. package/lib/permissions.js +85 -0
  27. package/lib/processManager.js +317 -0
  28. package/lib/recorder.js +690 -0
  29. package/lib/store.js +58 -0
  30. package/lib/tracking/FileTracker.js +105 -0
  31. package/lib/tracking/FileTrackerManager.js +62 -0
  32. package/lib/tracking/LogsTracker.js +161 -0
  33. package/lib/tracking/active-win.js +212 -0
  34. package/lib/tracking/icons/darwin.js +39 -0
  35. package/lib/tracking/icons/index.js +167 -0
  36. package/lib/tracking/icons/windows.js +27 -0
  37. package/lib/tracking/idle.js +82 -0
  38. package/lib/tracking.js +23 -0
  39. package/lib/uploader.js +456 -0
  40. package/lib/utilities/jsonl.js +77 -0
  41. package/lib/webLogsDaemon.js +234 -0
  42. package/lib/websocket/server.js +223 -0
  43. package/package.json +53 -21
  44. package/recording.log +814 -0
  45. package/sea-bundle.mjs +34595 -0
  46. package/test-page.html +15 -0
  47. package/test.log +1 -0
  48. package/test_run.log +48 -0
  49. package/test_workflow.sh +154 -0
  50. package/examples/crash-test.js +0 -11
  51. package/examples/github-issue.sh +0 -1
  52. package/examples/protocol.html +0 -22
  53. package/index.js +0 -158
  54. package/lib.js +0 -199
  55. package/recorder.js +0 -85
package/recorder.js DELETED
@@ -1,85 +0,0 @@
1
- const fs = require("fs");
2
- const pty = require("@homebridge/node-pty-prebuilt-multiarch");
3
- const process = require("process");
4
- const find = require("find-process");
5
-
6
- class Recorder {
7
- #ptyProcess = null;
8
- #logFile = null;
9
- #silent = false;
10
-
11
- constructor(logFile, silent) {
12
- // This way we don't run the recording script recursively, especially
13
- // if it's inside bash/zsh configs
14
- this.#silent = silent;
15
- if (process.env.DASHCAM_TERMINAL_RECORDING) {
16
- if (!this.#silent)
17
- console.log("The current terminal is already being recorded");
18
- process.exit(0);
19
- }
20
- this.#logFile = logFile;
21
- }
22
-
23
- #onInput(data) {
24
- this.#ptyProcess.write(data);
25
- }
26
-
27
- #onData(data) {
28
- process.stdout.write(data);
29
- fs.appendFileSync(this.#logFile, data, "utf-8");
30
- }
31
-
32
- async start() {
33
- if (!this.#silent) {
34
- console.log("This session is being recorded by Dashcam");
35
- console.log("Type `exit` to stop recording");
36
- }
37
-
38
- // TODO: Find a way to consistently get the current shell this is running from
39
- // instead of using the default user shell (Maybe use parent processId to find
40
- // the process filepath)
41
-
42
- const shell = (
43
- process.env.SHELL ||
44
- (await find("pid", process.ppid).then((arr) => arr[0].bin)) ||
45
- ""
46
- ).trim();
47
-
48
- if (!shell) throw new Error("Could not detect the current shell");
49
-
50
- const args = [];
51
- if (!shell.toLowerCase().includes("powershell")) args.push("-l");
52
- this.#ptyProcess = pty.spawn(shell, args, {
53
- // Inject a terminal variable to let the child processes know
54
- // of the active recording so they we don't record recursively
55
- env: { ...process.env, DASHCAM_TERMINAL_RECORDING: "TRUE" },
56
- cols: process.stdout.columns,
57
- rows: process.stdout.rows,
58
- cwd: process.cwd(),
59
- });
60
-
61
- process.stdout.on("resize", () =>
62
- this.#ptyProcess.resize(process.stdout.columns, process.stdout.rows)
63
- );
64
-
65
- process.stdin.on("data", this.#onInput.bind(this));
66
- this.#ptyProcess.on("data", this.#onData.bind(this));
67
- this.#ptyProcess.on("exit", this.stop.bind(this));
68
-
69
- process.stdout.setDefaultEncoding("utf8");
70
- process.stdin.setEncoding("utf8");
71
- process.stdin.setRawMode(true);
72
- process.stdin.resume();
73
- }
74
-
75
- stop() {
76
- process.stdin.removeListener("data", this.#onInput.bind(this));
77
- process.stdin.setRawMode(false);
78
- process.stdin.pause();
79
- console.clear();
80
- process.kill(process.ppid, "SIGTERM");
81
- process.exit();
82
- }
83
- }
84
-
85
- module.exports = Recorder;