1
0

index.html 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta name="apple-mobile-web-app-capable" content="yes" />
  5. <meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=1, maximum-scale=1"/>
  6. <meta charset="UTF-8">
  7. <meta name="theme-color" content="#4b75ff">
  8. <link rel="icon" type="image/png" href="./favicon.png" />
  9. <title>Control Panel | Zoraxy</title>
  10. <link rel="stylesheet" href="script/semantic/semantic.min.css">
  11. <script src="script/jquery-3.6.0.min.js"></script>
  12. <script src="../script/ao_module.js"></script>
  13. <script src="script/semantic/semantic.min.js"></script>
  14. <script src="script/tablesort.js"></script>
  15. <link rel="stylesheet" href="main.css">
  16. </head>
  17. <body>
  18. <div class="menubar">
  19. <div class="item">
  20. <img class="logo" src="img/logo.svg">
  21. </div>
  22. <div class="ui right floated buttons" style="padding-top: 2px;">
  23. <button class="ui basic icon button" onclick="logout();"><i class="sign-out icon"></i></button>
  24. </div>
  25. </div>
  26. <div class="wrapper">
  27. <div class="toolbar">
  28. <div id="mainmenu" class="ui secondary vertical pointing menu">
  29. <a class="item active" tag="status">
  30. <i class="blue info circle icon"></i>Status
  31. </a>
  32. <a class="item" tag="vdir">
  33. <i class="yellow folder icon"></i> Virtual Directory
  34. </a>
  35. <a class="item" tag="subd">
  36. <i class="teal sitemap icon"></i> Subdomain Proxy
  37. </a>
  38. <a class="item" tag="rules">
  39. <i class="brown plus square icon"></i> Create Proxy Rules
  40. </a>
  41. <a class="item" tag="setroot">
  42. <i class="home icon"></i> Set Proxy Root
  43. </a>
  44. <div class="ui divider menudivider">Access & Connections</div>
  45. <a class="item" tag="cert">
  46. <i class="orange lock icon"></i> TLS / SSL certificate
  47. </a>
  48. <a class="item" tag="redirectset">
  49. <i class="violet level up alternate icon"></i> Redirection
  50. </a>
  51. <a class="item" tag="blacklist">
  52. <i class="red ban icon"></i> Blacklist
  53. </a>
  54. <a class="item" tag="upnp">
  55. <i class="blue exchange icon"></i> Port Forward
  56. </a>
  57. <div class="ui divider menudivider">Bridging</div>
  58. <a class="item" tag="">
  59. <i class="remove icon"></i> TCP Proxy
  60. </a>
  61. <a class="item" tag="">
  62. <i class="remove icon"></i> HTTP over Websocket
  63. </a>
  64. <div class="ui divider menudivider">Others</div>
  65. <a class="item" tag="">
  66. <i class="remove icon"></i> Uptime Monitor
  67. </a>
  68. <a class="item" tag="">
  69. <i class="remove icon"></i> Network Tools
  70. </a>
  71. <a class="item" tag="utils">
  72. <i class="grey paperclip icon"></i> Utilities
  73. </a>
  74. <!-- Add more components here -->
  75. </div>
  76. </div>
  77. <div class="contentWindow">
  78. <!-- Status Tab -->
  79. <div id="status" class="functiontab" target="status.html" style="display: block ;">
  80. <br><br><div class="ui active centered inline loader"></div>
  81. </div>
  82. <!-- Virtual Directory Tab -->
  83. <div id="vdir" class="functiontab" target="vdir.html"></div>
  84. <!-- Subdomain Proxy -->
  85. <div id="subd" class="functiontab" target="subd.html"></div>
  86. <!-- Create Rules -->
  87. <div id="rules" class="functiontab" target="rules.html"></div>
  88. <!-- Set proxy root -->
  89. <div id="setroot" class="functiontab" target="rproot.html"></div>
  90. <!-- Set TLS cert -->
  91. <div id="cert" class="functiontab" target="cert.html"></div>
  92. <!-- Redirections -->
  93. <div id="redirectset" class="functiontab" target="redirection.html"></div>
  94. <!-- Blacklist -->
  95. <div id="blacklist" class="functiontab" target="blacklist.html"></div>
  96. <!-- UPnP based port fowarding -->
  97. <div id="upnp" class="functiontab" target="upnp.html"></div>
  98. <!-- Utilities -->
  99. <div id="utils" class="functiontab" target="utils.html"></div>
  100. </div>
  101. </div>
  102. </div>
  103. <br><br>
  104. <div class="ui divider"></div>
  105. <div class="ui container" style="color: grey; font-size: 90%">
  106. <p>CopyRight Zoraxy project and its author, 2022 - <span class="year"></span></p>
  107. </div>
  108. <br><br>
  109. <script>
  110. $(".year").text(new Date().getFullYear());
  111. /*
  112. Loader function
  113. Load all the components view from the
  114. components/ directory into their corrisponding divs
  115. */
  116. let loadingComponents = 0;
  117. function initTabs(callback=undefined){
  118. $('.functiontab').each(function(){
  119. let loadTarget = $(this).attr("target");
  120. if (loadTarget != undefined){
  121. $(this).load("./components/" + loadTarget, function(){
  122. loadingComponents--;
  123. });
  124. loadingComponents++;
  125. }else{
  126. $(this).html(`<p>Unable to load components for this tab</p>`);
  127. }
  128. })
  129. if (callback != undefined){
  130. waitInit(callback);
  131. }
  132. }
  133. function waitInit(callback = undefined, retryCount = 0){
  134. if (loadingComponents > 0 && retryCount < 5){
  135. setTimeout(function(){
  136. waitInit(callback, retryCount++);
  137. }, 300);
  138. }else if (loadingComponents == 0){
  139. callback();
  140. }else{
  141. alert("Missing component. Please check if your installation is complete.")
  142. }
  143. }
  144. initTabs(function(){
  145. initRPStaste();
  146. if (window.location.hash.length > 1){
  147. let tabID = window.location.hash.substr(1);
  148. openTabById(tabID);
  149. }else{
  150. openTabById("status");
  151. }
  152. $(".ui.dropdown").dropdown();
  153. $(".ui.checkbox").checkbox();
  154. //Click on the current tab
  155. $("#mainmenu").find(".item").each(function(){
  156. $(this).on("click", function(event){
  157. let tabid = $(this).attr("tag");
  158. openTabById(tabid);
  159. });
  160. });
  161. //Initialize all table that is sortable
  162. $('table').tablesort();
  163. });
  164. function logout() {
  165. $.get("/api/auth/logout", function(response) {
  166. if (response === "OK") {
  167. window.location.href = "/";
  168. }
  169. });
  170. }
  171. function getTabButtonById(targetTabId){
  172. let targetTabBtn = undefined;
  173. $("#mainmenu").find(".item").each(function(){
  174. let tabid = $(this).attr("tag");
  175. if (tabid == targetTabId){
  176. targetTabBtn = $(this);
  177. }
  178. });
  179. return targetTabBtn;
  180. }
  181. //Select and open a tab by its tag id
  182. function openTabById(tabID){
  183. let targetBtn = getTabButtonById(tabID);
  184. if (targetBtn == undefined){
  185. alert("Invalid tabid given");
  186. return;
  187. }
  188. $("#mainmenu").find(".item").removeClass("active");
  189. $(targetBtn).addClass("active");
  190. $(".functiontab").hide();
  191. $("#" + tabID).fadeIn('fast');
  192. $('html,body').animate({scrollTop: 0}, 'fast');
  193. window.location.hash = tabID;
  194. }
  195. </script>
  196. </body>
  197. </html>