hedit.html 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <div class="row tile">
  2. <div class="col-md-12 col-md-auto">
  3. <div class="ibox float-e-margins">
  4. <h3 class="ibox-title">add host</h3>
  5. <div class="ibox-content">
  6. <form class="form-horizontal">
  7. <input type="hidden" name="id" value="{{.h.Id}}">
  8. <div class="form-group">
  9. <label class="col-sm-2 control-label" langtag="info-remark">备注</label>
  10. <div class="col-sm-10">
  11. <input value="{{.h.Remark}}" class="form-control" type="text" name="remark"
  12. placeholder="remark">
  13. </div>
  14. </div>
  15. <div class="form-group">
  16. <label class="col-sm-2 control-label" langtag="info-host">域名</label>
  17. <div class="col-sm-10">
  18. <input value="{{.h.Host}}" class="form-control" type="text" name="host"
  19. placeholder="such as a.proxy.com">
  20. </div>
  21. </div>
  22. <div class="form-group" id="scheme">
  23. <label class="control-label col-sm-2" langtag="info-scheme">协议类型</label>
  24. <div class="col-sm-10">
  25. <select id="scheme_select" class="form-control" name="scheme">
  26. <option {{if eq "all" .h.Scheme}}selected{{end}} value="all">all</option>
  27. <option {{if eq "http" .h.Scheme}}selected{{end}} value="http">http</option>
  28. <option {{if eq "https" .h.Scheme}}selected{{end}} value="https">https</option>
  29. </select>
  30. </div>
  31. </div>
  32. {{if eq false .https_just_proxy}}
  33. <div class="form-group" id="cert_file">
  34. <label class="col-sm-2 control-label" langtag="info-https-cert">https cert file路径</label>
  35. <div class="col-sm-10">
  36. <input value="{{.h.CertFilePath}}" class="form-control" type="text" name="cert_file_path"
  37. placeholder="empty means to be unrestricted">
  38. </div>
  39. </div>
  40. <div class="form-group" id="key_file">
  41. <label class="col-sm-2 control-label" langtag="info-https-key">https key file路径</label>
  42. <div class="col-sm-10">
  43. <input value="{{.h.KeyFilePath}}" class="form-control" type="text" name="key_file_path"
  44. placeholder="empty means to be unrestricted">
  45. </div>
  46. </div>
  47. {{end}}
  48. <div class="form-group">
  49. <label class="col-sm-2 control-label" langtag="info-url-router">url路由</label>
  50. <div class="col-sm-10">
  51. <input value="{{.h.Location}}" class="form-control" type="text" name="location"
  52. placeholder="empty means to be unrestricted">
  53. </div>
  54. </div>
  55. <div class="form-group">
  56. <label class="col-sm-2 control-label" langtag="info-client-id">客户端id</label>
  57. <div class="col-sm-10">
  58. <input value="{{.h.Client.Id}}" class="form-control" type="text" name="client_id"
  59. placeholder="client id">
  60. </div>
  61. </div>
  62. {{if eq true .allow_local_proxy}}
  63. <div class="form-group" id="local_proxy">
  64. <label class="control-label col-sm-2" langtag="info-local-proxy">是否代理为服务端本地</label>
  65. <div class="col-sm-10">
  66. <select class="form-control" name="local_proxy">
  67. <option {{if eq false .h.Target.LocalProxy}}selected{{end}} value="0">no</option>
  68. <option {{if eq true .h.Target.LocalProxy}}selected{{end}} value="1">yes</option>
  69. </select>
  70. </div>
  71. </div>
  72. {{end}}
  73. <div class="form-group">
  74. <label class="col-sm-2 control-label" langtag="info-target">内网目标(ip:端口)</label>
  75. <div class="col-sm-10">
  76. <textarea class="form-control" rows="4" type="text" name="target"
  77. placeholder="such as
  78. 10.1.50.203:80
  79. 10.1.50.202:80">{{.h.Target.TargetStr}}</textarea>
  80. <span class="help-block m-b-none">Line break if load balancing</span>
  81. </div>
  82. </div>
  83. <div class="form-group" id="header">
  84. <label class="col-sm-2 control-label" langtag="info-header-modify">request header修改</label>
  85. <div class="col-sm-10">
  86. <textarea class="form-control" rows="4" type="text" name="header"
  87. placeholder="Cache-Control: no-cache">{{.h.HeaderChange}}</textarea>
  88. <span class="help-block m-b-none"> Colon separated, multiple lines please fill in</span>
  89. </div>
  90. </div>
  91. <div class="form-group" id="hostchange">
  92. <label class="col-sm-2 control-label" langtag="info-host-change">request host修改</label>
  93. <div class="col-sm-10">
  94. <input value="{{.h.HostChange}}" class="form-control" value="" type="text" name="hostchange"
  95. placeholder="host modify">
  96. </div>
  97. </div>
  98. <div class="hr-line-dashed"></div>
  99. <div class="form-group">
  100. <div class="col-sm-4 col-sm-offset-2">
  101. &nbsp;<button class="btn btn-success" href="#" id="add"><i
  102. class="fa fa-fw fa-lg fa-eye"></i><span langtag="info-save">保存</span>
  103. </button>
  104. </div>
  105. </div>
  106. </form>
  107. </div>
  108. </div>
  109. </div>
  110. </div>
  111. <script>
  112. $(function () {
  113. $("#add").on("click", function () {
  114. $.ajax({
  115. type: "POST",
  116. url: "{{.web_base_url}}/index/edithost",
  117. data: $("form").serializeArray(),
  118. success: function (res) {
  119. alert(res.msg)
  120. if (res.status) {
  121. history.back(-1)
  122. }
  123. }
  124. })
  125. })
  126. $("#scheme_select").on("change", function () {
  127. if ($("#scheme_select").val() == "all" || $("#scheme_select").val() == "https") {
  128. $("#cert_file").css("display", "block")
  129. $("#key_file").css("display", "block")
  130. } else {
  131. $("#cert_file").css("display", "none")
  132. $("#key_file").css("display", "none")
  133. }
  134. })
  135. })
  136. </script>