edit_config.html 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <title>Edit Config</title>
  5. <meta charset="utf-8">
  6. <style>
  7. h1 {font-size: 2em;}
  8. h2 {font-size: 1.5em; margin-block-start: 0.0em; margin-block-end: 0.2em;}
  9. h3 {font-size: 1.2em;}
  10. p {font-size: 1em;}
  11. .button {
  12. padding: 5px 20px;
  13. width: 211px;
  14. font-size: 16px;
  15. }
  16. textarea {
  17. font-size: 14px;
  18. }
  19. </style>
  20. </head>
  21. <body style="font-family: arial; padding: 0px 10px;">
  22. <table>
  23. <tr><td><h2>Config.ini:</h2></td></tr>
  24. <tr>
  25. <td colspan="3">
  26. <textarea id="inputTextToSave" cols="100" rows="33"></textarea>
  27. </td>
  28. </tr>
  29. <tr>
  30. <td><button class="button" onclick="saveTextAsFile()">Update Config.ini</button></td>
  31. </tr>
  32. <tr>
  33. <td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate updates</button></td>
  34. </tr>
  35. </table>
  36. <script type="text/javascript" src="./gethost.js"></script>
  37. <script type="text/javascript" src="./readconfig.js"></script>
  38. <script type="text/javascript">
  39. var canvas = document.getElementById('canvas'),
  40. basepath = "http://192.168.178.26";
  41. function LoadConfigNeu() {
  42. basepath = getbasepath();
  43. loadConfig(basepath);
  44. document.getElementById("inputTextToSave").value = getConfig();
  45. }
  46. function saveTextAsFile()
  47. {
  48. if (confirm("Are you sure you want to update \"config.ini\"?")) {
  49. FileDeleteOnServer("/config/config.ini", basepath);
  50. var textToSave = document.getElementById("inputTextToSave").value;
  51. FileSendContent(textToSave, "/config/config.ini", basepath);
  52. }
  53. }
  54. function doReboot() {
  55. if (confirm("Are you sure you want to reboot the ESP32?")) {
  56. var stringota = "/reboot";
  57. window.location = stringota;
  58. window.location.href = stringota;
  59. window.location.assign(stringota);
  60. window.location.replace(stringota);
  61. }
  62. }
  63. LoadConfigNeu();
  64. </script>
  65. </body>
  66. </html>