form.ejs 19 KB

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