edit_config.html 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <link rel="icon" href="favicon.ico?v=$COMMIT_HASH" 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. <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
  22. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  23. <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
  24. </head>
  25. <body style="font-family: arial; padding: 0px 10px;">
  26. <table>
  27. <tr><td><h2>Config.ini:</h2></td></tr>
  28. <tr>
  29. <td colspan="3">
  30. <textarea id="inputTextToSave" cols="100" rows="33"></textarea>
  31. </td>
  32. </tr>
  33. <tr>
  34. <td><button class="button" onclick="saveTextAsFile()">Save</button></td>
  35. </tr>
  36. <tr>
  37. <td><button class="button" id="reboot" type="button" onclick="doReboot()">Reboot to activate changes</button></td>
  38. </tr>
  39. </table>
  40. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  41. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  42. <script type="text/javascript">
  43. var canvas = document.getElementById('canvas'),
  44. domainname = getDomainname();
  45. function LoadConfigNeu() {
  46. domainname = getDomainname();
  47. loadConfig(domainname);
  48. document.getElementById("inputTextToSave").value = getConfig();
  49. }
  50. function saveTextAsFile()
  51. {
  52. if (confirm("Are you sure you want to update \"config.ini\"?")) {
  53. FileDeleteOnServer("/config/config.ini", domainname);
  54. var textToSave = document.getElementById("inputTextToSave").value;
  55. FileSendContent(textToSave, "/config/config.ini", domainname);
  56. firework.launch('Configuration got updated. It will get applied after the next reboot!', 'success', 5000);
  57. }
  58. }
  59. function doReboot() {
  60. if (confirm("Are you sure you want to reboot the ESP32?")) {
  61. var stringota = "/reboot";
  62. window.location = stringota;
  63. window.location.href = stringota;
  64. window.location.assign(stringota);
  65. window.location.replace(stringota);
  66. }
  67. }
  68. LoadConfigNeu();
  69. </script>
  70. </body>
  71. </html>