index.html 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238
  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="">
  72. <i class="remove 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. <!-- Utilities -->
  104. <div id="utils" class="functiontab" target="utils.html"></div>
  105. </div>
  106. </div>
  107. </div>
  108. <br><br>
  109. <div class="ui divider"></div>
  110. <div class="ui container" style="color: grey; font-size: 90%">
  111. <p>CopyRight Zoraxy project and its author, 2022 - <span class="year"></span></p>
  112. </div>
  113. <br><br>
  114. <script>
  115. $(".year").text(new Date().getFullYear());
  116. /*
  117. Loader function
  118. Load all the components view from the
  119. components/ directory into their corrisponding divs
  120. */
  121. let loadingComponents = 0;
  122. function initTabs(callback=undefined){
  123. $('.functiontab').each(function(){
  124. let loadTarget = $(this).attr("target");
  125. if (loadTarget != undefined){
  126. $(this).load("./components/" + loadTarget, function(){
  127. loadingComponents--;
  128. });
  129. loadingComponents++;
  130. }else{
  131. $(this).html(`<p>Unable to load components for this tab</p>`);
  132. }
  133. })
  134. if (callback != undefined){
  135. waitInit(callback);
  136. }
  137. }
  138. function waitInit(callback = undefined, retryCount = 0){
  139. if (loadingComponents > 0 && retryCount < 5){
  140. setTimeout(function(){
  141. waitInit(callback, retryCount++);
  142. }, 300);
  143. }else if (loadingComponents == 0){
  144. callback();
  145. }else{
  146. alert("Missing component. Please check if your installation is complete.")
  147. }
  148. }
  149. initTabs(function(){
  150. initRPStaste();
  151. if (window.location.hash.length > 1){
  152. let tabID = window.location.hash.substr(1);
  153. openTabById(tabID);
  154. }else{
  155. openTabById("status");
  156. }
  157. $(".ui.dropdown").dropdown();
  158. $(".ui.checkbox").checkbox();
  159. //Click on the current tab
  160. $("#mainmenu").find(".item").each(function(){
  161. $(this).on("click", function(event){
  162. let tabid = $(this).attr("tag");
  163. openTabById(tabid);
  164. });
  165. });
  166. //Initialize all table that is sortable
  167. $('table').tablesort();
  168. });
  169. function logout() {
  170. $.get("/api/auth/logout", function(response) {
  171. if (response === "OK") {
  172. window.location.href = "/";
  173. }
  174. });
  175. }
  176. function getTabButtonById(targetTabId){
  177. let targetTabBtn = undefined;
  178. $("#mainmenu").find(".item").each(function(){
  179. let tabid = $(this).attr("tag");
  180. if (tabid == targetTabId){
  181. targetTabBtn = $(this);
  182. }
  183. });
  184. return targetTabBtn;
  185. }
  186. //Select and open a tab by its tag id
  187. function openTabById(tabID){
  188. let targetBtn = getTabButtonById(tabID);
  189. if (targetBtn == undefined){
  190. alert("Invalid tabid given");
  191. return;
  192. }
  193. if (window.innerWidth < 750){
  194. //RWD mode, hide toolbar
  195. $(".toolbar").fadeOut('fast');
  196. }
  197. $("#mainmenu").find(".item").removeClass("active");
  198. $(targetBtn).addClass("active");
  199. $(".functiontab").hide();
  200. $("#" + tabID).fadeIn('fast');
  201. $('html,body').animate({scrollTop: 0}, 'fast');
  202. window.location.hash = tabID;
  203. }
  204. $(window).on("resize", function(){
  205. if (window.innerWidth >= 750 && $(".toolbar").is(":visible") == false){
  206. $(".toolbar").show();
  207. }
  208. });
  209. </script>
  210. </body>
  211. </html>