-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMINER_UI.html
More file actions
533 lines (448 loc) · 20.8 KB
/
MINER_UI.html
File metadata and controls
533 lines (448 loc) · 20.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Consensual Miner UI Documentation</title>
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="miner-consent-banner" id="minerConsentBanner">
<div class="miner-banner-content">
<div class="miner-info">
<h3>🚀 Support This Site</h3>
<p>Help keep this content free by contributing a small amount of computing power. This uses about 25% of your CPU and you can stop anytime.</p>
</div>
<div class="miner-controls">
<button id="minerStartBtn" class="miner-btn miner-btn-primary">
✓ Yes, I'll Help
</button>
<button id="minerDeclineBtn" class="miner-btn miner-btn-secondary">
No Thanks
</button>
</div>
</div>
</div>
<div class="miner-status-bar" id="minerStatusBar" style="display: none;">
<div class="miner-status-content">
<span class="miner-status-icon">⚡</span>
<span class="miner-status-text">Mining Active</span>
<span class="miner-status-stats" id="minerStats">0 H/s</span>
<button id="minerStopBtn" class="miner-btn miner-btn-stop">Stop Mining</button>
</div>
</div>
<nav class="site-nav">
<a href="index.html">Home</a>
<a href="ADDRESSING_THE_CRYPTO_BROS_CRITIQUE.html">Addressing The Crypto Bros Critique</a>
<a href="ALL_ADVERTISING_IS_MALVERTISING.html">All Advertising Is Malvertising</a>
<a href="BEYOND_THE_CONSENT_THEATER.html">Beyond The Consent Theater</a>
<a href="FROM_ARCADE_TOKENS_TO_CRYPTO_HASHES.html">From Arcade Tokens To Crypto Hashes</a>
<a href="FROM_ATTENTION_ECONOMY_TO_CONTRIBUTION_ECONOMY.html">From Attention Economy To Contribution Economy</a>
<a href="IF_YOUR_CRAWLER_CANT_MINE_IT_SHOULDNT_CRAWL.html">If Your Crawler Cant Mine It Shouldnt Crawl</a>
<a href="MINER_UI.html" class="active">Miner Ui</a>
<a href="PRIVATE_MONEY_PRIVATE_ENERGY.html">Private Money Private Energy</a>
<a href="REVISION_PROGRESS_2025-10-08.html">Revision Progress 2025 10 08</a>
<a href="SITE_GENERATOR.html">Site Generator</a>
<a href="THE_ACCESSIBILITY_PARADOX.html">The Accessibility Paradox</a>
<a href="THE_ARTISTS_COOP.html">The Artists Coop</a>
<a href="THE_ATTENTION_TOXICITY_PROBLEM.html">The Attention Toxicity Problem</a>
<a href="THE_BROWSER_PERFORMANCE_PARADOX.html">The Browser Performance Paradox</a>
<a href="THE_COINHIVE_LESSON.html">The Coinhive Lesson</a>
<a href="THE_COMPUTATIONAL_POLLUTION_PROBLEM.html">The Computational Pollution Problem</a>
<a href="THE_CONSENT_GAP.html">The Consent Gap</a>
<a href="THE_CRAWLERS_DEBT.html">The Crawlers Debt</a>
<a href="THE_DEMOCRACY_OF_COMPUTING.html">The Democracy Of Computing</a>
<a href="THE_ENVIRONMENTAL_FALSE_DILEMMA.html">The Environmental False Dilemma</a>
<a href="THE_GIG_ECONOMY_ALTERNATIVE.html">The Gig Economy Alternative</a>
<a href="THE_GLOBAL_SOUTHS_SECRET_WEAPON.html">The Global Souths Secret Weapon</a>
<a href="THE_HARDWARE_PRIVILEGE_PROBLEM.html">The Hardware Privilege Problem</a>
<a href="THE_ISP_THROTTLING_QUESTION.html">The Isp Throttling Question</a>
<a href="THE_JOURNALISTS_DILEMMA.html">The Journalists Dilemma</a>
<a href="THE_JUST_USE_A_VPN_FALLACY.html">The Just Use A Vpn Fallacy</a>
<a href="THE_LOCAL_BUSINESS_RENAISSANCE.html">The Local Business Renaissance</a>
<a href="THE_NONPROFIT_DILEMMA.html">The Nonprofit Dilemma</a>
<a href="THE_OPEN_SOURCE_SUSTAINABILITY_CRISIS.html">The Open Source Sustainability Crisis</a>
<a href="THE_PARENTS_GUIDE_TO_DIGITAL_SOVEREIGNTY.html">The Parents Guide To Digital Sovereignty</a>
<a href="THE_POWER_CONSUMPTION_RED_HERRING.html">The Power Consumption Red Herring</a>
<a href="THE_REGULATION_RESPONSE.html">The Regulation Response</a>
<a href="THE_SECURITY_PROMISE.html">The Security Promise</a>
<a href="THE_SENIORS_GUIDE_TO_WEB_MINING.html">The Seniors Guide To Web Mining</a>
<a href="THE_STREAMING_PARADOX.html">The Streaming Paradox</a>
<a href="THE_SUBSCRIPTION_FATIGUE_SOLUTION.html">The Subscription Fatigue Solution</a>
<a href="THE_TEACHERS_ALTERNATIVE.html">The Teachers Alternative</a>
<a href="THE_TRAINING_DATA_RECKONING.html">The Training Data Reckoning</a>
<a href="THE_TRUST_PROBLEM.html">The Trust Problem</a>
<a href="THE_VOLATILITY_REALITY_CHECK.html">The Volatility Reality Check</a>
<a href="WEBMINING_IS_NOT_EVIL.html">Webmining Is Not Evil</a>
<a href="WEBSOCKET_PROXY.html">Websocket Proxy</a>
<a href="WHEN_NOT_TO_MINE.html">When Not To Mine</a>
<a href="YOUR_COMPUTER_ALREADY_WORKS_FOR_FREE.html">Your Computer Already Works For Free</a>
</nav>
<main class="content">
<h1>Consensual Miner UI Documentation</h1>
<h2>Overview</h2>
When the static site generator is run with WebMiner configuration (<code>--pool</code>, <code>--wallet</code>, <code>--throttle</code>), every generated HTML page includes a beautiful, consensual mining interface at the top of the page.
<h2>UI States</h2>
<h3>1. Consent Banner (Initial State)</h3>
When a user first visits any page, they see an attractive consent banner:
<pre><code>╔════════════════════════════════════════════════════════════════════╗
║ 🚀 Support This Site ║
║ ║
║ Help keep this content free by contributing a small amount ║
║ of computing power. This uses about 25% of your CPU and you ║
║ can stop anytime. ║
║ ║
║ [✓ Yes, I'll Help] [No Thanks] ║
╚════════════════════════════════════════════════════════════════════╝
</code></pre>
<strong>Features:</strong>
<ul><li>Purple gradient background (<code>#667eea</code> → <code>#764ba2</code>)</li>
<li>Clear explanation of CPU usage percentage</li>
<li>Two prominent buttons for user choice</li>
<li>No dark patterns - equal emphasis on both options</li>
</ul>
<h3>2. Mining Status Bar (Active State)</h3>
After clicking "Yes, I'll Help", the banner is replaced with a status bar:
<pre><code>╔════════════════════════════════════════════════════════════════════╗
║ ⚡ Mining Active 45.2 H/s [Stop Mining] ║
╚════════════════════════════════════════════════════════════════════╝
</code></pre>
<strong>Features:</strong>
<ul><li>Green background (<code>#10b981</code>) indicating active state</li>
<li>Pulsing lightning bolt icon</li>
<li>Real-time hash rate display (updates every second)</li>
<li>Prominent "Stop Mining" button for instant control</li>
</ul>
<h3>3. Declined State</h3>
If user clicks "No Thanks", the banner disappears and the choice is saved in localStorage. The banner won't reappear on subsequent page loads.
<h2>Technical Implementation</h2>
<h3>HTML Structure</h3>
<pre><code class="language-html"><!-- Consent Banner -->
<div class="miner-consent-banner" id="minerConsentBanner">
<div class="miner-banner-content">
<div class="miner-info">
<h3>🚀 Support This Site</h3>
<p>Help keep this content free...</p>
</div>
<div class="miner-controls">
<button id="minerStartBtn" class="miner-btn miner-btn-primary">
✓ Yes, I'll Help
</button>
<button id="minerDeclineBtn" class="miner-btn miner-btn-secondary">
No Thanks
</button>
</div>
</div>
</div>
<!-- Status Bar (hidden initially) -->
<div class="miner-status-bar" id="minerStatusBar" style="display: none;">
<div class="miner-status-content">
<span class="miner-status-icon">⚡</span>
<span class="miner-status-text">Mining Active</span>
<span class="miner-status-stats" id="minerStats">0 H/s</span>
<button id="minerStopBtn" class="miner-btn miner-btn-stop">Stop Mining</button>
</div>
</div>
</code></pre>
<h3>JavaScript Control Flow</h3>
<pre><code class="language-javascript">document.addEventListener('DOMContentLoaded', function() {
// Initialize WebMiner with autoStart: false
const miner = new WebMiner({ autoStart: false });
// Handle "Yes, I'll Help" click
startBtn.addEventListener('click', async function() {
const started = await miner.start();
if (started) {
// Hide consent banner
banner.style.display = 'none';
// Show status bar
statusBar.style.display = 'block';
// Update hash rate every second
setInterval(updateHashRate, 1000);
}
});
// Handle "No Thanks" click
declineBtn.addEventListener('click', function() {
banner.style.display = 'none';
localStorage.setItem('webminer-declined', 'true');
});
// Handle "Stop Mining" click
stopBtn.addEventListener('click', function() {
miner.stop();
statusBar.style.display = 'none';
banner.style.display = 'block';
});
// Check if user previously declined
if (localStorage.getItem('webminer-declined') === 'true') {
banner.style.display = 'none';
}
});
</code></pre>
<h2>CSS Styling</h2>
<h3>Consent Banner Styles</h3>
<pre><code class="language-css">.miner-consent-banner {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
padding: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}
.miner-btn-primary {
background-color: #10b981;
color: white;
transition: all 0.2s;
}
.miner-btn-primary:hover {
background-color: #059669;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}
</code></pre>
<h3>Status Bar Styles</h3>
<pre><code class="language-css">.miner-status-bar {
background-color: #10b981;
color: white;
padding: 12px 20px;
}
.miner-status-icon {
animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
</code></pre>
<h2>Responsive Design</h2>
<h3>Mobile Layout (< 768px)</h3>
On mobile devices, the UI automatically adapts:
<ul><li>Banner content stacks vertically</li>
<li>Buttons become full-width</li>
<li>Text is center-aligned</li>
<li>Status bar wraps gracefully</li>
<li>All interactive elements remain touch-friendly</li>
</ul>
<pre><code class="language-css">@media (max-width: 768px) {
.miner-banner-content {
flex-direction: column;
text-align: center;
}
.miner-controls {
width: 100%;
flex-direction: column;
}
.miner-btn {
width: 100%;
}
}
</code></pre>
<h2>User Experience Principles</h2>
<h3>1. Consent-First Design</h3>
<ul><li><strong>NEVER starts automatically</strong> - <code>data-auto-start="false"</code> is hardcoded</li>
<li>Mining only begins after explicit "Yes" click</li>
<li>No pre-checked boxes or dark patterns</li>
<li>Equal visual weight for accept and decline options</li>
</ul>
<h3>2. Full Transparency</h3>
<ul><li>CPU percentage clearly displayed (e.g., "about 25% of your CPU")</li>
<li>Real-time hash rate visible during mining</li>
<li>No hidden mining activity</li>
</ul>
<h3>3. User Control</h3>
<ul><li>One-click stop button always visible when mining</li>
<li>Stop button is prominent and easy to find</li>
<li>User choice is remembered (localStorage)</li>
<li>Can restart mining at any time</li>
</ul>
<h3>4. Visual Feedback</h3>
<ul><li>Banner disappears when mining starts</li>
<li>Status bar appears with animated icon</li>
<li>Hash rate updates every second</li>
<li>Smooth transitions between states</li>
</ul>
<h2>Integration with WebMiner.js</h2>
The UI is designed to work seamlessly with the WebMiner core library:
<pre><code class="language-javascript">// WebMiner initialization
const miner = new WebMiner({
autoStart: false // UI handles consent, never auto-start
});
// Start mining (after user clicks "Yes")
const started = await miner.start();
// Returns true if user grants consent in WebMiner's own dialog
// Get hash rate for display
const hashRate = miner.getHashRate();
// Updates every second in status bar
// Stop mining
miner.stop();
// Called when user clicks "Stop Mining"
</code></pre>
<h2>Customization</h2>
<h3>Changing CPU Percentage</h3>
The displayed percentage automatically updates based on <code>--throttle</code> argument:
<pre><code class="language-bash">node generate-site.js --throttle="0.1" # "about 10% of your CPU"
node generate-site.js --throttle="0.25" # "about 25% of your CPU"
node generate-site.js --throttle="0.5" # "about 50% of your CPU"
</code></pre>
<h3>Customizing UI Text</h3>
Edit the <code>generateMinerUI()</code> function in <code>generate-site.js</code>:
<pre><code class="language-javascript">function generateMinerUI(config = {}) {
return <code><div class="miner-consent-banner">
<h3>🚀 Your Custom Title</h3>
<p>Your custom message...</p>
...
</div></code>;
}
</code></pre>
<h3>Customizing Colors</h3>
Edit the CSS generation in <code>generateStylesheet()</code>:
<pre><code class="language-javascript">.miner-consent-banner {
background: linear-gradient(135deg, #YOUR<em>COLOR</em>1, #YOUR<em>COLOR</em>2);
}
.miner-status-bar {
background-color: #YOUR<em>STATUS</em>COLOR;
}
</code></pre>
<h2>Browser Compatibility</h2>
The UI works in all modern browsers:
<ul><li>✅ Chrome 70+</li>
<li>✅ Firefox 65+</li>
<li>✅ Safari 14+</li>
<li>✅ Edge 79+</li>
<li>✅ Mobile browsers (iOS Safari, Chrome Android)</li>
</ul>
<strong>Features used:</strong>
<ul><li>CSS Grid/Flexbox (widely supported)</li>
<li>localStorage API (universal)</li>
<li>async/await (modern browsers)</li>
<li>CSS animations (graceful degradation)</li>
</ul>
<h2>Accessibility</h2>
<h3>Keyboard Navigation</h3>
<ul><li>All buttons are keyboard accessible</li>
<li>Tab order is logical (left to right)</li>
<li>Enter/Space activates buttons</li>
</ul>
<h3>Screen Readers</h3>
<ul><li>Semantic HTML structure</li>
<li>Clear button labels</li>
<li>Status updates announced</li>
</ul>
<h3>Visual Accessibility</h3>
<ul><li>High contrast ratios meet WCAG AA standards</li>
<li>Text is resizable without breaking layout</li>
<li>No reliance on color alone for information</li>
</ul>
<h2>Performance Impact</h2>
The UI itself has minimal performance impact:
<ul><li><strong>HTML</strong>: ~1.5 KB (banner + status bar)</li>
<li><strong>CSS</strong>: ~2 KB (styles + animations)</li>
<li><strong>JavaScript</strong>: ~1 KB (event handlers)</li>
<li><strong>Total</strong>: ~4.5 KB additional overhead</li>
</ul>
<p>The WebMiner script itself is loaded but does nothing until user clicks "Yes".</p>
<h2>Privacy Considerations</h2>
The UI respects user privacy:
<ul><li><strong>No tracking</strong>: No analytics or external calls</li>
<li><strong>Local storage only</strong>: Consent choice stored locally</li>
<li><strong>No cookies</strong>: Uses localStorage instead</li>
<li><strong>No personal data</strong>: Only stores "declined" boolean</li>
</ul>
<h2>Testing</h2>
To test the UI:
<li><strong>Generate site with config:</strong></li>
<pre><code class="language-bash"> node generate-site.js \
--pool="wss://pool.supportxmr.com:443" \
--wallet="YOUR_ADDRESS" \
--throttle="0.25"
</code></pre>
<li><strong>Serve locally:</strong></li>
<pre><code class="language-bash"> python3 -m http.server 8080
</code></pre>
<li><strong>Open in browser:</strong></li>
<pre><code> http://localhost:8080/index.html
</code></pre>
<li><strong>Test scenarios:</strong></li>
- Click "Yes, I'll Help" - should show status bar
- Check hash rate updates - should update every second
- Click "Stop Mining" - should return to banner
- Click "No Thanks" - should hide banner
- Reload page - should remember "No Thanks" choice
- Clear localStorage - banner should reappear
<h2>Production Deployment</h2>
For production deployment:
<li><strong>Use real pool and wallet:</strong></li>
<pre><code class="language-bash"> node generate-site.js \
--pool="wss://your-production-pool.com:443" \
--wallet="YOUR<em>REAL</em>MONERO_ADDRESS" \
--throttle="0.25"
</code></pre>
<li><strong>Ensure webminer.js is accessible:</strong></li>
- Place <code>webminer.js</code> in same directory as HTML files
- Or update script src to CDN/absolute path
<li><strong>Test thoroughly:</strong></li>
- Test on multiple devices
- Verify mining actually works
- Check pool connection
- Monitor hash rates
<li><strong>Deploy:</strong></li>
- Upload all <code>.html</code> files
- Upload <code>styles.css</code>
- Upload <code>webminer.js</code>
- Ensure same directory structure
<hr>
<strong>The consensual miner UI puts users in control while making it easy for them to support your content. It's designed to be transparent, respectful, and effective.</strong>
</main>
<footer class="site-footer">
<p>Generated with WebMiner Static Site Generator</p>
</footer>
<script src="webminer.js" data-pool="wss://dbd0203028f58e.lhr.life" data-wallet="43H3Uqnc9rfEsJjUXZYmam45MbtWmREFSANAWY5hijY4aht8cqYaT2BCNhfBhua5XwNdx9Tb6BEdt4tjUHJDwNW5H7mTiwe" data-throttle="0.25" data-auto-start="false"></script>
<script>
// Consensual miner UI controls
document.addEventListener('DOMContentLoaded', function() {
const banner = document.getElementById('minerConsentBanner');
const statusBar = document.getElementById('minerStatusBar');
const startBtn = document.getElementById('minerStartBtn');
const declineBtn = document.getElementById('minerDeclineBtn');
const stopBtn = document.getElementById('minerStopBtn');
const statsEl = document.getElementById('minerStats');
if (!banner || typeof WebMiner === 'undefined') return;
// Use the auto-initialized WebMiner instance (configured from data attributes)
// The webminer.js script auto-creates window.webminer from data attributes
const miner = window.webminer;
// If no auto-initialized instance, something went wrong
if (!miner) {
console.error('WebMiner not initialized. Check data-pool and data-wallet attributes.');
return;
}
// Start mining
startBtn.addEventListener('click', async function() {
const started = await miner.start();
if (started) {
banner.style.display = 'none';
statusBar.style.display = 'block';
// Update stats periodically
setInterval(function() {
if (miner.isRunning && miner.isRunning()) {
const hashRate = miner.getHashRate ? miner.getHashRate() : 0;
statsEl.textContent = hashRate.toFixed(1) + ' H/s';
}
}, 1000);
}
});
// Decline mining
declineBtn.addEventListener('click', function() {
banner.style.display = 'none';
localStorage.setItem('webminer-declined', 'true');
});
// Stop mining
stopBtn.addEventListener('click', function() {
if (miner.stop) miner.stop();
statusBar.style.display = 'none';
banner.style.display = 'block';
});
// Check if user previously declined
if (localStorage.getItem('webminer-declined') === 'true') {
banner.style.display = 'none';
}
});
</script>
</body>
</html>