app-manager-edge-worker 1.0.8 → 1.1.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.txt +21 -0
- package/README.md +13 -0
- package/bin/worker.js +16 -16
- package/package.json +49 -46
- package/src/banner.js +80 -80
- package/src/client.js +351 -300
- package/src/config.js +1 -1
- package/src/handlers/mailHandler.js +74 -74
- package/src/handlers/previewHandler.js +647 -557
- package/src/handlers/scrapeHandler.js +887 -887
- package/src/handlers/transformUtils.js +340 -340
- package/src/handlers/whatsappHandler.js +492 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Chetan Mohite
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -203,6 +203,19 @@ Log levels: `[INFO]` · `[SUCCESS]` · `[WARN]` · `[ERROR]` · `[TASK]` (job di
|
|
|
203
203
|
|
|
204
204
|
## 📝 Changelog
|
|
205
205
|
|
|
206
|
+
### v1.1.0
|
|
207
|
+
- **WhatsApp Multi-Device Companion Relay**:
|
|
208
|
+
- Independent companion device pairing via live QR streaming to Admin Dashboard.
|
|
209
|
+
- Multi-Device Protocol isolation prevents session collision and IP desync bans.
|
|
210
|
+
- **Stealth Presence** (`markOnlineOnConnect: false`) and human typing presence simulation (12–20s jitter).
|
|
211
|
+
- **Smart Sleep Cooldown**: Auto-sleeps Baileys socket after 10m inactivity to conserve worker RAM; reconnects instantly on demand.
|
|
212
|
+
- **Memory-Safe Ephemeral PDF Streaming**: Direct signed HTTP streaming with SHA-256 verification (zero large binary buffers on Socket.IO).
|
|
213
|
+
- **Pre-Send Delivery Reconciliation**: Checks companion chat store before dispatching to prevent duplicate invoice sends.
|
|
214
|
+
- **Real-Time Capacity Score ($\Omega$)**: Telemetry heartbeats report free RAM and active concurrency for intelligent load scheduling.
|
|
215
|
+
|
|
216
|
+
### v1.0.9
|
|
217
|
+
- Stability improvements and dependency optimizations for persistent daemon operation.
|
|
218
|
+
|
|
206
219
|
### v1.0.4
|
|
207
220
|
- **Timestamped logs**: every log line now starts with `[YYYY-MM-DD HH:mm:ss]` for debugging and production monitoring
|
|
208
221
|
- **Version fix**: banner, help text, and user-agent string now correctly report `v1.0.4`
|
package/bin/worker.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import { resolveWorkerConfig } from "../src/config.js";
|
|
4
|
-
import { startWorkerClient } from "../src/client.js";
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
try {
|
|
8
|
-
const config = await resolveWorkerConfig();
|
|
9
|
-
await startWorkerClient(config);
|
|
10
|
-
} catch (err) {
|
|
11
|
-
console.error("Fatal Worker Error:", err);
|
|
12
|
-
process.exit(1);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
main();
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { resolveWorkerConfig } from "../src/config.js";
|
|
4
|
+
import { startWorkerClient } from "../src/client.js";
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
try {
|
|
8
|
+
const config = await resolveWorkerConfig();
|
|
9
|
+
await startWorkerClient(config);
|
|
10
|
+
} catch (err) {
|
|
11
|
+
console.error("Fatal Worker Error:", err);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
main();
|
package/package.json
CHANGED
|
@@ -1,46 +1,49 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "app-manager-edge-worker",
|
|
3
|
-
"version": "1.0
|
|
4
|
-
"description": "Distributed Scraper Edge Worker for Apps Manager. Run on any local machine, VPS, or Termux Android device to serve browser and HTTP scraping jobs.",
|
|
5
|
-
"type": "module",
|
|
6
|
-
"bin": {
|
|
7
|
-
"app-manager-edge-worker": "bin/worker.js",
|
|
8
|
-
"apps-manager-worker": "bin/worker.js"
|
|
9
|
-
},
|
|
10
|
-
"main": "./src/client.js",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"
|
|
18
|
-
"
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
"
|
|
31
|
-
},
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
"
|
|
38
|
-
"
|
|
39
|
-
"puppeteer": "^24.3.0",
|
|
40
|
-
"puppeteer-core": "^24.3.0",
|
|
41
|
-
"puppeteer-extra": "^3.3.6",
|
|
42
|
-
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
}
|
|
46
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "app-manager-edge-worker",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "Distributed Scraper Edge Worker for Apps Manager. Run on any local machine, VPS, or Termux Android device to serve browser and HTTP scraping jobs.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"app-manager-edge-worker": "bin/worker.js",
|
|
8
|
+
"apps-manager-worker": "bin/worker.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "./src/client.js",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"app-manager-edge-worker",
|
|
13
|
+
"apps-manager",
|
|
14
|
+
"scraper",
|
|
15
|
+
"edge-worker",
|
|
16
|
+
"puppeteer",
|
|
17
|
+
"residential-proxy",
|
|
18
|
+
"distributed-scraping",
|
|
19
|
+
"termux"
|
|
20
|
+
],
|
|
21
|
+
"author": "Chetan Mohite <chetanmohite2128@gmail.com> (https://github.com/codes-by-chetan)",
|
|
22
|
+
"license": "MIT",
|
|
23
|
+
"homepage": "https://apps-manager.onrender.com",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "git+https://github.com/codes-by-chetan/Apps_Manager.git",
|
|
27
|
+
"directory": "packages/worker"
|
|
28
|
+
},
|
|
29
|
+
"publishConfig": {
|
|
30
|
+
"access": "public"
|
|
31
|
+
},
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@puppeteer/browsers": "^3.2.2",
|
|
34
|
+
"@whiskeysockets/baileys": "7.0.0-rc14",
|
|
35
|
+
"axios": "^1.8.1",
|
|
36
|
+
"cheerio": "^1.0.0",
|
|
37
|
+
"nodemailer": "^6.9.16",
|
|
38
|
+
"pino": "^10.4.0",
|
|
39
|
+
"puppeteer": "^24.3.0",
|
|
40
|
+
"puppeteer-core": "^24.3.0",
|
|
41
|
+
"puppeteer-extra": "^3.3.6",
|
|
42
|
+
"puppeteer-extra-plugin-stealth": "^2.11.2",
|
|
43
|
+
"qrcode": "^1.5.4",
|
|
44
|
+
"socket.io-client": "^4.8.1"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"start": "node ./bin/worker.js"
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/banner.js
CHANGED
|
@@ -1,80 +1,80 @@
|
|
|
1
|
-
import { createRequire } from "module";
|
|
2
|
-
|
|
3
|
-
const require = createRequire(import.meta.url);
|
|
4
|
-
let workerVersion = "1.0
|
|
5
|
-
try {
|
|
6
|
-
const pkg = require("../package.json");
|
|
7
|
-
if (pkg?.version) workerVersion = pkg.version;
|
|
8
|
-
} catch (_) { }
|
|
9
|
-
|
|
10
|
-
// ANSI color helpers
|
|
11
|
-
const colors = {
|
|
12
|
-
reset: "\x1b[0m",
|
|
13
|
-
bright: "\x1b[1m",
|
|
14
|
-
dim: "\x1b[2m",
|
|
15
|
-
cyan: "\x1b[36m",
|
|
16
|
-
green: "\x1b[32m",
|
|
17
|
-
yellow: "\x1b[33m",
|
|
18
|
-
red: "\x1b[31m",
|
|
19
|
-
magenta: "\x1b[35m",
|
|
20
|
-
gray: "\x1b[90m",
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Returns a formatted timestamp string using the device's local time: [YYYY-MM-DD HH:mm:ss]
|
|
25
|
-
*/
|
|
26
|
-
function timestamp() {
|
|
27
|
-
const now = new Date();
|
|
28
|
-
const pad = (n) => String(n).padStart(2, "0");
|
|
29
|
-
const year = now.getFullYear();
|
|
30
|
-
const month = pad(now.getMonth() + 1);
|
|
31
|
-
const day = pad(now.getDate());
|
|
32
|
-
const hours = pad(now.getHours());
|
|
33
|
-
const minutes = pad(now.getMinutes());
|
|
34
|
-
const seconds = pad(now.getSeconds());
|
|
35
|
-
return `${colors.gray}[${year}-${month}-${day} ${hours}:${minutes}:${seconds}]${colors.reset}`;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export function printBanner({ workerName, serverUrl, concurrency, platform, isTermux, keepAliveMinutes }) {
|
|
39
|
-
console.clear();
|
|
40
|
-
console.log(`${colors.cyan}${colors.bright}`);
|
|
41
|
-
console.log(" █████╗ ██████╗ ██████╗ ███████╗ ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗██████╗ ");
|
|
42
|
-
console.log(" ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝██╔══██╗");
|
|
43
|
-
console.log(" ███████║██████╔╝██████╔╝███████╗ ██╔████╔██║███████║██╔██╗ ██║███████║██║ ███╗█████╗ ██████╔╝");
|
|
44
|
-
console.log(" ██╔══██║██╔═══╝ ██╔═══╝ ╚════██║ ██║╚██╔╝██║██╔══██║██║╚██╗██║██╔══██║██║ ██║██╔══╝ ██╔══██╗");
|
|
45
|
-
console.log(" ██║ ██║██║ ██║ ███████║██╗██║ ╚═╝ ██║██║ ██║██║ ╚████║██║ ██║╚██████╔╝███████╗██║ ██║");
|
|
46
|
-
console.log(" ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝");
|
|
47
|
-
console.log(`${colors.reset}`);
|
|
48
|
-
console.log(`${colors.bright} 🌐 Distributed Scraper Edge Worker Client v${workerVersion}${colors.reset}`);
|
|
49
|
-
console.log(`${colors.dim} Zero-cost, persistent tunneling & residential edge scraping${colors.reset}`);
|
|
50
|
-
console.log("--------------------------------------------------------------------------------");
|
|
51
|
-
console.log(` ${colors.bright}Device Name :${colors.reset} ${colors.green}${workerName}${colors.reset}`);
|
|
52
|
-
console.log(` ${colors.bright}Server URL :${colors.reset} ${colors.cyan}${serverUrl}${colors.reset}`);
|
|
53
|
-
console.log(` ${colors.bright}Concurrency :${colors.reset} ${colors.yellow}${concurrency} concurrent tabs${colors.reset}`);
|
|
54
|
-
console.log(` ${colors.bright}Environment :${colors.reset} ${platform} ${isTermux ? "(Termux Android)" : ""}`);
|
|
55
|
-
console.log(` ${colors.bright}Keep-Alive :${colors.reset} ${keepAliveMinutes > 0 ? `${colors.green}Every ${keepAliveMinutes}m (Render Anti-Sleep Active)${colors.reset}` : `${colors.gray}Disabled${colors.reset}`}`);
|
|
56
|
-
console.log("--------------------------------------------------------------------------------\n");
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
export function logInfo(msg) {
|
|
60
|
-
console.log(`${timestamp()} ${colors.cyan}[INFO]${colors.reset} ${msg}`);
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export function logSuccess(msg) {
|
|
64
|
-
console.log(`${timestamp()} ${colors.green}[SUCCESS]${colors.reset} ${msg}`);
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function logWarn(msg) {
|
|
68
|
-
console.log(`${timestamp()} ${colors.yellow}[WARN]${colors.reset} ${msg}`);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export function logError(msg) {
|
|
72
|
-
console.log(`${timestamp()} ${colors.red}[ERROR]${colors.reset} ${msg}`);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export function logJob(jobType, url, durationMs = null) {
|
|
76
|
-
const timeStr = durationMs ? ` ${colors.gray}(${durationMs}ms)${colors.reset}` : "";
|
|
77
|
-
console.log(
|
|
78
|
-
`${timestamp()} ${colors.magenta}[TASK]${colors.reset} ${colors.bright}${jobType}${colors.reset} -> ${url}${timeStr}`
|
|
79
|
-
);
|
|
80
|
-
}
|
|
1
|
+
import { createRequire } from "module";
|
|
2
|
+
|
|
3
|
+
const require = createRequire(import.meta.url);
|
|
4
|
+
let workerVersion = "1.1.0";
|
|
5
|
+
try {
|
|
6
|
+
const pkg = require("../package.json");
|
|
7
|
+
if (pkg?.version) workerVersion = pkg.version;
|
|
8
|
+
} catch (_) { }
|
|
9
|
+
|
|
10
|
+
// ANSI color helpers
|
|
11
|
+
const colors = {
|
|
12
|
+
reset: "\x1b[0m",
|
|
13
|
+
bright: "\x1b[1m",
|
|
14
|
+
dim: "\x1b[2m",
|
|
15
|
+
cyan: "\x1b[36m",
|
|
16
|
+
green: "\x1b[32m",
|
|
17
|
+
yellow: "\x1b[33m",
|
|
18
|
+
red: "\x1b[31m",
|
|
19
|
+
magenta: "\x1b[35m",
|
|
20
|
+
gray: "\x1b[90m",
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Returns a formatted timestamp string using the device's local time: [YYYY-MM-DD HH:mm:ss]
|
|
25
|
+
*/
|
|
26
|
+
function timestamp() {
|
|
27
|
+
const now = new Date();
|
|
28
|
+
const pad = (n) => String(n).padStart(2, "0");
|
|
29
|
+
const year = now.getFullYear();
|
|
30
|
+
const month = pad(now.getMonth() + 1);
|
|
31
|
+
const day = pad(now.getDate());
|
|
32
|
+
const hours = pad(now.getHours());
|
|
33
|
+
const minutes = pad(now.getMinutes());
|
|
34
|
+
const seconds = pad(now.getSeconds());
|
|
35
|
+
return `${colors.gray}[${year}-${month}-${day} ${hours}:${minutes}:${seconds}]${colors.reset}`;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export function printBanner({ workerName, serverUrl, concurrency, platform, isTermux, keepAliveMinutes }) {
|
|
39
|
+
console.clear();
|
|
40
|
+
console.log(`${colors.cyan}${colors.bright}`);
|
|
41
|
+
console.log(" █████╗ ██████╗ ██████╗ ███████╗ ███╗ ███╗ █████╗ ███╗ ██╗ █████╗ ██████╗ ███████╗██████╗ ");
|
|
42
|
+
console.log(" ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ████╗ ████║██╔══██╗████╗ ██║██╔══██╗██╔════╝ ██╔════╝██╔══██╗");
|
|
43
|
+
console.log(" ███████║██████╔╝██████╔╝███████╗ ██╔████╔██║███████║██╔██╗ ██║███████║██║ ███╗█████╗ ██████╔╝");
|
|
44
|
+
console.log(" ██╔══██║██╔═══╝ ██╔═══╝ ╚════██║ ██║╚██╔╝██║██╔══██║██║╚██╗██║██╔══██║██║ ██║██╔══╝ ██╔══██╗");
|
|
45
|
+
console.log(" ██║ ██║██║ ██║ ███████║██╗██║ ╚═╝ ██║██║ ██║██║ ╚████║██║ ██║╚██████╔╝███████╗██║ ██║");
|
|
46
|
+
console.log(" ╚═╝ ╚═╝╚═╝ ╚═╝ ╚══════╝╚═╝╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝");
|
|
47
|
+
console.log(`${colors.reset}`);
|
|
48
|
+
console.log(`${colors.bright} 🌐 Distributed Scraper Edge Worker Client v${workerVersion}${colors.reset}`);
|
|
49
|
+
console.log(`${colors.dim} Zero-cost, persistent tunneling & residential edge scraping${colors.reset}`);
|
|
50
|
+
console.log("--------------------------------------------------------------------------------");
|
|
51
|
+
console.log(` ${colors.bright}Device Name :${colors.reset} ${colors.green}${workerName}${colors.reset}`);
|
|
52
|
+
console.log(` ${colors.bright}Server URL :${colors.reset} ${colors.cyan}${serverUrl}${colors.reset}`);
|
|
53
|
+
console.log(` ${colors.bright}Concurrency :${colors.reset} ${colors.yellow}${concurrency} concurrent tabs${colors.reset}`);
|
|
54
|
+
console.log(` ${colors.bright}Environment :${colors.reset} ${platform} ${isTermux ? "(Termux Android)" : ""}`);
|
|
55
|
+
console.log(` ${colors.bright}Keep-Alive :${colors.reset} ${keepAliveMinutes > 0 ? `${colors.green}Every ${keepAliveMinutes}m (Render Anti-Sleep Active)${colors.reset}` : `${colors.gray}Disabled${colors.reset}`}`);
|
|
56
|
+
console.log("--------------------------------------------------------------------------------\n");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export function logInfo(msg) {
|
|
60
|
+
console.log(`${timestamp()} ${colors.cyan}[INFO]${colors.reset} ${msg}`);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export function logSuccess(msg) {
|
|
64
|
+
console.log(`${timestamp()} ${colors.green}[SUCCESS]${colors.reset} ${msg}`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function logWarn(msg) {
|
|
68
|
+
console.log(`${timestamp()} ${colors.yellow}[WARN]${colors.reset} ${msg}`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
export function logError(msg) {
|
|
72
|
+
console.log(`${timestamp()} ${colors.red}[ERROR]${colors.reset} ${msg}`);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export function logJob(jobType, url, durationMs = null) {
|
|
76
|
+
const timeStr = durationMs ? ` ${colors.gray}(${durationMs}ms)${colors.reset}` : "";
|
|
77
|
+
console.log(
|
|
78
|
+
`${timestamp()} ${colors.magenta}[TASK]${colors.reset} ${colors.bright}${jobType}${colors.reset} -> ${url}${timeStr}`
|
|
79
|
+
);
|
|
80
|
+
}
|