index.html 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  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="stylesheet" href="../../script/semantic/semantic.min.css">
  9. <script src="../../script/jquery.min.js"></script>
  10. <script src="../../script/ao_module.js"></script>
  11. <script src="../../script/semantic/semantic.min.js"></script>
  12. <title>Reverse Proxy</title>
  13. <style>
  14. body{
  15. background-color:white;
  16. }
  17. .functiontab{
  18. display:none;
  19. }
  20. </style>
  21. </head>
  22. <body>
  23. <br>
  24. <div class="ui container">
  25. <h3><img class="ui middle aligned mini image" src="img/desktop_icon.png" style="margin-right: 4px;"> Reverse Proxy Settings</h3>
  26. <div class="ui divider"></div>
  27. <div id="errmsg" class="ui red message" style="display: none;"></div>
  28. <div class="ui stackable grid">
  29. <div class="four wide column">
  30. <div id="mainmenu" class="ui secondary vertical pointing menu">
  31. <a class="item active" tag="status">
  32. Status
  33. </a>
  34. <a class="item" tag="vdir">
  35. Virtual Directory
  36. </a>
  37. <a class="item" tag="subd">
  38. Subdomain Proxy
  39. </a>
  40. <a class="item" tag="rules">
  41. Create Proxy Rules
  42. </a>
  43. <a class="item" tag="setroot">
  44. Set Proxy Root
  45. </a>
  46. </div>
  47. </div>
  48. <div class="twelve wide column">
  49. <!-- Status Tab -->
  50. <div id="status" class="functiontab">
  51. <div id="serverstatus" class="ui message">
  52. <h3 class="ui header">
  53. <i class="power off icon"></i>
  54. <div class="content">
  55. <span id="statusTitle">Offline</span>
  56. <div class="sub header" id="statusText">Reverse proxy server is offline</div>
  57. </div>
  58. </h3>
  59. </div>
  60. <div class="ui divider"></div>
  61. <button id="startbtn" class="ui teal button" onclick="startService();">Start Service</button>
  62. <button id="stopbtn" class="ui red disabled button" onclick="stopService();">Stop Service</button>
  63. </div>
  64. <!-- Virtual Directory Tab -->
  65. <div id="vdir" class="functiontab">
  66. <table class="ui celled table">
  67. <thead>
  68. <tr>
  69. <th>Virtual Directory</th>
  70. <th>Proxy To</th>
  71. <th>Remove</th>
  72. </tr>
  73. </thead>
  74. <tbody>
  75. <tr>
  76. <td data-label="">test</td>
  77. <td data-label="">test</td>
  78. <td data-label=""><button class="ui circular mini red basic button"><i class="remove icon"></i> Remove Proxy</button></td>
  79. </tr>
  80. </tbody>
  81. </table>
  82. </div>
  83. <!-- Subdomain Proxy -->
  84. <div id="subd" class="functiontab">
  85. <table class="ui celled table">
  86. <thead>
  87. <tr>
  88. <th>Subdomain</th>
  89. <th>Proxy To</th>
  90. <th>Remove</th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. </tbody>
  95. </table>
  96. </div>
  97. <!-- Create Rules -->
  98. <div id="rules" class="functiontab">
  99. <div class="">
  100. <h3><i class="ui exchange icon"></i> New Proxy Endpoint</h3>
  101. <p>You can create a proxy endpoing by subdomain or virtual directories</p>
  102. <form class="ui form">
  103. <div class="field">
  104. <label>Proxy Type</label>
  105. <div class="ui selection dropdown">
  106. <input type="hidden" name="ptype">
  107. <i class="dropdown icon"></i>
  108. <div class="default text">Proxy Type</div>
  109. <div class="menu">
  110. <div class="item" data-value="domain">Sub-domain</div>
  111. <div class="item" data-value="vdir">Virtual Directory</div>
  112. </div>
  113. </div>
  114. </div>
  115. <div class="field">
  116. <label>Subdomain Matching Keyword / Virtual Directory Name</label>
  117. <input type="text" name="first-name" placeholder="First Name">
  118. <div class="ui message">
  119. Example of subdomain matching keyword:<br>
  120. <code>s1.arozos.com</code> (Any access starting with s1.arozos.com will be proxy to the IP address below)<br>
  121. Example of virtual directory name: <br>
  122. <code>s1</code> (Any access to {this_server}/s1/ will be proxy to the IP address below)
  123. </div>
  124. </div>
  125. <div class="field">
  126. <label>Last Name</label>
  127. <input type="text" name="last-name" placeholder="Last Name">
  128. </div>
  129. <button class="ui teal button" type="submit">Create Proxy Endpoint</button>
  130. </form>
  131. </div>
  132. </div>
  133. <!-- Set proxy root -->
  134. <div id="setroot" class="functiontab">
  135. <h3><i class="ui home icon"></i> Set Proxy Root</h3>
  136. <p>For all routing not found in the proxy rule, will be redirected to the proxy root server.</p>
  137. <button class="ui button" onclick=""><i class="edit icon"></i> Set Proxy Root</button>
  138. </div>
  139. </div>
  140. </div>
  141. </div>
  142. <br><br>
  143. </div>
  144. <script>
  145. initRPStaste();
  146. $("#status").slideDown('fast');
  147. $(".ui.dropdown").dropdown();
  148. $("#mainmenu").find(".item").each(function(){
  149. $(this).on("click", function(e){
  150. $("#mainmenu").find(".item").removeClass("active");
  151. $(this).addClass("active");
  152. let targetOpeningTab = $(this).attr("tag");
  153. $(".functiontab").hide();
  154. $("#" + targetOpeningTab).slideDown('fast');
  155. });
  156. });
  157. function initRPStaste(){
  158. $.get("../../system/proxy/status", function(data){
  159. if (data.Running == true){
  160. $("#startbtn").addClass("disabled");
  161. $("#stopbtn").removeClass("disabled");
  162. $("#serverstatus").addClass("green");
  163. }else{
  164. $("#startbtn").removeClass("disabled");
  165. $("#stopbtn").addClass("disabled");
  166. $("#statusTitle").text("Offline");
  167. $("#statusText").text("Reverse proxy server is offline");
  168. $("#serverstatus").removeClass("green");
  169. }
  170. });
  171. }
  172. function startService(){
  173. $.post("../../system/proxy/enable", {enable: true}, function(data){
  174. if (data.error != undefined){
  175. errmsg(data.error);
  176. }
  177. initRPStaste();
  178. });
  179. }
  180. function stopService(){
  181. $.post("../../system/proxy/enable", {enable: false}, function(data){
  182. if (data.error != undefined){
  183. errmsg(data.error);
  184. }
  185. initRPStaste();
  186. });
  187. }
  188. function errmsg(message){
  189. $("#errmsg").html(`<i class="red remove icon"></i> ${message}`);
  190. $("#errmsg").slideDown('fast').delay(5000).slideUp('fast');
  191. }
  192. </script>
  193. </body>
  194. </html>