dankgrinder 8.79.0 → 8.82.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/lib/grinder.js +17 -14
- package/lib/ui.js +9 -1
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -2740,34 +2740,38 @@ captchaDetector.build();
|
|
|
2740
2740
|
async function start(apiKey, apiUrl, opts = {}) {
|
|
2741
2741
|
ui.init({ workers, isShuttingDown: () => shutdownCalled });
|
|
2742
2742
|
ui.drawBanner(PKG_VERSION);
|
|
2743
|
+
ui.setLive(true);
|
|
2744
|
+
ui.startRefresh();
|
|
2745
|
+
|
|
2743
2746
|
CLOUD_ADMIN_KEY = process.env.CLOUD_ADMIN_KEY || '';
|
|
2744
2747
|
API_KEY = apiKey;
|
|
2745
2748
|
API_URL = apiUrl || process.env.DANKGRINDER_URL || 'http://localhost:3000';
|
|
2746
2749
|
const CLOUD_MODE = opts.cloud === true;
|
|
2747
2750
|
|
|
2748
2751
|
if (CLOUD_MODE) {
|
|
2749
|
-
|
|
2752
|
+
ui.log(-1, 'Starting in CLOUD MODE');
|
|
2750
2753
|
}
|
|
2751
2754
|
REDIS_URL = process.env.REDIS_URL || '';
|
|
2752
2755
|
WEBHOOK_URL = process.env.WEBHOOK_URL || '';
|
|
2753
2756
|
|
|
2754
2757
|
const tw = 80;
|
|
2755
2758
|
|
|
2756
|
-
|
|
2757
|
-
|
|
2759
|
+
ui.log(-1, `DankGrinder v${PKG_VERSION} (${AccountWorker.COMMAND_MAP.length} cmds) mapped`);
|
|
2760
|
+
ui.log(-1, 'Fetching proxy node configs...');
|
|
2758
2761
|
|
|
2759
2762
|
const fetchOpts = CLOUD_MODE ? { cloud: true } : {};
|
|
2760
2763
|
let data = await fetchConfig(4, 2000, fetchOpts);
|
|
2761
2764
|
while (!data) {
|
|
2762
|
-
|
|
2765
|
+
ui.log(-1, 'Cannot connect to API - retrying in 10s...');
|
|
2763
2766
|
await new Promise((r) => setTimeout(r, 10000));
|
|
2764
2767
|
data = await fetchConfig(4, 2000, fetchOpts);
|
|
2765
2768
|
}
|
|
2766
2769
|
if (data && data.error) {
|
|
2767
|
-
|
|
2770
|
+
ui.log(-1, `API error: ${data.error}`);
|
|
2771
|
+
setTimeout(() => ui.stop(), 500);
|
|
2768
2772
|
return;
|
|
2769
2773
|
}
|
|
2770
|
-
|
|
2774
|
+
ui.log(-1, `Resolved ${data.accounts?.length || 0} accounts from database`);
|
|
2771
2775
|
|
|
2772
2776
|
// Cloud mode: post heartbeat every 30s
|
|
2773
2777
|
if (CLOUD_MODE) {
|
|
@@ -2786,7 +2790,7 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2786
2790
|
};
|
|
2787
2791
|
postHeartbeat();
|
|
2788
2792
|
setInterval(postHeartbeat, CLOUD_HEARTBEAT_MS);
|
|
2789
|
-
log(
|
|
2793
|
+
ui.log(-1, 'Cloud heartbeat started');
|
|
2790
2794
|
}
|
|
2791
2795
|
|
|
2792
2796
|
// Pull Redis/Webhook URLs from API config if not in env
|
|
@@ -2798,18 +2802,19 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2798
2802
|
|
|
2799
2803
|
let { accounts } = data;
|
|
2800
2804
|
if (!accounts || accounts.length === 0) {
|
|
2801
|
-
|
|
2805
|
+
ui.log(-1, 'No active accounts. Add them in the dashboard.');
|
|
2806
|
+
setTimeout(() => ui.stop(), 500);
|
|
2802
2807
|
return;
|
|
2803
2808
|
}
|
|
2804
|
-
|
|
2809
|
+
ui.log(-1, `Processing ${accounts.length} accounts...`);
|
|
2805
2810
|
|
|
2806
2811
|
// Cluster mode: filter to only accounts this node can claim
|
|
2807
2812
|
if (CLUSTER_ENABLED) {
|
|
2808
2813
|
const totalBefore = accounts.length;
|
|
2809
2814
|
accounts = await filterClaimableAccounts(accounts);
|
|
2810
|
-
|
|
2815
|
+
ui.log(-1, `Cluster Node: claimed ${accounts.length}/${totalBefore} accounts`);
|
|
2811
2816
|
if (accounts.length === 0) {
|
|
2812
|
-
|
|
2817
|
+
ui.log(-1, 'All accounts claimed by other nodes. Waiting...');
|
|
2813
2818
|
}
|
|
2814
2819
|
}
|
|
2815
2820
|
|
|
@@ -2970,9 +2975,7 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
2970
2975
|
// ── Phase 3: Start grind loops ───────────────────────────────────
|
|
2971
2976
|
ui.setPhase('grinding');
|
|
2972
2977
|
ui.log(-1, `Starting ${activeWorkers.length} grind loops...`);
|
|
2973
|
-
|
|
2974
|
-
ui.draw();
|
|
2975
|
-
ui.startRefresh();
|
|
2978
|
+
|
|
2976
2979
|
for (const w of activeWorkers) {
|
|
2977
2980
|
if (!shutdownCalled) w.grindLoop();
|
|
2978
2981
|
}
|
package/lib/ui.js
CHANGED
|
@@ -83,8 +83,16 @@ function addEvent(type, msg) {
|
|
|
83
83
|
if (_live) render();
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
+
|
|
87
|
+
|
|
86
88
|
function logGlobal(msg) { addEvent('info', msg); }
|
|
87
|
-
function log(accountIdx, msg) {
|
|
89
|
+
function log(accountIdx, msg) {
|
|
90
|
+
if (accountIdx === -1) {
|
|
91
|
+
if (_live) addEvent('info', msg.replace(/\x1b\[[0-9;]*m/g, ''));
|
|
92
|
+
else console.log(chalk.bold(msg));
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
88
96
|
function updateAccountRow() { }
|
|
89
97
|
|
|
90
98
|
// Precision width padding
|