edit_config.html 2.2 KB

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