nps/web/views/index/edit.html

151 lines
8.0 KiB
Go
Raw Normal View History

2018-12-11 08:37:12 +00:00
<div class="row tile">
<div class="col-md-12 col-md-auto">
<div class="ibox float-e-margins">
2020-03-01 07:05:26 +00:00
<h3 class="ibox-title" langtag="page-edit"></h3>
<div class="ibox-content">
<form class="form-horizontal">
<input type="hidden" name="id" value="{{.t.Id}}">
2018-12-11 08:37:12 +00:00
<div class="form-group">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-scheme"></label>
<div class="col-sm-10">
<select class="form-control" name="type" id="type">
2020-03-01 07:05:26 +00:00
<option {{if eq "tcp" .t.Mode}}selected{{end}} value="tcp" langtag="scheme-tcp"></option>
<option {{if eq "udp" .t.Mode}}selected{{end}} value="udp" langtag="scheme-udp"></option>
<option {{if eq "httpProxy" .t.Mode}}selected{{end}} value="httpProxy" langtag="scheme-httpProxy"></option>
<option {{if eq "socks5" .t.Mode}}selected{{end}} value="socks5" langtag="scheme-socks5"></option>
<option {{if eq "secret" .t.Mode}}selected{{end}} value="secret" langtag="scheme-secret"></option>
<option {{if eq "p2p" .t.Mode}}selected{{end}} value="p2p" langtag="scheme-p2p"></option>
<option {{if eq "file" .t.Mode}}selected{{end}} value="file" langtag="scheme-file"></option>
</select>
</div>
2018-12-11 08:37:12 +00:00
</div>
2020-03-01 07:05:26 +00:00
<div class="form-group" id="client_id">
<label class="col-sm-2 control-label" langtag="word-clientid"></label>
<div class="col-sm-10">
<input value="{{.t.Client.Id}}" value="{{.client_id}}" class="form-control" type="text" name="client_id" placeholder="" langtag="word-clientid">
</div>
</div>
<div class="form-group">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-remark"></label>
<div class="col-sm-10">
2020-03-01 07:05:26 +00:00
<input value="{{.t.Remark}}" class="form-control" type="text" name="remark" placeholder="" langtag="info-unrestricted">
</div>
</div>
2019-04-04 09:46:06 +00:00
{{if eq true .allow_multi_ip}}
<div class="form-group" id="server_ip">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-serverip"></label>
<div class="col-sm-10">
2020-03-01 07:05:26 +00:00
<input class="form-control" type="text" value="{{.t.ServerIp}}" name="server_ip" placeholder="" langtag="info-suchasip">
</div>
</div>
2019-04-04 09:46:06 +00:00
{{end}}
2018-12-11 08:37:12 +00:00
<div class="form-group" id="port">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-serverport"></label>
<div class="col-sm-10">
2020-03-01 07:05:26 +00:00
<input value="{{.t.Port}}" class="form-control" type="text" name="port" placeholder="" langtag="info-suchasport">
</div>
2018-12-11 08:37:12 +00:00
</div>
2019-04-08 09:01:08 +00:00
{{if eq true .allow_local_proxy}}
<div class="form-group" id="local_proxy">
2020-03-01 07:05:26 +00:00
<label class="control-label col-sm-2" langtag="word-proxytolocal"></label>
2019-04-08 09:01:08 +00:00
<div class="col-sm-10">
<select class="form-control" name="local_proxy">
2020-03-01 07:05:26 +00:00
<option {{if eq false .t.Target.LocalProxy}}selected{{end}} value="0" langtag="word-no"></option>
<option {{if eq true .t.Target.LocalProxy}}selected{{end}} value="1" langtag="word-yes"></option>
2019-04-08 09:01:08 +00:00
</select>
</div>
</div>
{{end}}
2018-12-11 08:37:12 +00:00
<div class="form-group" id="target">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-target"></label>
<div class="col-sm-10">
2020-03-01 07:05:26 +00:00
<textarea class="form-control" name="target" rows="4" placeholder="" langtag="info-suchasiplist">{{.t.Target.TargetStr}}</textarea>
<span class="help-block m-b-none" langtag="info-targettunnel"></span>
</div>
</div>
2019-03-02 09:43:21 +00:00
<div class="form-group" id="local_path">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-localpath"></label>
2019-03-02 09:43:21 +00:00
<div class="col-sm-10">
2020-03-01 07:05:26 +00:00
<input value="{{.t.LocalPath}}" class="form-control" type="text" name="local_path" placeholder="" langtag="info-suchaslocalpath">
2019-03-02 09:43:21 +00:00
</div>
</div>
<div class="form-group" id="strip_pre">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-stripprefix"></label>
2019-03-02 09:43:21 +00:00
<div class="col-sm-10">
2020-03-01 07:05:26 +00:00
<input value="{{.t.StripPre}}" class="form-control" type="text" name="strip_pre" placeholder="" langtag="info-suchasstripprefix">
2019-03-02 09:43:21 +00:00
</div>
</div>
2019-02-23 15:29:48 +00:00
<div class="form-group" id="password">
2020-03-01 07:05:26 +00:00
<label class="col-sm-2 control-label" langtag="word-identificationkey"></label>
<div class="col-sm-10">
2020-03-01 07:05:26 +00:00
<input value="{{.t.Password}}" class="form-control" type="text" name="password" placeholder="" langtag="word-identificationkey">
<span class="help-block m-b-none" langtag="info-identificationkey"></span>
</div>
2019-02-23 15:29:48 +00:00
</div>
<div class="hr-line-dashed"></div>
<div class="form-group">
<div class="col-sm-4 col-sm-offset-2">
2020-03-01 07:05:26 +00:00
<button class="btn btn-success" type="button" onclick="submitform('edit', '{{.web_base_url}}/index/edit', $('form').serializeArray())">
<i class="fa fa-fw fa-lg fa-check-circle"></i> <span langtag="word-save"></span>
2019-03-02 09:43:21 +00:00
</button>
</div>
</div>
2018-12-11 08:37:12 +00:00
</form>
</div>
</div>
</div>
</div>
<script>
var arr = []
2019-04-08 09:01:08 +00:00
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"]
2019-03-02 09:43:21 +00:00
arr["secret"] = ["type", "target", "compress", "u", "p", "password"]
2019-04-13 11:48:34 +00:00
arr["p2p"] = ["type", "target", "password"]
2019-03-02 09:43:21 +00:00
arr["file"] = ["type", "port", "local_path", "strip_pre"]
arrClientHide = ["compress", "u", "p", "crypt", "mux"]
2018-12-11 08:37:12 +00:00
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")
}
}
2019-01-02 17:44:45 +00:00
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")
}
}
}
2018-12-11 08:37:12 +00:00
$(function () {
resetForm()
resetClientCnf()
2018-12-11 08:37:12 +00:00
$("#type").on("change", function () {
resetForm()
resetClientCnf()
})
$("#use_client").on("change", function () {
resetForm()
resetClientCnf()
2018-12-11 08:37:12 +00:00
})
})
</script>