Add boot sequence bypass and improve earnings check

Introduces a script in `boot.html` to bypass the boot sequence if the user has completed it previously, checking for a valid wallet configuration before redirecting to the dashboard. Additionally, updates the earnings check in `worker_service.py` to handle `None` values more robustly, ensuring a minimum unpaid earnings value of `0.001`.
This commit is contained in:
DJObleezy 2025-04-24 07:17:36 -07:00
parent b9c04a39e8
commit 81f79e2792
2 changed files with 42 additions and 1 deletions

View File

@ -9,6 +9,45 @@
<link rel="stylesheet" href="/static/css/theme-toggle.css"> <link rel="stylesheet" href="/static/css/theme-toggle.css">
<!-- Add Theme JS --> <!-- Add Theme JS -->
<script src="/static/js/theme.js"></script> <script src="/static/js/theme.js"></script>
<!-- Add Boot Sequence Bypass Logic -->
<script>
// Check if we should bypass boot sequence and go directly to dashboard
(function () {
// Only try to bypass if we've booted before
const hasBootedBefore = localStorage.getItem('hasCompletedBootSequence') === 'true';
if (hasBootedBefore) {
console.log("Boot sequence previously completed, checking configuration...");
// Check if configuration exists and is valid
fetch('/api/config?nocache=' + new Date().getTime())
.then(response => {
if (!response.ok) {
throw new Error('Configuration check failed');
}
return response.json();
})
.then(config => {
// Check if configuration has a valid wallet (not default/empty)
const isConfigured = config.wallet &&
config.wallet !== "yourwallethere" &&
config.wallet.trim() !== "";
if (isConfigured) {
console.log("Valid configuration found, bypassing boot sequence");
window.location.href = window.location.origin + "/dashboard";
} else {
console.log("Configuration invalid or incomplete, showing boot sequence");
// Continue with normal boot sequence
}
})
.catch(error => {
console.error("Error checking configuration:", error);
// On error, continue with boot sequence
});
}
})();
</script>
</head> </head>
<body> <body>
<script> <script>
@ -421,6 +460,8 @@ v.21
// Redirect to dashboard // Redirect to dashboard
function redirectToDashboard() { function redirectToDashboard() {
updateDebug("Boot sequence complete, redirecting..."); updateDebug("Boot sequence complete, redirecting...");
// Set localStorage flag to indicate boot sequence has been completed
localStorage.setItem('hasCompletedBootSequence', 'true');
const baseUrl = window.location.origin; const baseUrl = window.location.origin;
window.location.href = baseUrl + "/dashboard"; window.location.href = baseUrl + "/dashboard";
} }

View File

@ -392,7 +392,7 @@ class WorkerService:
unpaid_earnings = 0.001 unpaid_earnings = 0.001
# Ensure we have a minimum value for unpaid earnings # Ensure we have a minimum value for unpaid earnings
if unpaid_earnings <= 0: if unpaid_earnings is None or unpaid_earnings <= 0:
unpaid_earnings = 0.001 unpaid_earnings = 0.001
# Use unpaid_earnings as total_earnings # Use unpaid_earnings as total_earnings