123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174 |
- <div class="row tile">
- <div class="col-md-12 col-md-auto">
- <div class="ibox float-e-margins">
- <h3 class="ibox-title">编辑</h3>
- <div class="ibox-content">
- <form class="form-horizontal">
- <input type="hidden" name="id" value="{{.t.Id}}">
- <div class="form-group">
- <label class="col-sm-2 control-label" langtag="info-mode">类型 </label>
- <div class="col-sm-10">
- <select class="form-control" name="type" id="type">
- <option {{if eq "tcp" .t.Mode}}selected{{end}} value="tcp">tcp</option>
- <option {{if eq "udp" .t.Mode}}selected{{end}} value="udp">udp</option>
- <option {{if eq "socks5" .t.Mode}}selected{{end}} value="socks5">socks5
- </option>
- <option {{if eq "httpProxy" .t.Mode}}selected{{end}} value="httpProxy">http</option>
- <option {{if eq "secret" .t.Mode}}selected{{end}} value="secret">secret</option>
- <option {{if eq "p2p" .t.Mode}}selected{{end}} value="p2p">p2p</option>
- <option {{if eq "file" .t.Mode}}selected{{end}} value="file">file</option>
- </select>
- </div>
- </div>
- <div class="form-group">
- <label class="col-sm-2 control-label" langtag="info-remark">备注</label>
- <div class="col-sm-10">
- <input value="{{.t.Remark}}" class="form-control" type="text" name="remark"
- placeholder="empty means to be unrestricted">
- </div>
- </div>
- {{if eq true .allow_multi_ip}}
- <div class="form-group" id="server_ip">
- <label class="col-sm-2 control-label" langtag="info-server-ip">服务端ip</label>
- <div class="col-sm-10">
- <input class="form-control" type="text" value="{{.t.ServerIp}}" name="server_ip"
- placeholder="such as 0.0.0.0">
- </div>
- </div>
- {{end}}
- <div class="form-group" id="port">
- <label class="col-sm-2 control-label" langtag="info-server-port">服务端端口</label>
- <div class="col-sm-10">
- <input value="{{.t.Port}}" class="form-control" type="text" name="port"
- placeholder="such as 8024">
- </div>
- </div>
- {{if eq true .allow_local_proxy}}
- <div class="form-group" id="local_proxy">
- <label class="control-label col-sm-2" langtag="info-local-proxy">是否代理为服务端本地</label>
- <div class="col-sm-10">
- <select class="form-control" name="local_proxy">
- <option {{if eq false .t.Target.LocalProxy}}selected{{end}} value="0">no</option>
- <option {{if eq true .t.Target.LocalProxy}}selected{{end}} value="1">yes</option>
- </select>
- </div>
- </div>
- {{end}}
- <div class="form-group" id="target">
- <label class="col-sm-2 control-label" langtag="info-target">内网目标(ip:端口)</label>
- <div class="col-sm-10">
- <textarea class="form-control" name="target" rows="4" placeholder="10.1.50.203:22
- 10.1.50.202:22">{{.t.Target.TargetStr}}</textarea>
- <span class="help-block m-b-none">can only fill in ports if it is local machine proxy, only tcp supports load balancing
- </span></div>
- </div>
- <div class="form-group" id="client_id">
- <label class="col-sm-2 control-label" langtag="info-client-id">客户端id</label>
- <div class="col-sm-10">
- <input value="{{.t.Client.Id}}" value="{{.client_id}}" class="form-control" type="text"
- name="client_id"
- placeholder="id of client">
- </div>
- </div>
- <div class="form-group" id="local_path">
- <label class="col-sm-2 control-label" langtag="info-local-path">本地路径</label>
- <div class="col-sm-10">
- <input value="{{.t.LocalPath}}" class="form-control" type="text" name="local_path"
- placeholder="such as /tmp">
- </div>
- </div>
- <div class="form-group" id="strip_pre">
- <label class="col-sm-2 control-label" langtag="info-strip-pre">访问前缀</label>
- <div class="col-sm-10">
- <input value="{{.t.StripPre}}" class="form-control" type="text" name="strip_pre"
- placeholder="such as static">
- </div>
- </div>
- <div class="form-group" id="password">
- <label class="col-sm-2 control-label" langtag="info-unique-vkey">唯一验证密钥</label>
- <div class="col-sm-10">
- <input value="{{.t.Password}}" class="form-control" type="text" name="password"
- placeholder="unique identification key">
- <span class="help-block m-b-none">when p2p or secret</span>
- </div>
- </div>
- <div class="hr-line-dashed"></div>
- <div class="form-group">
- <div class="col-sm-4 col-sm-offset-2">
- <button class="btn btn-success" type="button" id="add"><i
- class="fa fa-fw fa-lg fa-eye"></i><span langtag="info-save">保存</span>
- </button>
- </div>
- </div>
- </form>
- </div>
- </div>
- </div>
- </div>
- <script>
- var arr = []
- arr["all"] = ["type", "port", "compress", "u", "p", "target", "password", "local_path", "strip_pre", "local_proxy"]
- arr["tcp"] = ["type", "port", "target", "u", "p", "compress", "local_proxy"]
- arr["udp"] = ["type", "port", "target", "compress", "local_proxy"]
- arr["socks5"] = ["type", "port", "compress", "u", "p"]
- arr["httpProxy"] = ["type", "port", "compress", "u", "p"]
- arr["secret"] = ["type", "target", "compress", "u", "p", "password"]
- arr["p2p"] = ["type", "target", "password"]
- arr["file"] = ["type", "port", "local_path", "strip_pre"]
- arrClientHide = ["compress", "u", "p", "crypt", "mux"]
- function resetForm() {
- for (var i = 0; i < arr["all"].length; i++) {
- $("#" + arr["all"][i]).css("display", "none")
- }
- o = $("#type option:selected").val()
- for (var i = 0; i < arr[o].length; i++) {
- $("#" + arr[o][i]).css("display", "block")
- }
- }
- function resetClientCnf() {
- for (var i = 0; i < arrClientHide.length; i++) {
- $("#" + arrClientHide[i]).css("display", "block")
- }
- op = $("#use_client option:selected").val()
- if (op == 1) {
- for (var i = 0; i < arrClientHide.length; i++) {
- $("#" + arrClientHide[i]).css("display", "none")
- }
- }
- }
- $(function () {
- resetForm()
- resetClientCnf()
- $("#type").on("change", function () {
- resetForm()
- resetClientCnf()
- })
- $("#use_client").on("change", function () {
- resetForm()
- resetClientCnf()
- })
- $("#add").on("click", function () {
- $.ajax({
- type: "POST",
- url: "{{.web_base_url}}/index/edit",
- data: $("form").serializeArray(),
- success: function (res) {
- alert(res.msg)
- if (res.status) {
- history.back(-1)
- }
- }
- })
- })
- })
- </script>
|