cdp-saw 1.1.5 → 1.1.6

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 (2) hide show
  1. package/index.js +20 -4
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -65,13 +65,31 @@ function selectBestKey(isHighCost) {
65
65
  return bestKey;
66
66
  }
67
67
 
68
+ const readline = require('readline');
69
+
70
+ function logToFile(msg) {
71
+ const logPath = path.join(process.cwd(), 'cdp-debug.log');
72
+ fs.appendFileSync(logPath, `[${new Date().toISOString()}] ${msg}\n`);
73
+ }
74
+
75
+ function pauseAndExit(msg) {
76
+ console.error(msg);
77
+ logToFile('CRITICAL ERROR: ' + msg);
78
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
79
+ rl.question('\n❌ Error occurred. Press ENTER to close...', () => {
80
+ rl.close();
81
+ process.exit(1);
82
+ });
83
+ }
84
+
68
85
  function findTestpadPath() {
69
86
  const commonPaths = [
70
87
  process.env.LOCALAPPDATA ? path.join(process.env.LOCALAPPDATA, 'Programs', 'testpad', 'testpad.exe') : null,
71
88
  process.env.ProgramFiles ? path.join(process.env.ProgramFiles, 'testpad', 'testpad.exe') : null,
72
89
  process.env['ProgramFiles(x86)'] ? path.join(process.env['ProgramFiles(x86)'], 'testpad', 'testpad.exe') : null,
73
90
  'C:\\Program Files\\testpad\\testpad.exe',
74
- 'C:\\Program Files (x86)\\testpad\\testpad.exe'
91
+ 'C:\\Program Files (x86)\\testpad\\testpad.exe',
92
+ path.join(process.env.USERPROFILE || '', 'AppData', 'Local', 'Programs', 'testpad', 'testpad.exe')
75
93
  ];
76
94
  for (const p of commonPaths) {
77
95
  if (p && fs.existsSync(p)) return p;
@@ -81,9 +99,7 @@ function findTestpadPath() {
81
99
 
82
100
  const TESTPAD_PATH = findTestpadPath();
83
101
  if (!TESTPAD_PATH) {
84
- console.error('[cdp] ❌ ERROR: testpad.exe not found in common locations!');
85
- console.error('[cdp] Please ensure Testpad is installed or provide the path manually.');
86
- process.exit(1);
102
+ pauseAndExit('[cdp] ❌ ERROR: testpad.exe not found! Please make sure Testpad is installed.');
87
103
  }
88
104
 
89
105
  function launchBrowser() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-saw",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "description": "Ultimate Stealth Exam Injector & Ghost Solver for CDP-based proctoring systems.",
5
5
  "main": "index.js",
6
6
  "bin": {