edit_config_raw.html 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <!DOCTYPE html>
  2. <html lang="en" xml:lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <title>Edit Config</title>
  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. #reboot_button {
  20. float: none;
  21. background-color: #f44336;
  22. color: white;
  23. padding: 5px;
  24. border-radius:
  25. 5px; font-weight: bold;
  26. text-align: center;
  27. text-decoration: none;
  28. display: inline-block;
  29. }
  30. </style>
  31. <link href="firework.css?v=$COMMIT_HASH" rel="stylesheet">
  32. <script type="text/javascript" src="common.js?v=$COMMIT_HASH"></script>
  33. <script type="text/javascript" src="jquery-3.6.0.min.js?v=$COMMIT_HASH"></script>
  34. <script type="text/javascript" src="firework.js?v=$COMMIT_HASH"></script>
  35. </head>
  36. <body style="font-family: arial; padding: 0px 10px;">
  37. <table style="width:660px">
  38. <h2>Configuration - "Config.ini" Editor</h2>
  39. <td>
  40. <textarea id="inputTextToSave" rows="30" style="width:100%"></textarea>
  41. </td>
  42. </table>
  43. <hr>
  44. <button class="button" onclick="saveTextAsFile()">Save Config</button>
  45. <script type="text/javascript" src="readconfigparam.js?v=$COMMIT_HASH"></script>
  46. <script type="text/javascript" src="readconfigcommon.js?v=$COMMIT_HASH"></script>
  47. <script type="text/javascript">
  48. var canvas = document.getElementById('canvas'),
  49. domainname = getDomainname();
  50. async function LoadConfigNeu() {
  51. domainname = getDomainname();
  52. if (!await loadConfig(domainname)) {
  53. firework.launch('Configuration could not be loaded!', 'danger', 10000);
  54. return;
  55. }
  56. document.getElementById("inputTextToSave").value = getConfig();
  57. }
  58. async function saveTextAsFile() {
  59. await FileDeleteOnServer("/config/config.ini", domainname);
  60. var textToSave = document.getElementById("inputTextToSave").value;
  61. if (!await FileSendContent(textToSave, "/config/config.ini", domainname)) {
  62. firework.launch('Configuration could not be saved!', 'danger', 10000);
  63. return;
  64. }
  65. firework.launch('Configuration saved. It will get applied after the next reboot!<br><br>\n<a id="reboot_button" onclick="doReboot()">reboot now</a>', 'success', 5000);
  66. }
  67. function doReboot() {
  68. var stringota = "/reboot";
  69. window.location = stringota;
  70. window.location.href = stringota;
  71. window.location.assign(stringota);
  72. window.location.replace(stringota);
  73. }
  74. LoadConfigNeu().catch(function (error) { console.error('Could not load configuration editor:', error); });
  75. </script>
  76. </body>
  77. </html>