edit_config.html 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  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" 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. }
  54. }
  55. function doReboot() {
  56. if (confirm("Are you sure you want to reboot the ESP32?")) {
  57. var stringota = "/reboot";
  58. window.location = stringota;
  59. window.location.href = stringota;
  60. window.location.assign(stringota);
  61. window.location.replace(stringota);
  62. }
  63. }
  64. LoadConfigNeu();
  65. </script>
  66. </body>
  67. </html>