dankgrinder 8.32.0 → 8.33.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 +1 -1
- package/lib/ui.js +15 -4
- package/package.json +1 -1
package/lib/grinder.js
CHANGED
|
@@ -2660,7 +2660,7 @@ captchaDetector.build();
|
|
|
2660
2660
|
// ══════════════════════════════════════════════════════════════
|
|
2661
2661
|
|
|
2662
2662
|
async function start(apiKey, apiUrl, opts = {}) {
|
|
2663
|
-
ui.init({ workers,
|
|
2663
|
+
ui.init({ workers, isShuttingDown: () => shutdownCalled });
|
|
2664
2664
|
ui.drawBanner(PKG_VERSION);
|
|
2665
2665
|
CLOUD_ADMIN_KEY = process.env.CLOUD_ADMIN_KEY || '';
|
|
2666
2666
|
API_KEY = apiKey;
|
package/lib/ui.js
CHANGED
|
@@ -4,10 +4,21 @@
|
|
|
4
4
|
* Shows per-account status, earned coins, commands, and session uptime.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
+
let _startTime = Date.now();
|
|
7
8
|
let _workers = [];
|
|
8
|
-
let _getUptime = () => '0s';
|
|
9
9
|
let _isShuttingDown = () => false;
|
|
10
10
|
|
|
11
|
+
function formatUptime() {
|
|
12
|
+
const s = Math.floor((Date.now() - _startTime) / 1000);
|
|
13
|
+
if (s < 60) return `${s}s`;
|
|
14
|
+
const m = Math.floor(s / 60);
|
|
15
|
+
const h = Math.floor(m / 60);
|
|
16
|
+
const d = Math.floor(h / 24);
|
|
17
|
+
if (d > 0) return `${d}d ${h % 24}h`;
|
|
18
|
+
if (h > 0) return `${h}h ${m % 60}m`;
|
|
19
|
+
return `${m}m`;
|
|
20
|
+
}
|
|
21
|
+
|
|
11
22
|
// ANSI helpers
|
|
12
23
|
const c = {
|
|
13
24
|
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
@@ -85,7 +96,7 @@ function _render() {
|
|
|
85
96
|
lines.push(
|
|
86
97
|
` ${c.bold}Total${c.reset} ` +
|
|
87
98
|
`${totalCoins > 0 ? c.green + '+⏣' + totalCoins.toLocaleString() + c.reset : DIM + '—' + c.reset}` +
|
|
88
|
-
` ${totalCmds} cmds ${
|
|
99
|
+
` ${totalCmds} cmds ${formatUptime()} ${memMB}MB`
|
|
89
100
|
);
|
|
90
101
|
lines.push('');
|
|
91
102
|
|
|
@@ -107,9 +118,9 @@ function _clear() {
|
|
|
107
118
|
|
|
108
119
|
// ── Public API ────────────────────────────────────────────────
|
|
109
120
|
|
|
110
|
-
function init({ workers,
|
|
121
|
+
function init({ workers, isShuttingDown }) {
|
|
122
|
+
_startTime = Date.now();
|
|
111
123
|
_workers = workers;
|
|
112
|
-
_getUptime = getUptime || (() => '0s');
|
|
113
124
|
_isShuttingDown = isShuttingDown || (() => false);
|
|
114
125
|
}
|
|
115
126
|
|