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,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);