cdp-core 1.0.2 → 1.0.4

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/README.md CHANGED
@@ -5,7 +5,7 @@ Stealth Exam Assistant for Testpad.
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install -g cdp-exam-solver
8
+ npm install -g cdp-core
9
9
  ```
10
10
 
11
11
  ## Usage
@@ -13,7 +13,7 @@ npm install -g cdp-exam-solver
13
13
  On your other laptop, simply run:
14
14
 
15
15
  ```bash
16
- npx -y cdp-exam-solver
16
+ npx -y cdp-core
17
17
  ```
18
18
 
19
19
  ### What it does:
package/cdp_inject.js CHANGED
@@ -1,7 +1,14 @@
1
1
  #!/usr/bin/env node
2
2
  const http = require('http');
3
3
  const https = require('https');
4
- const WebSocket = require('ws');
4
+ let WebSocket;
5
+ try {
6
+ WebSocket = require('ws');
7
+ } catch (e) {
8
+ console.error('[cdp] ❌ Missing dependency: "ws"');
9
+ console.log('[cdp] 💡 Run: npm install ws');
10
+ process.exit(1);
11
+ }
5
12
  const { exec } = require('child_process');
6
13
  const path = require('path');
7
14
  const fs = require('fs');
@@ -21,8 +28,24 @@ function getNextKey() {
21
28
  }
22
29
 
23
30
  function launchBrowser() {
24
- const p = "C:\\Users\\ASUS\\AppData\\Local\\Programs\\testpad\\testpad.exe";
25
- if (fs.existsSync(p)) exec(`start "" "${p}" --remote-debugging-port=${CDP_PORT}`);
31
+ const userProfile = process.env.USERPROFILE || 'C:\\Users\\' + (process.env.USERNAME || 'Default');
32
+ const paths = [
33
+ path.join(userProfile, "AppData\\Local\\Programs\\testpad\\testpad.exe"),
34
+ "C:\\Program Files\\Google\\Chrome\\Application\\chrome.exe",
35
+ "C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe",
36
+ "C:\\Program Files\\Microsoft\\Edge\\Application\\msedge.exe",
37
+ "C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe"
38
+ ];
39
+
40
+ for (const p of paths) {
41
+ if (fs.existsSync(p)) {
42
+ console.log(`[cdp] 🚀 Launching: ${p}`);
43
+ exec(`start "" "${p}" --remote-debugging-port=${CDP_PORT}`);
44
+ return;
45
+ }
46
+ }
47
+ console.error("[cdp] ❌ Could not find Testpad, Chrome, or Edge automatically.");
48
+ console.log("[cdp] 💡 Please launch your browser manually with: --remote-debugging-port=9222");
26
49
  }
27
50
 
28
51
  const SOLVER_SCRIPT = `
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-core",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Stealth Exam Assistant for Testpad",
5
5
  "main": "cdp_inject.js",
6
6
  "bin": {