dankgrinder 8.15.0 → 8.16.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 +21 -80
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -77,13 +77,14 @@ async function sendWebhook(title, description, color = 0x5865f2) {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// ── Terminal Colors & ANSI ───────────────────────────────────
|
|
80
|
+
// All colors stripped — plain text output only
|
|
80
81
|
const c = {
|
|
81
|
-
reset: '
|
|
82
|
-
green: '
|
|
83
|
-
magenta: '
|
|
84
|
-
bgGreen: '
|
|
85
|
-
bgMagenta: '
|
|
86
|
-
// Cursor control
|
|
82
|
+
reset: '', bold: '', dim: '', italic: '',
|
|
83
|
+
green: '', red: '', yellow: '', cyan: '',
|
|
84
|
+
magenta: '', white: '', blue: '',
|
|
85
|
+
bgGreen: '', bgRed: '', bgYellow: '', bgCyan: '',
|
|
86
|
+
bgMagenta: '', bgBlue: '', bgWhite: '',
|
|
87
|
+
// Cursor control (kept for functional use)
|
|
87
88
|
clearLine: '\x1b[2K',
|
|
88
89
|
cursorUp: (n) => `\x1b[${n}A`,
|
|
89
90
|
cursorTo: (col) => `\x1b[${col}G`,
|
|
@@ -220,22 +221,13 @@ async function filterClaimableAccounts(accounts) {
|
|
|
220
221
|
return claimable;
|
|
221
222
|
}
|
|
222
223
|
|
|
223
|
-
// ── Truecolor gradient helpers
|
|
224
|
-
function rgb(r, g, b) { return
|
|
225
|
-
function bgRgb(r, g, b) { return
|
|
224
|
+
// ── Truecolor gradient helpers (disabled — plain text only) ──
|
|
225
|
+
function rgb(r, g, b) { return ''; }
|
|
226
|
+
function bgRgb(r, g, b) { return ''; }
|
|
226
227
|
function lerp(a, b, t) { return Math.round(a + (b - a) * t); }
|
|
227
228
|
|
|
228
229
|
function gradientLine(text, from, to) {
|
|
229
|
-
|
|
230
|
-
const visible = chars.filter(ch => ch !== ' ').length;
|
|
231
|
-
let ci = 0, out = '';
|
|
232
|
-
for (const ch of chars) {
|
|
233
|
-
if (ch === ' ') { out += ' '; continue; }
|
|
234
|
-
const t = visible > 1 ? ci / (visible - 1) : 0;
|
|
235
|
-
out += rgb(lerp(from[0], to[0], t), lerp(from[1], to[1], t), lerp(from[2], to[2], t)) + ch;
|
|
236
|
-
ci++;
|
|
237
|
-
}
|
|
238
|
-
return out + c.reset;
|
|
230
|
+
return text;
|
|
239
231
|
}
|
|
240
232
|
|
|
241
233
|
function gradientText(text, from, to) {
|
|
@@ -283,69 +275,20 @@ function getSpinner(type = 'braille') {
|
|
|
283
275
|
return BRAILLE_SPIN[now % BRAILLE_SPIN.length];
|
|
284
276
|
}
|
|
285
277
|
|
|
286
|
-
// ── Box drawing helpers ──────────────────────────────────────
|
|
287
|
-
const BOX = {
|
|
288
|
-
tl: '╭', tr: '╮', bl: '╰', br: '╯',
|
|
289
|
-
h: '─', v: '│', hBold: '━', vBold: '┃',
|
|
290
|
-
dtl: '╔', dtr: '╗', dbl: '╚', dbr: '╝', dh: '═', dv: '║',
|
|
291
|
-
cross: '┼', tee: '├', teeR: '┤', teeD: '┬', teeU: '┴',
|
|
292
|
-
};
|
|
293
|
-
|
|
294
|
-
function boxTop(w, color) { return color + BOX.dtl + BOX.dh.repeat(w - 2) + BOX.dtr + c.reset; }
|
|
295
|
-
function boxMid(w, color) { return color + BOX.tee + BOX.h.repeat(w - 2) + BOX.teeR + c.reset; }
|
|
296
|
-
function boxBot(w, color) { return color + BOX.dbl + BOX.dh.repeat(w - 2) + BOX.dbr + c.reset; }
|
|
297
|
-
function boxLine(content, w, color) {
|
|
298
|
-
const stripped = content.replace(/\x1b\[[0-9;]*m/g, '');
|
|
299
|
-
const pad = Math.max(0, w - 4 - stripped.length);
|
|
300
|
-
return color + BOX.dv + c.reset + ' ' + content + ' '.repeat(pad) + ' ' + color + BOX.dv + c.reset;
|
|
301
|
-
}
|
|
302
|
-
function thinLine(w) { return ' ' + c.dim + BOX.h.repeat(w - 4) + c.reset; }
|
|
303
|
-
|
|
304
|
-
const BANNER_RAW = [
|
|
305
|
-
' ██████╗ █████╗ ███╗ ██╗██╗ ██╗',
|
|
306
|
-
' ██╔══██╗██╔══██╗████╗ ██║██║ ██╔╝',
|
|
307
|
-
' ██║ ██║███████║██╔██╗ ██║█████╔╝ ',
|
|
308
|
-
' ██║ ██║██╔══██║██║╚██╗██║██╔═██╗ ',
|
|
309
|
-
' ██████╔╝██║ ██║██║ ╚████║██║ ██╗',
|
|
310
|
-
' ╚═════╝ ╚═╝ ╚═╝╚═╝ ╚═══╝╚═╝ ╚═╝',
|
|
311
|
-
' ██████╗ ██████╗ ██╗███╗ ██╗██████╗ ███████╗██████╗ ',
|
|
312
|
-
' ██╔════╝ ██╔══██╗██║████╗ ██║██╔══██╗██╔════╝██╔══██╗',
|
|
313
|
-
' ██║ ███╗██████╔╝██║██╔██╗ ██║██║ ██║█████╗ ██████╔╝',
|
|
314
|
-
' ██║ ██║██╔══██╗██║██║╚██╗██║██║ ██║██╔══╝ ██╔══██╗',
|
|
315
|
-
' ╚██████╔╝██║ ██║██║██║ ╚████║██████╔╝███████╗██║ ██║',
|
|
316
|
-
' ╚═════╝ ╚═╝ ╚═╝╚═╝╚═╝ ╚═══╝╚═════╝ ╚══════╝╚═╝ ╚═╝',
|
|
317
|
-
];
|
|
318
|
-
|
|
319
278
|
function colorBanner() {
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
const n = BANNER_RAW.length;
|
|
324
|
-
let out = '\n';
|
|
325
|
-
for (let i = 0; i < n; i++) {
|
|
326
|
-
const t = i / (n - 1);
|
|
327
|
-
const from = t < 0.5
|
|
328
|
-
? [lerp(topColor[0], midColor[0], t * 2), lerp(topColor[1], midColor[1], t * 2), lerp(topColor[2], midColor[2], t * 2)]
|
|
329
|
-
: [lerp(midColor[0], botColor[0], (t - 0.5) * 2), lerp(midColor[1], botColor[1], (t - 0.5) * 2), lerp(midColor[2], botColor[2], (t - 0.5) * 2)];
|
|
330
|
-
const to = t < 0.5
|
|
331
|
-
? [lerp(236, 168, t * 2), lerp(72, 85, t * 2), lerp(153, 247, t * 2)]
|
|
332
|
-
: [lerp(168, 6, (t - 0.5) * 2), lerp(85, 182, (t - 0.5) * 2), lerp(247, 212, (t - 0.5) * 2)];
|
|
333
|
-
out += c.bold + gradientLine(BANNER_RAW[i], from, to) + '\n';
|
|
334
|
-
}
|
|
335
|
-
return out;
|
|
279
|
+
return `
|
|
280
|
+
DANKGRINDER v${PKG_VERSION}
|
|
281
|
+
`;
|
|
336
282
|
}
|
|
337
283
|
|
|
338
284
|
// ── Simple Logging ─────────────────────────────────────────────
|
|
339
285
|
function log(type, msg, label) {
|
|
340
|
-
const
|
|
341
|
-
info:
|
|
342
|
-
|
|
343
|
-
cmd: `${rgb(168, 85, 247)}▸${c.reset}`, coin: `${rgb(251, 191, 36)}$${c.reset}`,
|
|
344
|
-
buy: `${rgb(59, 130, 246)}♦${c.reset}`, bal: `${rgb(52, 211, 153)}◈${c.reset}`,
|
|
345
|
-
debug: `${c.dim}·${c.reset}`,
|
|
286
|
+
const icons = {
|
|
287
|
+
info: '.', success: '[OK]', error: '[X]', warn: '[!]',
|
|
288
|
+
cmd: '>', coin: '$', buy: '#', bal: '*', debug: '.',
|
|
346
289
|
};
|
|
347
290
|
const tagCol = label ? `${label} ` : '';
|
|
348
|
-
console.log(` ${
|
|
291
|
+
console.log(` ${icons[type] || icons.info} ${tagCol}${msg}`);
|
|
349
292
|
}
|
|
350
293
|
|
|
351
294
|
async function fetchConfig(retries = 3, delayMs = 1500, opts = {}) {
|
|
@@ -2737,22 +2680,20 @@ captchaDetector.build();
|
|
|
2737
2680
|
// ══════════════════════════════════════════════════════════════
|
|
2738
2681
|
|
|
2739
2682
|
async function start(apiKey, apiUrl, opts = {}) {
|
|
2683
|
+
console.log('DANKGRINDER starting...');
|
|
2740
2684
|
CLOUD_ADMIN_KEY = process.env.CLOUD_ADMIN_KEY || '';
|
|
2741
2685
|
API_KEY = apiKey;
|
|
2742
2686
|
API_URL = apiUrl || process.env.DANKGRINDER_URL || 'http://localhost:3000';
|
|
2743
2687
|
const CLOUD_MODE = opts.cloud === true;
|
|
2744
2688
|
|
|
2745
2689
|
if (CLOUD_MODE) {
|
|
2746
|
-
|
|
2747
|
-
// Per-account keys are fetched per-account from /api/cloud/grinders.
|
|
2748
|
-
console.log('🌥️ Starting in CLOUD MODE — grinding all cloud-enabled accounts');
|
|
2690
|
+
console.log('Starting in CLOUD MODE');
|
|
2749
2691
|
}
|
|
2750
2692
|
REDIS_URL = process.env.REDIS_URL || '';
|
|
2751
2693
|
WEBHOOK_URL = process.env.WEBHOOK_URL || '';
|
|
2752
2694
|
|
|
2753
|
-
process.stdout.write('\x1b[2J\x1b[H');
|
|
2754
2695
|
const tw = Math.min(process.stdout.columns || 80, 78);
|
|
2755
|
-
const bar =
|
|
2696
|
+
const bar = '─'.repeat(tw);
|
|
2756
2697
|
|
|
2757
2698
|
// Detect zlib-sync availability
|
|
2758
2699
|
let hasZlib = false;
|