modified: data/www/index.html

modified:   data/www/wifi.html
This commit is contained in:
2025-04-13 12:40:07 +02:00
parent 1080d3025c
commit 777640b7df
2 changed files with 51 additions and 22 deletions

View File

@@ -62,8 +62,6 @@
<div class="danger-zone">
<h4>Danger Zone</h4>
<button class="danger-btn" onclick="resetWiFi()">Reset WiFi Settings</button>
<button class="danger-btn" onclick="forgetNetwork()">Forget Current Network</button>
<button class="danger-btn" onclick="factoryReset()">Factory Reset</button>
</div>
</div>
@@ -88,27 +86,9 @@
});
});
function resetWiFi() {
if(confirm('Are you sure you want to reset all WiFi settings?')) {
fetch('/api/wifi/reset', { method: 'POST' })
.then(response => response.json())
.then(data => alert(data.message))
.catch(error => alert('Error: ' + error));
}
}
function forgetNetwork() {
if(confirm('Are you sure you want to forget the current WiFi network?')) {
fetch('/api/wifi/forget', { method: 'POST' })
.then(response => response.json())
.then(data => alert(data.message))
.catch(error => alert('Error: ' + error));
}
}
function factoryReset() {
if(confirm('WARNING: This will reset all settings to factory defaults. Are you sure?')) {
fetch('/api/system/reset', { method: 'POST' })
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));

View File

@@ -20,6 +20,25 @@
.status-disconnected {
color: #c0392b;
}
.danger-zone {
margin-top: 30px;
padding: 20px;
border: 2px solid #e74c3c;
border-radius: 5px;
}
.danger-btn {
background: #e74c3c;
color: white;
border: none;
padding: 10px 15px;
border-radius: 4px;
cursor: pointer;
width: 100%;
margin: 5px 0;
}
.danger-btn:hover {
background: #c0392b;
}
</style>
</head>
<body>
@@ -29,6 +48,12 @@
<h3>Current Status</h3>
<div id="wifiStatus"></div>
</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>
</div>
<script>
function updateWiFiStatus() {
@@ -53,6 +78,30 @@
});
}
function resetWiFi() {
if(confirm('Are you sure you want to reset all WiFi settings?')) {
fetch('/api/wifi/reset', { method: 'POST' })
.then(response => response.json())
.then(data => {
alert(data.message);
updateWiFiStatus();
})
.catch(error => alert('Error: ' + error));
}
}
function forgetNetwork() {
if(confirm('Are you sure you want to forget the current network?')) {
fetch('/api/wifi/forget', { method: 'POST' })
.then(response => response.json())
.then(data => {
alert(data.message);
updateWiFiStatus();
})
.catch(error => alert('Error: ' + error));
}
}
// Update status every 5 seconds
updateWiFiStatus();
setInterval(updateWiFiStatus, 5000);