modified: data/www/index.html
modified: data/www/wifi.html
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user