config.html 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <!-- Meta headers for mobile devices-->
  5. <meta name="apple-mobile-web-app-capable" content="yes" />
  6. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  7. <meta charset="UTF-8">
  8. <link rel="icon" href="favicon.png">
  9. <!-- CSS and JavaScript, access to scripe folder is not blocked for non logged in users-->
  10. <link rel="stylesheet" href="../../../script/semantic/semantic.min.css">
  11. <script src="../../../script/jquery.min.js"></script>
  12. <script src="../../../script/ao_module.js"></script>
  13. <script src="../../../script/semantic/semantic.min.js"></script>
  14. <title>Personal Homepage</title>
  15. <style>
  16. body{
  17. background-color:white;
  18. }
  19. </style>
  20. </head>
  21. <body>
  22. <br>
  23. <div class="ui container">
  24. <div class="ui basic segment">
  25. <h3 class="ui header">
  26. <i class="home icon"></i>
  27. <div class="content">
  28. Personal Home Page
  29. <div class="sub header">Create your own home page on ArozOS</div>
  30. </div>
  31. </h3>
  32. </div>
  33. <div class="ui divider"></div>
  34. <div class="ui message">
  35. <div class="header">
  36. What is Personal Home Page?
  37. </div>
  38. <ul class="list">
  39. <li>You can host a static website using ArozOS</li>
  40. <li>All website source are accessiable by your File Manager located inside your user file system</li>
  41. <li>Everyone can access your home page using <a><span class=".protocol">http:</span>//<span class="hostname"></span>:<span class="port"></span>/www/<span class="username">{your_username}</span>/</a></li>
  42. </ul>
  43. </div>
  44. <div class="ui container">
  45. <h4>Toggle Personal Home Page</h4>
  46. <div class="ui toggle checkbox">
  47. <input type="checkbox" id="enablehp" onchange="updateHomepageStatus(this.checked);">
  48. <label>Enable personal home page</label>
  49. </div>
  50. <div id="updateSuceed" style="display:none;" class="ui green inverted segment"><i class="checkmark icon"></i> Home Page Status Updated</div>
  51. <br>
  52. <h4>Select web root folder location</h4>
  53. <div class="ui action fluid input">
  54. <input id="webroot" type="text" placeholder="Select Location" readonly="true">
  55. <button class="ui black button" onclick="selectWebRootLocation();"><i class="folder open icon"></i> Open</button>
  56. </div>
  57. <div class="ui yellow message"><i class="warning icon"></i> All files located inside the web root will be accessiable by everyone on the internet.</div>
  58. <div id="webrootSetSuceed" style="display:none;" class="ui green inverted segment"><i class="checkmark icon"></i> Web Root Location Updated</div>
  59. <br>
  60. <small>*All changes will be saved automatically upon updates.</small>
  61. </div>
  62. <br><br>
  63. </div>
  64. <script>
  65. var ignoreChange = true;
  66. //Update the user information
  67. $.get("../../../system/desktop/user", function(data){
  68. if (data.error == undefined){
  69. $(".username").text(data.Username);
  70. }
  71. });
  72. //Update tutorial information
  73. $(".hostname").text(window.location.hostname);
  74. $(".port").text(window.location.port);
  75. if (window.location.port == ""){
  76. $(".port").text("80");
  77. }
  78. $(".protocol").text(location.protocol);
  79. initHomePageInfo();
  80. function initHomePageInfo(){
  81. $.get("../../../system/network/www/toggle", function(data){
  82. if (data.error == undefined){
  83. $("#enablehp")[0].checked = data;
  84. ignoreChange = false;
  85. }
  86. });
  87. $.get("../../../system/network/www/webRoot", function(data){
  88. if (data.error !== undefined){
  89. //Not defined.
  90. }else{
  91. //Defined. Set it to the input field
  92. $("#webroot").val(data);
  93. }
  94. });
  95. }
  96. function updateHomepageStatus(enableHomePage = false){
  97. if (ignoreChange){
  98. return;
  99. }
  100. $.ajax({
  101. url: "../../../system/network/www/toggle",
  102. data: {set: enableHomePage},
  103. success: function(data){
  104. if (data.error !== undefined){
  105. alert(data.error);
  106. }else{
  107. $("#updateSuceed").slideDown("fast").delay(3000).slideUp("fast");
  108. }
  109. }
  110. });
  111. }
  112. function selectWebRootLocation(){
  113. ao_module_openFileSelector(webrootSelected, "user:/", "folder",false);
  114. }
  115. function webrootSelected(filedata){
  116. for (var i=0; i < filedata.length; i++){
  117. var filename = filedata[i].filename;
  118. var filepath = filedata[i].filepath;
  119. $("#webroot").val(filepath);
  120. }
  121. //Update the server database
  122. $.ajax({
  123. url: "../../../system/network/www/webRoot",
  124. data: {set: $("#webroot").val()},
  125. success: function(data){
  126. if (data.error !== undefined){
  127. alert(data.error);
  128. }else{
  129. $("#webrootSetSuceed").slideDown("fast").delay(3000).slideUp("fast");
  130. }
  131. }
  132. });
  133. }
  134. </script>
  135. </body>
  136. </html>