Moved buttons to wifi.html

modified:   data/www/index.html
	modified:   data/www/wifi.html
This commit is contained in:
2025-04-13 20:33:15 +02:00
parent 777640b7df
commit 3031f75836
2 changed files with 32 additions and 21 deletions

View File

@@ -34,9 +34,7 @@
overflow-y: auto;
}
.danger-zone {
margin-top: auto;
padding: 20px;
border-top: 1px solid #34495e;
display: none; /* Hide the danger zone since it's no longer needed */
}
.danger-btn {
background: #e74c3c;
@@ -59,11 +57,6 @@
<div class="menu-item" data-page="wifi">WiFi Settings</div>
<div class="menu-item" data-page="midi">MIDI Config</div>
<div class="menu-item" data-page="system">System</div>
<div class="danger-zone">
<h4>Danger Zone</h4>
<button class="danger-btn" onclick="factoryReset()">Factory Reset</button>
</div>
</div>
<div class="content" id="mainContent">
<iframe id="contentFrame" style="width:100%;height:100%;border:none;"></iframe>
@@ -86,15 +79,6 @@
});
});
function factoryReset() {
if(confirm('Are you sure you want to perform a factory reset? This will erase all settings.')) {
fetch('/api/system/factory-reset', { method: 'POST' })
.then(response => response.json())
.then(data => alert(data.message))
.catch(error => alert('Error: ' + error));
}
}
// Load dashboard by default
document.getElementById('contentFrame').src = pages.dashboard;
</script>

View File

@@ -34,11 +34,17 @@
border-radius: 4px;
cursor: pointer;
width: 100%;
margin: 5px 0;
margin: 10px 0;
}
.danger-btn:hover {
background: #c0392b;
}
.danger-section {
margin-bottom: 20px;
}
.danger-section h4 {
margin-bottom: 10px;
}
</style>
</head>
<body>
@@ -50,9 +56,15 @@
</div>
<div class="danger-zone">
<h4>WiFi Controls</h4>
<button class="danger-btn" onclick="resetWiFi()">Reset WiFi Settings</button>
<button class="danger-btn" onclick="forgetNetwork()">Forget Current Network</button>
<div class="danger-section">
<h4>WiFi Controls</h4>
<button class="danger-btn" onclick="resetWiFi()">Reset WiFi Settings</button>
<button class="danger-btn" onclick="forgetNetwork()">Forget Current Network</button>
</div>
<div class="danger-section">
<h4>System Controls</h4>
<button class="danger-btn" onclick="factoryReset()">Factory Reset</button>
</div>
</div>
</div>
<script>
@@ -102,6 +114,21 @@
}
}
function factoryReset() {
if(confirm('Are you sure you want to perform a factory reset? This will erase ALL settings and restart the device.')) {
// Using GET method to avoid HTTP method redefinition issues with WiFiManager
fetch('/api/system/factory-reset')
.then(response => response.json())
.then(data => {
alert(data.message || 'Factory reset initiated. Device will restart.');
setTimeout(() => {
window.location.href = '/';
}, 3000);
})
.catch(error => alert('Error: ' + error));
}
}
// Update status every 5 seconds
updateWiFiStatus();
setInterval(updateWiFiStatus, 5000);