edit_config.html 1.9 KB

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