index.html 11 KB

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