form.ejs 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  1. <div class="modal-content">
  2. <div class="modal-header">
  3. <h5 class="modal-title"><%- i18n('proxy-hosts', 'form-title', {id: id}) %></h5>
  4. <button type="button" class="close cancel" aria-label="Close" data-dismiss="modal">&nbsp;</button>
  5. </div>
  6. <div class="modal-body has-tabs">
  7. <form>
  8. <ul class="nav nav-tabs" role="tablist">
  9. <li role="presentation" class="nav-item"><a href="#details" aria-controls="tab1" role="tab" data-toggle="tab" class="nav-link active"><i class="fe fe-zap"></i> <%- i18n('all-hosts', 'details') %></a></li>
  10. <li role="presentation" class="nav-item"><a href="#locations" aria-controls="tab4" role="tab" data-toggle="tab" class="nav-link"><i class="fe fe-layers"></i> <%- i18n('all-hosts', 'locations') %></a></li>
  11. <li role="presentation" class="nav-item"><a href="#ssl-options" aria-controls="tab2" role="tab" data-toggle="tab" class="nav-link"><i class="fe fe-shield"></i> <%- i18n('str', 'ssl') %></a></li>
  12. <li role="presentation" class="nav-item"><a href="#advanced" aria-controls="tab3" role="tab" data-toggle="tab" class="nav-link"><i class="fe fe-settings"></i> <%- i18n('all-hosts', 'advanced') %></a></li>
  13. </ul>
  14. <div class="tab-content">
  15. <!-- Locations -->
  16. <div class="tab-pane" id="locations">
  17. <div class="row">
  18. <div class="col-sm-12">
  19. <button type="button" class="btn btn-secondary add_location"><%- i18n('locations', 'new_location') %></button>
  20. <div class="locations_container mt-3"></div>
  21. </div>
  22. </div>
  23. </div>
  24. <!-- Details -->
  25. <div role="tabpanel" class="tab-pane active" id="details">
  26. <div class="row">
  27. <div class="col-sm-12 col-md-12">
  28. <div class="form-group">
  29. <label class="form-label"><%- i18n('all-hosts', 'domain-names') %> <span class="form-required">*</span></label>
  30. <input type="text" name="domain_names" class="form-control" id="input-domains" value="<%- domain_names.join(',') %>" required>
  31. </div>
  32. </div>
  33. <div class="col-sm-3 col-md-3">
  34. <div class="form-group">
  35. <label class="form-label"><%- i18n('proxy-hosts', 'forward-scheme') %><span class="form-required">*</span></label>
  36. <select name="forward_scheme" class="form-control custom-select" placeholder="http">
  37. <option value="http" <%- forward_scheme === 'http' ? 'selected' : '' %>>http</option>
  38. <option value="https" <%- forward_scheme === 'https' ? 'selected' : '' %>>https</option>
  39. </select>
  40. </div>
  41. </div>
  42. <div class="col-sm-5 col-md-5">
  43. <div class="form-group">
  44. <label class="form-label"><%- i18n('proxy-hosts', 'forward-host') %><span class="form-required">*</span></label>
  45. <input type="text" name="forward_host" class="form-control text-monospace" placeholder="" value="<%- forward_host %>" autocomplete="off" maxlength="255" required>
  46. </div>
  47. </div>
  48. <div class="col-sm-4 col-md-4">
  49. <div class="form-group">
  50. <label class="form-label"><%- i18n('proxy-hosts', 'forward-port') %> <span class="form-required">*</span></label>
  51. <input name="forward_port" type="number" class="form-control text-monospace" placeholder="80" value="<%- forward_port %>" required>
  52. </div>
  53. </div>
  54. <div class="col-sm-6 col-md-6">
  55. <div class="form-group">
  56. <label class="custom-switch">
  57. <input type="checkbox" class="custom-switch-input" name="caching_enabled" value="1"<%- caching_enabled ? ' checked' : '' %>>
  58. <span class="custom-switch-indicator"></span>
  59. <span class="custom-switch-description"><%- i18n('all-hosts', 'caching-enabled') %></span>
  60. </label>
  61. </div>
  62. </div>
  63. <div class="col-sm-6 col-md-6">
  64. <div class="form-group">
  65. <label class="custom-switch">
  66. <input type="checkbox" class="custom-switch-input" name="block_exploits" value="1"<%- block_exploits ? ' checked' : '' %>>
  67. <span class="custom-switch-indicator"></span>
  68. <span class="custom-switch-description"><%- i18n('all-hosts', 'block-exploits') %></span>
  69. </label>
  70. </div>
  71. </div>
  72. <div class="col-sm-12 col-md-12">
  73. <div class="form-group">
  74. <label class="custom-switch">
  75. <input type="checkbox" class="custom-switch-input" name="allow_websocket_upgrade" value="1"<%- allow_websocket_upgrade ? ' checked' : '' %>>
  76. <span class="custom-switch-indicator"></span>
  77. <span class="custom-switch-description"><%- i18n('proxy-hosts', 'allow-websocket-upgrade') %></span>
  78. </label>
  79. </div>
  80. </div>
  81. <div class="col-sm-12 col-md-12">
  82. <div class="form-group">
  83. <label class="form-label"><%- i18n('proxy-hosts', 'access-list') %></label>
  84. <select name="access_list_id" class="form-control custom-select" placeholder="<%- i18n('access-lists', 'public') %>">
  85. <option selected value="0" data-data="{&quot;id&quot;:0}" <%- access_list_id ? '' : 'selected' %>><%- i18n('access-lists', 'public') %></option>
  86. </select>
  87. </div>
  88. </div>
  89. </div>
  90. </div>
  91. <!-- SSL -->
  92. <div role="tabpanel" class="tab-pane" id="ssl-options">
  93. <div class="row">
  94. <div class="col-sm-12 col-md-12">
  95. <div class="form-group">
  96. <label class="form-label"><%- i18n('all-hosts', 'ssl-certificate') %></label>
  97. <select name="certificate_id" class="form-control custom-select" placeholder="<%- i18n('all-hosts', 'none') %>">
  98. <option selected value="0" data-data="{&quot;id&quot;:0}" <%- certificate_id ? '' : 'selected' %>><%- i18n('all-hosts', 'none') %></option>
  99. <option selected value="new" data-data="{&quot;id&quot;:&quot;new&quot;}"><%- i18n('all-hosts', 'new-cert') %></option>
  100. </select>
  101. </div>
  102. </div>
  103. <div class="col-sm-6 col-md-6">
  104. <div class="form-group">
  105. <label class="custom-switch">
  106. <input type="checkbox" class="custom-switch-input" name="ssl_forced" value="1"<%- ssl_forced ? ' checked' : '' %><%- certificate_id ? '' : ' disabled' %>>
  107. <span class="custom-switch-indicator"></span>
  108. <span class="custom-switch-description"><%- i18n('all-hosts', 'force-ssl') %></span>
  109. </label>
  110. </div>
  111. </div>
  112. <div class="col-sm-6 col-md-6">
  113. <div class="form-group">
  114. <label class="custom-switch">
  115. <input type="checkbox" class="custom-switch-input" name="http2_support" value="1"<%- http2_support ? ' checked' : '' %><%- certificate_id ? '' : ' disabled' %>>
  116. <span class="custom-switch-indicator"></span>
  117. <span class="custom-switch-description"><%- i18n('all-hosts', 'http2-support') %></span>
  118. </label>
  119. </div>
  120. </div>
  121. <div class="col-sm-6 col-md-6">
  122. <div class="form-group">
  123. <label class="custom-switch">
  124. <input type="checkbox" class="custom-switch-input" name="hsts_enabled" value="1"<%- hsts_enabled ? ' checked' : '' %><%- certificate_id && ssl_forced ? '' : ' disabled' %>>
  125. <span class="custom-switch-indicator"></span>
  126. <span class="custom-switch-description"><%- i18n('all-hosts', 'hsts-enabled') %> <a href="https://en.wikipedia.org/wiki/HTTP_Strict_Transport_Security" target="_blank"><i class="fe fe-help-circle"></i></a></span>
  127. </label>
  128. </div>
  129. </div>
  130. <div class="col-sm-6 col-md-6">
  131. <div class="form-group">
  132. <label class="custom-switch">
  133. <input type="checkbox" class="custom-switch-input" name="hsts_subdomains" value="1"<%- hsts_subdomains ? ' checked' : '' %><%- certificate_id && ssl_forced && hsts_enabled ? '' : ' disabled' %>>
  134. <span class="custom-switch-indicator"></span>
  135. <span class="custom-switch-description"><%- i18n('all-hosts', 'hsts-subdomains') %></span>
  136. </label>
  137. </div>
  138. </div>
  139. <!-- DNS challenge -->
  140. <div class="col-sm-12 col-md-12 letsencrypt">
  141. <div class="form-group">
  142. <label class="custom-switch">
  143. <input
  144. type="checkbox"
  145. class="custom-switch-input"
  146. name="meta[dns_challenge]"
  147. value="1"
  148. <%- getUseDnsChallenge() ? 'checked' : '' %>
  149. >
  150. <span class="custom-switch-indicator"></span>
  151. <span class="custom-switch-description"><%= i18n('ssl', 'dns-challenge') %></span>
  152. </label>
  153. </div>
  154. </div>
  155. <div class="col-sm-12 col-md-12 letsencrypt">
  156. <fieldset class="form-fieldset dns-challenge">
  157. <div class="text-red mb-4"><i class="fe fe-alert-triangle"></i> <%= i18n('ssl', 'certbot-warning') %></div>
  158. <!-- Certbot DNS plugin selection -->
  159. <div class="row">
  160. <div class="col-sm-12 col-md-12">
  161. <div class="form-group">
  162. <label class="form-label"><%- i18n('ssl', 'dns-provider') %> <span class="form-required">*</span></label>
  163. <select
  164. name="meta[dns_provider]"
  165. id="dns_provider"
  166. class="form-control custom-select"
  167. >
  168. <option
  169. value=""
  170. disabled
  171. hidden
  172. <%- getDnsProvider() === null ? 'selected' : '' %>
  173. >Please Choose...</option>
  174. <% _.each(dns_plugins, function(plugin_info, plugin_name){ %>
  175. <option
  176. value="<%- plugin_name %>"
  177. <%- getDnsProvider() === plugin_name ? 'selected' : '' %>
  178. ><%- plugin_info.display_name %></option>
  179. <% }); %>
  180. </select>
  181. </div>
  182. </div>
  183. </div>
  184. <!-- Certbot credentials file content -->
  185. <div class="row credentials-file-content">
  186. <div class="col-sm-12 col-md-12">
  187. <div class="form-group">
  188. <label class="form-label"><%- i18n('ssl', 'credentials-file-content') %> <span class="form-required">*</span></label>
  189. <textarea
  190. name="meta[dns_provider_credentials]"
  191. class="form-control text-monospace"
  192. id="dns_provider_credentials"
  193. ><%- getDnsProviderCredentials() %></textarea>
  194. <div class="text-secondary small">
  195. <i class="fe fe-info"></i>
  196. <%= i18n('ssl', 'credentials-file-content-info') %>
  197. </div>
  198. </div>
  199. </div>
  200. </div>
  201. <!-- DNS propagation delay -->
  202. <div class="row">
  203. <div class="col-sm-12 col-md-12">
  204. <div class="form-group mb-0">
  205. <label class="form-label"><%- i18n('ssl', 'propagation-seconds') %></label>
  206. <input
  207. type="number"
  208. min="0"
  209. name="meta[propagation_seconds]"
  210. class="form-control"
  211. id="propagation_seconds"
  212. value="<%- getPropagationSeconds() %>"
  213. >
  214. <div class="text-secondary small">
  215. <i class="fe fe-info"></i>
  216. <%= i18n('ssl', 'propagation-seconds-info') %>
  217. </div>
  218. </div>
  219. </div>
  220. </div>
  221. </fieldset>
  222. </div>
  223. <!-- Lets encrypt -->
  224. <div class="col-sm-12 col-md-12 letsencrypt">
  225. <div class="form-group">
  226. <label class="form-label"><%- i18n('ssl', 'letsencrypt-email') %> <span class="form-required">*</span></label>
  227. <input name="meta[letsencrypt_email]" type="email" class="form-control" placeholder="" value="<%- getLetsencryptEmail() %>" required disabled>
  228. </div>
  229. </div>
  230. <div class="col-sm-12 col-md-12 letsencrypt">
  231. <div class="form-group">
  232. <label class="custom-switch">
  233. <input type="checkbox" class="custom-switch-input" name="meta[letsencrypt_agree]" value="1" required disabled>
  234. <span class="custom-switch-indicator"></span>
  235. <span class="custom-switch-description"><%= i18n('ssl', 'letsencrypt-agree', {url: 'https://letsencrypt.org/repository/'}) %> <span class="form-required">*</span></span>
  236. </label>
  237. </div>
  238. </div>
  239. </div>
  240. </div>
  241. <!-- Advanced -->
  242. <div role="tabpanel" class="tab-pane" id="advanced">
  243. <div class="row">
  244. <div class="col-md-12">
  245. <p>Nginx variables available to you are:</p>
  246. <ul class="text-monospace">
  247. <li>$server # Host/IP</li>
  248. <li>$port # Port Number</li>
  249. <li>$forward_scheme # http or https</li>
  250. </ul>
  251. <div class="form-group mb-0">
  252. <label class="form-label"><%- i18n('all-hosts', 'advanced-config') %></label>
  253. <textarea name="advanced_config" rows="8" class="form-control text-monospace" placeholder="# <%- i18n('all-hosts', 'advanced-warning') %>"><%- advanced_config %></textarea>
  254. </div>
  255. </div>
  256. </div>
  257. </div>
  258. </div>
  259. </form>
  260. </div>
  261. <div class="modal-footer">
  262. <button type="button" class="btn btn-secondary cancel" data-dismiss="modal"><%- i18n('str', 'cancel') %></button>
  263. <button type="button" class="btn btn-teal save"><%- i18n('str', 'save') %></button>
  264. </div>
  265. </div>