dankgrinder 8.90.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 +7 -5
- 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
|
@@ -156,11 +156,13 @@ function render() {
|
|
|
156
156
|
// 2. MINIMALIST STATS + TREND SPARKLINE
|
|
157
157
|
const profStr = totalCoins > 0 ? '+' + formatBal(totalCoins) : '+0';
|
|
158
158
|
const graph = getSparkline();
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
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`;
|
|
164
166
|
|
|
165
167
|
// Divider
|
|
166
168
|
const divWidth = Math.min(C - 4, 100);
|