diff --git a/cmd_parser.c b/cmd_parser.c
index bc02967..847e847 100644
--- a/cmd_parser.c
+++ b/cmd_parser.c
@@ -1043,7 +1043,6 @@ void execute_config(void) __banked
config_done:
// Start saving commands to cmd_history
save_cmd = 1;
- clear_command_history();
}
void clear_command_history(void) __banked
diff --git a/html/system.html b/html/system.html
index 749cd5f..c23cef8 100644
--- a/html/system.html
+++ b/html/system.html
@@ -21,18 +21,24 @@
-
+
When updating the above settings, remember to point your browser to the new IP afterwards:
+ Save all current settings to Flash:
+
+
+
+
+ Advanced Settings
-
-
- Save all current settings to Flash:
-
-
+
+
+
+
+
diff --git a/html/system.js b/html/system.js
index e58113c..1e11598 100644
--- a/html/system.js
+++ b/html/system.js
@@ -42,7 +42,21 @@ async function sendConfig(c) {
}
}
+
async function flashSave() {
+ fetchConfig().then((s) => {
+ parseConf(s);
+ fetchCmdLog().then((s) => {
+ parseConf(s);
+ var body = "";
+ for (const x of configuration) { body = body + x + "\n"; }
+ console.log("CONFIGURATION to save: ", body);
+ sendConfig(body);
+ });
+ });
+}
+
+async function flashStartupSave() {
var configContent = document.getElementById("config_display").value;
console.log("CONFIGURATION to save: ", configContent);
sendConfig(configContent);
@@ -86,19 +100,28 @@ function fetchIP() {
fetchConfig().then((configText) => {
let fullConfig = configText;
// Fetch and append cmd_log
- return fetchCmdLog().then((cmdLogText) => {
- if (cmdLogText) {
- fullConfig = fullConfig + cmdLogText;
- }
- document.getElementById("config_display").value = fullConfig;
+ //return fetchCmdLog().then((cmdLogText) => {
+ // if (cmdLogText) {
+ // fullConfig = fullConfig + cmdLogText;
+ // }
+ document.getElementById("config_display").value = fullConfig;
});
- });
+ };
}
- }
xhttp.open("GET", `/information.json`, true);
xhttp.send();
}
+function resetSwitch() {
+ if (!confirm('Are you sure you want to reset the switch?')) {
+ return;
+ }
+ fetch('/reset', { method: 'GET' }).catch(() => {});
+ setTimeout(() => {
+ alert('Switch is resetting. Please wait and refresh the page.');
+ }, 3000);
+}
+
window.addEventListener("load", function() {
systemInterval = setInterval(fetchIP, 1000);
});
diff --git a/httpd/httpd.c b/httpd/httpd.c
index 940a574..4432f29 100644
--- a/httpd/httpd.c
+++ b/httpd/httpd.c
@@ -601,6 +601,9 @@ void httpd_appcall(void)
} else if (is_word(q, "/cmd_log_clear")) {
clear_command_history();
send_mtu(); // dummy response
+ } else if (is_word(q, "/reset")) {
+ uip_close();
+ reset_chip();
} else {
send_not_found();
}