dankgrinder 8.89.0 → 8.91.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 +19 -15
- package/lib/ui.js +21 -14
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -3057,42 +3057,46 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
3057
3057
|
let finalCoins = 0;
|
|
3058
3058
|
let finalCmds = 0;
|
|
3059
3059
|
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
table
|
|
3060
|
+
const figlet = require('figlet');
|
|
3061
|
+
|
|
3062
|
+
let table = '';
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
table += ' ' + c.dim('────────────────────────────────────────────────────────────────────────────────────────────────') + '\n\n';
|
|
3066
|
+
table += ' ' + c.dim('ACCOUNT'.padEnd(25)) + c.dim('GAINED'.padEnd(15)) + c.dim('COMMANDS'.padEnd(10)) + c.dim('OK %') + '\n\n';
|
|
3063
3067
|
|
|
3064
3068
|
for (const wk of workers) {
|
|
3065
3069
|
const rate = wk.stats.commands > 0 ? ((wk.stats.successes / wk.stats.commands) * 100).toFixed(0) : 0;
|
|
3066
3070
|
finalCoins += wk.stats.coins || 0;
|
|
3067
3071
|
finalCmds += wk.stats.commands || 0;
|
|
3068
3072
|
|
|
3069
|
-
const unRaw = (wk.username || '?').substring(0,
|
|
3073
|
+
const unRaw = (wk.username || '?').substring(0, 23);
|
|
3070
3074
|
const coinsRaw = '+⏣' + (wk.stats.coins || 0).toLocaleString();
|
|
3071
3075
|
const cmdsRaw = String(wk.stats.commands || 0);
|
|
3072
3076
|
const okRaw = rate + '%';
|
|
3073
3077
|
|
|
3074
|
-
const un = unRaw.padEnd(
|
|
3075
|
-
const coins = coinsRaw.substring(0, 14).padEnd(
|
|
3076
|
-
const cmds = cmdsRaw.substring(0, 8).padEnd(
|
|
3078
|
+
const un = unRaw.padEnd(25);
|
|
3079
|
+
const coins = coinsRaw.substring(0, 14).padEnd(15);
|
|
3080
|
+
const cmds = cmdsRaw.substring(0, 8).padEnd(10);
|
|
3077
3081
|
const ok = okRaw.substring(0, 6).padEnd(6);
|
|
3078
3082
|
|
|
3079
|
-
table += `
|
|
3083
|
+
table += ` ${c.cyan}${un}${c.reset} ${c.green}${coins}${c.reset} ${cmds} ${ok}\n`;
|
|
3080
3084
|
}
|
|
3081
3085
|
|
|
3082
3086
|
if (workers.length === 0) {
|
|
3083
|
-
table += `
|
|
3087
|
+
table += ` ${c.dim}${'No workers...'.padEnd(25)}${c.reset} ${''.padEnd(15)} ${''.padEnd(10)} ${''.padEnd(6)}\n`;
|
|
3084
3088
|
}
|
|
3085
3089
|
|
|
3086
|
-
table +=
|
|
3090
|
+
table += '\n ' + c.dim('────────────────────────────────────────────────────────────────────────────────────────────────') + '\n';
|
|
3087
3091
|
process.stdout.write(table);
|
|
3088
3092
|
|
|
3089
3093
|
const memFinal = Math.round((process.memoryUsage?.rss?.() ?? process.memoryUsage().rss) / 1048576);
|
|
3090
3094
|
const cpm = globalCmdRate.getRate().toFixed(1);
|
|
3091
3095
|
|
|
3092
|
-
console.log(
|
|
3093
|
-
console.log(
|
|
3094
|
-
console.log(
|
|
3095
|
-
|
|
3096
|
+
console.log('\n ' + c.magenta('◆') + ' ' + c.bold('TOTAL') + ' ' + c.green('+⏣' + finalCoins.toLocaleString()) + ' ' + c.dim('in ' + ui.formatUptime()));
|
|
3097
|
+
console.log(' ' + c.cyan('◆') + ' ' + c.bold('STATS') + ' ' + finalCmds + c.dim(' cmds │ ') + '~' + cpm + c.dim(' cmd/m │ ') + memFinal + c.dim('MB RAM'));
|
|
3098
|
+
console.log('\n');
|
|
3099
|
+
|
|
3096
3100
|
|
|
3097
3101
|
// Stop workers immediately (don't wait) — instant shutdown
|
|
3098
3102
|
for (const wk of workers) {
|
|
@@ -3123,7 +3127,7 @@ async function start(apiKey, apiUrl, opts = {}) {
|
|
|
3123
3127
|
|
|
3124
3128
|
const disResult = redis?.disconnect?.();
|
|
3125
3129
|
if (disResult && typeof disResult.catch === 'function') disResult.catch(() => {});
|
|
3126
|
-
console.log(
|
|
3130
|
+
console.log(c.magenta + figlet.textSync('GOODBYE!', { font: 'ANSI Shadow' }) + c.reset + '\n');
|
|
3127
3131
|
// Force exit so Ctrl+C always terminates immediately
|
|
3128
3132
|
setTimeout(() => process.exit(0), 2000);
|
|
3129
3133
|
process.exit(0);
|
package/lib/ui.js
CHANGED
|
@@ -39,7 +39,8 @@ const ACC_COLORS = ['#ff0054', '#ffbd00', '#390099', '#9e0059', '#ff5400', '#00f
|
|
|
39
39
|
function getAccountColor(str) {
|
|
40
40
|
let hash = 0;
|
|
41
41
|
for (let i = 0; i < str.length; i++) hash = str.charCodeAt(i) + ((hash << 5) - hash);
|
|
42
|
-
|
|
42
|
+
const h = Math.abs(hash) % 360;
|
|
43
|
+
return chalk.hsl(h, 90, 65); // 360 distinct hues, visually scaled for 10k unique accounts!
|
|
43
44
|
}
|
|
44
45
|
|
|
45
46
|
const STATUS_DOT = {
|
|
@@ -147,17 +148,21 @@ function render() {
|
|
|
147
148
|
if (w.channel && !w.paused && !w.dashboardPaused) onlineCount++;
|
|
148
149
|
}
|
|
149
150
|
|
|
150
|
-
// 1.
|
|
151
|
-
|
|
152
|
-
out +=
|
|
153
|
-
|
|
151
|
+
// 1. BIG ASCI TITLE IS BACK (With Gradient)
|
|
152
|
+
const titleStr = figlet.textSync('DANK GRINDER', { font: 'ANSI Shadow' });
|
|
153
|
+
out += chalk.bold(applyGradient(titleStr));
|
|
154
|
+
out += ' ' + chalk.dim('v' + _version + ' │ ') + chalk.cyan('● ' + getLoader() + ' Running') + '\n\n';
|
|
154
155
|
|
|
155
|
-
// 2. MINIMALIST STATS
|
|
156
|
-
const profStr = totalCoins > 0 ? '+' + formatBal(totalCoins) : '0';
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
156
|
+
// 2. MINIMALIST STATS + TREND SPARKLINE
|
|
157
|
+
const profStr = totalCoins > 0 ? '+' + formatBal(totalCoins) : '+0';
|
|
158
|
+
const graph = getSparkline();
|
|
159
|
+
|
|
160
|
+
const secOnline = chalk.dim('Online') + ' ' + chalk.bold.cyan(`${onlineCount}/${_workers.length}`);
|
|
161
|
+
const secUptime = chalk.dim('Uptime') + ' ' + chalk.bold.blue(fmtUptime());
|
|
162
|
+
const secBal = chalk.dim('Bank') + ' ' + chalk.bold.green(`⏣ ${formatBal(totalBal)}`) + chalk.greenBright(` (${profStr})`);
|
|
163
|
+
const secTrend = chalk.dim('Trend') + ' ' + chalk.magenta(graph);
|
|
164
|
+
|
|
165
|
+
out += ` ${secOnline} ${chalk.dim('│')} ${secUptime} ${chalk.dim('│')} ${secBal} ${chalk.dim('│')} ${secTrend}\n`;
|
|
161
166
|
|
|
162
167
|
// Divider
|
|
163
168
|
const divWidth = Math.min(C - 4, 100);
|
|
@@ -190,11 +195,12 @@ function render() {
|
|
|
190
195
|
activity = chalk.gray('◎');
|
|
191
196
|
}
|
|
192
197
|
|
|
193
|
-
const numStr = chalk.dim(
|
|
198
|
+
const numStr = chalk.dim('0' + (i + 1).toString().slice(-2));
|
|
194
199
|
const dot = getDot(w);
|
|
195
200
|
|
|
196
201
|
const nameRaw = trunc(w.username || 'Worker ' + (i+1), wCols.name - 3);
|
|
197
|
-
|
|
202
|
+
// INDIVIDUAL SMART COLORS TRIGGERED HERE
|
|
203
|
+
const nameStr = dot.color(dot.dot) + ' ' + getAccountColor(nameRaw)(chalk.bold(nameRaw));
|
|
198
204
|
|
|
199
205
|
const bVal = w.stats.balance !== undefined ? formatBal(w.stats.balance) : '—';
|
|
200
206
|
const balRaw = trunc(bVal === '—' ? '—' : bVal, wCols.bal - 1);
|
|
@@ -222,11 +228,12 @@ function render() {
|
|
|
222
228
|
out += '\n ' + chalk.dim('─'.repeat(divWidth)) + '\n\n';
|
|
223
229
|
|
|
224
230
|
// 4. ACTIVITY STREAM
|
|
225
|
-
out += chalk.gray(' ACTIVITY') + '\n';
|
|
231
|
+
out += chalk.gray(' ACTIVITY LOG') + '\n';
|
|
226
232
|
if (_events.length === 0) {
|
|
227
233
|
out += chalk.dim(' No recent events.\n');
|
|
228
234
|
} else {
|
|
229
235
|
_events.forEach(ev => {
|
|
236
|
+
// Enhanced event log with nice contrast
|
|
230
237
|
out += ` ${chalk.dim(ev.ts)} ${ev.icon} ${chalk.white(ev.msg)}\n`;
|
|
231
238
|
});
|
|
232
239
|
}
|