stealth-ws 1.0.0
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/LICENSE +21 -0
- package/README.md +273 -0
- package/bin/stealth-bridge.exe +0 -0
- package/lib/cookie-jar.js +276 -0
- package/lib/fingerprint.js +208 -0
- package/lib/index.d.ts +74 -0
- package/lib/index.js +29 -0
- package/lib/websocket.js +416 -0
- package/package.json +58 -0
- package/prebuilds/darwin-x64/stealth-bridge +0 -0
- package/prebuilds/linux-x64/stealth-bridge +0 -0
- package/prebuilds/win32-x64/stealth-bridge.exe +0 -0
- package/scripts/build-all.js +102 -0
- package/scripts/build-go.js +134 -0
- package/scripts/download-binary.js +50 -0
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Post-install script: Copy prebuilt binary to bin/ for current platform
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { join, dirname } from 'path';
|
|
6
|
+
import { fileURLToPath } from 'url';
|
|
7
|
+
import { existsSync, mkdirSync, copyFileSync } from 'fs';
|
|
8
|
+
|
|
9
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
+
const ROOT_DIR = join(__dirname, '..');
|
|
11
|
+
const BIN_DIR = join(ROOT_DIR, 'bin');
|
|
12
|
+
|
|
13
|
+
const PLATFORMS = {
|
|
14
|
+
'win32-x64': { ext: '.exe' },
|
|
15
|
+
'linux-x64': { ext: '' },
|
|
16
|
+
'darwin-x64': { ext: '' }
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
function getPlatform() {
|
|
20
|
+
const key = `${process.platform}-${process.arch}`;
|
|
21
|
+
return PLATFORMS[key] ? key : null;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const platform = getPlatform();
|
|
25
|
+
|
|
26
|
+
if (!platform) {
|
|
27
|
+
console.log('ARM builds not supported (build from source with: npm run build:go)');
|
|
28
|
+
process.exit(0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const ext = PLATFORMS[platform].ext;
|
|
32
|
+
const binaryName = `stealth-bridge${ext}`;
|
|
33
|
+
const srcPath = join(ROOT_DIR, 'prebuilds', platform, binaryName);
|
|
34
|
+
const destPath = join(BIN_DIR, binaryName);
|
|
35
|
+
|
|
36
|
+
if (existsSync(destPath)) {
|
|
37
|
+
process.exit(0);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (!existsSync(srcPath)) {
|
|
41
|
+
console.log(`No prebuilt binary found for ${platform}. Run: npm run build:go`);
|
|
42
|
+
process.exit(0);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (!existsSync(BIN_DIR)) {
|
|
46
|
+
mkdirSync(BIN_DIR, { recursive: true });
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
copyFileSync(srcPath, destPath);
|
|
50
|
+
console.log(`Installed binary: ${destPath}`);
|