mirror of
https://github.com/Retropex/custom-ocean.xyz-dashboard.git
synced 2025-05-12 11:10:44 +02:00
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:
parent
b9c04a39e8
commit
81f79e2792
@ -9,6 +9,45 @@
|
||||
<link rel="stylesheet" href="/static/css/theme-toggle.css">
|
||||
<!-- Add Theme JS -->
|
||||
<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>
|
||||
<body>
|
||||
<script>
|
||||
@ -421,6 +460,8 @@ v.21
|
||||
// Redirect to dashboard
|
||||
function redirectToDashboard() {
|
||||
updateDebug("Boot sequence complete, redirecting...");
|
||||
// Set localStorage flag to indicate boot sequence has been completed
|
||||
localStorage.setItem('hasCompletedBootSequence', 'true');
|
||||
const baseUrl = window.location.origin;
|
||||
window.location.href = baseUrl + "/dashboard";
|
||||
}
|
||||
|
@ -392,7 +392,7 @@ class WorkerService:
|
||||
unpaid_earnings = 0.001
|
||||
|
||||
# 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
|
||||
|
||||
# Use unpaid_earnings as total_earnings
|
||||
|
Loading…
Reference in New Issue
Block a user