index.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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. <style>
  16. body{
  17. background-color:white;
  18. }
  19. .functiontab{
  20. display:none;
  21. }
  22. .menubar{
  23. width: 100%;
  24. padding: 0.4em;
  25. padding-left: 1.2em;
  26. padding-right: 1.2em;
  27. background-color: #f5f5f5;
  28. margin-bottom: 1em;
  29. position: fixed;
  30. top: 0;
  31. width: 100%;
  32. z-index: 10;
  33. box-shadow: 0px 1px 5px 0px rgba(38,38,38,0.26);
  34. }
  35. .menubar .logo{
  36. height: 36px;
  37. }
  38. .menubar .item{
  39. display: inline-block;
  40. vertical-align: middle;
  41. }
  42. .wrapper{
  43. display: flex;
  44. flex-wrap: wrap;
  45. margin-top: 4em;
  46. }
  47. .toolbar{
  48. width: 240px;
  49. }
  50. .contentWindow{
  51. padding: 1em;
  52. flex: 1;
  53. }
  54. @media screen and (max-width: 750px) {
  55. .toolbar {
  56. display: inline-block;
  57. width: 100%;
  58. margin-bottom: 1em;
  59. }
  60. #mainmenu{
  61. width: calc(100% - 1em);
  62. }
  63. .contentWindow{
  64. display: inline-block;
  65. width: 100%;
  66. }
  67. }
  68. .menudivider{
  69. font-size: 0.8em !important;
  70. color: #9c9c9c !important;
  71. padding-left: 0.6em;
  72. }
  73. </style>
  74. </head>
  75. <body>
  76. <div class="menubar">
  77. <div class="item">
  78. <img class="logo" src="img/logo.svg">
  79. </div>
  80. <div class="ui right floated buttons" style="padding-top: 2px;">
  81. <button class="ui basic icon button" onclick="logout();"><i class="sign-out icon"></i></button>
  82. </div>
  83. </div>
  84. <div class="wrapper">
  85. <div class="toolbar">
  86. <div id="mainmenu" class="ui secondary vertical pointing menu">
  87. <a class="item active" tag="status">
  88. <i class="blue info circle icon"></i>Status
  89. </a>
  90. <a class="item" tag="vdir">
  91. <i class="yellow folder icon"></i> Virtual Directory
  92. </a>
  93. <a class="item" tag="subd">
  94. <i class="teal sitemap icon"></i> Subdomain Proxy
  95. </a>
  96. <a class="item" tag="rules">
  97. <i class="brown plus square icon"></i> Create Proxy Rules
  98. </a>
  99. <a class="item" tag="setroot">
  100. <i class="home icon"></i> Set Proxy Root
  101. </a>
  102. <div class="ui divider menudivider">Access & Connections</div>
  103. <a class="item" tag="cert">
  104. <i class="orange lock icon"></i> TLS / SSL certificate
  105. </a>
  106. <a class="item" tag="redirectset">
  107. <i class="violet level up alternate icon"></i> Redirection
  108. </a>
  109. <a class="item" tag="blacklist">
  110. <i class="red ban icon"></i> Blacklist
  111. </a>
  112. <a class="item" tag="upnp">
  113. <i class="blue exchange icon"></i> Port Forward
  114. </a>
  115. <div class="ui divider menudivider">Bridging</div>
  116. <a class="item" tag="">
  117. <i class="remove icon"></i> TCP Proxy
  118. </a>
  119. <a class="item" tag="">
  120. <i class="remove icon"></i> HTTP over Websocket
  121. </a>
  122. <div class="ui divider menudivider">Others</div>
  123. <a class="item" tag="">
  124. <i class="remove icon"></i> Uptime Monitor
  125. </a>
  126. <a class="item" tag="">
  127. <i class="remove icon"></i> Network Tools
  128. </a>
  129. <a class="item" tag="utils">
  130. <i class="grey paperclip icon"></i> Utilities
  131. </a>
  132. <!-- Add more components here -->
  133. </div>
  134. </div>
  135. <div class="contentWindow">
  136. <!-- Status Tab -->
  137. <div id="status" class="functiontab" target="status.html" style="display: block ;">
  138. <br><br><div class="ui active centered inline loader"></div>
  139. </div>
  140. <!-- Virtual Directory Tab -->
  141. <div id="vdir" class="functiontab" target="vdir.html"></div>
  142. <!-- Subdomain Proxy -->
  143. <div id="subd" class="functiontab" target="subd.html"></div>
  144. <!-- Create Rules -->
  145. <div id="rules" class="functiontab" target="rules.html"></div>
  146. <!-- Set proxy root -->
  147. <div id="setroot" class="functiontab" target="rproot.html"></div>
  148. <!-- Set TLS cert -->
  149. <div id="cert" class="functiontab" target="cert.html"></div>
  150. <!-- Redirections -->
  151. <div id="redirectset" class="functiontab" target="redirection.html"></div>
  152. <!-- Blacklist -->
  153. <div id="blacklist" class="functiontab" target="blacklist.html"></div>
  154. <!-- UPnP based port fowarding -->
  155. <div id="upnp" class="functiontab" target="upnp.html"></div>
  156. <!-- Utilities -->
  157. <div id="utils" class="functiontab" target="utils.html"></div>
  158. </div>
  159. </div>
  160. </div>
  161. <br><br>
  162. <div class="ui divider"></div>
  163. <div class="ui container" style="color: grey; font-size: 90%">
  164. <p>CopyRight Zoraxy project and its author, 2022 - <span class="year"></span></p>
  165. </div>
  166. <br><br>
  167. <script>
  168. $(".year").text(new Date().getFullYear());
  169. /*
  170. Loader function
  171. Load all the components view from the
  172. components/ directory into their corrisponding divs
  173. */
  174. let loadingComponents = 0;
  175. function initTabs(callback=undefined){
  176. $('.functiontab').each(function(){
  177. let loadTarget = $(this).attr("target");
  178. if (loadTarget != undefined){
  179. $(this).load("./components/" + loadTarget, function(){
  180. loadingComponents--;
  181. });
  182. loadingComponents++;
  183. }else{
  184. $(this).html(`<p>Unable to load components for this tab</p>`);
  185. }
  186. })
  187. if (callback != undefined){
  188. waitInit(callback);
  189. }
  190. }
  191. function waitInit(callback = undefined, retryCount = 0){
  192. if (loadingComponents > 0 && retryCount < 5){
  193. setTimeout(function(){
  194. waitInit(callback, retryCount++);
  195. }, 300);
  196. }else if (loadingComponents == 0){
  197. callback();
  198. }else{
  199. alert("Missing component. Please check if your installation is complete.")
  200. }
  201. }
  202. initTabs(function(){
  203. initRPStaste();
  204. if (window.location.hash.length > 1){
  205. let tabID = window.location.hash.substr(1);
  206. openTabById(tabID);
  207. }else{
  208. openTabById("status");
  209. }
  210. $(".ui.dropdown").dropdown();
  211. $(".ui.checkbox").checkbox();
  212. //Click on the current tab
  213. $("#mainmenu").find(".item").each(function(){
  214. $(this).on("click", function(event){
  215. let tabid = $(this).attr("tag");
  216. openTabById(tabid);
  217. });
  218. });
  219. //Initialize all table that is sortable
  220. $('table').tablesort();
  221. });
  222. function logout() {
  223. $.get("/api/auth/logout", function(response) {
  224. if (response === "OK") {
  225. window.location.href = "/";
  226. }
  227. });
  228. }
  229. function getTabButtonById(targetTabId){
  230. let targetTabBtn = undefined;
  231. $("#mainmenu").find(".item").each(function(){
  232. let tabid = $(this).attr("tag");
  233. if (tabid == targetTabId){
  234. targetTabBtn = $(this);
  235. }
  236. });
  237. return targetTabBtn;
  238. }
  239. //Select and open a tab by its tag id
  240. function openTabById(tabID){
  241. let targetBtn = getTabButtonById(tabID);
  242. if (targetBtn == undefined){
  243. alert("Invalid tabid given");
  244. return;
  245. }
  246. $("#mainmenu").find(".item").removeClass("active");
  247. $(targetBtn).addClass("active");
  248. $(".functiontab").hide();
  249. $("#" + tabID).fadeIn('fast');
  250. $('html,body').animate({scrollTop: 0}, 'fast');
  251. window.location.hash = tabID;
  252. }
  253. </script>
  254. </body>
  255. </html>