index.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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 menutoggle" style="padding-top: 2px;">
  23. <button class="ui basic icon button" onclick="$('.toolbar').fadeToggle('fast');"><i class="content icon"></i></button>
  24. </div>
  25. <div class="ui right floated buttons" style="padding-top: 2px;">
  26. <button class="ui basic icon button" onclick="logout();"><i class="sign-out icon"></i></button>
  27. </div>
  28. </div>
  29. <div class="wrapper">
  30. <div class="toolbar">
  31. <div id="mainmenu" class="ui secondary vertical pointing menu">
  32. <a class="item active" tag="status">
  33. <i class="blue info circle icon"></i>Status
  34. </a>
  35. <a class="item" tag="vdir">
  36. <i class="yellow folder icon"></i> Virtual Directory
  37. </a>
  38. <a class="item" tag="subd">
  39. <i class="teal sitemap icon"></i> Subdomain Proxy
  40. </a>
  41. <a class="item" tag="rules">
  42. <i class="brown plus square icon"></i> Create Proxy Rules
  43. </a>
  44. <a class="item" tag="setroot">
  45. <i class="home icon"></i> Set Proxy Root
  46. </a>
  47. <div class="ui divider menudivider">Access & Connections</div>
  48. <a class="item" tag="cert">
  49. <i class="orange lock icon"></i> TLS / SSL certificate
  50. </a>
  51. <a class="item" tag="redirectset">
  52. <i class="violet level up alternate icon"></i> Redirection
  53. </a>
  54. <a class="item" tag="blacklist">
  55. <i class="red ban icon"></i> Blacklist
  56. </a>
  57. <div class="ui divider menudivider">Bridging</div>
  58. <a class="item" tag="gan">
  59. <i class="blue exchange icon"></i> Global Area Network
  60. </a>
  61. <a class="item" tag="">
  62. <i class="remove icon"></i> HTTP over Websocket
  63. </a>
  64. <a class="item" tag="">
  65. <i class="remove icon"></i> TCP Proxy
  66. </a>
  67. <div class="ui divider menudivider">Others</div>
  68. <a class="item" tag="utm">
  69. <i class="green time icon"></i> Uptime Monitor
  70. </a>
  71. <a class="item" tag="networktool">
  72. <i class="terminal icon"></i> Network Tools
  73. </a>
  74. <a class="item" tag="utils">
  75. <i class="grey paperclip icon"></i> Utilities
  76. </a>
  77. <!-- Add more components here -->
  78. </div>
  79. </div>
  80. <div class="contentWindow">
  81. <!-- Status Tab -->
  82. <div id="status" class="functiontab" target="status.html" style="display: block ;">
  83. <br><br><div class="ui active centered inline loader"></div>
  84. </div>
  85. <!-- Virtual Directory Tab -->
  86. <div id="vdir" class="functiontab" target="vdir.html"></div>
  87. <!-- Subdomain Proxy -->
  88. <div id="subd" class="functiontab" target="subd.html"></div>
  89. <!-- Create Rules -->
  90. <div id="rules" class="functiontab" target="rules.html"></div>
  91. <!-- Set proxy root -->
  92. <div id="setroot" class="functiontab" target="rproot.html"></div>
  93. <!-- Set TLS cert -->
  94. <div id="cert" class="functiontab" target="cert.html"></div>
  95. <!-- Redirections -->
  96. <div id="redirectset" class="functiontab" target="redirection.html"></div>
  97. <!-- Blacklist -->
  98. <div id="blacklist" class="functiontab" target="blacklist.html"></div>
  99. <!-- UPnP based port fowarding -->
  100. <div id="gan" class="functiontab" target="gan.html"></div>
  101. <!-- Up Time Monitor -->
  102. <div id="utm" class="functiontab" target="uptime.html"></div>
  103. <!-- Network Tools -->
  104. <div id="networktool" class="functiontab" target="networktools.html"></div>
  105. <!-- Utilities -->
  106. <div id="utils" class="functiontab" target="utils.html"></div>
  107. </div>
  108. </div>
  109. </div>
  110. <br><br>
  111. <div class="ui divider"></div>
  112. <div class="ui container" style="color: grey; font-size: 90%">
  113. <p>CopyRight Zoraxy project and its author, 2022 - <span class="year"></span></p>
  114. </div>
  115. <br><br>
  116. <script>
  117. $(".year").text(new Date().getFullYear());
  118. /*
  119. Loader function
  120. Load all the components view from the
  121. components/ directory into their corrisponding divs
  122. */
  123. let loadingComponents = 0;
  124. function initTabs(callback=undefined){
  125. $('.functiontab').each(function(){
  126. let loadTarget = $(this).attr("target");
  127. if (loadTarget != undefined){
  128. $(this).load("./components/" + loadTarget, function(){
  129. loadingComponents--;
  130. });
  131. loadingComponents++;
  132. }else{
  133. $(this).html(`<p>Unable to load components for this tab</p>`);
  134. }
  135. })
  136. if (callback != undefined){
  137. waitInit(callback);
  138. }
  139. }
  140. function waitInit(callback = undefined, retryCount = 0){
  141. if (loadingComponents > 0 && retryCount < 5){
  142. setTimeout(function(){
  143. waitInit(callback, retryCount++);
  144. }, 300);
  145. }else if (loadingComponents == 0){
  146. callback();
  147. }else{
  148. alert("Missing component. Please check if your installation is complete.")
  149. }
  150. }
  151. initTabs(function(){
  152. initRPStaste();
  153. if (window.location.hash.length > 1){
  154. let tabID = window.location.hash.substr(1);
  155. openTabById(tabID);
  156. }else{
  157. openTabById("status");
  158. }
  159. $(".ui.dropdown").dropdown();
  160. $(".ui.checkbox").checkbox();
  161. //Click on the current tab
  162. $("#mainmenu").find(".item").each(function(){
  163. $(this).on("click", function(event){
  164. let tabid = $(this).attr("tag");
  165. openTabById(tabid);
  166. });
  167. });
  168. //Initialize all table that is sortable
  169. $('table').tablesort();
  170. });
  171. function logout() {
  172. $.get("/api/auth/logout", function(response) {
  173. if (response === "OK") {
  174. window.location.href = "/";
  175. }
  176. });
  177. }
  178. function getTabButtonById(targetTabId){
  179. let targetTabBtn = undefined;
  180. $("#mainmenu").find(".item").each(function(){
  181. let tabid = $(this).attr("tag");
  182. if (tabid == targetTabId){
  183. targetTabBtn = $(this);
  184. }
  185. });
  186. return targetTabBtn;
  187. }
  188. //Select and open a tab by its tag id
  189. function openTabById(tabID){
  190. let targetBtn = getTabButtonById(tabID);
  191. if (targetBtn == undefined){
  192. alert("Invalid tabid given");
  193. return;
  194. }
  195. if (window.innerWidth < 750){
  196. //RWD mode, hide toolbar
  197. $(".toolbar").fadeOut('fast');
  198. }
  199. $("#mainmenu").find(".item").removeClass("active");
  200. $(targetBtn).addClass("active");
  201. $(".functiontab").hide();
  202. $("#" + tabID).fadeIn('fast');
  203. $('html,body').animate({scrollTop: 0}, 'fast');
  204. window.location.hash = tabID;
  205. }
  206. $(window).on("resize", function(){
  207. if (window.innerWidth >= 750 && $(".toolbar").is(":visible") == false){
  208. $(".toolbar").show();
  209. }
  210. });
  211. </script>
  212. </body>
  213. </html>