mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-12 19:20:45 +02:00
Delete Custom-Ocean.xyz-Dashboard directory
This commit is contained in:
parent
5312b11132
commit
32447b87eb
File diff suppressed because it is too large
Load Diff
@ -1,21 +0,0 @@
|
|||||||
MIT License
|
|
||||||
|
|
||||||
Copyright (c) 2025 DJObleezy
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in all
|
|
||||||
copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
||||||
SOFTWARE.
|
|
@ -1,131 +0,0 @@
|
|||||||
# Ocean.xyz Bitcoin Mining Dashboard
|
|
||||||
|
|
||||||
## A Practical Monitoring Solution for Bitcoin Miners
|
|
||||||
|
|
||||||
This open-source dashboard provides comprehensive monitoring for Ocean.xyz pool miners, offering real-time data on hashrate, profitability, and worker status. Designed to be resource-efficient and user-friendly, it helps miners maintain oversight of their operations.
|
|
||||||
|
|
||||||
---
|
|
||||||
## Gallery:
|
|
||||||

|
|
||||||

|
|
||||||

|
|
||||||
---
|
|
||||||
|
|
||||||
## Practical Mining Intelligence
|
|
||||||
|
|
||||||
The dashboard aggregates essential metrics in one accessible interface:
|
|
||||||
|
|
||||||
- **Profitability Analysis**: Monitor daily and monthly earnings in BTC and USD
|
|
||||||
- **Worker Status**: Track online/offline status of mining equipment
|
|
||||||
- **Payout Monitoring**: View unpaid balance and estimated time to next payout
|
|
||||||
- **Network Metrics**: Stay informed of difficulty adjustments and network hashrate
|
|
||||||
- **Cost Analysis**: Calculate profit margins based on power consumption
|
|
||||||
|
|
||||||
## Key Features
|
|
||||||
|
|
||||||
### Mining Performance Metrics
|
|
||||||
- **Hashrate Visualization**: Clear graphical representation of hashrate trends
|
|
||||||
- **Financial Calculations**: Automatic conversion between BTC and USD values
|
|
||||||
- **Payout Estimation**: Projected time until minimum payout threshold is reached
|
|
||||||
- **Network Intelligence**: Current Bitcoin price, difficulty, and total network hashrate
|
|
||||||
|
|
||||||
### Worker Management
|
|
||||||
- **Equipment Overview**: Consolidated view of all mining devices
|
|
||||||
- **Status Monitoring**: Clear indicators for active and inactive devices
|
|
||||||
- **Performance Data**: Individual hashrate, temperature, and acceptance rate metrics
|
|
||||||
- **Filtering Options**: Sort and search by device type or operational status
|
|
||||||
|
|
||||||
### Thoughtful Design Elements
|
|
||||||
- **Retro Terminal Monitor**: A floating system monitor with classic design aesthetics
|
|
||||||
- **Boot Sequence**: An engaging initialization sequence on startup
|
|
||||||
- **Responsive Interface**: Adapts seamlessly to desktop and mobile devices
|
|
||||||
|
|
||||||
## Installation Options
|
|
||||||
|
|
||||||
### Standard Installation
|
|
||||||
|
|
||||||
1. Download the latest release package
|
|
||||||
2. Configure your mining parameters in `config.json`:
|
|
||||||
- Pool wallet address
|
|
||||||
- Electricity cost ($/kWh)
|
|
||||||
- System power consumption (watts)
|
|
||||||
3. Launch the application using the included startup script
|
|
||||||
4. Access the dashboard at `http://localhost:5000`
|
|
||||||
|
|
||||||
### Docker Installation
|
|
||||||
|
|
||||||
For those preferring containerized deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run -d -p 5000:5000 -e WALLET=your-wallet-address -e POWER_COST=0.12 -e POWER_USAGE=3450 yourusername/ocean-mining-dashboard
|
|
||||||
```
|
|
||||||
|
|
||||||
Then navigate to `http://localhost:5000` in your web browser.
|
|
||||||
|
|
||||||
## Dashboard Components
|
|
||||||
|
|
||||||
### Main Dashboard
|
|
||||||
|
|
||||||
- Interactive hashrate visualization
|
|
||||||
- Detailed profitability metrics
|
|
||||||
- Network statistics
|
|
||||||
- Current Bitcoin price
|
|
||||||
- Balance and payment information
|
|
||||||
|
|
||||||
### Workers Dashboard
|
|
||||||

|
|
||||||
|
|
||||||
- Fleet summary with aggregate statistics
|
|
||||||
- Individual worker performance metrics
|
|
||||||
- Status indicators for each device
|
|
||||||
- Flexible filtering and search functionality
|
|
||||||
|
|
||||||
### Retro Terminal Monitor
|
|
||||||

|
|
||||||
|
|
||||||
- Floating interface providing system statistics
|
|
||||||
- Progress indicator for data refresh cycles
|
|
||||||
- System uptime display
|
|
||||||
- Minimizable design for unobtrusive monitoring
|
|
||||||
- Thoughtful visual styling reminiscent of classic computer terminals
|
|
||||||
|
|
||||||
## System Requirements
|
|
||||||
|
|
||||||
The application is designed for efficient resource utilization:
|
|
||||||
- Compatible with standard desktop and laptop computers
|
|
||||||
- Modest CPU and memory requirements
|
|
||||||
- Suitable for continuous operation
|
|
||||||
- Cross-platform support for Windows, macOS, and Linux
|
|
||||||
|
|
||||||
## Troubleshooting
|
|
||||||
|
|
||||||
For optimal performance:
|
|
||||||
|
|
||||||
1. Use the refresh function if data appears outdated
|
|
||||||
2. Verify network connectivity for consistent updates
|
|
||||||
3. Restart the application after configuration changes
|
|
||||||
4. Access the health endpoint at `/api/health` for system status information
|
|
||||||
|
|
||||||
## Getting Started
|
|
||||||
|
|
||||||
1. Download the latest release
|
|
||||||
2. Configure with your mining information
|
|
||||||
3. Launch the application to begin monitoring
|
|
||||||
|
|
||||||
The dashboard requires only your Ocean.xyz mining wallet address for basic functionality.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Technical Foundation
|
|
||||||
|
|
||||||
Built on Flask with Chart.js for visualization and Server-Sent Events for real-time updates, this dashboard retrieves data from Ocean.xyz and performs calculations based on current network metrics and your specified parameters.
|
|
||||||
|
|
||||||
The application prioritizes stability and efficiency for reliable long-term operation. Source code is available for review and customization.
|
|
||||||
|
|
||||||
## Acknowledgments
|
|
||||||
|
|
||||||
- Ocean.xyz mining pool for their service
|
|
||||||
- The open-source community for their contributions
|
|
||||||
- Bitcoin protocol developers
|
|
||||||
|
|
||||||
Available under the MIT License. This is an independent project not affiliated with Ocean.xyz.
|
|
@ -1,55 +0,0 @@
|
|||||||
FROM python:3.9-slim
|
|
||||||
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install curl for healthcheck and other dependencies
|
|
||||||
RUN apt-get update && \
|
|
||||||
apt-get install -y --no-install-recommends curl && \
|
|
||||||
apt-get clean && \
|
|
||||||
rm -rf /var/lib/apt/lists/*
|
|
||||||
|
|
||||||
# Install dependencies first to leverage Docker cache.
|
|
||||||
COPY requirements.txt .
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
|
|
||||||
# Copy the entire application.
|
|
||||||
COPY . .
|
|
||||||
|
|
||||||
# Run the minifier to process HTML templates.
|
|
||||||
RUN python minify.py
|
|
||||||
|
|
||||||
# Create a non-root user first.
|
|
||||||
RUN adduser --disabled-password --gecos '' appuser
|
|
||||||
|
|
||||||
# Change ownership of the /app directory so that appuser can write files.
|
|
||||||
RUN chown -R appuser:appuser /app
|
|
||||||
|
|
||||||
# Create a directory for logs with proper permissions
|
|
||||||
RUN mkdir -p /app/logs && chown -R appuser:appuser /app/logs
|
|
||||||
|
|
||||||
USER appuser
|
|
||||||
|
|
||||||
EXPOSE 5000
|
|
||||||
|
|
||||||
# Add environment variables for app configuration
|
|
||||||
ENV FLASK_ENV=production
|
|
||||||
ENV PYTHONUNBUFFERED=1
|
|
||||||
ENV PYTHON_UNBUFFERED=1
|
|
||||||
|
|
||||||
# Improve healthcheck reliability - use new health endpoint
|
|
||||||
HEALTHCHECK --interval=15s --timeout=5s --start-period=30s --retries=3 \
|
|
||||||
CMD curl -f http://localhost:5000/api/health || exit 1
|
|
||||||
|
|
||||||
# Use Gunicorn as the production WSGI server with improved settings
|
|
||||||
# For shared global state, we need to keep the single worker model but optimize other parameters
|
|
||||||
CMD ["gunicorn", "-b", "0.0.0.0:5000", "App:app", \
|
|
||||||
"--workers=1", \
|
|
||||||
"--threads=12", \
|
|
||||||
"--timeout=600", \
|
|
||||||
"--keep-alive=5", \
|
|
||||||
"--log-level=info", \
|
|
||||||
"--access-logfile=-", \
|
|
||||||
"--error-logfile=-", \
|
|
||||||
"--log-file=-", \
|
|
||||||
"--graceful-timeout=60", \
|
|
||||||
"--worker-tmp-dir=/dev/shm"]
|
|
@ -1,76 +0,0 @@
|
|||||||
import os
|
|
||||||
import htmlmin
|
|
||||||
import logging
|
|
||||||
|
|
||||||
# Set up logging
|
|
||||||
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
|
|
||||||
|
|
||||||
TEMPLATES_DIR = "templates"
|
|
||||||
HTML_FILES = ["index.html", "error.html"]
|
|
||||||
|
|
||||||
def minify_html_file(file_path):
|
|
||||||
"""
|
|
||||||
Minify an HTML file with error handling
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
with open(file_path, "r", encoding="utf-8") as f:
|
|
||||||
content = f.read()
|
|
||||||
|
|
||||||
# Check if file has content
|
|
||||||
if not content.strip():
|
|
||||||
logging.warning(f"File {file_path} is empty. Skipping.")
|
|
||||||
return
|
|
||||||
|
|
||||||
# Minify the content
|
|
||||||
try:
|
|
||||||
minified = htmlmin.minify(content,
|
|
||||||
remove_comments=True,
|
|
||||||
remove_empty_space=True,
|
|
||||||
remove_all_empty_space=False,
|
|
||||||
reduce_boolean_attributes=True)
|
|
||||||
|
|
||||||
# Make sure minification worked and didn't remove everything
|
|
||||||
if not minified.strip():
|
|
||||||
logging.error(f"Minification of {file_path} resulted in empty content. Using original.")
|
|
||||||
minified = content
|
|
||||||
|
|
||||||
# Write back the minified content
|
|
||||||
with open(file_path, "w", encoding="utf-8") as f:
|
|
||||||
f.write(minified)
|
|
||||||
|
|
||||||
logging.info(f"Minified {file_path}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Error minifying {file_path}: {e}")
|
|
||||||
|
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Error reading file {file_path}: {e}")
|
|
||||||
|
|
||||||
def ensure_templates_dir():
|
|
||||||
"""
|
|
||||||
Ensure templates directory exists
|
|
||||||
"""
|
|
||||||
if not os.path.exists(TEMPLATES_DIR):
|
|
||||||
try:
|
|
||||||
os.makedirs(TEMPLATES_DIR)
|
|
||||||
logging.info(f"Created templates directory: {TEMPLATES_DIR}")
|
|
||||||
except Exception as e:
|
|
||||||
logging.error(f"Error creating templates directory: {e}")
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
logging.info("Starting HTML minification process")
|
|
||||||
|
|
||||||
if not ensure_templates_dir():
|
|
||||||
logging.error("Templates directory does not exist and could not be created. Exiting.")
|
|
||||||
exit(1)
|
|
||||||
|
|
||||||
for filename in HTML_FILES:
|
|
||||||
file_path = os.path.join(TEMPLATES_DIR, filename)
|
|
||||||
if os.path.exists(file_path):
|
|
||||||
minify_html_file(file_path)
|
|
||||||
else:
|
|
||||||
logging.warning(f"File {file_path} not found.")
|
|
||||||
|
|
||||||
logging.info("HTML minification process completed")
|
|
@ -1,9 +0,0 @@
|
|||||||
Flask==2.3.3
|
|
||||||
requests==2.31.0
|
|
||||||
beautifulsoup4==4.12.2
|
|
||||||
Flask-Caching==2.1.0
|
|
||||||
gunicorn==22.0.0
|
|
||||||
htmlmin==0.1.12
|
|
||||||
redis==5.0.1
|
|
||||||
APScheduler==3.10.4
|
|
||||||
psutil==5.9.5
|
|
@ -1,369 +0,0 @@
|
|||||||
/* Retro Floating Refresh Bar Styles */
|
|
||||||
:root {
|
|
||||||
--terminal-bg: #000000;
|
|
||||||
--terminal-border: #f7931a;
|
|
||||||
--terminal-text: #f7931a;
|
|
||||||
--terminal-glow: rgba(247, 147, 26, 0.7);
|
|
||||||
--terminal-width: 300px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adjust width for desktop */
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
:root {
|
|
||||||
--terminal-width: 340px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Remove the existing refresh timer container styles */
|
|
||||||
#refreshUptime {
|
|
||||||
visibility: hidden !important;
|
|
||||||
height: 0 !important;
|
|
||||||
overflow: hidden !important;
|
|
||||||
margin: 0 !important;
|
|
||||||
padding: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add padding to the bottom of the page to prevent floating bar from covering content
|
|
||||||
body {
|
|
||||||
padding-bottom: 100px !important;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/* Floating Retro Terminal Container */
|
|
||||||
#retro-terminal-bar {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 20px;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%);
|
|
||||||
width: var(--terminal-width);
|
|
||||||
background-color: var(--terminal-bg);
|
|
||||||
border: 2px solid var(--terminal-border);
|
|
||||||
/* box-shadow: 0 0 15px var(--terminal-glow); */
|
|
||||||
z-index: 1000;
|
|
||||||
font-family: 'VT323', monospace;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Desktop positioning (bottom right) */
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
#retro-terminal-bar {
|
|
||||||
left: auto;
|
|
||||||
right: 20px;
|
|
||||||
transform: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Terminal header with control buttons */
|
|
||||||
/* Update the terminal title to match card headers */
|
|
||||||
.terminal-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
border-bottom: 1px solid var(--terminal-border);
|
|
||||||
padding-bottom: 3px;
|
|
||||||
background-color: #000; /* Match card header background */
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-title {
|
|
||||||
color: var(--primary-color);
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.1rem; /* Match card header font size */
|
|
||||||
border-bottom: none;
|
|
||||||
text-shadow: 0 0 5px var(--primary-color);
|
|
||||||
animation: flicker 4s infinite; /* Add flicker animation from card headers */
|
|
||||||
font-family: var(--header-font); /* Use the same font variable */
|
|
||||||
padding: 0.3rem 0; /* Match card header padding */
|
|
||||||
letter-spacing: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make sure we're using the flicker animation defined in the main CSS */
|
|
||||||
@keyframes flicker {
|
|
||||||
0% { opacity: 0.97; }
|
|
||||||
5% { opacity: 0.95; }
|
|
||||||
10% { opacity: 0.97; }
|
|
||||||
15% { opacity: 0.94; }
|
|
||||||
20% { opacity: 0.98; }
|
|
||||||
50% { opacity: 0.95; }
|
|
||||||
80% { opacity: 0.96; }
|
|
||||||
90% { opacity: 0.94; }
|
|
||||||
100% { opacity: 0.98; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-controls {
|
|
||||||
display: flex;
|
|
||||||
gap: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-dot {
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: #555;
|
|
||||||
transition: background-color 0.3s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-dot:hover {
|
|
||||||
background-color: #999;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-dot.minimize:hover {
|
|
||||||
background-color: #ffcc00;
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-dot.close:hover {
|
|
||||||
background-color: #ff3b30;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Terminal content area */
|
|
||||||
.terminal-content {
|
|
||||||
position: relative;
|
|
||||||
color: #ffffff;
|
|
||||||
padding: 5px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scanline effect for authentic CRT look */
|
|
||||||
.terminal-content::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
0deg,
|
|
||||||
rgba(0, 0, 0, 0.15),
|
|
||||||
rgba(0, 0, 0, 0.15) 1px,
|
|
||||||
transparent 1px,
|
|
||||||
transparent 2px
|
|
||||||
);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1;
|
|
||||||
animation: flicker 0.15s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes flicker {
|
|
||||||
0% { opacity: 1.0; }
|
|
||||||
50% { opacity: 0.98; }
|
|
||||||
100% { opacity: 1.0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enhanced Progress Bar with tick marks */
|
|
||||||
#retro-terminal-bar .bitcoin-progress-container {
|
|
||||||
width: 100%;
|
|
||||||
height: 20px;
|
|
||||||
background-color: #111;
|
|
||||||
border: 1px solid var(--terminal-border);
|
|
||||||
margin-bottom: 10px;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tick marks on progress bar */
|
|
||||||
.progress-ticks {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
padding: 0 5px;
|
|
||||||
color: rgba(255, 255, 255, 0.6);
|
|
||||||
font-size: 10px;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
.progress-ticks span {
|
|
||||||
display: flex;
|
|
||||||
align-items: flex-end;
|
|
||||||
height: 100%;
|
|
||||||
padding-bottom: 2px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.tick-mark {
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
width: 1px;
|
|
||||||
height: 5px;
|
|
||||||
background-color: rgba(255, 255, 255, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.tick-mark.major {
|
|
||||||
height: 8px;
|
|
||||||
background-color: rgba(255, 255, 255, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The actual progress bar */
|
|
||||||
#retro-terminal-bar #bitcoin-progress-inner {
|
|
||||||
height: 100%;
|
|
||||||
width: 0;
|
|
||||||
background: linear-gradient(90deg, #f7931a, #ffa500);
|
|
||||||
position: relative;
|
|
||||||
transition: width 1s linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Position the original inner container correctly */
|
|
||||||
#retro-terminal-bar #refreshContainer {
|
|
||||||
display: block;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Blinking scan line animation */
|
|
||||||
.scan-line {
|
|
||||||
position: absolute;
|
|
||||||
height: 2px;
|
|
||||||
width: 100%;
|
|
||||||
background-color: rgba(255, 255, 255, 0.7);
|
|
||||||
animation: scan 3s linear infinite;
|
|
||||||
box-shadow: 0 0 8px 1px rgba(255, 255, 255, 0.5);
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes scan {
|
|
||||||
0% { top: -2px; }
|
|
||||||
100% { top: 22px; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Text styling */
|
|
||||||
#retro-terminal-bar #progress-text {
|
|
||||||
font-size: 16px;
|
|
||||||
color: var(--terminal-text);
|
|
||||||
text-shadow: 0 0 5px var(--terminal-text);
|
|
||||||
margin-top: 5px;
|
|
||||||
text-align: center;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
#retro-terminal-bar #uptimeTimer {
|
|
||||||
font-size: 16px;
|
|
||||||
color: var(--terminal-text);
|
|
||||||
text-shadow: 0 0 5px var(--terminal-text);
|
|
||||||
text-align: center;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
border-top: 1px solid rgba(247, 147, 26, 0.3);
|
|
||||||
padding-top: 5px;
|
|
||||||
margin-top: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Terminal cursor */
|
|
||||||
#retro-terminal-bar #terminal-cursor {
|
|
||||||
display: inline-block;
|
|
||||||
width: 8px;
|
|
||||||
height: 14px;
|
|
||||||
background-color: var(--terminal-text);
|
|
||||||
margin-left: 2px;
|
|
||||||
animation: blink 1s step-end infinite;
|
|
||||||
box-shadow: 0 0 8px var(--terminal-text);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Glowing effect during the last few seconds */
|
|
||||||
#retro-terminal-bar #bitcoin-progress-inner.glow-effect {
|
|
||||||
box-shadow: 0 0 15px #f7931a, 0 0 25px #f7931a;
|
|
||||||
}
|
|
||||||
|
|
||||||
#retro-terminal-bar .waiting-for-update {
|
|
||||||
animation: waitingPulse 2s infinite !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes waitingPulse {
|
|
||||||
0%, 100% { box-shadow: 0 0 10px #f7931a, 0 0 15px #f7931a; opacity: 0.8; }
|
|
||||||
50% { box-shadow: 0 0 20px #f7931a, 0 0 35px #f7931a; opacity: 1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Status indicators */
|
|
||||||
.status-indicators {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
font-size: 12px;
|
|
||||||
color: #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-indicator {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-dot {
|
|
||||||
width: 6px;
|
|
||||||
height: 6px;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-right: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-dot.connected {
|
|
||||||
background-color: #32CD32;
|
|
||||||
box-shadow: 0 0 5px #32CD32;
|
|
||||||
animation: pulse 2s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes pulse {
|
|
||||||
0% { opacity: 0.8; }
|
|
||||||
50% { opacity: 1; }
|
|
||||||
100% { opacity: 0.8; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Collapse/expand functionality */
|
|
||||||
#retro-terminal-bar.collapsed .terminal-content {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
#retro-terminal-bar.collapsed {
|
|
||||||
width: 180px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* On desktop, move the collapsed bar to bottom right */
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
#retro-terminal-bar.collapsed {
|
|
||||||
right: 20px;
|
|
||||||
transform: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Show button */
|
|
||||||
#show-terminal-button {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 10px;
|
|
||||||
right: 10px;
|
|
||||||
z-index: 1000;
|
|
||||||
background-color: #f7931a;
|
|
||||||
color: #000;
|
|
||||||
border: none;
|
|
||||||
padding: 8px 12px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-family: 'VT323', monospace;
|
|
||||||
font-size: 14px;
|
|
||||||
box-shadow: 0 0 10px rgba(247, 147, 26, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
#show-terminal-button:hover {
|
|
||||||
background-color: #ffaa33;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobile responsiveness */
|
|
||||||
@media (max-width: 576px) {
|
|
||||||
#retro-terminal-bar {
|
|
||||||
width: 280px;
|
|
||||||
bottom: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-title {
|
|
||||||
font-size: 14px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.terminal-dot {
|
|
||||||
width: 6px;
|
|
||||||
height: 6px;
|
|
||||||
}
|
|
||||||
|
|
||||||
#show-terminal-button {
|
|
||||||
padding: 6px 10px;
|
|
||||||
font-size: 12px;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,801 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
// Global variables
|
|
||||||
let previousMetrics = {};
|
|
||||||
let persistentArrows = {};
|
|
||||||
let serverTimeOffset = 0;
|
|
||||||
let serverStartTime = null;
|
|
||||||
let latestMetrics = null;
|
|
||||||
let initialLoad = true;
|
|
||||||
let trendData = [];
|
|
||||||
let trendLabels = [];
|
|
||||||
let trendChart = null;
|
|
||||||
let connectionRetryCount = 0;
|
|
||||||
let maxRetryCount = 10;
|
|
||||||
let reconnectionDelay = 1000; // Start with 1 second
|
|
||||||
let pingInterval = null;
|
|
||||||
let lastPingTime = Date.now();
|
|
||||||
let connectionLostTimeout = null;
|
|
||||||
|
|
||||||
// Bitcoin-themed progress bar functionality
|
|
||||||
let progressInterval;
|
|
||||||
let currentProgress = 0;
|
|
||||||
let lastUpdateTime = Date.now();
|
|
||||||
let expectedUpdateInterval = 60000; // Expected server update interval (60 seconds)
|
|
||||||
const PROGRESS_MAX = 60; // 60 seconds for a complete cycle
|
|
||||||
|
|
||||||
// Initialize the progress bar and start the animation
|
|
||||||
function initProgressBar() {
|
|
||||||
// Clear any existing interval
|
|
||||||
if (progressInterval) {
|
|
||||||
clearInterval(progressInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set last update time to now
|
|
||||||
lastUpdateTime = Date.now();
|
|
||||||
|
|
||||||
// Reset progress with initial offset
|
|
||||||
currentProgress = 1; // Start at 1 instead of 0 for offset
|
|
||||||
updateProgressBar(currentProgress);
|
|
||||||
|
|
||||||
// Start the interval
|
|
||||||
progressInterval = setInterval(function() {
|
|
||||||
// Calculate elapsed time since last update
|
|
||||||
const elapsedTime = Date.now() - lastUpdateTime;
|
|
||||||
|
|
||||||
// Calculate progress percentage based on elapsed time with +1 second offset
|
|
||||||
const secondsElapsed = Math.floor(elapsedTime / 1000) + 1; // Add 1 second offset
|
|
||||||
|
|
||||||
// If we've gone past the expected update time
|
|
||||||
if (secondsElapsed >= PROGRESS_MAX) {
|
|
||||||
// Keep the progress bar full but show waiting state
|
|
||||||
currentProgress = PROGRESS_MAX;
|
|
||||||
} else {
|
|
||||||
// Normal progress with offset
|
|
||||||
currentProgress = secondsElapsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
updateProgressBar(currentProgress);
|
|
||||||
}, 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the progress bar display
|
|
||||||
function updateProgressBar(seconds) {
|
|
||||||
const progressPercent = (seconds / PROGRESS_MAX) * 100;
|
|
||||||
$("#bitcoin-progress-inner").css("width", progressPercent + "%");
|
|
||||||
|
|
||||||
// Add glowing effect when close to completion
|
|
||||||
if (progressPercent > 80) {
|
|
||||||
$("#bitcoin-progress-inner").addClass("glow-effect");
|
|
||||||
} else {
|
|
||||||
$("#bitcoin-progress-inner").removeClass("glow-effect");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update remaining seconds text - more precise calculation
|
|
||||||
let remainingSeconds = PROGRESS_MAX - seconds;
|
|
||||||
|
|
||||||
// When we're past the expected time, show "Waiting for update..."
|
|
||||||
if (remainingSeconds <= 0) {
|
|
||||||
$("#progress-text").text("Waiting for update...");
|
|
||||||
$("#bitcoin-progress-inner").addClass("waiting-for-update");
|
|
||||||
} else {
|
|
||||||
$("#progress-text").text(remainingSeconds + "s to next update");
|
|
||||||
$("#bitcoin-progress-inner").removeClass("waiting-for-update");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Register Chart.js annotation plugin if available
|
|
||||||
if (window['chartjs-plugin-annotation']) {
|
|
||||||
Chart.register(window['chartjs-plugin-annotation']);
|
|
||||||
}
|
|
||||||
|
|
||||||
// SSE Connection with Error Handling and Reconnection Logic
|
|
||||||
function setupEventSource() {
|
|
||||||
console.log("Setting up EventSource connection...");
|
|
||||||
|
|
||||||
if (window.eventSource) {
|
|
||||||
console.log("Closing existing EventSource connection");
|
|
||||||
window.eventSource.close();
|
|
||||||
window.eventSource = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always use absolute URL with origin to ensure it works from any path
|
|
||||||
const baseUrl = window.location.origin;
|
|
||||||
const streamUrl = `${baseUrl}/stream`;
|
|
||||||
|
|
||||||
console.log("Current path:", window.location.pathname);
|
|
||||||
console.log("Using stream URL:", streamUrl);
|
|
||||||
|
|
||||||
// Clear any existing ping interval
|
|
||||||
if (pingInterval) {
|
|
||||||
clearInterval(pingInterval);
|
|
||||||
pingInterval = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Clear any connection lost timeout
|
|
||||||
if (connectionLostTimeout) {
|
|
||||||
clearTimeout(connectionLostTimeout);
|
|
||||||
connectionLostTimeout = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const eventSource = new EventSource(streamUrl);
|
|
||||||
|
|
||||||
eventSource.onopen = function(e) {
|
|
||||||
console.log("EventSource connection opened successfully");
|
|
||||||
connectionRetryCount = 0; // Reset retry count on successful connection
|
|
||||||
reconnectionDelay = 1000; // Reset reconnection delay
|
|
||||||
hideConnectionIssue();
|
|
||||||
|
|
||||||
// Start ping interval to detect dead connections
|
|
||||||
lastPingTime = Date.now();
|
|
||||||
pingInterval = setInterval(function() {
|
|
||||||
const now = Date.now();
|
|
||||||
if (now - lastPingTime > 60000) { // 60 seconds without data
|
|
||||||
console.warn("No data received for 60 seconds, reconnecting...");
|
|
||||||
showConnectionIssue("Connection stalled");
|
|
||||||
eventSource.close();
|
|
||||||
setupEventSource();
|
|
||||||
}
|
|
||||||
}, 10000); // Check every 10 seconds
|
|
||||||
};
|
|
||||||
|
|
||||||
eventSource.onmessage = function(e) {
|
|
||||||
console.log("SSE message received");
|
|
||||||
lastPingTime = Date.now(); // Update ping time on any message
|
|
||||||
|
|
||||||
try {
|
|
||||||
const data = JSON.parse(e.data);
|
|
||||||
|
|
||||||
// Handle different message types
|
|
||||||
if (data.type === "ping") {
|
|
||||||
console.log("Ping received:", data);
|
|
||||||
// Update connection count if available
|
|
||||||
if (data.connections !== undefined) {
|
|
||||||
console.log(`Active connections: ${data.connections}`);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.type === "timeout_warning") {
|
|
||||||
console.log(`Connection timeout warning: ${data.remaining}s remaining`);
|
|
||||||
// If less than 30 seconds remaining, prepare for reconnection
|
|
||||||
if (data.remaining < 30) {
|
|
||||||
console.log("Preparing for reconnection due to upcoming timeout");
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.type === "timeout") {
|
|
||||||
console.log("Connection timeout from server:", data.message);
|
|
||||||
eventSource.close();
|
|
||||||
// If reconnect flag is true, reconnect immediately
|
|
||||||
if (data.reconnect) {
|
|
||||||
console.log("Server requested reconnection");
|
|
||||||
setTimeout(setupEventSource, 500);
|
|
||||||
} else {
|
|
||||||
setupEventSource();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (data.error) {
|
|
||||||
console.error("Server reported error:", data.error);
|
|
||||||
showConnectionIssue(data.error);
|
|
||||||
|
|
||||||
// If retry time provided, use it, otherwise use default
|
|
||||||
const retryTime = data.retry || 5000;
|
|
||||||
setTimeout(function() {
|
|
||||||
manualRefresh();
|
|
||||||
}, retryTime);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Process regular data update
|
|
||||||
latestMetrics = data;
|
|
||||||
updateUI();
|
|
||||||
hideConnectionIssue();
|
|
||||||
|
|
||||||
// Also explicitly trigger a data refresh event
|
|
||||||
$(document).trigger('dataRefreshed');
|
|
||||||
} catch (err) {
|
|
||||||
console.error("Error processing SSE data:", err);
|
|
||||||
showConnectionIssue("Data processing error");
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
eventSource.onerror = function(e) {
|
|
||||||
console.error("SSE connection error", e);
|
|
||||||
showConnectionIssue("Connection lost");
|
|
||||||
|
|
||||||
eventSource.close();
|
|
||||||
|
|
||||||
// Implement exponential backoff for reconnection
|
|
||||||
connectionRetryCount++;
|
|
||||||
|
|
||||||
if (connectionRetryCount > maxRetryCount) {
|
|
||||||
console.log("Maximum retry attempts reached, switching to polling mode");
|
|
||||||
if (pingInterval) {
|
|
||||||
clearInterval(pingInterval);
|
|
||||||
pingInterval = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Switch to regular polling
|
|
||||||
showConnectionIssue("Using polling mode");
|
|
||||||
setInterval(manualRefresh, 30000); // Poll every 30 seconds
|
|
||||||
manualRefresh(); // Do an immediate refresh
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Exponential backoff with jitter
|
|
||||||
const jitter = Math.random() * 0.3 + 0.85; // 0.85-1.15
|
|
||||||
reconnectionDelay = Math.min(30000, reconnectionDelay * 1.5 * jitter);
|
|
||||||
|
|
||||||
console.log(`Reconnecting in ${(reconnectionDelay/1000).toFixed(1)} seconds... (attempt ${connectionRetryCount}/${maxRetryCount})`);
|
|
||||||
setTimeout(setupEventSource, reconnectionDelay);
|
|
||||||
};
|
|
||||||
|
|
||||||
window.eventSource = eventSource;
|
|
||||||
console.log("EventSource setup complete");
|
|
||||||
|
|
||||||
// Set a timeout to detect if connection is established
|
|
||||||
connectionLostTimeout = setTimeout(function() {
|
|
||||||
if (eventSource.readyState !== 1) { // 1 = OPEN
|
|
||||||
console.warn("Connection not established within timeout, switching to manual refresh");
|
|
||||||
showConnectionIssue("Connection timeout");
|
|
||||||
eventSource.close();
|
|
||||||
manualRefresh();
|
|
||||||
}
|
|
||||||
}, 10000); // 10 seconds timeout to establish connection
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Failed to create EventSource:", error);
|
|
||||||
showConnectionIssue("Connection setup failed");
|
|
||||||
setTimeout(setupEventSource, 5000); // Try again in 5 seconds
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add page visibility change listener
|
|
||||||
// This helps reconnect when user returns to the tab after it's been inactive
|
|
||||||
document.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
||||||
document.addEventListener("visibilitychange", handleVisibilityChange);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle page visibility changes
|
|
||||||
function handleVisibilityChange() {
|
|
||||||
if (!document.hidden) {
|
|
||||||
console.log("Page became visible, checking connection");
|
|
||||||
if (!window.eventSource || window.eventSource.readyState !== 1) {
|
|
||||||
console.log("Connection not active, reestablishing");
|
|
||||||
setupEventSource();
|
|
||||||
}
|
|
||||||
manualRefresh(); // Always refresh data when page becomes visible
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to show connection issues to the user
|
|
||||||
function showConnectionIssue(message) {
|
|
||||||
let $connectionStatus = $("#connectionStatus");
|
|
||||||
if (!$connectionStatus.length) {
|
|
||||||
$("body").append('<div id="connectionStatus" style="position: fixed; top: 10px; right: 10px; background: rgba(255,0,0,0.7); color: white; padding: 10px; border-radius: 5px; z-index: 9999;"></div>');
|
|
||||||
$connectionStatus = $("#connectionStatus");
|
|
||||||
}
|
|
||||||
$connectionStatus.html(`<i class="fas fa-exclamation-triangle"></i> ${message}`).show();
|
|
||||||
|
|
||||||
// Show manual refresh button when there are connection issues
|
|
||||||
$("#refreshButton").show();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to hide connection issue message
|
|
||||||
function hideConnectionIssue() {
|
|
||||||
$("#connectionStatus").hide();
|
|
||||||
$("#refreshButton").hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Improved manual refresh function as fallback
|
|
||||||
function manualRefresh() {
|
|
||||||
console.log("Manually refreshing data...");
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '/api/metrics',
|
|
||||||
method: 'GET',
|
|
||||||
dataType: 'json',
|
|
||||||
timeout: 15000, // 15 second timeout
|
|
||||||
success: function(data) {
|
|
||||||
console.log("Manual refresh successful");
|
|
||||||
lastPingTime = Date.now(); // Update ping time
|
|
||||||
latestMetrics = data;
|
|
||||||
updateUI();
|
|
||||||
hideConnectionIssue();
|
|
||||||
|
|
||||||
// Explicitly trigger data refresh event
|
|
||||||
$(document).trigger('dataRefreshed');
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error("Manual refresh failed:", error);
|
|
||||||
showConnectionIssue("Manual refresh failed");
|
|
||||||
|
|
||||||
// Try again with exponential backoff
|
|
||||||
const retryDelay = Math.min(30000, 1000 * Math.pow(1.5, Math.min(5, connectionRetryCount)));
|
|
||||||
connectionRetryCount++;
|
|
||||||
setTimeout(manualRefresh, retryDelay);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize Chart.js with Error Handling
|
|
||||||
function initializeChart() {
|
|
||||||
try {
|
|
||||||
const ctx = document.getElementById('trendGraph').getContext('2d');
|
|
||||||
if (!ctx) {
|
|
||||||
console.error("Could not find trend graph canvas");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!window.Chart) {
|
|
||||||
console.error("Chart.js not loaded");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if Chart.js plugin is available
|
|
||||||
const hasAnnotationPlugin = window['chartjs-plugin-annotation'] !== undefined;
|
|
||||||
|
|
||||||
return new Chart(ctx, {
|
|
||||||
type: 'line',
|
|
||||||
data: {
|
|
||||||
labels: [],
|
|
||||||
datasets: [{
|
|
||||||
label: '60s Hashrate Trend (TH/s)',
|
|
||||||
data: [],
|
|
||||||
borderColor: '#f7931a',
|
|
||||||
backgroundColor: 'rgba(247,147,26,0.1)',
|
|
||||||
fill: true,
|
|
||||||
tension: 0.2,
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
animation: {
|
|
||||||
duration: 0 // Disable animations for better performance
|
|
||||||
},
|
|
||||||
scales: {
|
|
||||||
x: { display: false },
|
|
||||||
y: {
|
|
||||||
ticks: { color: 'white' },
|
|
||||||
grid: { color: '#333' }
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: { display: false },
|
|
||||||
annotation: hasAnnotationPlugin ? {
|
|
||||||
annotations: {
|
|
||||||
averageLine: {
|
|
||||||
type: 'line',
|
|
||||||
yMin: 0,
|
|
||||||
yMax: 0,
|
|
||||||
borderColor: '#f7931a',
|
|
||||||
borderWidth: 2,
|
|
||||||
borderDash: [6, 6],
|
|
||||||
label: {
|
|
||||||
enabled: true,
|
|
||||||
content: '24hr Avg: 0 TH/s',
|
|
||||||
backgroundColor: 'rgba(0,0,0,0.7)',
|
|
||||||
color: '#f7931a',
|
|
||||||
font: { weight: 'bold', size: 13 },
|
|
||||||
position: 'start'
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} : {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error initializing chart:", error);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to safely format numbers with commas
|
|
||||||
function numberWithCommas(x) {
|
|
||||||
if (x == null) return "N/A";
|
|
||||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Server time update via polling
|
|
||||||
function updateServerTime() {
|
|
||||||
$.ajax({
|
|
||||||
url: "/api/time",
|
|
||||||
method: "GET",
|
|
||||||
timeout: 5000,
|
|
||||||
success: function(data) {
|
|
||||||
serverTimeOffset = new Date(data.server_timestamp).getTime() - Date.now();
|
|
||||||
serverStartTime = new Date(data.server_start_time).getTime();
|
|
||||||
},
|
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
|
||||||
console.error("Error fetching server time:", textStatus, errorThrown);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update uptime display
|
|
||||||
function updateUptime() {
|
|
||||||
if (serverStartTime) {
|
|
||||||
const currentServerTime = Date.now() + serverTimeOffset;
|
|
||||||
const diff = currentServerTime - serverStartTime;
|
|
||||||
const hours = Math.floor(diff / (1000 * 60 * 60));
|
|
||||||
const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
|
|
||||||
const seconds = Math.floor((diff % (1000 * 60)) / 1000);
|
|
||||||
$("#uptimeTimer").html("<strong>Uptime:</strong> " + hours + "h " + minutes + "m " + seconds + "s");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update UI indicators (arrows)
|
|
||||||
function updateIndicators(newMetrics) {
|
|
||||||
const keys = [
|
|
||||||
"pool_total_hashrate", "hashrate_24hr", "hashrate_3hr", "hashrate_10min",
|
|
||||||
"hashrate_60sec", "block_number", "btc_price", "network_hashrate",
|
|
||||||
"difficulty", "daily_revenue", "daily_power_cost", "daily_profit_usd",
|
|
||||||
"monthly_profit_usd", "daily_mined_sats", "monthly_mined_sats", "unpaid_earnings",
|
|
||||||
"estimated_earnings_per_day_sats", "estimated_earnings_next_block_sats", "estimated_rewards_in_window_sats",
|
|
||||||
"workers_hashing"
|
|
||||||
];
|
|
||||||
|
|
||||||
keys.forEach(function(key) {
|
|
||||||
const newVal = parseFloat(newMetrics[key]);
|
|
||||||
if (isNaN(newVal)) return;
|
|
||||||
|
|
||||||
const oldVal = parseFloat(previousMetrics[key]);
|
|
||||||
if (!isNaN(oldVal)) {
|
|
||||||
if (newVal > oldVal) {
|
|
||||||
persistentArrows[key] = "<i class='arrow chevron fa-solid fa-angle-double-up bounce-up' style='color: green;'></i>";
|
|
||||||
} else if (newVal < oldVal) {
|
|
||||||
persistentArrows[key] = "<i class='arrow chevron fa-solid fa-angle-double-down bounce-down' style='color: red; position: relative; top: -2px;'></i>";
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (newMetrics.arrow_history && newMetrics.arrow_history[key] && newMetrics.arrow_history[key].length > 0) {
|
|
||||||
const historyArr = newMetrics.arrow_history[key];
|
|
||||||
for (let i = historyArr.length - 1; i >= 0; i--) {
|
|
||||||
if (historyArr[i].arrow !== "") {
|
|
||||||
if (historyArr[i].arrow === "↑") {
|
|
||||||
persistentArrows[key] = "<i class='arrow chevron fa-solid fa-angle-double-up bounce-up' style='color: green;'></i>";
|
|
||||||
} else if (historyArr[i].arrow === "↓") {
|
|
||||||
persistentArrows[key] = "<i class='arrow chevron fa-solid fa-angle-double-down bounce-down' style='color: red; position: relative; top: -2px;'></i>";
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const indicator = document.getElementById("indicator_" + key);
|
|
||||||
if (indicator) {
|
|
||||||
indicator.innerHTML = persistentArrows[key] || "";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
previousMetrics = { ...newMetrics };
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to safely update element text content
|
|
||||||
function updateElementText(elementId, text) {
|
|
||||||
const element = document.getElementById(elementId);
|
|
||||||
if (element) {
|
|
||||||
element.textContent = text;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to safely update element HTML content
|
|
||||||
function updateElementHTML(elementId, html) {
|
|
||||||
const element = document.getElementById(elementId);
|
|
||||||
if (element) {
|
|
||||||
element.innerHTML = html;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update workers_hashing value from metrics, but don't try to access worker details
|
|
||||||
function updateWorkersCount() {
|
|
||||||
if (latestMetrics && latestMetrics.workers_hashing !== undefined) {
|
|
||||||
$("#workers_hashing").text(latestMetrics.workers_hashing || 0);
|
|
||||||
|
|
||||||
// Update miner status with online/offline indicator based on worker count
|
|
||||||
if (latestMetrics.workers_hashing > 0) {
|
|
||||||
updateElementHTML("miner_status", "<span class='status-green'>ONLINE</span> <span class='online-dot'></span>");
|
|
||||||
} else {
|
|
||||||
updateElementHTML("miner_status", "<span class='status-red'>OFFLINE</span> <span class='offline-dot'></span>");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for block updates and show congratulatory messages
|
|
||||||
function checkForBlockUpdates(data) {
|
|
||||||
if (previousMetrics.last_block_height !== undefined &&
|
|
||||||
data.last_block_height !== previousMetrics.last_block_height) {
|
|
||||||
showCongrats("Congrats! New Block Found: " + data.last_block_height);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (previousMetrics.blocks_found !== undefined &&
|
|
||||||
data.blocks_found !== previousMetrics.blocks_found) {
|
|
||||||
showCongrats("Congrats! Blocks Found updated: " + data.blocks_found);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to show congratulatory messages
|
|
||||||
function showCongrats(message) {
|
|
||||||
const $congrats = $("#congratsMessage");
|
|
||||||
$congrats.text(message).fadeIn(500, function() {
|
|
||||||
setTimeout(function() {
|
|
||||||
$congrats.fadeOut(500);
|
|
||||||
}, 3000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Main UI update function
|
|
||||||
function updateUI() {
|
|
||||||
if (!latestMetrics) {
|
|
||||||
console.warn("No metrics data available");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
const data = latestMetrics;
|
|
||||||
|
|
||||||
// If there's execution time data, log it
|
|
||||||
if (data.execution_time) {
|
|
||||||
console.log(`Server metrics fetch took ${data.execution_time.toFixed(2)}s`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Cache jQuery selectors for performance and use safe update methods
|
|
||||||
updateElementText("pool_total_hashrate",
|
|
||||||
(data.pool_total_hashrate != null ? data.pool_total_hashrate : "N/A") + " " +
|
|
||||||
(data.pool_total_hashrate_unit ? data.pool_total_hashrate_unit.slice(0,-2).toUpperCase() + data.pool_total_hashrate_unit.slice(-2) : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
updateElementText("hashrate_24hr",
|
|
||||||
(data.hashrate_24hr != null ? data.hashrate_24hr : "N/A") + " " +
|
|
||||||
(data.hashrate_24hr_unit ? data.hashrate_24hr_unit.slice(0,-2).toUpperCase() + data.hashrate_24hr_unit.slice(-2) : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
updateElementText("hashrate_3hr",
|
|
||||||
(data.hashrate_3hr != null ? data.hashrate_3hr : "N/A") + " " +
|
|
||||||
(data.hashrate_3hr_unit ? data.hashrate_3hr_unit.slice(0,-2).toUpperCase() + data.hashrate_3hr_unit.slice(-2) : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
updateElementText("hashrate_10min",
|
|
||||||
(data.hashrate_10min != null ? data.hashrate_10min : "N/A") + " " +
|
|
||||||
(data.hashrate_10min_unit ? data.hashrate_10min_unit.slice(0,-2).toUpperCase() + data.hashrate_10min_unit.slice(-2) : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
updateElementText("hashrate_60sec",
|
|
||||||
(data.hashrate_60sec != null ? data.hashrate_60sec : "N/A") + " " +
|
|
||||||
(data.hashrate_60sec_unit ? data.hashrate_60sec_unit.slice(0,-2).toUpperCase() + data.hashrate_60sec_unit.slice(-2) : "")
|
|
||||||
);
|
|
||||||
|
|
||||||
updateElementText("block_number", numberWithCommas(data.block_number));
|
|
||||||
|
|
||||||
updateElementText("btc_price",
|
|
||||||
data.btc_price != null ? "$" + numberWithCommas(parseFloat(data.btc_price).toFixed(2)) : "N/A"
|
|
||||||
);
|
|
||||||
|
|
||||||
updateElementText("network_hashrate", numberWithCommas(Math.round(data.network_hashrate)) + " EH/s");
|
|
||||||
updateElementText("difficulty", numberWithCommas(Math.round(data.difficulty)));
|
|
||||||
updateElementText("daily_revenue", "$" + numberWithCommas(data.daily_revenue.toFixed(2)));
|
|
||||||
updateElementText("daily_power_cost", "$" + numberWithCommas(data.daily_power_cost.toFixed(2)));
|
|
||||||
updateElementText("daily_profit_usd", "$" + numberWithCommas(data.daily_profit_usd.toFixed(2)));
|
|
||||||
updateElementText("monthly_profit_usd", "$" + numberWithCommas(data.monthly_profit_usd.toFixed(2)));
|
|
||||||
updateElementText("daily_mined_sats", numberWithCommas(data.daily_mined_sats) + " sats");
|
|
||||||
updateElementText("monthly_mined_sats", numberWithCommas(data.monthly_mined_sats) + " sats");
|
|
||||||
|
|
||||||
// Update worker count from metrics (just the number, not full worker data)
|
|
||||||
updateWorkersCount();
|
|
||||||
|
|
||||||
updateElementText("unpaid_earnings", data.unpaid_earnings + " BTC");
|
|
||||||
|
|
||||||
// Update payout estimation with color coding
|
|
||||||
const payoutText = data.est_time_to_payout;
|
|
||||||
updateElementText("est_time_to_payout", payoutText);
|
|
||||||
|
|
||||||
if (payoutText && payoutText.toLowerCase().includes("next block")) {
|
|
||||||
$("#est_time_to_payout").css({
|
|
||||||
"color": "#32CD32",
|
|
||||||
"animation": "glowPulse 1s infinite"
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
const days = parseFloat(payoutText);
|
|
||||||
if (!isNaN(days)) {
|
|
||||||
if (days < 4) {
|
|
||||||
$("#est_time_to_payout").css({"color": "#32CD32", "animation": "none"});
|
|
||||||
} else if (days > 20) {
|
|
||||||
$("#est_time_to_payout").css({"color": "red", "animation": "none"});
|
|
||||||
} else {
|
|
||||||
$("#est_time_to_payout").css({"color": "#ffd700", "animation": "none"});
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$("#est_time_to_payout").css({"color": "#ffd700", "animation": "none"});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
updateElementText("last_block_height", data.last_block_height || "");
|
|
||||||
updateElementText("last_block_time", data.last_block_time || "");
|
|
||||||
updateElementText("blocks_found", data.blocks_found || "0");
|
|
||||||
updateElementText("last_share", data.total_last_share || "");
|
|
||||||
|
|
||||||
// Update Estimated Earnings metrics
|
|
||||||
updateElementText("estimated_earnings_per_day_sats", numberWithCommas(data.estimated_earnings_per_day_sats) + " sats");
|
|
||||||
updateElementText("estimated_earnings_next_block_sats", numberWithCommas(data.estimated_earnings_next_block_sats) + " sats");
|
|
||||||
updateElementText("estimated_rewards_in_window_sats", numberWithCommas(data.estimated_rewards_in_window_sats) + " sats");
|
|
||||||
|
|
||||||
// Update last updated timestamp
|
|
||||||
const now = new Date(Date.now() + serverTimeOffset);
|
|
||||||
updateElementHTML("lastUpdated", "<strong>Last Updated:</strong> " + now.toLocaleString() + "<span id='terminal-cursor'></span>");
|
|
||||||
|
|
||||||
// Update chart if it exists
|
|
||||||
if (trendChart) {
|
|
||||||
try {
|
|
||||||
// Always update the 24hr average line even if we don't have data points yet
|
|
||||||
const avg24hr = parseFloat(data.hashrate_24hr || 0);
|
|
||||||
if (!isNaN(avg24hr) &&
|
|
||||||
trendChart.options.plugins.annotation &&
|
|
||||||
trendChart.options.plugins.annotation.annotations &&
|
|
||||||
trendChart.options.plugins.annotation.annotations.averageLine) {
|
|
||||||
const annotation = trendChart.options.plugins.annotation.annotations.averageLine;
|
|
||||||
annotation.yMin = avg24hr;
|
|
||||||
annotation.yMax = avg24hr;
|
|
||||||
annotation.label.content = '24hr Avg: ' + avg24hr + ' TH/s';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update data points if we have any (removed minimum length requirement)
|
|
||||||
if (data.arrow_history && data.arrow_history.hashrate_60sec) {
|
|
||||||
const historyData = data.arrow_history.hashrate_60sec;
|
|
||||||
if (historyData && historyData.length > 0) {
|
|
||||||
console.log(`Updating chart with ${historyData.length} data points`);
|
|
||||||
trendChart.data.labels = historyData.map(item => item.time);
|
|
||||||
trendChart.data.datasets[0].data = historyData.map(item => {
|
|
||||||
const val = parseFloat(item.value);
|
|
||||||
return isNaN(val) ? 0 : val;
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
console.log("No history data points available yet");
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log("No hashrate_60sec history available yet");
|
|
||||||
|
|
||||||
// If there's no history data, create a starting point using current hashrate
|
|
||||||
if (data.hashrate_60sec) {
|
|
||||||
const currentTime = new Date().toLocaleTimeString('en-US', {hour12: false, hour: '2-digit', minute: '2-digit'});
|
|
||||||
trendChart.data.labels = [currentTime];
|
|
||||||
trendChart.data.datasets[0].data = [parseFloat(data.hashrate_60sec) || 0];
|
|
||||||
console.log("Created initial data point with current hashrate");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Always update the chart, even if we just updated the average line
|
|
||||||
trendChart.update('none');
|
|
||||||
} catch (chartError) {
|
|
||||||
console.error("Error updating chart:", chartError);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update indicators and check for block updates
|
|
||||||
updateIndicators(data);
|
|
||||||
checkForBlockUpdates(data);
|
|
||||||
|
|
||||||
} catch (error) {
|
|
||||||
console.error("Error updating UI:", error);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up refresh synchronization
|
|
||||||
function setupRefreshSync() {
|
|
||||||
// Listen for the dataRefreshed event
|
|
||||||
$(document).on('dataRefreshed', function() {
|
|
||||||
// Broadcast to any other open tabs/pages that the data has been refreshed
|
|
||||||
try {
|
|
||||||
// Store the current timestamp to localStorage
|
|
||||||
localStorage.setItem('dashboardRefreshTime', Date.now().toString());
|
|
||||||
|
|
||||||
// Create a custom event that can be detected across tabs/pages
|
|
||||||
localStorage.setItem('dashboardRefreshEvent', 'refresh-' + Date.now());
|
|
||||||
|
|
||||||
console.log("Dashboard refresh synchronized");
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Error synchronizing refresh:", e);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Document ready initialization
|
|
||||||
$(document).ready(function() {
|
|
||||||
// Initialize the chart
|
|
||||||
trendChart = initializeChart();
|
|
||||||
|
|
||||||
// Initialize the progress bar
|
|
||||||
initProgressBar();
|
|
||||||
|
|
||||||
// Set up direct monitoring of data refreshes
|
|
||||||
$(document).on('dataRefreshed', function() {
|
|
||||||
console.log("Data refresh event detected, resetting progress bar");
|
|
||||||
lastUpdateTime = Date.now();
|
|
||||||
currentProgress = 0;
|
|
||||||
updateProgressBar(currentProgress);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Wrap the updateUI function to detect changes and trigger events
|
|
||||||
const originalUpdateUI = updateUI;
|
|
||||||
updateUI = function() {
|
|
||||||
const previousMetricsTimestamp = latestMetrics ? latestMetrics.server_timestamp : null;
|
|
||||||
|
|
||||||
// Call the original function
|
|
||||||
originalUpdateUI.apply(this, arguments);
|
|
||||||
|
|
||||||
// Check if we got new data by comparing timestamps
|
|
||||||
if (latestMetrics && latestMetrics.server_timestamp !== previousMetricsTimestamp) {
|
|
||||||
console.log("New data detected, triggering refresh event");
|
|
||||||
$(document).trigger('dataRefreshed');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Set up event source for SSE
|
|
||||||
setupEventSource();
|
|
||||||
|
|
||||||
// Start server time polling
|
|
||||||
updateServerTime();
|
|
||||||
setInterval(updateServerTime, 30000);
|
|
||||||
|
|
||||||
// Start uptime timer
|
|
||||||
setInterval(updateUptime, 1000);
|
|
||||||
updateUptime();
|
|
||||||
|
|
||||||
// Set up refresh synchronization with workers page
|
|
||||||
setupRefreshSync();
|
|
||||||
|
|
||||||
// Add a manual refresh button for fallback
|
|
||||||
$("body").append('<button id="refreshButton" style="position: fixed; bottom: 20px; left: 20px; z-index: 1000; background: #f7931a; color: black; border: none; padding: 8px 16px; display: none; border-radius: 4px; cursor: pointer;">Refresh Data</button>');
|
|
||||||
|
|
||||||
$("#refreshButton").on("click", function() {
|
|
||||||
$(this).text("Refreshing...");
|
|
||||||
$(this).prop("disabled", true);
|
|
||||||
manualRefresh();
|
|
||||||
setTimeout(function() {
|
|
||||||
$("#refreshButton").text("Refresh Data");
|
|
||||||
$("#refreshButton").prop("disabled", false);
|
|
||||||
}, 5000);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Force a data refresh when the page loads
|
|
||||||
manualRefresh();
|
|
||||||
|
|
||||||
// Add emergency refresh button functionality
|
|
||||||
$("#forceRefreshBtn").show().on("click", function() {
|
|
||||||
$(this).text("Refreshing...");
|
|
||||||
$(this).prop("disabled", true);
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '/api/force-refresh',
|
|
||||||
method: 'POST',
|
|
||||||
timeout: 15000,
|
|
||||||
success: function(data) {
|
|
||||||
console.log("Force refresh successful:", data);
|
|
||||||
manualRefresh(); // Immediately get the new data
|
|
||||||
$("#forceRefreshBtn").text("Force Refresh").prop("disabled", false);
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error("Force refresh failed:", error);
|
|
||||||
$("#forceRefreshBtn").text("Force Refresh").prop("disabled", false);
|
|
||||||
alert("Refresh failed: " + error);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Add stale data detection
|
|
||||||
setInterval(function() {
|
|
||||||
if (latestMetrics && latestMetrics.server_timestamp) {
|
|
||||||
const lastUpdate = new Date(latestMetrics.server_timestamp);
|
|
||||||
const timeSinceUpdate = Math.floor((Date.now() - lastUpdate.getTime()) / 1000);
|
|
||||||
if (timeSinceUpdate > 120) { // More than 2 minutes
|
|
||||||
showConnectionIssue(`Data stale (${timeSinceUpdate}s old). Use Force Refresh.`);
|
|
||||||
$("#forceRefreshBtn").show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 30000); // Check every 30 seconds
|
|
||||||
});
|
|
@ -1,238 +0,0 @@
|
|||||||
// This script integrates the retro floating refresh bar
|
|
||||||
// with the existing dashboard and workers page functionality
|
|
||||||
|
|
||||||
(function() {
|
|
||||||
// Wait for DOM to be ready
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
// Create the retro terminal bar if it doesn't exist yet
|
|
||||||
if (!document.getElementById('retro-terminal-bar')) {
|
|
||||||
createRetroTerminalBar();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hide the original refresh container
|
|
||||||
const originalRefreshUptime = document.getElementById('refreshUptime');
|
|
||||||
if (originalRefreshUptime) {
|
|
||||||
originalRefreshUptime.style.visibility = 'hidden';
|
|
||||||
originalRefreshUptime.style.height = '0';
|
|
||||||
originalRefreshUptime.style.overflow = 'hidden';
|
|
||||||
|
|
||||||
// Important: We keep the original elements and just hide them
|
|
||||||
// This ensures all existing JavaScript functions still work
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add extra space at the bottom of the page to prevent the floating bar from covering content
|
|
||||||
const extraSpace = document.createElement('div');
|
|
||||||
extraSpace.style.height = '100px';
|
|
||||||
document.body.appendChild(extraSpace);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Function to create the retro terminal bar
|
|
||||||
function createRetroTerminalBar() {
|
|
||||||
// Get the HTML content from the shared CSS/HTML
|
|
||||||
const html = `
|
|
||||||
<div id="retro-terminal-bar">
|
|
||||||
<div class="terminal-header">
|
|
||||||
<div class="terminal-title">SYSTEM MONITOR v0.1</div>
|
|
||||||
<div class="terminal-controls">
|
|
||||||
<div class="terminal-dot minimize" title="Minimize" onclick="toggleTerminal()"></div>
|
|
||||||
<div class="terminal-dot close" title="Close" onclick="hideTerminal()"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="terminal-content">
|
|
||||||
<div class="status-indicators">
|
|
||||||
<div class="status-indicator">
|
|
||||||
<div class="status-dot connected"></div>
|
|
||||||
<span>LIVE</span>
|
|
||||||
</div>
|
|
||||||
<div class="status-indicator">
|
|
||||||
<span id="data-refresh-time">00:00:00</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="refreshContainer">
|
|
||||||
<!-- Enhanced progress bar with tick marks -->
|
|
||||||
<div class="bitcoin-progress-container">
|
|
||||||
<div id="bitcoin-progress-inner">
|
|
||||||
<div class="scan-line"></div>
|
|
||||||
</div>
|
|
||||||
<div class="progress-ticks">
|
|
||||||
<span>0s</span>
|
|
||||||
<span>15s</span>
|
|
||||||
<span>30s</span>
|
|
||||||
<span>45s</span>
|
|
||||||
<span>60s</span>
|
|
||||||
</div>
|
|
||||||
<!-- Add tick marks every 5 seconds -->
|
|
||||||
<div class="tick-mark major" style="left: 0%"></div>
|
|
||||||
<div class="tick-mark" style="left: 8.33%"></div>
|
|
||||||
<div class="tick-mark" style="left: 16.67%"></div>
|
|
||||||
<div class="tick-mark major" style="left: 25%"></div>
|
|
||||||
<div class="tick-mark" style="left: 33.33%"></div>
|
|
||||||
<div class="tick-mark" style="left: 41.67%"></div>
|
|
||||||
<div class="tick-mark major" style="left: 50%"></div>
|
|
||||||
<div class="tick-mark" style="left: 58.33%"></div>
|
|
||||||
<div class="tick-mark" style="left: 66.67%"></div>
|
|
||||||
<div class="tick-mark major" style="left: 75%"></div>
|
|
||||||
<div class="tick-mark" style="left: 83.33%"></div>
|
|
||||||
<div class="tick-mark" style="left: 91.67%"></div>
|
|
||||||
<div class="tick-mark major" style="left: 100%"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="progress-text">60s to next update</div>
|
|
||||||
<div id="uptimeTimer"><strong>Uptime:</strong> 0h 0m 0s</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
||||||
|
|
||||||
// Create a container for the HTML
|
|
||||||
const container = document.createElement('div');
|
|
||||||
container.innerHTML = html;
|
|
||||||
|
|
||||||
// Append to the body
|
|
||||||
document.body.appendChild(container.firstElementChild);
|
|
||||||
|
|
||||||
// Start the clock update
|
|
||||||
updateTerminalClock();
|
|
||||||
setInterval(updateTerminalClock, 1000);
|
|
||||||
|
|
||||||
// Check if terminal should be collapsed based on previous state
|
|
||||||
const isCollapsed = localStorage.getItem('terminalCollapsed') === 'true';
|
|
||||||
if (isCollapsed) {
|
|
||||||
document.getElementById('retro-terminal-bar').classList.add('collapsed');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Function to update the terminal clock
|
|
||||||
function updateTerminalClock() {
|
|
||||||
const clockElement = document.getElementById('data-refresh-time');
|
|
||||||
if (clockElement) {
|
|
||||||
const now = new Date();
|
|
||||||
const hours = String(now.getHours()).padStart(2, '0');
|
|
||||||
const minutes = String(now.getMinutes()).padStart(2, '0');
|
|
||||||
const seconds = String(now.getSeconds()).padStart(2, '0');
|
|
||||||
clockElement.textContent = `${hours}:${minutes}:${seconds}`;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Expose these functions globally for the onclick handlers
|
|
||||||
window.toggleTerminal = function() {
|
|
||||||
const terminal = document.getElementById('retro-terminal-bar');
|
|
||||||
terminal.classList.toggle('collapsed');
|
|
||||||
|
|
||||||
// Store state in localStorage
|
|
||||||
localStorage.setItem('terminalCollapsed', terminal.classList.contains('collapsed'));
|
|
||||||
};
|
|
||||||
|
|
||||||
window.hideTerminal = function() {
|
|
||||||
document.getElementById('retro-terminal-bar').style.display = 'none';
|
|
||||||
|
|
||||||
// Create a show button that appears at the bottom right
|
|
||||||
const showButton = document.createElement('button');
|
|
||||||
showButton.id = 'show-terminal-button';
|
|
||||||
showButton.textContent = 'Show Monitor';
|
|
||||||
showButton.style.position = 'fixed';
|
|
||||||
showButton.style.bottom = '10px';
|
|
||||||
showButton.style.right = '10px';
|
|
||||||
showButton.style.zIndex = '1000';
|
|
||||||
showButton.style.backgroundColor = '#f7931a';
|
|
||||||
showButton.style.color = '#000';
|
|
||||||
showButton.style.border = 'none';
|
|
||||||
showButton.style.padding = '8px 12px';
|
|
||||||
showButton.style.cursor = 'pointer';
|
|
||||||
showButton.style.fontFamily = "'VT323', monospace";
|
|
||||||
showButton.style.fontSize = '14px';
|
|
||||||
showButton.onclick = function() {
|
|
||||||
document.getElementById('retro-terminal-bar').style.display = 'block';
|
|
||||||
this.remove();
|
|
||||||
};
|
|
||||||
document.body.appendChild(showButton);
|
|
||||||
};
|
|
||||||
|
|
||||||
// Redirect original progress bar updates to our new floating bar
|
|
||||||
// This Observer will listen for changes to the original #bitcoin-progress-inner
|
|
||||||
// and replicate them to our new floating bar version
|
|
||||||
const initProgressObserver = function() {
|
|
||||||
// Setup a MutationObserver to watch for style changes on the original progress bar
|
|
||||||
const originalProgressBar = document.querySelector('#refreshUptime #bitcoin-progress-inner');
|
|
||||||
const newProgressBar = document.querySelector('#retro-terminal-bar #bitcoin-progress-inner');
|
|
||||||
|
|
||||||
if (originalProgressBar && newProgressBar) {
|
|
||||||
const observer = new MutationObserver(function(mutations) {
|
|
||||||
mutations.forEach(function(mutation) {
|
|
||||||
if (mutation.attributeName === 'style') {
|
|
||||||
// Get the width from the original progress bar
|
|
||||||
const width = originalProgressBar.style.width;
|
|
||||||
if (width) {
|
|
||||||
// Apply it to our new progress bar
|
|
||||||
newProgressBar.style.width = width;
|
|
||||||
|
|
||||||
// Also copy any classes (like glow-effect)
|
|
||||||
if (originalProgressBar.classList.contains('glow-effect') &&
|
|
||||||
!newProgressBar.classList.contains('glow-effect')) {
|
|
||||||
newProgressBar.classList.add('glow-effect');
|
|
||||||
} else if (!originalProgressBar.classList.contains('glow-effect') &&
|
|
||||||
newProgressBar.classList.contains('glow-effect')) {
|
|
||||||
newProgressBar.classList.remove('glow-effect');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy waiting-for-update class
|
|
||||||
if (originalProgressBar.classList.contains('waiting-for-update') &&
|
|
||||||
!newProgressBar.classList.contains('waiting-for-update')) {
|
|
||||||
newProgressBar.classList.add('waiting-for-update');
|
|
||||||
} else if (!originalProgressBar.classList.contains('waiting-for-update') &&
|
|
||||||
newProgressBar.classList.contains('waiting-for-update')) {
|
|
||||||
newProgressBar.classList.remove('waiting-for-update');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start observing
|
|
||||||
observer.observe(originalProgressBar, { attributes: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Also watch for changes to the progress text
|
|
||||||
const originalProgressText = document.querySelector('#refreshUptime #progress-text');
|
|
||||||
const newProgressText = document.querySelector('#retro-terminal-bar #progress-text');
|
|
||||||
|
|
||||||
if (originalProgressText && newProgressText) {
|
|
||||||
const textObserver = new MutationObserver(function(mutations) {
|
|
||||||
mutations.forEach(function(mutation) {
|
|
||||||
if (mutation.type === 'childList') {
|
|
||||||
// Update the text in our new bar
|
|
||||||
newProgressText.textContent = originalProgressText.textContent;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start observing
|
|
||||||
textObserver.observe(originalProgressText, { childList: true, subtree: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Watch for changes to the uptime timer
|
|
||||||
const originalUptimeTimer = document.querySelector('#refreshUptime #uptimeTimer');
|
|
||||||
const newUptimeTimer = document.querySelector('#retro-terminal-bar #uptimeTimer');
|
|
||||||
|
|
||||||
if (originalUptimeTimer && newUptimeTimer) {
|
|
||||||
const uptimeObserver = new MutationObserver(function(mutations) {
|
|
||||||
mutations.forEach(function(mutation) {
|
|
||||||
if (mutation.type === 'childList') {
|
|
||||||
// Update the text in our new bar
|
|
||||||
newUptimeTimer.innerHTML = originalUptimeTimer.innerHTML;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start observing
|
|
||||||
uptimeObserver.observe(originalUptimeTimer, { childList: true, subtree: true });
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// Start the observer once the page is fully loaded
|
|
||||||
window.addEventListener('load', function() {
|
|
||||||
// Give a short delay to ensure all elements are rendered
|
|
||||||
setTimeout(initProgressObserver, 500);
|
|
||||||
});
|
|
||||||
})();
|
|
@ -1,641 +0,0 @@
|
|||||||
"use strict";
|
|
||||||
|
|
||||||
// Global variables for workers dashboard
|
|
||||||
let workerData = null;
|
|
||||||
let refreshTimer;
|
|
||||||
let pageLoadTime = Date.now();
|
|
||||||
let currentProgress = 0;
|
|
||||||
const PROGRESS_MAX = 60; // 60 seconds for a complete cycle
|
|
||||||
let lastUpdateTime = Date.now();
|
|
||||||
let filterState = {
|
|
||||||
currentFilter: 'all',
|
|
||||||
searchTerm: ''
|
|
||||||
};
|
|
||||||
let miniChart = null;
|
|
||||||
let connectionRetryCount = 0;
|
|
||||||
|
|
||||||
// Server time variables for uptime calculation - synced with main dashboard
|
|
||||||
let serverTimeOffset = 0;
|
|
||||||
let serverStartTime = null;
|
|
||||||
|
|
||||||
// New variable to track custom refresh timing
|
|
||||||
let lastManualRefreshTime = 0;
|
|
||||||
const MIN_REFRESH_INTERVAL = 10000; // Minimum 10 seconds between refreshes
|
|
||||||
|
|
||||||
// Initialize the page
|
|
||||||
$(document).ready(function() {
|
|
||||||
// Set up initial UI
|
|
||||||
initializePage();
|
|
||||||
|
|
||||||
// Get server time for uptime calculation
|
|
||||||
updateServerTime();
|
|
||||||
|
|
||||||
// Set up refresh synchronization with main dashboard
|
|
||||||
setupRefreshSync();
|
|
||||||
|
|
||||||
// Fetch worker data immediately on page load
|
|
||||||
fetchWorkerData();
|
|
||||||
|
|
||||||
// Set up refresh timer
|
|
||||||
setInterval(updateProgressBar, 1000);
|
|
||||||
|
|
||||||
// Set up uptime timer - synced with main dashboard
|
|
||||||
setInterval(updateUptime, 1000);
|
|
||||||
|
|
||||||
// Start server time polling - same as main dashboard
|
|
||||||
setInterval(updateServerTime, 30000);
|
|
||||||
|
|
||||||
// Auto-refresh worker data - aligned with main dashboard if possible
|
|
||||||
setInterval(function() {
|
|
||||||
// Check if it's been at least PROGRESS_MAX seconds since last update
|
|
||||||
const timeSinceLastUpdate = Date.now() - lastUpdateTime;
|
|
||||||
if (timeSinceLastUpdate >= PROGRESS_MAX * 1000) {
|
|
||||||
// Check if there was a recent manual refresh
|
|
||||||
const timeSinceManualRefresh = Date.now() - lastManualRefreshTime;
|
|
||||||
if (timeSinceManualRefresh >= MIN_REFRESH_INTERVAL) {
|
|
||||||
console.log("Auto-refresh triggered after time interval");
|
|
||||||
fetchWorkerData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}, 10000); // Check every 10 seconds to align better with main dashboard
|
|
||||||
|
|
||||||
// Set up filter button click handlers
|
|
||||||
$('.filter-button').click(function() {
|
|
||||||
$('.filter-button').removeClass('active');
|
|
||||||
$(this).addClass('active');
|
|
||||||
filterState.currentFilter = $(this).data('filter');
|
|
||||||
filterWorkers();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set up search input handler
|
|
||||||
$('#worker-search').on('input', function() {
|
|
||||||
filterState.searchTerm = $(this).val().toLowerCase();
|
|
||||||
filterWorkers();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Set up refresh synchronization with main dashboard
|
|
||||||
function setupRefreshSync() {
|
|
||||||
// Listen for storage events (triggered by main dashboard)
|
|
||||||
window.addEventListener('storage', function(event) {
|
|
||||||
// Check if this is our dashboard refresh event
|
|
||||||
if (event.key === 'dashboardRefreshEvent') {
|
|
||||||
console.log("Detected dashboard refresh event");
|
|
||||||
|
|
||||||
// Prevent too frequent refreshes
|
|
||||||
const now = Date.now();
|
|
||||||
const timeSinceLastRefresh = now - lastUpdateTime;
|
|
||||||
|
|
||||||
if (timeSinceLastRefresh >= MIN_REFRESH_INTERVAL) {
|
|
||||||
console.log("Syncing refresh with main dashboard");
|
|
||||||
// Reset progress bar and immediately fetch
|
|
||||||
resetProgressBar();
|
|
||||||
// Refresh the worker data
|
|
||||||
fetchWorkerData();
|
|
||||||
} else {
|
|
||||||
console.log("Skipping too-frequent refresh", timeSinceLastRefresh);
|
|
||||||
// Just reset the progress bar to match main dashboard
|
|
||||||
resetProgressBar();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// On page load, check if we should align with main dashboard timing
|
|
||||||
try {
|
|
||||||
const lastDashboardRefresh = localStorage.getItem('dashboardRefreshTime');
|
|
||||||
if (lastDashboardRefresh) {
|
|
||||||
const lastRefreshTime = parseInt(lastDashboardRefresh);
|
|
||||||
const timeSinceLastDashboardRefresh = Date.now() - lastRefreshTime;
|
|
||||||
|
|
||||||
// If main dashboard refreshed recently, adjust our timer
|
|
||||||
if (timeSinceLastDashboardRefresh < PROGRESS_MAX * 1000) {
|
|
||||||
console.log("Adjusting timer to align with main dashboard");
|
|
||||||
currentProgress = Math.floor(timeSinceLastDashboardRefresh / 1000);
|
|
||||||
updateProgressBar(currentProgress);
|
|
||||||
|
|
||||||
// Calculate when next update will happen (roughly 60 seconds from last dashboard refresh)
|
|
||||||
const timeUntilNextRefresh = (PROGRESS_MAX * 1000) - timeSinceLastDashboardRefresh;
|
|
||||||
|
|
||||||
// Schedule a one-time check near the expected refresh time
|
|
||||||
if (timeUntilNextRefresh > 0) {
|
|
||||||
console.log(`Scheduling coordinated refresh in ${Math.floor(timeUntilNextRefresh/1000)} seconds`);
|
|
||||||
setTimeout(function() {
|
|
||||||
// Check if a refresh happened in the last few seconds via localStorage event
|
|
||||||
const newLastRefresh = parseInt(localStorage.getItem('dashboardRefreshTime') || '0');
|
|
||||||
const secondsSinceLastRefresh = (Date.now() - newLastRefresh) / 1000;
|
|
||||||
|
|
||||||
// If dashboard hasn't refreshed in the last 5 seconds, do our own refresh
|
|
||||||
if (secondsSinceLastRefresh > 5) {
|
|
||||||
console.log("Coordinated refresh time reached, fetching data");
|
|
||||||
fetchWorkerData();
|
|
||||||
} else {
|
|
||||||
console.log("Dashboard already refreshed recently, skipping coordinated refresh");
|
|
||||||
}
|
|
||||||
}, timeUntilNextRefresh);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Error reading dashboard refresh time:", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for dashboard refresh periodically
|
|
||||||
setInterval(function() {
|
|
||||||
try {
|
|
||||||
const lastDashboardRefresh = parseInt(localStorage.getItem('dashboardRefreshTime') || '0');
|
|
||||||
const now = Date.now();
|
|
||||||
const timeSinceLastRefresh = (now - lastUpdateTime) / 1000;
|
|
||||||
const timeSinceDashboardRefresh = (now - lastDashboardRefresh) / 1000;
|
|
||||||
|
|
||||||
// If dashboard refreshed more recently than we did and we haven't refreshed in at least 10 seconds
|
|
||||||
if (lastDashboardRefresh > lastUpdateTime && timeSinceLastRefresh > 10) {
|
|
||||||
console.log("Catching up with dashboard refresh");
|
|
||||||
resetProgressBar();
|
|
||||||
fetchWorkerData();
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Error in periodic dashboard check:", e);
|
|
||||||
}
|
|
||||||
}, 5000); // Check every 5 seconds
|
|
||||||
}
|
|
||||||
|
|
||||||
// Server time update via polling - same as main.js
|
|
||||||
function updateServerTime() {
|
|
||||||
$.ajax({
|
|
||||||
url: "/api/time",
|
|
||||||
method: "GET",
|
|
||||||
timeout: 5000,
|
|
||||||
success: function(data) {
|
|
||||||
serverTimeOffset = new Date(data.server_timestamp).getTime() - Date.now();
|
|
||||||
serverStartTime = new Date(data.server_start_time).getTime();
|
|
||||||
},
|
|
||||||
error: function(jqXHR, textStatus, errorThrown) {
|
|
||||||
console.error("Error fetching server time:", textStatus, errorThrown);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update uptime display - synced with main dashboard
|
|
||||||
function updateUptime() {
|
|
||||||
if (serverStartTime) {
|
|
||||||
const currentServerTime = Date.now() + serverTimeOffset;
|
|
||||||
const diff = currentServerTime - serverStartTime;
|
|
||||||
const hours = Math.floor(diff / (1000 * 60 * 60));
|
|
||||||
const minutes = Math.floor((diff % (1000 * 60 * 60)) / (1000 * 60));
|
|
||||||
const seconds = Math.floor((diff % (1000 * 60)) / 1000);
|
|
||||||
$("#uptimeTimer").html("<strong>Uptime:</strong> " + hours + "h " + minutes + "m " + seconds + "s");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize page elements
|
|
||||||
function initializePage() {
|
|
||||||
// Initialize mini chart for total hashrate if the element exists
|
|
||||||
if (document.getElementById('total-hashrate-chart')) {
|
|
||||||
initializeMiniChart();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Show loading state
|
|
||||||
$('#worker-grid').html('<div class="text-center p-5"><i class="fas fa-spinner fa-spin"></i> Loading worker data...</div>');
|
|
||||||
|
|
||||||
// Add retry button (hidden by default)
|
|
||||||
if (!$('#retry-button').length) {
|
|
||||||
$('body').append('<button id="retry-button" style="position: fixed; bottom: 20px; left: 20px; z-index: 1000; background: #f7931a; color: black; border: none; padding: 8px 16px; display: none; border-radius: 4px; cursor: pointer;">Retry Loading Data</button>');
|
|
||||||
|
|
||||||
$('#retry-button').on('click', function() {
|
|
||||||
$(this).text('Retrying...').prop('disabled', true);
|
|
||||||
fetchWorkerData(true);
|
|
||||||
setTimeout(() => {
|
|
||||||
$('#retry-button').text('Retry Loading Data').prop('disabled', false);
|
|
||||||
}, 3000);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fetch worker data from API
|
|
||||||
function fetchWorkerData(forceRefresh = false) {
|
|
||||||
// Track this as a manual refresh for throttling purposes
|
|
||||||
lastManualRefreshTime = Date.now();
|
|
||||||
|
|
||||||
$('#worker-grid').addClass('loading-fade');
|
|
||||||
|
|
||||||
// Update progress bar to show data is being fetched
|
|
||||||
resetProgressBar();
|
|
||||||
|
|
||||||
// Choose API URL based on whether we're forcing a refresh
|
|
||||||
const apiUrl = `/api/workers${forceRefresh ? '?force=true' : ''}`;
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: apiUrl,
|
|
||||||
method: 'GET',
|
|
||||||
dataType: 'json',
|
|
||||||
timeout: 15000, // 15 second timeout
|
|
||||||
success: function(data) {
|
|
||||||
workerData = data;
|
|
||||||
lastUpdateTime = Date.now();
|
|
||||||
|
|
||||||
// Update UI with new data
|
|
||||||
updateWorkerGrid();
|
|
||||||
updateSummaryStats();
|
|
||||||
updateMiniChart();
|
|
||||||
updateLastUpdated();
|
|
||||||
|
|
||||||
// Hide retry button
|
|
||||||
$('#retry-button').hide();
|
|
||||||
|
|
||||||
// Reset connection retry count
|
|
||||||
connectionRetryCount = 0;
|
|
||||||
|
|
||||||
console.log("Worker data updated successfully");
|
|
||||||
},
|
|
||||||
error: function(xhr, status, error) {
|
|
||||||
console.error("Error fetching worker data:", error);
|
|
||||||
|
|
||||||
// Show error in worker grid
|
|
||||||
$('#worker-grid').html(`
|
|
||||||
<div class="text-center p-5 text-danger">
|
|
||||||
<i class="fas fa-exclamation-triangle"></i>
|
|
||||||
<p>Error loading worker data: ${error || 'Unknown error'}</p>
|
|
||||||
</div>
|
|
||||||
`);
|
|
||||||
|
|
||||||
// Show retry button
|
|
||||||
$('#retry-button').show();
|
|
||||||
|
|
||||||
// Implement exponential backoff for automatic retry
|
|
||||||
connectionRetryCount++;
|
|
||||||
const delay = Math.min(30000, 1000 * Math.pow(1.5, Math.min(5, connectionRetryCount)));
|
|
||||||
console.log(`Will retry in ${delay/1000} seconds (attempt ${connectionRetryCount})`);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
fetchWorkerData(true); // Force refresh on retry
|
|
||||||
}, delay);
|
|
||||||
},
|
|
||||||
complete: function() {
|
|
||||||
$('#worker-grid').removeClass('loading-fade');
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the worker grid with data
|
|
||||||
// UPDATED FUNCTION
|
|
||||||
function updateWorkerGrid() {
|
|
||||||
if (!workerData || !workerData.workers) {
|
|
||||||
console.error("No worker data available");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const workerGrid = $('#worker-grid');
|
|
||||||
workerGrid.empty();
|
|
||||||
|
|
||||||
// Apply current filters before rendering
|
|
||||||
const filteredWorkers = filterWorkersData(workerData.workers);
|
|
||||||
|
|
||||||
if (filteredWorkers.length === 0) {
|
|
||||||
workerGrid.html(`
|
|
||||||
<div class="text-center p-5">
|
|
||||||
<i class="fas fa-search"></i>
|
|
||||||
<p>No workers match your filter criteria</p>
|
|
||||||
</div>
|
|
||||||
`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate total unpaid earnings (from the dashboard)
|
|
||||||
const totalUnpaidEarnings = workerData.total_earnings || 0;
|
|
||||||
|
|
||||||
// Sum up hashrates of online workers to calculate share percentages
|
|
||||||
const totalHashrate = workerData.workers
|
|
||||||
.filter(w => w.status === 'online')
|
|
||||||
.reduce((sum, w) => sum + parseFloat(w.hashrate_3hr || 0), 0);
|
|
||||||
|
|
||||||
// Calculate share percentage for each worker
|
|
||||||
const onlineWorkers = workerData.workers.filter(w => w.status === 'online');
|
|
||||||
const offlineWorkers = workerData.workers.filter(w => w.status === 'offline');
|
|
||||||
|
|
||||||
// Allocate 95% to online workers, 5% to offline workers
|
|
||||||
const onlinePool = totalUnpaidEarnings * 0.95;
|
|
||||||
const offlinePool = totalUnpaidEarnings * 0.05;
|
|
||||||
|
|
||||||
// Generate worker cards
|
|
||||||
filteredWorkers.forEach(worker => {
|
|
||||||
// Calculate earnings share based on hashrate proportion
|
|
||||||
let earningsDisplay = worker.earnings;
|
|
||||||
|
|
||||||
// Explicitly recalculate earnings share for display consistency
|
|
||||||
if (worker.status === 'online' && totalHashrate > 0) {
|
|
||||||
const hashrateShare = parseFloat(worker.hashrate_3hr || 0) / totalHashrate;
|
|
||||||
earningsDisplay = (onlinePool * hashrateShare).toFixed(8);
|
|
||||||
} else if (worker.status === 'offline' && offlineWorkers.length > 0) {
|
|
||||||
earningsDisplay = (offlinePool / offlineWorkers.length).toFixed(8);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create worker card
|
|
||||||
const card = $('<div class="worker-card"></div>');
|
|
||||||
|
|
||||||
// Add class based on status
|
|
||||||
if (worker.status === 'online') {
|
|
||||||
card.addClass('worker-card-online');
|
|
||||||
} else {
|
|
||||||
card.addClass('worker-card-offline');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add worker type badge
|
|
||||||
card.append(`<div class="worker-type">${worker.type}</div>`);
|
|
||||||
|
|
||||||
// Add worker name
|
|
||||||
card.append(`<div class="worker-name">${worker.name}</div>`);
|
|
||||||
|
|
||||||
// Add status badge
|
|
||||||
if (worker.status === 'online') {
|
|
||||||
card.append('<div class="status-badge status-badge-online">ONLINE</div>');
|
|
||||||
} else {
|
|
||||||
card.append('<div class="status-badge status-badge-offline">OFFLINE</div>');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add hashrate bar
|
|
||||||
const maxHashrate = 200; // TH/s - adjust based on your fleet
|
|
||||||
const hashratePercent = Math.min(100, (worker.hashrate_3hr / maxHashrate) * 100);
|
|
||||||
card.append(`
|
|
||||||
<div class="worker-stats-row">
|
|
||||||
<div class="worker-stats-label">Hashrate (3hr):</div>
|
|
||||||
<div class="white-glow">${worker.hashrate_3hr} ${worker.hashrate_3hr_unit}</div>
|
|
||||||
</div>
|
|
||||||
<div class="stats-bar-container">
|
|
||||||
<div class="stats-bar" style="width: ${hashratePercent}%"></div>
|
|
||||||
</div>
|
|
||||||
`);
|
|
||||||
|
|
||||||
// Add additional stats - NOTE: Using recalculated earnings
|
|
||||||
card.append(`
|
|
||||||
<div class="worker-stats">
|
|
||||||
<div class="worker-stats-row">
|
|
||||||
<div class="worker-stats-label">Last Share:</div>
|
|
||||||
<div class="blue-glow">${worker.last_share.split(' ')[1]}</div>
|
|
||||||
</div>
|
|
||||||
<div class="worker-stats-row">
|
|
||||||
<div class="worker-stats-label">Earnings:</div>
|
|
||||||
<div class="green-glow">${earningsDisplay}</div>
|
|
||||||
</div>
|
|
||||||
<div class="worker-stats-row">
|
|
||||||
<div class="worker-stats-label">Accept Rate:</div>
|
|
||||||
<div class="white-glow">${worker.acceptance_rate}%</div>
|
|
||||||
</div>
|
|
||||||
<div class="worker-stats-row">
|
|
||||||
<div class="worker-stats-label">Temp:</div>
|
|
||||||
<div class="${worker.temperature > 65 ? 'red-glow' : 'white-glow'}">${worker.temperature > 0 ? worker.temperature + '°C' : 'N/A'}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`);
|
|
||||||
|
|
||||||
// Add card to grid
|
|
||||||
workerGrid.append(card);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Verify the sum of displayed earnings equals the total
|
|
||||||
console.log(`Total unpaid earnings: ${totalUnpaidEarnings} BTC`);
|
|
||||||
console.log(`Sum of worker displayed earnings: ${
|
|
||||||
filteredWorkers.reduce((sum, w) => {
|
|
||||||
if (w.status === 'online' && totalHashrate > 0) {
|
|
||||||
const hashrateShare = parseFloat(w.hashrate_3hr || 0) / totalHashrate;
|
|
||||||
return sum + parseFloat((onlinePool * hashrateShare).toFixed(8));
|
|
||||||
} else if (w.status === 'offline' && offlineWorkers.length > 0) {
|
|
||||||
return sum + parseFloat((offlinePool / offlineWorkers.length).toFixed(8));
|
|
||||||
}
|
|
||||||
return sum;
|
|
||||||
}, 0)
|
|
||||||
} BTC`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter worker data based on current filter state
|
|
||||||
function filterWorkersData(workers) {
|
|
||||||
if (!workers) return [];
|
|
||||||
|
|
||||||
return workers.filter(worker => {
|
|
||||||
const workerName = worker.name.toLowerCase();
|
|
||||||
const isOnline = worker.status === 'online';
|
|
||||||
const workerType = worker.type.toLowerCase();
|
|
||||||
|
|
||||||
// Check if worker matches filter
|
|
||||||
let matchesFilter = false;
|
|
||||||
if (filterState.currentFilter === 'all') {
|
|
||||||
matchesFilter = true;
|
|
||||||
} else if (filterState.currentFilter === 'online' && isOnline) {
|
|
||||||
matchesFilter = true;
|
|
||||||
} else if (filterState.currentFilter === 'offline' && !isOnline) {
|
|
||||||
matchesFilter = true;
|
|
||||||
} else if (filterState.currentFilter === 'asic' && workerType === 'asic') {
|
|
||||||
matchesFilter = true;
|
|
||||||
} else if (filterState.currentFilter === 'fpga' && workerType === 'fpga') {
|
|
||||||
matchesFilter = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if worker matches search term
|
|
||||||
const matchesSearch = workerName.includes(filterState.searchTerm);
|
|
||||||
|
|
||||||
return matchesFilter && matchesSearch;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Apply filter to rendered worker cards
|
|
||||||
function filterWorkers() {
|
|
||||||
if (!workerData || !workerData.workers) return;
|
|
||||||
|
|
||||||
// Re-render the worker grid with current filters
|
|
||||||
updateWorkerGrid();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Modified updateSummaryStats function for workers.js
|
|
||||||
function updateSummaryStats() {
|
|
||||||
if (!workerData) return;
|
|
||||||
|
|
||||||
// Update worker counts
|
|
||||||
$('#workers-count').text(workerData.workers_total || 0);
|
|
||||||
$('#workers-online').text(workerData.workers_online || 0);
|
|
||||||
$('#workers-offline').text(workerData.workers_offline || 0);
|
|
||||||
|
|
||||||
// Update worker ring percentage
|
|
||||||
const onlinePercent = workerData.workers_total > 0 ?
|
|
||||||
workerData.workers_online / workerData.workers_total : 0;
|
|
||||||
$('.worker-ring').css('--online-percent', onlinePercent);
|
|
||||||
|
|
||||||
// IMPORTANT: Update total hashrate using EXACT format matching main dashboard
|
|
||||||
// This ensures the displayed value matches exactly what's on the main page
|
|
||||||
if (workerData.total_hashrate !== undefined) {
|
|
||||||
// Format with exactly 1 decimal place - matches main dashboard format
|
|
||||||
const formattedHashrate = Number(workerData.total_hashrate).toFixed(1);
|
|
||||||
$('#total-hashrate').text(`${formattedHashrate} ${workerData.hashrate_unit || 'TH/s'}`);
|
|
||||||
} else {
|
|
||||||
$('#total-hashrate').text(`0.0 ${workerData.hashrate_unit || 'TH/s'}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update other summary stats
|
|
||||||
$('#total-earnings').text(`${(workerData.total_earnings || 0).toFixed(8)} BTC`);
|
|
||||||
$('#daily-sats').text(`${numberWithCommas(workerData.daily_sats || 0)} sats`);
|
|
||||||
$('#avg-acceptance-rate').text(`${(workerData.avg_acceptance_rate || 0).toFixed(2)}%`);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize mini chart
|
|
||||||
function initializeMiniChart() {
|
|
||||||
const ctx = document.getElementById('total-hashrate-chart').getContext('2d');
|
|
||||||
|
|
||||||
// Generate some sample data to start
|
|
||||||
const labels = Array(24).fill('').map((_, i) => i);
|
|
||||||
const data = [750, 760, 755, 770, 780, 775, 760, 765, 770, 775, 780, 790, 785, 775, 770, 765, 780, 785, 775, 770, 775, 780, 775, 774.8];
|
|
||||||
|
|
||||||
miniChart = new Chart(ctx, {
|
|
||||||
type: 'line',
|
|
||||||
data: {
|
|
||||||
labels: labels,
|
|
||||||
datasets: [{
|
|
||||||
data: data,
|
|
||||||
borderColor: '#1137F5',
|
|
||||||
backgroundColor: 'rgba(57, 255, 20, 0.1)',
|
|
||||||
fill: true,
|
|
||||||
tension: 0.3,
|
|
||||||
borderWidth: 1.5,
|
|
||||||
pointRadius: 0
|
|
||||||
}]
|
|
||||||
},
|
|
||||||
options: {
|
|
||||||
responsive: true,
|
|
||||||
maintainAspectRatio: false,
|
|
||||||
scales: {
|
|
||||||
x: { display: false },
|
|
||||||
y: {
|
|
||||||
display: false,
|
|
||||||
min: Math.min(...data) * 0.9,
|
|
||||||
max: Math.max(...data) * 1.1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
plugins: {
|
|
||||||
legend: { display: false },
|
|
||||||
tooltip: { enabled: false }
|
|
||||||
},
|
|
||||||
animation: false,
|
|
||||||
elements: {
|
|
||||||
line: {
|
|
||||||
tension: 0.4
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update mini chart with real data
|
|
||||||
function updateMiniChart() {
|
|
||||||
if (!miniChart || !workerData || !workerData.hashrate_history) return;
|
|
||||||
|
|
||||||
// Extract hashrate data from history
|
|
||||||
const historyData = workerData.hashrate_history;
|
|
||||||
if (!historyData || historyData.length === 0) return;
|
|
||||||
|
|
||||||
// Get the values for the chart
|
|
||||||
const values = historyData.map(item => parseFloat(item.value) || 0);
|
|
||||||
const labels = historyData.map(item => item.time);
|
|
||||||
|
|
||||||
// Update chart data
|
|
||||||
miniChart.data.labels = labels;
|
|
||||||
miniChart.data.datasets[0].data = values;
|
|
||||||
|
|
||||||
// Update y-axis range
|
|
||||||
const min = Math.min(...values);
|
|
||||||
const max = Math.max(...values);
|
|
||||||
miniChart.options.scales.y.min = min * 0.9;
|
|
||||||
miniChart.options.scales.y.max = max * 1.1;
|
|
||||||
|
|
||||||
// Update the chart
|
|
||||||
miniChart.update('none');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update progress bar
|
|
||||||
function updateProgressBar() {
|
|
||||||
if (currentProgress < PROGRESS_MAX) {
|
|
||||||
currentProgress++;
|
|
||||||
const progressPercent = (currentProgress / PROGRESS_MAX) * 100;
|
|
||||||
$("#bitcoin-progress-inner").css("width", progressPercent + "%");
|
|
||||||
|
|
||||||
// Add glowing effect when close to completion
|
|
||||||
if (progressPercent > 80) {
|
|
||||||
$("#bitcoin-progress-inner").addClass("glow-effect");
|
|
||||||
} else {
|
|
||||||
$("#bitcoin-progress-inner").removeClass("glow-effect");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update remaining seconds text
|
|
||||||
let remainingSeconds = PROGRESS_MAX - currentProgress;
|
|
||||||
if (remainingSeconds <= 0) {
|
|
||||||
$("#progress-text").text("Waiting for update...");
|
|
||||||
$("#bitcoin-progress-inner").addClass("waiting-for-update");
|
|
||||||
} else {
|
|
||||||
$("#progress-text").text(remainingSeconds + "s to next update");
|
|
||||||
$("#bitcoin-progress-inner").removeClass("waiting-for-update");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for main dashboard refresh near the end to ensure sync
|
|
||||||
if (currentProgress >= 55) { // When we're getting close to refresh time
|
|
||||||
try {
|
|
||||||
const lastDashboardRefresh = parseInt(localStorage.getItem('dashboardRefreshTime') || '0');
|
|
||||||
const secondsSinceDashboardRefresh = (Date.now() - lastDashboardRefresh) / 1000;
|
|
||||||
|
|
||||||
// If main dashboard just refreshed (within last 5 seconds)
|
|
||||||
if (secondsSinceDashboardRefresh <= 5) {
|
|
||||||
console.log("Detected recent dashboard refresh, syncing now");
|
|
||||||
resetProgressBar();
|
|
||||||
fetchWorkerData();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Error checking dashboard refresh status:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Reset progress bar if it's time to refresh
|
|
||||||
// But first check if the main dashboard refreshed recently
|
|
||||||
try {
|
|
||||||
const lastDashboardRefresh = parseInt(localStorage.getItem('dashboardRefreshTime') || '0');
|
|
||||||
const secondsSinceDashboardRefresh = (Date.now() - lastDashboardRefresh) / 1000;
|
|
||||||
|
|
||||||
// If dashboard refreshed in the last 10 seconds, wait for it instead of refreshing ourselves
|
|
||||||
if (secondsSinceDashboardRefresh < 10) {
|
|
||||||
console.log("Waiting for dashboard refresh event instead of refreshing independently");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Error checking dashboard refresh status:", e);
|
|
||||||
}
|
|
||||||
|
|
||||||
// If main dashboard hasn't refreshed recently, do our own refresh
|
|
||||||
if (Date.now() - lastUpdateTime > PROGRESS_MAX * 1000) {
|
|
||||||
console.log("Progress bar expired, fetching data");
|
|
||||||
fetchWorkerData();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Reset progress bar
|
|
||||||
function resetProgressBar() {
|
|
||||||
currentProgress = 0;
|
|
||||||
$("#bitcoin-progress-inner").css("width", "0%");
|
|
||||||
$("#bitcoin-progress-inner").removeClass("glow-effect");
|
|
||||||
$("#bitcoin-progress-inner").removeClass("waiting-for-update");
|
|
||||||
$("#progress-text").text(PROGRESS_MAX + "s to next update");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Update the last updated timestamp
|
|
||||||
function updateLastUpdated() {
|
|
||||||
if (!workerData || !workerData.timestamp) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
const timestamp = new Date(workerData.timestamp);
|
|
||||||
$("#lastUpdated").html("<strong>Last Updated:</strong> " +
|
|
||||||
timestamp.toLocaleString() + "<span id='terminal-cursor'></span>");
|
|
||||||
} catch (e) {
|
|
||||||
console.error("Error formatting timestamp:", e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format numbers with commas
|
|
||||||
function numberWithCommas(x) {
|
|
||||||
if (x == null) return "N/A";
|
|
||||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
||||||
}
|
|
@ -1,563 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Ocean.xyz Pool Miner - Initializing...</title>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=VT323&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
/* Base Styles with a subtle radial background for extra depth */
|
|
||||||
body {
|
|
||||||
background: linear-gradient(135deg, #121212, #000000);
|
|
||||||
color: #f7931a;
|
|
||||||
font-family: 'VT323', monospace;
|
|
||||||
font-size: 20px;
|
|
||||||
line-height: 1.4;
|
|
||||||
margin: 0;
|
|
||||||
padding: 10px;
|
|
||||||
overflow-x: hidden;
|
|
||||||
text-shadow: 0 0 5px rgba(247, 147, 26, 0.4);
|
|
||||||
height: calc(100vh - 100px);
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
/* CRT Screen Effect */
|
|
||||||
body::before {
|
|
||||||
content: " ";
|
|
||||||
display: block;
|
|
||||||
position: fixed;
|
|
||||||
top: 0; left: 0; bottom: 0; right: 0;
|
|
||||||
background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
|
|
||||||
linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.03));
|
|
||||||
background-size: 100% 2px, 3px 100%;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 2;
|
|
||||||
opacity: 0.15;
|
|
||||||
}
|
|
||||||
/* Flicker Animation */
|
|
||||||
@keyframes flicker {
|
|
||||||
0% { opacity: 0.97; }
|
|
||||||
5% { opacity: 0.95; }
|
|
||||||
10% { opacity: 0.97; }
|
|
||||||
15% { opacity: 0.94; }
|
|
||||||
20% { opacity: 0.98; }
|
|
||||||
50% { opacity: 0.95; }
|
|
||||||
80% { opacity: 0.96; }
|
|
||||||
90% { opacity: 0.94; }
|
|
||||||
100% { opacity: 0.98; }
|
|
||||||
}
|
|
||||||
/* Terminal Window with scrolling enabled */
|
|
||||||
#terminal {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 0 auto;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
word-break: break-word;
|
|
||||||
animation: flicker 4s infinite;
|
|
||||||
height: 400px;
|
|
||||||
overflow-y: auto;
|
|
||||||
position: relative;
|
|
||||||
flex: 1;
|
|
||||||
}
|
|
||||||
#terminal-content {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 0;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.cursor {
|
|
||||||
display: inline-block;
|
|
||||||
width: 10px;
|
|
||||||
height: 16px;
|
|
||||||
background-color: #f7931a;
|
|
||||||
animation: blink 1s step-end infinite;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-shadow: 0 0 5px rgba(247, 147, 26, 0.8);
|
|
||||||
}
|
|
||||||
@keyframes blink {
|
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0; }
|
|
||||||
}
|
|
||||||
/* Neon-inspired color classes */
|
|
||||||
.green {
|
|
||||||
color: #39ff14 !important;
|
|
||||||
text-shadow: 0 0 10px #39ff14, 0 0 20px #39ff14;
|
|
||||||
}
|
|
||||||
.blue {
|
|
||||||
color: #00dfff !important;
|
|
||||||
text-shadow: 0 0 10px #00dfff, 0 0 20px #00dfff;
|
|
||||||
}
|
|
||||||
.yellow {
|
|
||||||
color: #ffd700 !important;
|
|
||||||
text-shadow: 0 0 8px #ffd700, 0 0 16px #ffd700;
|
|
||||||
}
|
|
||||||
.white {
|
|
||||||
color: #ffffff !important;
|
|
||||||
text-shadow: 0 0 8px #ffffff, 0 0 16px #ffffff;
|
|
||||||
}
|
|
||||||
.red {
|
|
||||||
color: #ff2d2d !important;
|
|
||||||
text-shadow: 0 0 10px #ff2d2d, 0 0 20px #ff2d2d;
|
|
||||||
}
|
|
||||||
.magenta {
|
|
||||||
color: #ff2d95 !important;
|
|
||||||
text-shadow: 0 0 10px #ff2d95, 0 0 20px #ff2d95;
|
|
||||||
}
|
|
||||||
/* Bitcoin Logo styling with extra neon border */
|
|
||||||
#bitcoin-logo {
|
|
||||||
display: block;
|
|
||||||
visibility: hidden;
|
|
||||||
text-align: center;
|
|
||||||
margin: 10px auto;
|
|
||||||
font-size: 10px;
|
|
||||||
line-height: 1;
|
|
||||||
color: #f7931a;
|
|
||||||
text-shadow: 0 0 10px rgba(247, 147, 26, 0.8);
|
|
||||||
white-space: pre;
|
|
||||||
width: 260px;
|
|
||||||
padding: 10px;
|
|
||||||
border: 2px solid #f7931a;
|
|
||||||
background-color: #0a0a0a;
|
|
||||||
box-shadow: 0 0 15px rgba(247, 147, 26, 0.5);
|
|
||||||
font-family: monospace;
|
|
||||||
opacity: 0;
|
|
||||||
transition: opacity 1s ease;
|
|
||||||
}
|
|
||||||
/* Skip Button */
|
|
||||||
#skip-button {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 20px;
|
|
||||||
right: 20px;
|
|
||||||
background-color: #f7931a;
|
|
||||||
color: #000;
|
|
||||||
border: none;
|
|
||||||
padding: 10px 15px;
|
|
||||||
border-radius: 5px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-family: 'VT323', monospace;
|
|
||||||
font-size: 16px;
|
|
||||||
box-shadow: 0 0 8px rgba(247, 147, 26, 0.5);
|
|
||||||
transition: all 0.2s ease;
|
|
||||||
}
|
|
||||||
#skip-button:hover {
|
|
||||||
background-color: #ffa32e;
|
|
||||||
box-shadow: 0 0 12px rgba(247, 147, 26, 0.7);
|
|
||||||
}
|
|
||||||
/* Prompt Styling */
|
|
||||||
#prompt-container {
|
|
||||||
display: none;
|
|
||||||
white-space: nowrap;
|
|
||||||
}
|
|
||||||
#prompt-text {
|
|
||||||
color: #f7931a;
|
|
||||||
margin-right: 5px;
|
|
||||||
text-shadow: 0 0 5px rgba(247, 147, 26, 0.8);
|
|
||||||
display: inline;
|
|
||||||
}
|
|
||||||
#user-input {
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
color: #f7931a;
|
|
||||||
font-family: 'VT323', monospace;
|
|
||||||
font-size: 20px;
|
|
||||||
caret-color: transparent;
|
|
||||||
outline: none;
|
|
||||||
width: 20px;
|
|
||||||
padding: 0;
|
|
||||||
margin: 0;
|
|
||||||
text-shadow: 0 0 5px rgba(247, 147, 26, 0.8);
|
|
||||||
display: inline-block;
|
|
||||||
vertical-align: top;
|
|
||||||
}
|
|
||||||
.prompt-cursor {
|
|
||||||
display: inline-block;
|
|
||||||
width: 10px;
|
|
||||||
height: 16px;
|
|
||||||
background-color: #f7931a;
|
|
||||||
animation: blink 1s step-end infinite;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-shadow: 0 0 5px rgba(247, 147, 26, 0.8);
|
|
||||||
position: relative;
|
|
||||||
top: 1px;
|
|
||||||
margin-left: -2px;
|
|
||||||
}
|
|
||||||
/* Mobile Responsiveness */
|
|
||||||
@media (max-width: 600px) {
|
|
||||||
body { font-size: 14px; padding: 10px; }
|
|
||||||
#terminal { margin: 0; }
|
|
||||||
}
|
|
||||||
/* Loading and Debug Info */
|
|
||||||
#loading-message {
|
|
||||||
text-align: center;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
text-shadow: 0 0 5px rgba(247, 147, 26, 0.8);
|
|
||||||
}
|
|
||||||
#debug-info {
|
|
||||||
position: fixed;
|
|
||||||
bottom: 10px;
|
|
||||||
left: 10px;
|
|
||||||
color: #666;
|
|
||||||
font-size: 12px;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<button id="skip-button">SKIP</button>
|
|
||||||
<div id="debug-info"></div>
|
|
||||||
<div id="loading-message">Loading mining data...</div>
|
|
||||||
<div id="bitcoin-logo">
|
|
||||||
██████╗ ████████╗ ██████╗ ██████╗ ███████╗
|
|
||||||
██╔══██╗╚══██╔══╝██╔════╝ ██╔═══██╗██╔════╝
|
|
||||||
██████╔╝ ██║ ██║ ██║ ██║███████╗
|
|
||||||
██╔══██╗ ██║ ██║ ██║ ██║╚════██║
|
|
||||||
██████╔╝ ██║ ╚██████╗ ╚██████╔╝███████║
|
|
||||||
╚═════╝ ╚═╝ ╚═════╝ ╚═════╝ ╚══════╝
|
|
||||||
v.21
|
|
||||||
</div>
|
|
||||||
<div id="terminal">
|
|
||||||
<div id="terminal-content">
|
|
||||||
<span id="output"></span><span class="cursor"></span>
|
|
||||||
<span id="prompt-container">
|
|
||||||
<span id="prompt-text">Initialize mining dashboard? [Y/N]:
|
|
||||||
<span class="prompt-cursor"></span>
|
|
||||||
<input type="text" id="user-input" maxlength="1" autocomplete="off" spellcheck="false" autofocus style="font-size: 16px; font-weight: bold;">
|
|
||||||
</span>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
// Debug logging
|
|
||||||
function updateDebug(message) {
|
|
||||||
document.getElementById('debug-info').textContent = message;
|
|
||||||
console.log(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Format numbers with commas
|
|
||||||
function numberWithCommas(x) {
|
|
||||||
if (x == null) return "N/A";
|
|
||||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
|
||||||
}
|
|
||||||
|
|
||||||
// Global variables
|
|
||||||
let bootMessages = [];
|
|
||||||
let dashboardData = null;
|
|
||||||
let outputElement = document.getElementById('output');
|
|
||||||
const bitcoinLogo = document.getElementById('bitcoin-logo');
|
|
||||||
const skipButton = document.getElementById('skip-button');
|
|
||||||
const loadingMessage = document.getElementById('loading-message');
|
|
||||||
const promptContainer = document.getElementById('prompt-container');
|
|
||||||
const userInput = document.getElementById('user-input');
|
|
||||||
let messageIndex = 0;
|
|
||||||
let timeoutId = null;
|
|
||||||
let waitingForUserInput = false;
|
|
||||||
let bootComplete = false;
|
|
||||||
|
|
||||||
// Safety timeout: redirect after 60 seconds if boot not complete
|
|
||||||
window.addEventListener('load', function() {
|
|
||||||
setTimeout(function() {
|
|
||||||
if (!bootComplete && !waitingForUserInput) {
|
|
||||||
console.warn("Safety timeout reached - redirecting to dashboard");
|
|
||||||
redirectToDashboard();
|
|
||||||
}
|
|
||||||
}, 60000);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Redirect to dashboard
|
|
||||||
function redirectToDashboard() {
|
|
||||||
updateDebug("Boot sequence complete, redirecting...");
|
|
||||||
const baseUrl = window.location.origin;
|
|
||||||
window.location.href = baseUrl + "/dashboard";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fade in Bitcoin logo
|
|
||||||
document.addEventListener('DOMContentLoaded', function() {
|
|
||||||
setTimeout(function() {
|
|
||||||
bitcoinLogo.style.visibility = 'visible';
|
|
||||||
setTimeout(function() {
|
|
||||||
bitcoinLogo.style.opacity = '1';
|
|
||||||
}, 100);
|
|
||||||
}, 500);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Post-confirmation messages with retro typing effect
|
|
||||||
function showPostConfirmationMessages(response) {
|
|
||||||
try {
|
|
||||||
outputElement = document.getElementById('output');
|
|
||||||
if (!outputElement) {
|
|
||||||
setTimeout(redirectToDashboard, 1000);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const yesMessages = [
|
|
||||||
{ text: "INITIALIZING DASHBOARD...\n", html: true, delay: 400 },
|
|
||||||
{ text: "Connecting to real-time data feeds...", speed: 20, delay: 300 },
|
|
||||||
{ text: "<span class='green'>CONNECTED</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "Loading blockchain validators...", speed: 15, delay: 300 },
|
|
||||||
{ text: "<span class='green'>COMPLETE</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "Starting TX fee calculation module...", speed: 15, delay: 400 },
|
|
||||||
{ text: "<span class='green'>ACTIVE</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "Verifying BTC-USD exchange rates...", speed: 15, delay: 200 },
|
|
||||||
{ text: "<span class='green'>CURRENT RATE CONFIRMED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "Calibrating hashrate telemetry...", speed: 15, delay: 200 },
|
|
||||||
{ text: "<span class='green'>CALIBRATED</span>\n", html: true, delay: 200 },
|
|
||||||
{ text: "Loading historical mining data: [", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>████</span>", html: true, delay: 100 },
|
|
||||||
{ text: "<span class='green'>████████</span>", html: true, delay: 100 },
|
|
||||||
{ text: "<span class='green'>███████</span>", html: true, delay: 100 },
|
|
||||||
{ text: "<span class='green'>████</span>", html: true, delay: 100 },
|
|
||||||
{ text: "<span class='green'>██</span>", html: true, delay: 100 },
|
|
||||||
{ text: "<span class='green'>█</span>", html: true, delay: 100 },
|
|
||||||
{ text: "] <span class='green'>COMPLETE</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "Block reward calculation initialized...", speed: 15, delay: 300 },
|
|
||||||
{ text: "<span class='yellow'>HALVING SCHEDULE VERIFIED</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "Satoshi per kWh optimizer: <span class='green'>ENGAGED</span>\n", html: true, delay: 500 },
|
|
||||||
{ text: "Launching mining dashboard in 3...", speed: 80, delay: 1000 },
|
|
||||||
{ text: " 2...", speed: 80, delay: 1000 },
|
|
||||||
{ text: " 1...\n", speed: 80, delay: 1000 },
|
|
||||||
{ text: "<span class='green'>STACK SATS MODE: ACTIVATED</span>\n", html: true, delay: 500 }
|
|
||||||
];
|
|
||||||
const noMessages = [
|
|
||||||
{ text: "DASHBOARD INITIALIZATION ABORTED.\n", html: true, delay: 400 },
|
|
||||||
{ text: "Mining processes will continue in background.\n", speed: 30, delay: 500 },
|
|
||||||
{ text: "Attempting emergency recovery...\n", speed: 30, delay: 1000 },
|
|
||||||
{ text: "Bypassing authentication checks...", speed: 20, delay: 300 },
|
|
||||||
{ text: "<span class='green'>SUCCESS</span>\n", html: true, delay: 500 },
|
|
||||||
{ text: "Initializing fallback ASIC control interface...", speed: 20, delay: 300 },
|
|
||||||
{ text: "<span class='green'>ACTIVE</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "<span class='green'>RECOVERY SUCCESSFUL!</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "Loading minimal dashboard in safe mode: [", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>████████</span>", html: true, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>████████</span>", html: true, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>████████</span>", html: true, delay: 100 },
|
|
||||||
{ text: "] <span class='white'>READY</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "\nNOTE: REDUCED FUNCTIONALITY IN SAFE MODE\n", html: true, delay: 500 },
|
|
||||||
{ text: "Launching minimal dashboard in 3...", speed: 80, delay: 1000 },
|
|
||||||
{ text: " 2...", speed: 80, delay: 1000 },
|
|
||||||
{ text: " 1...\n", speed: 80, delay: 1000 },
|
|
||||||
{ text: "<span class='green'>BITCOIN MINING CONTINUES REGARDLESS! ;)</span>\n", html: true, delay: 500 }
|
|
||||||
];
|
|
||||||
const messages = response === 'Y' ? yesMessages : noMessages;
|
|
||||||
let msgIndex = 0;
|
|
||||||
function processNextMessage() {
|
|
||||||
if (msgIndex >= messages.length) {
|
|
||||||
bootComplete = true;
|
|
||||||
setTimeout(redirectToDashboard, 500);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
const currentMessage = messages[msgIndex];
|
|
||||||
if (currentMessage.html) {
|
|
||||||
outputElement.innerHTML += currentMessage.text;
|
|
||||||
msgIndex++;
|
|
||||||
setTimeout(processNextMessage, currentMessage.delay || 300);
|
|
||||||
} else {
|
|
||||||
let charIndex = 0;
|
|
||||||
function typeCharacter() {
|
|
||||||
if (charIndex < currentMessage.text.length) {
|
|
||||||
outputElement.innerHTML += currentMessage.text.charAt(charIndex);
|
|
||||||
charIndex++;
|
|
||||||
setTimeout(typeCharacter, currentMessage.speed || 20);
|
|
||||||
} else {
|
|
||||||
msgIndex++;
|
|
||||||
setTimeout(processNextMessage, currentMessage.delay || 300);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
typeCharacter();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setTimeout(processNextMessage, 500);
|
|
||||||
} catch(err) {
|
|
||||||
setTimeout(redirectToDashboard, 1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Handle Y/N prompt input
|
|
||||||
userInput.addEventListener('keydown', function(e) {
|
|
||||||
if (waitingForUserInput && e.key === 'Enter') {
|
|
||||||
e.preventDefault();
|
|
||||||
const response = userInput.value.toUpperCase();
|
|
||||||
promptContainer.style.display = 'none';
|
|
||||||
waitingForUserInput = false;
|
|
||||||
outputElement.innerHTML += response + "\n";
|
|
||||||
userInput.value = '';
|
|
||||||
showPostConfirmationMessages(response);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Show the prompt
|
|
||||||
function showUserPrompt() {
|
|
||||||
promptContainer.style.display = 'inline';
|
|
||||||
waitingForUserInput = true;
|
|
||||||
document.querySelector('.cursor').style.display = 'none';
|
|
||||||
userInput.focus();
|
|
||||||
}
|
|
||||||
|
|
||||||
// We disable truncation so all text is visible.
|
|
||||||
function manageTerminalContent() { }
|
|
||||||
|
|
||||||
// Retro typing effect for boot messages
|
|
||||||
function typeBootMessages() {
|
|
||||||
try {
|
|
||||||
if (!outputElement) {
|
|
||||||
outputElement = document.getElementById('output');
|
|
||||||
if (!outputElement) {
|
|
||||||
skipButton.click();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
console.log("Processing boot message index:", messageIndex);
|
|
||||||
if (messageIndex >= bootMessages.length) { return; }
|
|
||||||
const currentMessage = bootMessages[messageIndex];
|
|
||||||
if (currentMessage.showPrompt) {
|
|
||||||
messageIndex++;
|
|
||||||
showUserPrompt();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (currentMessage.html) {
|
|
||||||
outputElement.innerHTML += currentMessage.text;
|
|
||||||
messageIndex++;
|
|
||||||
timeoutId = setTimeout(typeBootMessages, currentMessage.delay || 300);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (!currentMessage.typingIndex) { currentMessage.typingIndex = 0; }
|
|
||||||
if (currentMessage.typingIndex < currentMessage.text.length) {
|
|
||||||
outputElement.innerHTML += currentMessage.text.charAt(currentMessage.typingIndex);
|
|
||||||
currentMessage.typingIndex++;
|
|
||||||
timeoutId = setTimeout(typeBootMessages, currentMessage.speed || 15);
|
|
||||||
} else {
|
|
||||||
messageIndex++;
|
|
||||||
timeoutId = setTimeout(typeBootMessages, currentMessage.delay || 300);
|
|
||||||
}
|
|
||||||
} catch(err) {
|
|
||||||
messageIndex++;
|
|
||||||
timeoutId = setTimeout(typeBootMessages, 500);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip button: immediately redirect
|
|
||||||
skipButton.addEventListener('click', function() {
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
redirectToDashboard();
|
|
||||||
});
|
|
||||||
|
|
||||||
// Start the typing animation (hides loading message)
|
|
||||||
function startTyping() {
|
|
||||||
loadingMessage.style.display = 'none';
|
|
||||||
setTimeout(typeBootMessages, 150);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fallback messages (used immediately)
|
|
||||||
function setupFallbackMessages() {
|
|
||||||
bootMessages = [
|
|
||||||
{ text: "BITCOIN OS - MINING SYSTEM - v21.000.000\n", speed: 25, delay: 300 },
|
|
||||||
{ text: "Copyright (c) 2009-2025 Satoshi Nakamoto\n", speed: 20, delay: 250 },
|
|
||||||
{ text: "All rights reserved.\n\n", speed: 25, delay: 300 },
|
|
||||||
{ text: "INITIALIZING SYSTEM...\n", speed: 25, delay: 300 },
|
|
||||||
{ text: "HARDWARE: ", speed: 25, delay: 100 },
|
|
||||||
{ text: "<span class='green'>OK</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "NETWORK: ", speed: 25, delay: 100 },
|
|
||||||
{ text: "<span class='green'>OK</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "BLOCKCHAIN: ", speed: 25, delay: 100 },
|
|
||||||
{ text: "<span class='green'>SYNCHRONIZED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "MINING RIG: ", speed: 25, delay: 100 },
|
|
||||||
{ text: "<span class='green'>ONLINE</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\nSystem ready. ", speed: 25, delay: 400 },
|
|
||||||
{ showPrompt: true, delay: 0 }
|
|
||||||
];
|
|
||||||
startTyping();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize with fallback, then try live data
|
|
||||||
setupFallbackMessages();
|
|
||||||
updateDebug("Fetching dashboard data...");
|
|
||||||
fetch('/api/metrics')
|
|
||||||
.then(response => {
|
|
||||||
if (!response.ok) { throw new Error(`HTTP error! Status: ${response.status}`); }
|
|
||||||
return response.json();
|
|
||||||
})
|
|
||||||
.then(data => {
|
|
||||||
dashboardData = data;
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
messageIndex = 0;
|
|
||||||
outputElement = document.getElementById('output');
|
|
||||||
outputElement.innerHTML = "";
|
|
||||||
bootMessages = [
|
|
||||||
{ text: "BITCOIN OS - MINING CONTROL SYSTEM - v21.000.000\n", speed: 25, delay: 300 },
|
|
||||||
{ text: "Copyright (c) 2009-2025 Satoshi Nakamoto & The Bitcoin Core Developers\n", speed: 20, delay: 250 },
|
|
||||||
{ text: "All rights reserved.\n\n", speed: 25, delay: 300 },
|
|
||||||
{ text: "INITIALIZING SHA-256 MINING SUBSYSTEMS...\n", speed: 25, delay: 400 },
|
|
||||||
{ text: "ASIC CLUSTER STATUS: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>ONLINE</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "CHIP TEMPERATURE: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>62°C - WITHIN OPTIMAL RANGE</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "COOLING SYSTEMS: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>OPERATIONAL</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "POWER SUPPLY HEALTH: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>98.7% - NOMINAL</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\nCONNECTING TO BITCOIN NETWORK...\n", speed: 20, delay: 400 },
|
|
||||||
{ text: "BLOCKCHAIN SYNC STATUS: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>SYNCHRONIZED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "DIFFICULTY ADJUSTMENT: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>CALCULATED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "MEMPOOL MONITORING: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>ACTIVE</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\nESTABLISHING POOL CONNECTION...\n", speed: 20, delay: 300 },
|
|
||||||
{ text: "CONNECTING TO OCEAN.XYZ...\n", speed: 20, delay: 300 },
|
|
||||||
{ text: "STRATUM PROTOCOL v2: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>INITIALIZED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "POOL HASHRATE: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>VERIFIED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "WORKER AUTHENTICATION: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>SUCCESSFUL</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\nINITIALIZING METRICS COLLECTORS...\n", speed: 20, delay: 300 },
|
|
||||||
{ text: "HASHRATE MONITOR: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>ACTIVE</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "EARNINGS CALCULATOR: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>CALIBRATED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "POWER USAGE TRACKING: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>ENABLED</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "PAYOUT THRESHOLD MONITOR: ", speed: 15, delay: 100 },
|
|
||||||
{ text: "<span class='green'>ACTIVE</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\nCURRENT NETWORK METRICS DETECTED\n", speed: 20, delay: 300 },
|
|
||||||
{ text: "BTC PRICE: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>$" + numberWithCommas((data.btc_price || 0).toFixed(2)) + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "NETWORK DIFFICULTY: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='white'>" + numberWithCommas(Math.round(data.difficulty || 0)) + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "NETWORK HASHRATE: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='white'>" + (data.network_hashrate ? numberWithCommas(Math.round(data.network_hashrate)) : "N/A") + " EH/s</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "BLOCK HEIGHT: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='white'>" + numberWithCommas(data.block_number || "N/A") + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\nMINER PERFORMANCE DATA\n", speed: 20, delay: 300 },
|
|
||||||
{ text: "CURRENT HASHRATE: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>" + (data.hashrate_60sec || "N/A") + " " + (data.hashrate_60sec_unit || "TH/s") + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "24HR AVG HASHRATE: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>" + (data.hashrate_24hr || "N/A") + " " + (data.hashrate_24hr_unit || "TH/s") + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "ACTIVE WORKERS: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>" + (data.workers_hashing || "0") + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\nFINANCIAL CALCULATIONS\n", speed: 20, delay: 300 },
|
|
||||||
{ text: "DAILY MINING REVENUE: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='green'>$" + numberWithCommas((data.daily_revenue || 0).toFixed(2)) + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "DAILY POWER COST: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='red'>$" + numberWithCommas((data.daily_power_cost || 0).toFixed(2)) + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "DAILY PROFIT: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='green'>$" + numberWithCommas((data.daily_profit_usd || 0).toFixed(2)) + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "PROJECTED MONTHLY PROFIT: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='green'>$" + numberWithCommas((data.monthly_profit_usd || 0).toFixed(2)) + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "DAILY SATOSHI YIELD: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>" + numberWithCommas(data.daily_mined_sats || 0) + " sats</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "UNPAID EARNINGS: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='green'>" + (data.unpaid_earnings || "0") + " BTC</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "ESTIMATED TIME TO PAYOUT: ", speed: 20, delay: 100 },
|
|
||||||
{ text: "<span class='yellow'>" + (data.est_time_to_payout || "Unknown") + "</span>\n", html: true, delay: 300 },
|
|
||||||
{ text: "\n", speed: 25, delay: 100 },
|
|
||||||
{ text: "<span class='green'>ALL MINING PROCESSES OPERATIONAL</span>\n", html: true, delay: 400 },
|
|
||||||
{ text: "\nInitialize mining dashboard? ", speed: 25, delay: 400 },
|
|
||||||
{ showPrompt: true, delay: 0 }
|
|
||||||
];
|
|
||||||
startTyping();
|
|
||||||
})
|
|
||||||
.catch(error => {
|
|
||||||
updateDebug(`Error fetching dashboard data: ${error.message}`);
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
@ -1,161 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Error - Mining Dashboard</title>
|
|
||||||
<!-- Include both Orbitron and VT323 fonts -->
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=VT323&display=swap" rel="stylesheet">
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color: #0a0a0a;
|
|
||||||
--bg-gradient: linear-gradient(135deg, #0a0a0a, #1a1a1a);
|
|
||||||
--primary-color: #f7931a;
|
|
||||||
--text-color: white;
|
|
||||||
--terminal-font: 'VT323', monospace;
|
|
||||||
--header-font: 'Orbitron', sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* CRT Screen Effect */
|
|
||||||
body::before {
|
|
||||||
content: " ";
|
|
||||||
display: block;
|
|
||||||
position: fixed;
|
|
||||||
top: 0; left: 0; bottom: 0; right: 0;
|
|
||||||
background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
|
|
||||||
linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.03));
|
|
||||||
background-size: 100% 2px, 3px 100%;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 2;
|
|
||||||
opacity: 0.15;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flicker Animation */
|
|
||||||
@keyframes flicker {
|
|
||||||
0% { opacity: 0.97; }
|
|
||||||
5% { opacity: 0.95; }
|
|
||||||
10% { opacity: 0.97; }
|
|
||||||
15% { opacity: 0.94; }
|
|
||||||
20% { opacity: 0.98; }
|
|
||||||
50% { opacity: 0.95; }
|
|
||||||
80% { opacity: 0.96; }
|
|
||||||
90% { opacity: 0.94; }
|
|
||||||
100% { opacity: 0.98; }
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background: var(--bg-gradient);
|
|
||||||
color: var(--text-color);
|
|
||||||
padding-top: 50px;
|
|
||||||
font-family: var(--terminal-font);
|
|
||||||
text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
a.btn-primary {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
border-color: var(--primary-color);
|
|
||||||
color: black;
|
|
||||||
margin-top: 20px;
|
|
||||||
font-family: var(--header-font);
|
|
||||||
text-shadow: none;
|
|
||||||
box-shadow: 0 0 10px rgba(247, 147, 26, 0.5);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
a.btn-primary:hover {
|
|
||||||
background-color: #ffa64d;
|
|
||||||
box-shadow: 0 0 15px rgba(247, 147, 26, 0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enhanced error container with scanlines */
|
|
||||||
.error-container {
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto;
|
|
||||||
text-align: center;
|
|
||||||
padding: 2rem;
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
border-radius: 0;
|
|
||||||
background-color: rgba(0, 0, 0, 0.3);
|
|
||||||
box-shadow: 0 0 15px rgba(247, 147, 26, 0.3);
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
animation: flicker 4s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scanline effect for error container */
|
|
||||||
.error-container::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
0deg,
|
|
||||||
rgba(0, 0, 0, 0.1),
|
|
||||||
rgba(0, 0, 0, 0.1) 1px,
|
|
||||||
transparent 1px,
|
|
||||||
transparent 2px
|
|
||||||
);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
color: var(--primary-color);
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
font-family: var(--header-font);
|
|
||||||
font-weight: bold;
|
|
||||||
text-shadow: 0 0 10px var(--primary-color);
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
p {
|
|
||||||
margin-bottom: 1.5rem;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
color: #ff5555;
|
|
||||||
text-shadow: 0 0 8px rgba(255, 85, 85, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cursor blink for terminal feel */
|
|
||||||
.terminal-cursor {
|
|
||||||
display: inline-block;
|
|
||||||
width: 10px;
|
|
||||||
height: 20px;
|
|
||||||
background-color: #f7931a;
|
|
||||||
margin-left: 2px;
|
|
||||||
animation: blink 1s step-end infinite;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-shadow: 0 0 5px rgba(247, 147, 26, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes blink {
|
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Error code styling */
|
|
||||||
.error-code {
|
|
||||||
font-family: var(--terminal-font);
|
|
||||||
font-size: 1.2rem;
|
|
||||||
color: #00dfff;
|
|
||||||
text-shadow: 0 0 10px #00dfff, 0 0 20px #00dfff;
|
|
||||||
margin-bottom: 1rem;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container">
|
|
||||||
<div class="error-container">
|
|
||||||
<h1>ERROR</h1>
|
|
||||||
<div class="error-code">CODE: SYS_EXCEPTION_0x45</div>
|
|
||||||
<p>{{ message }}<span class="terminal-cursor"></span></p>
|
|
||||||
<a href="/" class="btn btn-primary">Return to Dashboard</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
File diff suppressed because it is too large
Load Diff
@ -1,941 +0,0 @@
|
|||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<!-- Custom Fonts -->
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700&family=VT323&display=swap" rel="stylesheet">
|
|
||||||
<!-- Retro Floating Refresh Bar -->
|
|
||||||
<link rel="stylesheet" href="/static/css/retro-refresh.css">
|
|
||||||
<!-- Meta viewport for responsive scaling -->
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>Workers Overview - Ocean.xyz Pool Mining Dashboard v 0.2</title>
|
|
||||||
<!-- Font Awesome CDN for icon support -->
|
|
||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
|
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color: #0a0a0a;
|
|
||||||
--bg-gradient: linear-gradient(135deg, #0a0a0a, #1a1a1a);
|
|
||||||
--primary-color: #f7931a;
|
|
||||||
--accent-color: #00ffff;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-padding: 0.5rem;
|
|
||||||
--text-size-base: 16px;
|
|
||||||
--terminal-font: 'VT323', monospace;
|
|
||||||
--header-font: 'Orbitron', sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
:root {
|
|
||||||
--card-padding: 0.75rem;
|
|
||||||
--text-size-base: 18px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* CRT Screen Effect */
|
|
||||||
body::before {
|
|
||||||
content: " ";
|
|
||||||
display: block;
|
|
||||||
position: fixed;
|
|
||||||
top: 0; left: 0; bottom: 0; right: 0;
|
|
||||||
background: linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.1) 50%),
|
|
||||||
linear-gradient(90deg, rgba(255, 0, 0, 0.03), rgba(0, 255, 0, 0.02), rgba(0, 0, 255, 0.03));
|
|
||||||
background-size: 100% 2px, 3px 100%;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 2;
|
|
||||||
opacity: 0.15;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Flicker Animation */
|
|
||||||
@keyframes flicker {
|
|
||||||
0% { opacity: 0.97; }
|
|
||||||
5% { opacity: 0.95; }
|
|
||||||
10% { opacity: 0.97; }
|
|
||||||
15% { opacity: 0.94; }
|
|
||||||
20% { opacity: 0.98; }
|
|
||||||
50% { opacity: 0.95; }
|
|
||||||
80% { opacity: 0.96; }
|
|
||||||
90% { opacity: 0.94; }
|
|
||||||
100% { opacity: 0.98; }
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background: var(--bg-gradient);
|
|
||||||
color: var(--text-color);
|
|
||||||
padding-top: 0.5rem;
|
|
||||||
font-size: var(--text-size-base);
|
|
||||||
font-family: var(--terminal-font);
|
|
||||||
text-shadow: 0 0 5px rgba(255, 255, 255, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 24px;
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--primary-color);
|
|
||||||
font-family: var(--header-font);
|
|
||||||
letter-spacing: 1px;
|
|
||||||
text-shadow: 0 0 10px var(--primary-color);
|
|
||||||
animation: flicker 4s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (min-width: 768px) {
|
|
||||||
h1 {
|
|
||||||
font-size: 26px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.card,
|
|
||||||
.card-header,
|
|
||||||
.card-body,
|
|
||||||
.card-footer {
|
|
||||||
border-radius: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enhanced card with scanlines */
|
|
||||||
.card {
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
margin-bottom: 0.5rem;
|
|
||||||
padding: var(--card-padding);
|
|
||||||
flex: 1;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
box-shadow: 0 0 5px rgba(247, 147, 26, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Scanline effect for cards */
|
|
||||||
.card::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
0deg,
|
|
||||||
rgba(0, 0, 0, 0.05),
|
|
||||||
rgba(0, 0, 0, 0.05) 1px,
|
|
||||||
transparent 1px,
|
|
||||||
transparent 2px
|
|
||||||
);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-header {
|
|
||||||
background-color: #000;
|
|
||||||
color: var(--primary-color);
|
|
||||||
font-weight: bold;
|
|
||||||
padding: 0.3rem 0.5rem;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
border-bottom: 1px solid var(--primary-color);
|
|
||||||
text-shadow: 0 0 5px var(--primary-color);
|
|
||||||
animation: flicker 4s infinite;
|
|
||||||
font-family: var(--header-font);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-body hr {
|
|
||||||
border-top: 1px solid var(--primary-color);
|
|
||||||
margin: 0.25rem 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.arrow {
|
|
||||||
display: inline-block;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-left: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bounce Up Animation for Up Chevron */
|
|
||||||
@keyframes bounceUp {
|
|
||||||
0% { transform: translateY(0); }
|
|
||||||
25% { transform: translateY(-2px); }
|
|
||||||
50% { transform: translateY(0); }
|
|
||||||
75% { transform: translateY(-2px); }
|
|
||||||
100% { transform: translateY(0); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bounce Down Animation for Down Chevron */
|
|
||||||
@keyframes bounceDown {
|
|
||||||
0% { transform: translateY(0); }
|
|
||||||
25% { transform: translateY(2px); }
|
|
||||||
50% { transform: translateY(0); }
|
|
||||||
75% { transform: translateY(2px); }
|
|
||||||
100% { transform: translateY(0); }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Apply bounce animations */
|
|
||||||
.bounce-up {
|
|
||||||
animation: bounceUp 1s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bounce-down {
|
|
||||||
animation: bounceDown 1s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Make chevrons slightly smaller */
|
|
||||||
.chevron {
|
|
||||||
font-size: 0.8rem;
|
|
||||||
position: relative;
|
|
||||||
top: 3px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enhanced Online dot with more glow */
|
|
||||||
.online-dot {
|
|
||||||
display: inline-block;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
background: #32CD32;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-left: 0.5em;
|
|
||||||
position: relative;
|
|
||||||
top: -2px;
|
|
||||||
animation: glow 1s infinite;
|
|
||||||
box-shadow: 0 0 10px #32CD32, 0 0 20px #32CD32;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes glow {
|
|
||||||
0%, 100% { box-shadow: 0 0 10px #32CD32, 0 0 15px #32CD32; }
|
|
||||||
50% { box-shadow: 0 0 15px #32CD32, 0 0 25px #32CD32; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enhanced Offline dot with more glow */
|
|
||||||
.offline-dot {
|
|
||||||
display: inline-block;
|
|
||||||
width: 8px;
|
|
||||||
height: 8px;
|
|
||||||
background: red;
|
|
||||||
border-radius: 50%;
|
|
||||||
margin-left: 0.5em;
|
|
||||||
animation: glowRed 1s infinite;
|
|
||||||
box-shadow: 0 0 10px red, 0 0 20px red;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes glowRed {
|
|
||||||
0%, 100% { box-shadow: 0 0 10px red, 0 0 15px red; }
|
|
||||||
50% { box-shadow: 0 0 15px red, 0 0 25px red; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Refresh timer container */
|
|
||||||
#refreshUptime {
|
|
||||||
text-align: center;
|
|
||||||
margin-top: 0.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
#refreshContainer {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Enhance metric value styling with consistent glow */
|
|
||||||
.metric-value {
|
|
||||||
color: var(--text-color);
|
|
||||||
font-weight: bold;
|
|
||||||
text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Standardized glow effects for all metrics */
|
|
||||||
/* Yellow color family (BTC price, sats metrics, time to payout) */
|
|
||||||
.metric-value.yellow,
|
|
||||||
.yellow-glow {
|
|
||||||
color: #ffd700;
|
|
||||||
text-shadow: 0 0 6px rgba(255, 215, 0, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Green color family (profits, earnings) */
|
|
||||||
.metric-value.green,
|
|
||||||
.green-glow {
|
|
||||||
color: #32CD32;
|
|
||||||
text-shadow: 0 0 6px rgba(50, 205, 50, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Red color family (costs) */
|
|
||||||
.metric-value.red,
|
|
||||||
.red-glow {
|
|
||||||
color: #ff5555 !important;
|
|
||||||
text-shadow: 0 0 6px rgba(255, 85, 85, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* White metrics (general stats) */
|
|
||||||
.metric-value.white,
|
|
||||||
.white-glow {
|
|
||||||
color: #ffffff;
|
|
||||||
text-shadow: 0 0 6px rgba(255, 255, 255, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Blue metrics (time data) */
|
|
||||||
.metric-value.blue,
|
|
||||||
.blue-glow {
|
|
||||||
color: #00dfff;
|
|
||||||
text-shadow: 0 0 6px rgba(0, 223, 255, 0.6);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Special stronger glow only for online/offline indicators */
|
|
||||||
.status-green {
|
|
||||||
color: #39ff14 !important;
|
|
||||||
text-shadow: 0 0 10px #39ff14, 0 0 20px #39ff14;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-red {
|
|
||||||
color: #ff2d2d !important;
|
|
||||||
text-shadow: 0 0 10px #ff2d2d, 0 0 20px #ff2d2d;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Card body elements */
|
|
||||||
.card-body strong {
|
|
||||||
color: var(--primary-color);
|
|
||||||
margin-right: 0.25rem;
|
|
||||||
text-shadow: 0 0 2px var(--primary-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
.card-body p {
|
|
||||||
margin: 0.25rem 0;
|
|
||||||
line-height: 1.2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.container-fluid {
|
|
||||||
max-width: 1200px;
|
|
||||||
margin: 0 auto;
|
|
||||||
padding-left: 1rem;
|
|
||||||
padding-right: 1rem;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
#topRightLink {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 10px;
|
|
||||||
color: grey;
|
|
||||||
text-decoration: none;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
text-shadow: 0 0 5px grey;
|
|
||||||
}
|
|
||||||
|
|
||||||
#uptimeTimer strong {
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
#uptimeTimer {
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Connection status indicator */
|
|
||||||
#connectionStatus {
|
|
||||||
display: none;
|
|
||||||
position: fixed;
|
|
||||||
top: 10px;
|
|
||||||
right: 10px;
|
|
||||||
background: rgba(255,0,0,0.7);
|
|
||||||
color: white;
|
|
||||||
padding: 10px;
|
|
||||||
border-radius: 5px;
|
|
||||||
z-index: 9999;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
text-shadow: 0 0 5px rgba(255, 0, 0, 0.8);
|
|
||||||
box-shadow: 0 0 10px rgba(255, 0, 0, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Worker grid for worker cards */
|
|
||||||
.worker-grid {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
|
||||||
gap: 10px;
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Worker card styles */
|
|
||||||
.worker-card {
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
box-shadow: 0 0 5px rgba(247, 147, 26, 0.3);
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
padding: 10px;
|
|
||||||
height: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-card::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: repeating-linear-gradient(
|
|
||||||
0deg,
|
|
||||||
rgba(0, 0, 0, 0.05),
|
|
||||||
rgba(0, 0, 0, 0.05) 1px,
|
|
||||||
transparent 1px,
|
|
||||||
transparent 2px
|
|
||||||
);
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-card-online {
|
|
||||||
border-color: #32CD32;
|
|
||||||
box-shadow: 0 0 8px rgba(50, 205, 50, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-card-offline {
|
|
||||||
border-color: #ff5555;
|
|
||||||
box-shadow: 0 0 8px rgba(255, 85, 85, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-name {
|
|
||||||
color: var(--primary-color);
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
text-shadow: 0 0 5px var(--primary-color);
|
|
||||||
margin-bottom: 5px;
|
|
||||||
white-space: nowrap;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
z-index: 2;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-stats {
|
|
||||||
margin-top: 8px;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
z-index: 2;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-stats-row {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-stats-label {
|
|
||||||
color: #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
.hashrate-bar {
|
|
||||||
height: 4px;
|
|
||||||
background: linear-gradient(90deg, #1137F5, #39ff14);
|
|
||||||
margin-top: 4px;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Worker badge */
|
|
||||||
.worker-type {
|
|
||||||
position: absolute;
|
|
||||||
top: 10px;
|
|
||||||
right: 10px;
|
|
||||||
font-size: 0.7rem;
|
|
||||||
background-color: rgba(0, 0, 0, 0.6);
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
color: var(--primary-color);
|
|
||||||
padding: 1px 5px;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Status badges */
|
|
||||||
.status-badge {
|
|
||||||
display: inline-block;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
padding: 2px 8px;
|
|
||||||
border-radius: 3px;
|
|
||||||
z-index: 2;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-badge-online {
|
|
||||||
background-color: rgba(50, 205, 50, 0.2);
|
|
||||||
border: 1px solid #32CD32;
|
|
||||||
color: #32CD32;
|
|
||||||
text-shadow: 0 0 5px rgba(50, 205, 50, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
.status-badge-offline {
|
|
||||||
background-color: rgba(255, 85, 85, 0.2);
|
|
||||||
border: 1px solid #ff5555;
|
|
||||||
color: #ff5555;
|
|
||||||
text-shadow: 0 0 5px rgba(255, 85, 85, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Stats bars */
|
|
||||||
.stats-bar-container {
|
|
||||||
width: 100%;
|
|
||||||
height: 4px;
|
|
||||||
background-color: rgba(255, 255, 255, 0.1);
|
|
||||||
margin-top: 2px;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
.stats-bar {
|
|
||||||
height: 100%;
|
|
||||||
background: linear-gradient(90deg, #1137F5, #39ff14);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Search and filter controls */
|
|
||||||
.controls-bar {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
gap: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-box {
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
color: var(--text-color);
|
|
||||||
padding: 5px 10px;
|
|
||||||
font-family: var(--terminal-font);
|
|
||||||
min-width: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-box:focus {
|
|
||||||
outline: none;
|
|
||||||
box-shadow: 0 0 8px rgba(247, 147, 26, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-button {
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
color: var(--primary-color);
|
|
||||||
padding: 5px 10px;
|
|
||||||
font-family: var(--terminal-font);
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-button.active {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
color: var(--bg-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Bitcoin Progress Bar Styles */
|
|
||||||
.bitcoin-progress-container {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 300px;
|
|
||||||
height: 20px;
|
|
||||||
background-color: #111;
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
border-radius: 0;
|
|
||||||
margin: 0.5rem auto;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
box-shadow: 0 0 8px rgba(247, 147, 26, 0.5);
|
|
||||||
align-self: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bitcoin-progress-inner {
|
|
||||||
height: 100%;
|
|
||||||
width: 0;
|
|
||||||
background: linear-gradient(90deg, #f7931a, #ffa500);
|
|
||||||
border-radius: 0;
|
|
||||||
transition: width 0.3s ease;
|
|
||||||
position: relative;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.bitcoin-progress-inner::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: linear-gradient(90deg,
|
|
||||||
rgba(255, 255, 255, 0.1) 0%,
|
|
||||||
rgba(255, 255, 255, 0.2) 20%,
|
|
||||||
rgba(255, 255, 255, 0.1) 40%);
|
|
||||||
animation: shimmer 2s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes shimmer {
|
|
||||||
0% { transform: translateX(-100%); }
|
|
||||||
100% { transform: translateX(100%); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.bitcoin-icons {
|
|
||||||
position: absolute;
|
|
||||||
top: 50%;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
transform: translateY(-50%);
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-around;
|
|
||||||
font-size: 12px;
|
|
||||||
color: rgba(0, 0, 0, 0.7);
|
|
||||||
}
|
|
||||||
|
|
||||||
.glow-effect {
|
|
||||||
box-shadow: 0 0 15px #f7931a, 0 0 25px #f7931a;
|
|
||||||
animation: pulse 1s infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes pulse {
|
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0.8; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#progress-text {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: var(--primary-color);
|
|
||||||
margin-top: 0.3rem;
|
|
||||||
text-shadow: 0 0 5px var(--primary-color);
|
|
||||||
text-align: center;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Last Updated text with subtle animation */
|
|
||||||
#lastUpdated {
|
|
||||||
animation: flicker 5s infinite;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Cursor blink for terminal feel */
|
|
||||||
#terminal-cursor {
|
|
||||||
display: inline-block;
|
|
||||||
width: 10px;
|
|
||||||
height: 16px;
|
|
||||||
background-color: #f7931a;
|
|
||||||
margin-left: 2px;
|
|
||||||
animation: blink 1s step-end infinite;
|
|
||||||
vertical-align: middle;
|
|
||||||
box-shadow: 0 0 5px rgba(247, 147, 26, 0.8);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes blink {
|
|
||||||
0%, 100% { opacity: 1; }
|
|
||||||
50% { opacity: 0; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Summary stats in the header */
|
|
||||||
.summary-stats {
|
|
||||||
display: flex;
|
|
||||||
flex-wrap: wrap;
|
|
||||||
justify-content: space-around;
|
|
||||||
gap: 15px;
|
|
||||||
margin: 15px 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-stat {
|
|
||||||
text-align: center;
|
|
||||||
min-width: 120px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-stat-value {
|
|
||||||
font-size: 1.6rem;
|
|
||||||
font-weight: bold;
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-stat-label {
|
|
||||||
font-size: 0.9rem;
|
|
||||||
color: #aaa;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Worker count ring */
|
|
||||||
.worker-ring {
|
|
||||||
width: 90px;
|
|
||||||
height: 90px;
|
|
||||||
border-radius: 50%;
|
|
||||||
position: relative;
|
|
||||||
margin: 0 auto;
|
|
||||||
background: conic-gradient(
|
|
||||||
#32CD32 0% calc(var(--online-percent) * 100%),
|
|
||||||
#ff5555 calc(var(--online-percent) * 100%) 100%
|
|
||||||
);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
box-shadow: 0 0 15px rgba(247, 147, 26, 0.3);
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-ring-inner {
|
|
||||||
width: 70px;
|
|
||||||
height: 70px;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
font-size: 1.2rem;
|
|
||||||
font-weight: bold;
|
|
||||||
color: var(--text-color);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mini hashrate chart */
|
|
||||||
.mini-chart {
|
|
||||||
height: 40px;
|
|
||||||
width: 100%;
|
|
||||||
margin-top: 5px;
|
|
||||||
position: relative;
|
|
||||||
z-index: 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mobile responsiveness */
|
|
||||||
@media (max-width: 576px) {
|
|
||||||
.controls-bar {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: stretch;
|
|
||||||
}
|
|
||||||
|
|
||||||
.search-box {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.filter-buttons {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-grid {
|
|
||||||
grid-template-columns: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-stats {
|
|
||||||
flex-direction: column;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.summary-stat {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Navigation links */
|
|
||||||
.navigation-links {
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: 10px;
|
|
||||||
margin-bottom: 15px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-link {
|
|
||||||
padding: 5px 15px;
|
|
||||||
margin: 0 10px;
|
|
||||||
background-color: var(--bg-color);
|
|
||||||
border: 1px solid var(--primary-color);
|
|
||||||
color: var(--primary-color);
|
|
||||||
text-decoration: none;
|
|
||||||
font-family: var(--terminal-font);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-link:hover {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
color: var(--bg-color);
|
|
||||||
box-shadow: 0 0 10px rgba(247, 147, 26, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.nav-link.active {
|
|
||||||
background-color: var(--primary-color);
|
|
||||||
color: var(--bg-color);
|
|
||||||
box-shadow: 0 0 10px rgba(247, 147, 26, 0.5);
|
|
||||||
}
|
|
||||||
.loading-fade {
|
|
||||||
opacity: 0.6;
|
|
||||||
transition: opacity 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from { opacity: 0; }
|
|
||||||
to { opacity: 1; }
|
|
||||||
}
|
|
||||||
|
|
||||||
.worker-card {
|
|
||||||
animation: fadeIn 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
|
||||||
/* Fix for "Made by" link collision with title */
|
|
||||||
#topRightLink {
|
|
||||||
position: static !important;
|
|
||||||
display: block !important;
|
|
||||||
text-align: right !important;
|
|
||||||
margin-bottom: 0.5rem !important;
|
|
||||||
margin-top: 0 !important;
|
|
||||||
font-size: 0.8rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adjust heading for better mobile display */
|
|
||||||
h1 {
|
|
||||||
font-size: 20px !important;
|
|
||||||
line-height: 1.2 !important;
|
|
||||||
margin-top: 0.5rem !important;
|
|
||||||
padding-top: 0 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Improve container padding for mobile */
|
|
||||||
.container-fluid {
|
|
||||||
padding-left: 0.5rem !important;
|
|
||||||
padding-right: 0.5rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Ensure top section has appropriate spacing */
|
|
||||||
.row.mb-3 {
|
|
||||||
margin-top: 0.5rem !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Add a more aggressive breakpoint for very small screens */
|
|
||||||
@media (max-width: 380px) {
|
|
||||||
#topRightLink {
|
|
||||||
margin-bottom: 0.75rem !important;
|
|
||||||
font-size: 0.7rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 18px !important;
|
|
||||||
margin-bottom: 0.5rem !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Further reduce container padding */
|
|
||||||
.container-fluid {
|
|
||||||
padding-left: 0.3rem !important;
|
|
||||||
padding-right: 0.3rem !important;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<div class="container-fluid">
|
|
||||||
<!-- Connection status indicator -->
|
|
||||||
<div id="connectionStatus"></div>
|
|
||||||
|
|
||||||
<!-- Updated section to fix mobile layout issues -->
|
|
||||||
<div class="top-section">
|
|
||||||
<!-- Top right link - moved to top for better mobile flow -->
|
|
||||||
<a href="https://x.com/DJObleezy" id="topRightLink" target="_blank" rel="noopener noreferrer">Made by @DJO₿leezy</a>
|
|
||||||
|
|
||||||
<!-- Title with margin to avoid collision -->
|
|
||||||
<h1 class="text-center">Workers Overview</h1>
|
|
||||||
<p class="text-center" id="lastUpdated"><strong>Last Updated:</strong> {{ current_time }}<span id="terminal-cursor"></span></p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Navigation links -->
|
|
||||||
<div class="navigation-links">
|
|
||||||
<a href="/dashboard" class="nav-link">Main Dashboard</a>
|
|
||||||
<a href="/workers" class="nav-link active">Workers Overview</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Summary statistics -->
|
|
||||||
<div class="row mb-3">
|
|
||||||
<div class="col-md-12">
|
|
||||||
<div class="card">
|
|
||||||
<div class="card-header">Fleet Summary</div>
|
|
||||||
<div class="card-body">
|
|
||||||
<div class="summary-stats">
|
|
||||||
<div class="summary-stat">
|
|
||||||
<div class="worker-ring" style="--online-percent: {{ workers_online / workers_total if workers_total > 0 else 0 }}">
|
|
||||||
<div class="worker-ring-inner">
|
|
||||||
<span id="workers-count">{{ workers_total }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="summary-stat-label">Workers</div>
|
|
||||||
<div>
|
|
||||||
<span class="green-glow" id="workers-online">{{ workers_online }}</span> /
|
|
||||||
<span class="red-glow" id="workers-offline">{{ workers_offline }}</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="summary-stat">
|
|
||||||
<div class="summary-stat-value white-glow" id="total-hashrate">
|
|
||||||
{% if total_hashrate is defined %}
|
|
||||||
{{ "%.1f"|format(total_hashrate) }} {{ hashrate_unit }}
|
|
||||||
{% else %}
|
|
||||||
N/A
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="summary-stat-label">Total Hashrate</div>
|
|
||||||
<div class="mini-chart">
|
|
||||||
<canvas id="total-hashrate-chart"></canvas>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="summary-stat">
|
|
||||||
<div class="summary-stat-value green-glow" id="total-earnings">
|
|
||||||
{% if total_earnings is defined %}
|
|
||||||
{{ "%.8f"|format(total_earnings) }} BTC
|
|
||||||
{% else %}
|
|
||||||
N/A
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="summary-stat-label">Lifetime Earnings</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="summary-stat">
|
|
||||||
<div class="summary-stat-value yellow-glow" id="daily-sats">
|
|
||||||
{% if daily_sats is defined %}
|
|
||||||
{{ daily_sats|commafy }} sats
|
|
||||||
{% else %}
|
|
||||||
N/A
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="summary-stat-label">Daily Sats</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="summary-stat">
|
|
||||||
<div class="summary-stat-value white-glow" id="avg-acceptance-rate">
|
|
||||||
{% if avg_acceptance_rate is defined %}
|
|
||||||
{{ "%.2f"|format(avg_acceptance_rate) }}%
|
|
||||||
{% else %}
|
|
||||||
N/A
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
<div class="summary-stat-label">Acceptance Rate</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Controls bar -->
|
|
||||||
<div class="controls-bar">
|
|
||||||
<input type="text" class="search-box" id="worker-search" placeholder="Search workers...">
|
|
||||||
<div class="filter-buttons">
|
|
||||||
<button class="filter-button active" data-filter="all">All Workers</button>
|
|
||||||
<button class="filter-button" data-filter="online">Online</button>
|
|
||||||
<button class="filter-button" data-filter="offline">Offline</button>
|
|
||||||
<button class="filter-button" data-filter="asic">ASIC</button>
|
|
||||||
<button class="filter-button" data-filter="fpga">FPGA</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Workers grid -->
|
|
||||||
<div class="worker-grid" id="worker-grid">
|
|
||||||
<!-- Worker cards will be generated here via JavaScript -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- Bitcoin-themed Progress Bar and Uptime -->
|
|
||||||
<div id="refreshUptime" class="text-center mt-4">
|
|
||||||
<div id="refreshContainer">
|
|
||||||
<!-- Bitcoin-themed progress bar -->
|
|
||||||
<div class="bitcoin-progress-container">
|
|
||||||
<div id="bitcoin-progress-inner" class="bitcoin-progress-inner" style="width: 0%">
|
|
||||||
<!-- Small Bitcoin icons inside the bar -->
|
|
||||||
<div class="bitcoin-icons">
|
|
||||||
<i class="fab fa-bitcoin"></i>
|
|
||||||
<i class="fab fa-bitcoin"></i>
|
|
||||||
<i class="fab fa-bitcoin"></i>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div id="progress-text">60s to next update</div>
|
|
||||||
</div>
|
|
||||||
<div id="uptimeTimer"><strong>Uptime:</strong> 0h 0m 0s</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<!-- External JavaScript libraries -->
|
|
||||||
<script src="https://code.jquery.com/jquery-3.7.0.min.js"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
|
|
||||||
<script src="/static/js/workers.js"></script>
|
|
||||||
<!-- Retro Floating Refresh Bar -->
|
|
||||||
<script src="/static/js/retro-refresh.js"></script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Loading…
Reference in New Issue
Block a user