mirror of
https://github.com/ehang-io/nps.git
synced 2025-09-02 03:16:53 +00:00
hzgjq
This commit is contained in:
114
web/views/index/add.html
Executable file → Normal file
114
web/views/index/add.html
Executable file → Normal file
@@ -1,128 +1,119 @@
|
||||
<div class="row tile">
|
||||
<div class="col-md-12 col-md-auto">
|
||||
<div class="ibox float-e-margins">
|
||||
<h3 class="ibox-title">add</h3>
|
||||
<h3 class="ibox-title" langtag="page-add"></h3>
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-mode">类型 </label>
|
||||
<label class="control-label font-bold" langtag="word-scheme"></label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="type" id="type">
|
||||
<option {{if eq "tcp" .type}}selected{{end}} value="tcp">tcp</option>
|
||||
<option {{if eq "udp" .type}}selected{{end}} value="udp">udp</option>
|
||||
<option {{if eq "socks5" .type}}selected{{end}} value="socks5">socks5
|
||||
<option {{if eq "tcp" .type}}selected{{end}} value="tcp" langtag="scheme-tcp"></option>
|
||||
<option {{if eq "udp" .type}}selected{{end}} value="udp" langtag="scheme-udp"></option>
|
||||
<option {{if eq "httpProxy" .type}}selected{{end}} value="httpProxy" langtag="scheme-httpProxy"></option>
|
||||
<option {{if eq "socks5" .type}}selected{{end}} value="socks5" langtag="scheme-socks5">
|
||||
</option>
|
||||
<option {{if eq "httpProxy" .type}}selected{{end}} value="httpProxy">http</option>
|
||||
<option {{if eq "secret" .type}}selected{{end}} value="secret">secret</option>
|
||||
<option {{if eq "p2p" .type}}selected{{end}} value="p2p">p2p</option>
|
||||
{{/*<option {{if eq "file" .type}}selected{{end}} value="file">file*/}}
|
||||
<option {{if eq "secret" .type}}selected{{end}} value="secret" langtag="scheme-secret"></option>
|
||||
<option {{if eq "p2p" .type}}selected{{end}} value="p2p" langtag="scheme-p2p"></option>
|
||||
{{/*<option {{if eq "file" .type}}selected{{end}} value="file" langtag="scheme-file"></option>*/}}
|
||||
</select>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="client_id">
|
||||
<label class="control-label font-bold" langtag="word-clientid"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.client_id}}" class="form-control" type="text" name="client_id" placeholder="" langtag="word-clientid">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-remark">备注</label>
|
||||
<label class="control-label font-bold" langtag="word-remark"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="remark"
|
||||
placeholder="empty means to be unrestricted">
|
||||
<input class="form-control" type="text" name="remark" placeholder="" langtag="info-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>
|
||||
<label class="control-label font-bold" langtag="word-serverip"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" value="0.0.0.0" name="server_ip"
|
||||
placeholder="such as 0.0.0.0">
|
||||
<input class="form-control" type="text" value="0.0.0.0" name="server_ip" placeholder="" langtag="info-suchasip">
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="form-group" id="port">
|
||||
<label class="col-sm-2 control-label" langtag="info-server-port">服务端端口</label>
|
||||
<label class="control-label font-bold" langtag="word-serverport"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="port" placeholder="such as 8024">
|
||||
<input class="form-control" type="text" name="port" placeholder="" langtag="info-suchasport">
|
||||
</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>
|
||||
<label class="control-label font-bold" langtag="word-proxytolocal"></label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="local_proxy">
|
||||
<option value="0">no</option>
|
||||
<option value="1">yes</option>
|
||||
<option value="0" langtag="word-no"></option>
|
||||
<option value="1" langtag="word-yes"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
|
||||
<div class="form-group" id="target">
|
||||
<label class="col-sm-2 control-label" langtag="info-target">目标(ip:端口)</label>
|
||||
<label class="control-label font-bold" langtag="word-target"></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"></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="{{.client_id}}" class="form-control" type="text" name="client_id"
|
||||
placeholder="id of client">
|
||||
<textarea class="form-control" name="target" rows="4" placeholder="" langtag="info-suchasiplist"></textarea>
|
||||
<span class="help-block m-b-none" langtag="info-targettunnel"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="local_path">
|
||||
<label class="col-sm-2 control-label" langtag="info-local-path">本地路径</label>
|
||||
<label class="control-label font-bold" langtag="word-localpath"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="local_path"
|
||||
placeholder="such as /tmp">
|
||||
<input class="form-control" type="text" name="local_path" placeholder="" langtag="info-suchaslocalpath">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="strip_pre">
|
||||
<label class="col-sm-2 control-label" langtag="info-strip-pre">访问前缀</label>
|
||||
<label class="control-label font-bold" langtag="word-stripprefix"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="strip_pre"
|
||||
placeholder="such as static">
|
||||
<input class="form-control" type="text" name="strip_pre" placeholder="" langtag="info-suchasstripprefix">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="password">
|
||||
<label class="col-sm-2 control-label" langtag="info-unique-vkey">唯一验证密钥</label>
|
||||
<label class="control-label font-bold" langtag="word-identificationkey"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="password"
|
||||
placeholder="unique identification key">
|
||||
<span class="help-block m-b-none">when p2p or secret</span>
|
||||
<input class="form-control" type="text" name="password" placeholder="" langtag="word-identificationkey">
|
||||
<span class="help-block m-b-none" langtag="info-identificationkey"></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>新增
|
||||
<button class="btn btn-success" type="button" onclick="submitform('add', '{{.web_base_url}}/index/add', $('form').serializeArray())">
|
||||
<i class="fa fa-fw fa-lg fa-check-circle"></i> <span langtag="word-add"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script>
|
||||
var arr = []
|
||||
arr["all"] = ["type", "port", "compress", "u", "p", "target", "password", "strip_pre", "local_path", "local_proxy"]
|
||||
arr["tcp"] = ["type", "port", "target", "compress", "u", "p", "local_proxy", "tcp隧道模式,提供一条tcp隧道,适用于ssh、远程桌面等,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,访问公网服务器的设定端口,则相当于访问内网目标地址的目标端口"]
|
||||
arr["udp"] = ["type", "port", "target", "compress", "local_proxy", "udp隧道模式,提供一条udp隧道,适用于dns、内网dns访问等,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,访问公网服务器的设定端口,则相当于访问内网目标地址的udp目标端口"]
|
||||
arr["socks5"] = ["type", "port", "compress", "u", "p", "socks5代理模式,内网socks5代理,配合proxifer,可如同使用vpn一样访问内网设备或资源,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置socks5代理,即访问内网设备或者资源 "]
|
||||
arr["httpProxy"] = ["type", "port", "compress", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
|
||||
arr["secret"] = ["type", "target", "compress", "password", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
|
||||
arr["p2p"] = ["type", "target", "compress", "password", "u", "p", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
|
||||
arr["file"] = ["type", "strip_pre", "local_path", "port", " http代理模式,内网http代理,可访问内网网站,添加后会自动生成一个客户端验证key<br>在内网机器执行<span style='color: red'>./easyProxy -vkey=生成的key -server=公网服务器ip:下面设定的端口</span><br>建立成功后,在外网环境下本机配置http代理,即访问内网站点"]
|
||||
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() {
|
||||
@@ -159,18 +150,5 @@
|
||||
resetForm()
|
||||
resetClientCnf()
|
||||
})
|
||||
$("#add").on("click", function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/index/add",
|
||||
data: $("form").serializeArray(),
|
||||
success: function (res) {
|
||||
alert(res.msg)
|
||||
if (res.status) {
|
||||
history.back(-1)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
</script>
|
101
web/views/index/edit.html
Executable file → Normal file
101
web/views/index/edit.html
Executable file → Normal file
@@ -1,108 +1,98 @@
|
||||
<div class="row tile">
|
||||
<div class="col-md-12 col-md-auto">
|
||||
<div class="ibox float-e-margins">
|
||||
<h3 class="ibox-title">编辑</h3>
|
||||
<h3 class="ibox-title" langtag="page-edit"></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>
|
||||
<label class="col-sm-2 control-label" langtag="word-scheme"></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>
|
||||
<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>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-remark">备注</label>
|
||||
<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.Remark}}" class="form-control" type="text" name="remark"
|
||||
placeholder="empty means to be unrestricted">
|
||||
<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">
|
||||
<label class="col-sm-2 control-label" langtag="word-remark"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.t.Remark}}" class="form-control" type="text" name="remark" placeholder="" langtag="info-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>
|
||||
<label class="col-sm-2 control-label" langtag="word-serverip"></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">
|
||||
<input class="form-control" type="text" value="{{.t.ServerIp}}" name="server_ip" placeholder="" langtag="info-suchasip">
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="form-group" id="port">
|
||||
<label class="col-sm-2 control-label" langtag="info-server-port">服务端端口</label>
|
||||
<label class="col-sm-2 control-label" langtag="word-serverport"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.t.Port}}" class="form-control" type="text" name="port"
|
||||
placeholder="such as 8024">
|
||||
<input value="{{.t.Port}}" class="form-control" type="text" name="port" placeholder="" langtag="info-suchasport">
|
||||
</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>
|
||||
<label class="control-label col-sm-2" langtag="word-proxytolocal"></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>
|
||||
<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>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="form-group" id="target">
|
||||
<label class="col-sm-2 control-label" langtag="info-target">内网目标(ip:端口)</label>
|
||||
<label class="col-sm-2 control-label" langtag="word-target"></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">
|
||||
<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>
|
||||
|
||||
<div class="form-group" id="local_path">
|
||||
<label class="col-sm-2 control-label" langtag="info-local-path">本地路径</label>
|
||||
<label class="col-sm-2 control-label" langtag="word-localpath"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.t.LocalPath}}" class="form-control" type="text" name="local_path"
|
||||
placeholder="such as /tmp">
|
||||
<input value="{{.t.LocalPath}}" class="form-control" type="text" name="local_path" placeholder="" langtag="info-suchaslocalpath">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="strip_pre">
|
||||
<label class="col-sm-2 control-label" langtag="info-strip-pre">访问前缀</label>
|
||||
<label class="col-sm-2 control-label" langtag="word-stripprefix"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.t.StripPre}}" class="form-control" type="text" name="strip_pre"
|
||||
placeholder="such as static">
|
||||
<input value="{{.t.StripPre}}" class="form-control" type="text" name="strip_pre" placeholder="" langtag="info-suchasstripprefix">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group" id="password">
|
||||
<label class="col-sm-2 control-label" langtag="info-unique-vkey">唯一验证密钥</label>
|
||||
<label class="col-sm-2 control-label" langtag="word-identificationkey"></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>
|
||||
<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>
|
||||
</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 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>
|
||||
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -157,18 +147,5 @@
|
||||
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>
|
92
web/views/index/hadd.html
Executable file → Normal file
92
web/views/index/hadd.html
Executable file → Normal file
@@ -1,105 +1,96 @@
|
||||
<div class="row tile">
|
||||
<div class="col-md-12 col-md-auto">
|
||||
<div class="ibox float-e-margins">
|
||||
<h3 class="ibox-title">add host</h3>
|
||||
<h3 class="ibox-title" langtag="page-hostadd"></h3>
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-remark">备注</label>
|
||||
<label class="control-label font-bold" langtag="word-clientid"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="remark" placeholder="remark">
|
||||
<input value="{{.client_id}}" class="form-control" type="text" name="client_id" placeholder="" langtag="word-clientid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-host">域名</label>
|
||||
<label class="control-label font-bold" langtag="word-remark"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="host" placeholder="such as a.proxy.com">
|
||||
<input class="form-control" type="text" name="remark" placeholder="" langtag="word-remark">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label font-bold" langtag="word-host"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="host" placeholder="" langtag="info-suchashost">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="scheme">
|
||||
<label class="control-label col-sm-2" langtag="info-scheme">协议类型</label>
|
||||
<label class="control-label font-bold" langtag="word-scheme"></label>
|
||||
<div class="col-sm-10">
|
||||
<select id="scheme_select" class="form-control" name="scheme">
|
||||
<option value="all">all</option>
|
||||
<option value="http">http</option>
|
||||
<option value="https">https</option>
|
||||
<option value="all" langtag="word-all"></option>
|
||||
<option value="http" langtag="word-http"></option>
|
||||
<option value="https" langtag="word-https"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{if eq false .https_just_proxy}}
|
||||
<div class="form-group" id="cert_file">
|
||||
<label class="col-sm-2 control-label" langtag="info-https-cert">https cert file路径</label>
|
||||
<label class="control-label font-bold" langtag="word-httpscert"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="cert_file_path"
|
||||
placeholder="empty means to be unrestricted">
|
||||
<input class="form-control" type="text" name="cert_file_path" placeholder="" langtag="info-unrestricted">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="key_file">
|
||||
<label class="col-sm-2 control-label" langtag="info-https-key">https key file路径</label>
|
||||
<label class="control-label font-bold" langtag="word-httpskey"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="key_file_path"
|
||||
placeholder="empty means to be unrestricted">
|
||||
<input class="form-control" type="text" name="key_file_path" placeholder="" langtag="info-unrestricted">
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-url-router">url路由</label>
|
||||
<label class="control-label font-bold" langtag="word-urlroute"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" type="text" name="location"
|
||||
placeholder="empty means to be unrestricted">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-client-id">客户端id</label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.client_id}}" class="form-control" type="text" name="client_id"
|
||||
placeholder="client id">
|
||||
<input class="form-control" type="text" name="location" placeholder="" langtag="info-unrestricted">
|
||||
</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>
|
||||
<label class="control-label font-bold" langtag="word-proxytolocal"></label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="local_proxy">
|
||||
<option value="0">no</option>
|
||||
<option value="1">yes</option>
|
||||
<option value="0" langtag="word-no"></option>
|
||||
<option value="1" langtag="word-yes"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-target">内网目标(ip:端口)</label>
|
||||
<label class="control-label font-bold" langtag="word-target"></label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="4" type="text" name="target"
|
||||
placeholder="such as
|
||||
10.1.50.203:80
|
||||
10.1.50.202:80"></textarea>
|
||||
<span class="help-block m-b-none">Line break if load balancing</span>
|
||||
<textarea class="form-control" rows="4" type="text" name="target" placeholder="" langtag="info-suchasiplist"></textarea>
|
||||
<span class="help-block m-b-none" langtag="info-targethost"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="header">
|
||||
<label class="col-sm-2 control-label" langtag="info-header-modify">request header修改</label>
|
||||
<label class="control-label font-bold" langtag="word-requestheader"></label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="4" type="text" name="header"
|
||||
placeholder="Cache-Control: no-cache"></textarea>
|
||||
<span class="help-block m-b-none"> Colon separated, multiple lines please fill in</span>
|
||||
<textarea class="form-control" rows="4" type="text" name="header" placeholder="Cache-Control: no-cache"></textarea>
|
||||
<span class="help-block m-b-none" langtag="info-header"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group" id="hostchange">
|
||||
<label class="col-sm-2 control-label" langtag="info-host-change">request host修改</label>
|
||||
<label class="control-label font-bold" langtag="word-requesthost"></label>
|
||||
<div class="col-sm-10">
|
||||
<input class="form-control" value="" type="text" name="hostchange"
|
||||
placeholder="host modify">
|
||||
<input class="form-control" value="" type="text" name="hostchange" placeholder="" langtag="word-requesthost">
|
||||
</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>新增
|
||||
</button>
|
||||
<button class="btn btn-success" type="button" onclick="submitform('add', '{{.web_base_url}}/index/addhost', $('form').serializeArray())">
|
||||
<i class="fa fa-fw fa-lg fa-check-circle"></i> <span langtag="word-add"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -109,19 +100,6 @@
|
||||
</div>
|
||||
<script>
|
||||
$(function () {
|
||||
$("#add").on("click", function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/index/addhost",
|
||||
data: $("form").serializeArray(),
|
||||
success: function (res) {
|
||||
alert(res.msg)
|
||||
if (res.status) {
|
||||
history.back(-1)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$("#scheme_select").on("change", function () {
|
||||
if ($("#scheme_select").val() == "all" || $("#scheme_select").val() == "https") {
|
||||
$("#cert_file").css("display", "block")
|
||||
|
@@ -1,108 +1,98 @@
|
||||
<div class="row tile">
|
||||
<div class="col-md-12 col-md-auto">
|
||||
<div class="ibox float-e-margins">
|
||||
<h3 class="ibox-title">add host</h3>
|
||||
<h3 class="ibox-title" langtag="page-hostedit"></h3>
|
||||
<div class="ibox-content">
|
||||
<form class="form-horizontal">
|
||||
<input type="hidden" name="id" value="{{.h.Id}}">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-remark">备注</label>
|
||||
<label class="control-label font-bold" langtag="word-clientid"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Client.Id}}" class="form-control" type="text" name="client_id" placeholder="" langtag="word-clientid">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label font-bold" langtag="word-remark"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Remark}}" class="form-control" type="text" name="remark"
|
||||
placeholder="remark">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-host">域名</label>
|
||||
<label class="control-label font-bold" langtag="word-host"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Host}}" class="form-control" type="text" name="host"
|
||||
placeholder="such as a.proxy.com">
|
||||
<input value="{{.h.Host}}" class="form-control" type="text" name="host" placeholder="" langtag="info-suchashost">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="scheme">
|
||||
<label class="control-label col-sm-2" langtag="info-scheme">协议类型</label>
|
||||
<label class="control-label font-bold" langtag="word-scheme"></label>
|
||||
<div class="col-sm-10">
|
||||
<select id="scheme_select" class="form-control" name="scheme">
|
||||
<option {{if eq "all" .h.Scheme}}selected{{end}} value="all">all</option>
|
||||
<option {{if eq "http" .h.Scheme}}selected{{end}} value="http">http</option>
|
||||
<option {{if eq "https" .h.Scheme}}selected{{end}} value="https">https</option>
|
||||
<option {{if eq "all" .h.Scheme}}selected{{end}} value="all" langtag="word-all"></option>
|
||||
<option {{if eq "http" .h.Scheme}}selected{{end}} value="http" langtag="word-http"></option>
|
||||
<option {{if eq "https" .h.Scheme}}selected{{end}} value="https" langtag="word-https"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{if eq false .https_just_proxy}}
|
||||
<div class="form-group" id="cert_file">
|
||||
<label class="col-sm-2 control-label" langtag="info-https-cert">https cert file路径</label>
|
||||
<label class="control-label font-bold" langtag="word-httpscert"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.CertFilePath}}" class="form-control" type="text" name="cert_file_path"
|
||||
placeholder="empty means to be unrestricted">
|
||||
<input value="{{.h.CertFilePath}}" class="form-control" type="text" name="cert_file_path" placeholder="" langtag="info-unrestricted">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="key_file">
|
||||
<label class="col-sm-2 control-label" langtag="info-https-key">https key file路径</label>
|
||||
<label class="control-label font-bold" langtag="word-httpskey"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.KeyFilePath}}" class="form-control" type="text" name="key_file_path"
|
||||
placeholder="empty means to be unrestricted">
|
||||
<input value="{{.h.KeyFilePath}}" class="form-control" type="text" name="key_file_path" placeholder="" langtag="info-unrestricted">
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-url-router">url路由</label>
|
||||
<label class="control-label font-bold" langtag="word-urlroute"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Location}}" class="form-control" type="text" name="location"
|
||||
placeholder="empty means to be unrestricted">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-client-id">客户端id</label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.Client.Id}}" class="form-control" type="text" name="client_id"
|
||||
placeholder="client id">
|
||||
<input value="{{.h.Location}}" class="form-control" type="text" name="location" placeholder="" langtag="info-unrestricted">
|
||||
</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>
|
||||
<label class="control-label font-bold" langtag="word-proxytolocal"></label>
|
||||
<div class="col-sm-10">
|
||||
<select class="form-control" name="local_proxy">
|
||||
<option {{if eq false .h.Target.LocalProxy}}selected{{end}} value="0">no</option>
|
||||
<option {{if eq true .h.Target.LocalProxy}}selected{{end}} value="1">yes</option>
|
||||
<option {{if eq false .h.Target.LocalProxy}}selected{{end}} value="0" langtag="word-no"></option>
|
||||
<option {{if eq true .h.Target.LocalProxy}}selected{{end}} value="1" langtag="word-yes"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label" langtag="info-target">内网目标(ip:端口)</label>
|
||||
<label class="control-label font-bold" langtag="word-target"></label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="4" type="text" name="target"
|
||||
placeholder="such as
|
||||
10.1.50.203:80
|
||||
10.1.50.202:80">{{.h.Target.TargetStr}}</textarea>
|
||||
<span class="help-block m-b-none">Line break if load balancing</span>
|
||||
<textarea class="form-control" rows="4" type="text" name="target" placeholder="" langtag="info-suchasiplist">{{.h.Target.TargetStr}}</textarea>
|
||||
<span class="help-block m-b-none" langtag="info-targethost"></span>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="header">
|
||||
<label class="col-sm-2 control-label" langtag="info-header-modify">request header修改</label>
|
||||
<label class="control-label font-bold" langtag="word-requestheader"></label>
|
||||
<div class="col-sm-10">
|
||||
<textarea class="form-control" rows="4" type="text" name="header"
|
||||
placeholder="Cache-Control: no-cache">{{.h.HeaderChange}}</textarea>
|
||||
<span class="help-block m-b-none"> Colon separated, multiple lines please fill in</span>
|
||||
<textarea class="form-control" rows="4" type="text" name="header" placeholder="Cache-Control: no-cache">{{.h.HeaderChange}}</textarea>
|
||||
<span class="help-block m-b-none" langtag="info-header"></span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="form-group" id="hostchange">
|
||||
<label class="col-sm-2 control-label" langtag="info-host-change">request host修改</label>
|
||||
<label class="control-label font-bold" langtag="word-requesthost"></label>
|
||||
<div class="col-sm-10">
|
||||
<input value="{{.h.HostChange}}" class="form-control" value="" type="text" name="hostchange"
|
||||
placeholder="host modify">
|
||||
<input value="{{.h.HostChange}}" class="form-control" value="" type="text" name="hostchange" placeholder="" langtag="word-requesthost">
|
||||
</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>
|
||||
<button class="btn btn-success" type="button" onclick="submitform('edit', '{{.web_base_url}}/index/edithost', $('form').serializeArray())">
|
||||
<i class="fa fa-fw fa-lg fa-save"></i> <span langtag="word-save"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -113,19 +103,6 @@
|
||||
|
||||
<script>
|
||||
$(function () {
|
||||
$("#add").on("click", function () {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/index/edithost",
|
||||
data: $("form").serializeArray(),
|
||||
success: function (res) {
|
||||
alert(res.msg)
|
||||
if (res.status) {
|
||||
history.back(-1)
|
||||
}
|
||||
}
|
||||
})
|
||||
})
|
||||
$("#scheme_select").on("change", function () {
|
||||
if ($("#scheme_select").val() == "all" || $("#scheme_select").val() == "https") {
|
||||
$("#cert_file").css("display", "block")
|
||||
|
@@ -136,6 +136,3 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</main>
|
||||
|
115
web/views/index/hlist.html
Executable file → Normal file
115
web/views/index/hlist.html
Executable file → Normal file
@@ -4,7 +4,7 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>host list</h5>
|
||||
<h5 langtag="page-hostlist"></h5>
|
||||
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
@@ -18,9 +18,8 @@
|
||||
<div class="content">
|
||||
<div class="table-responsive">
|
||||
<div id="toolbar">
|
||||
<a href="{{.web_base_url}}/index/addhost?vkey={{.task_id}}&client_id={{.client_id}}"
|
||||
class="btn btn-primary dim"
|
||||
type="button" langtag="info-new">新增</a>
|
||||
<a href="{{.web_base_url}}/index/addhost?vkey={{.task_id}}&client_id={{.client_id}}" class="btn btn-primary dim">
|
||||
<i class="fa fa-fw fa-lg fa-plus"></i> <span langtag="word-add"></span></a>
|
||||
</div>
|
||||
<table id="taskList_table" class="table-striped table-hover"
|
||||
data-mobile-responsive="true"></table>
|
||||
@@ -61,118 +60,102 @@
|
||||
pageList: [5, 10, 20, 50],//分页步进值
|
||||
detailView: true,
|
||||
smartDisplay: true, // 智能显示 pagination 和 cardview 等
|
||||
onExpandRow: function () {$('body').setLang ('.detail-view');},
|
||||
onPostBody: function (data) { if ($(this)[0].locale != undefined ) $('body').setLang ('#table'); },
|
||||
detailFormatter: function (index, row, element) {
|
||||
return '<b langtag="info-export-flow">出口流量</b>:' + change(row.Flow.ExportFlow) + `       `
|
||||
+ '<b langtag="info-inlet-flow">入口流量</b>:' + change(row.Flow.InletFlow) + `       `
|
||||
+ '<b langtag="info-crypt">加密</b>:' + row.Client.Cnf.Crypt + `       `
|
||||
+ '<b langtag="info-compress">压缩</b>:' + row.Client.Cnf.Compress + `       ` + "<br/><br>"
|
||||
+ '<b langtag="info-web-auth-username">basic权限认证用户名</b>:' + row.Client.Cnf.U + `       `
|
||||
+ '<b langtag="info-web-auth-password">basic权限认证密码</b>:' + row.Client.Cnf.P + `       ` + "<br/><br>"
|
||||
+ '<b langtag="info-https-cert">cert file路径</b>:' + row.CertFilePath + `       `
|
||||
+ '<b langtag="info-https-key">key file路径</b>:' + row.KeyFilePath + `       ` + "<br/><br>"
|
||||
+ '<b langtag="info-header-change">request header修改</b>:' + row.HeaderChange + `       ` + "<br/><br>"
|
||||
+ '<b langtag="info-host-change">request host 修改</b>:' + row.HostChange + `       `
|
||||
return '<b langtag="word-exportflow"></b>: ' + changeunit(row.Flow.ExportFlow) + ' '
|
||||
+ '<b langtag="word-inletflow"></b>: ' + changeunit(row.Flow.InletFlow) + ' '
|
||||
+ '<b langtag="word-crypt"></b>: ' + row.Client.Cnf.Crypt + ' '
|
||||
+ '<b langtag="word-compress"></b>: ' + row.Client.Cnf.Compress + ' '
|
||||
+ '<b langtag="word-basicusername"></b>: ' + row.Client.Cnf.U + ' '
|
||||
+ '<b langtag="word-basicpassword"></b>: ' + row.Client.Cnf.P + ' <br/><br>'
|
||||
+ '<b langtag="word-httpscert"></b>: ' + row.CertFilePath + ' '
|
||||
+ '<b langtag="word-httpskey"></b>: ' + row.KeyFilePath + ' <br/><br>'
|
||||
+ '<b langtag="word-requestheader"></b>: ' + row.HeaderChange + ' <br/><br>'
|
||||
+ '<b langtag="word-requesthost"></b>: ' + row.HostChange + ' '
|
||||
},
|
||||
//表格的列
|
||||
columns: [
|
||||
{
|
||||
field: 'Id',//域值
|
||||
title: 'id',//标题
|
||||
visible: true,//false表示不显示
|
||||
|
||||
title: '<span langtag="word-id"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: 'Id',//域值
|
||||
title: 'client id',//标题
|
||||
title: '<span langtag="word-clientid"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
return row.Client.Id
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'Remark',//域值
|
||||
title: 'remark',//标题
|
||||
visible: true,//false表示不显示
|
||||
|
||||
title: '<span langtag="word-remark"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: 'Host',//域值
|
||||
title: 'host',//标题
|
||||
visible: true,//false表示不显示
|
||||
|
||||
title: '<span langtag="word-host"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: 'Scheme',//域值
|
||||
title: 'scheme',//标题
|
||||
title: '<span langtag="word-scheme"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
return '<span langtag="word-' +value+ '"></span>'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'Target',//域值
|
||||
title: 'target',//标题
|
||||
title: '<span langtag="word-target"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
return row.Target.TargetStr
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'Location',//域值
|
||||
title: 'location',//标题
|
||||
visible: true,//false表示不显示
|
||||
|
||||
title: '<span langtag="word-location"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: '',//域值
|
||||
title: 'client status',//内容
|
||||
title: '<span langtag="word-clientstatus"></span>',//内容
|
||||
align: 'center',
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
if (row.Client.IsConnect) {
|
||||
return '<span class="badge badge-primary">online</span>'
|
||||
return '<span class="badge badge-primary" langtag="word-online"></span>'
|
||||
} else {
|
||||
return '<span class="badge badge-badge">offline</span>'
|
||||
return '<span class="badge badge-badge" langtag="word-offline"></span>'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'option',//域值
|
||||
title: 'option',//内容
|
||||
title: '<span langtag="word-option"></span>',//内容
|
||||
align: 'center',
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
btn_group = '<div class="btn-group">'
|
||||
btn = `<button onclick="del(` + row.Id + `)" class="btn-danger"><i class="fa fa-trash"></i></button><button onclick="edit(` + row.Id + `)" class="btn-primary"><i class="fa fa-edit"></i></button></div>`
|
||||
return btn_group + btn
|
||||
btn_group += "<a onclick=\"submitform('delete', '{{.web_base_url}}/index/delhost', {'id':" + row.Id
|
||||
btn_group += '})" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i></a>'
|
||||
btn_group += '<a href="{{.web_base_url}}/index/edithost?id=' + row.Id
|
||||
btn_group += '" class="btn btn-outline btn-success"><i class="fa fa-edit"></i></a></div>'
|
||||
return btn_group
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function del(id) {
|
||||
if (confirm("Are you sure you want to delete it??")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/index/delhost",
|
||||
data: {"id": id},
|
||||
success: function (res) {
|
||||
alert(res.msg)
|
||||
if (res.status) {
|
||||
document.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
window.location.href = "{{.web_base_url}}/index/edithost?id=" + id
|
||||
}
|
||||
|
||||
|
||||
</script>
|
||||
|
835
web/views/index/index.html
Executable file → Normal file
835
web/views/index/index.html
Executable file → Normal file
File diff suppressed because it is too large
Load Diff
176
web/views/index/list.html
Executable file → Normal file
176
web/views/index/list.html
Executable file → Normal file
@@ -4,7 +4,7 @@
|
||||
<div class="col-lg-12">
|
||||
<div class="ibox float-e-margins">
|
||||
<div class="ibox-title">
|
||||
<h5>{{.name}}</h5>
|
||||
<h5><span id="langtag"></span><span></span></h5>
|
||||
|
||||
<div class="ibox-tools">
|
||||
<a class="collapse-link">
|
||||
@@ -18,11 +18,10 @@
|
||||
<div class="content">
|
||||
<div class="table-responsive">
|
||||
<div id="toolbar">
|
||||
<a href="{{.web_base_url}}/index/add?type={{.type}}&client_id={{.client_id}}" class="btn btn-primary dim"
|
||||
type="button" langtag="info-new">新增</a>
|
||||
<a href="{{.web_base_url}}/index/add?type={{.type}}&client_id={{.client_id}}" class="btn btn-primary dim">
|
||||
<i class="fa fa-fw fa-lg fa-plus"></i> <span langtag="word-add"></span></a>
|
||||
</div>
|
||||
<table id="taskList_table" class="table-striped table-hover"
|
||||
data-mobile-responsive="true"></table>
|
||||
<table id="taskList_table" class="table-striped table-hover" data-mobile-responsive="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ibox-content">
|
||||
@@ -36,6 +35,9 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
name = '{{.name}}:'.replace(/\s*/g,"")
|
||||
$('#langtag').attr('langtag','page-list' + name.replace(/:.*/,"")).next().text(name.split(":")[1])
|
||||
|
||||
/*bootstrap table*/
|
||||
$('#table').bootstrapTable({
|
||||
toolbar: "#toolbar",
|
||||
@@ -62,22 +64,29 @@
|
||||
pageList: [5, 10, 20, 50],//分页步进值
|
||||
detailView: true,
|
||||
smartDisplay: true, // 智能显示 pagination 和 cardview 等
|
||||
onExpandRow: function () {$('body').setLang ('.detail-view');},
|
||||
onLoadSuccess:function (data) {$('body').setLang ('.detail-view');},
|
||||
onPostBody: function (data) { if ($(this)[0].locale != undefined ) $('body').setLang ('#table'); },
|
||||
detailFormatter: function (index, row, element) {
|
||||
tmp = '<b langtag="info-export-flow">出口流量</b>:' + change(row.Flow.ExportFlow) + `       `
|
||||
+ '<b langtag="info-inlet-flow">入口流量</b>:' + change(row.Flow.InletFlow) + `       `
|
||||
+ '<b langtag="info-crypt">加密</b>:' + row.Client.Cnf.Crypt + `       `
|
||||
+ '<b langtag="info-compress">压缩</b>:' + row.Client.Cnf.Compress + `       `
|
||||
+ '<b langtag="info-web-auth-username">basic权限认证用户名</b>:' + row.Client.Cnf.U + `       `
|
||||
+ '<b langtag="info-web-auth-password">basic权限认证密码</b>:' + row.Client.Cnf.P + `       `
|
||||
tmp = '<b langtag="word-exportflow"></b>: ' + changeunit(row.Flow.ExportFlow) + ' '
|
||||
+ '<b langtag="word-inletflow"></b>: ' + changeunit(row.Flow.InletFlow) + ' '
|
||||
+ '<b langtag="word-crypt"></b>: ' + row.Client.Cnf.Crypt + ' '
|
||||
+ '<b langtag="word-compress"></b>: ' + row.Client.Cnf.Compress + ' '
|
||||
+ '<b langtag="word-basicusername"></b>: ' + row.Client.Cnf.U + ' '
|
||||
+ '<b langtag="word-basicpassword"></b>: ' + row.Client.Cnf.P + ' '
|
||||
if (row.Mode == "p2p") {
|
||||
return tmp + "<br/><br>"
|
||||
+ '<b langtag="info-command">访问端命令(tcp)</b>:' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey + " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -target=" + row.Target.TargetStr + "</code>" + "<br/><br>"
|
||||
+ '<b langtag="info-command">访问端命令(socks5)</b>:' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey + " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -local_type=p2ps" + "</code>" + "<br/><br>"
|
||||
+ '<b langtag="info-command">访问端命令(透明代理)</b>:' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey + " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -local_type=p2pt" + "</code>"
|
||||
+ '<b langtag="word-commandaccessp2p"></b>: ' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey
|
||||
+ " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -target=" + row.Target.TargetStr + "</code>" + "<br/><br>"
|
||||
+ '<b langtag="word-commandaccessp2ps"></b>: ' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey
|
||||
+ " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -local_type=p2ps" + "</code>" + "<br/><br>"
|
||||
+ '<b langtag="word-commandaccessp2pt"></b>: ' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey
|
||||
+ " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -local_type=p2pt" + "</code>"
|
||||
|
||||
}
|
||||
if (row.Mode = "secret") {
|
||||
return tmp + "<br/><br>" + '<b langtag="info-command">访问端命令</b>:' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey + " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -local_type=secret" + "</code>"
|
||||
if (row.Mode == "secret") {
|
||||
return tmp + "<br/><br>" + '<b langtag="word-commandaccess"></b>: ' + "<code>./npc{{.win}} -server={{.ip}}:{{.p}} -vkey=" + row.Client.VerifyKey
|
||||
+ " -type=" +{{.bridgeType}} +" -password=" + row.Password + " -local_type=secret" + "</code>"
|
||||
}
|
||||
return tmp
|
||||
},
|
||||
@@ -85,12 +94,14 @@
|
||||
columns: [
|
||||
{
|
||||
field: 'Id',//域值
|
||||
title: 'id',//标题
|
||||
visible: true,//false表示不显示
|
||||
title: '<span langtag="word-id"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: 'Id',//域值
|
||||
title: 'client id',//标题
|
||||
title: '<span langtag="word-clientid"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
formatter: function (value, row, index) {
|
||||
return row.Client.Id
|
||||
@@ -98,22 +109,29 @@
|
||||
},
|
||||
{
|
||||
field: 'Remark',//域值
|
||||
title: 'remark',//标题
|
||||
visible: true,//false表示不显示
|
||||
title: '<span langtag="word-remark"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: 'Mode',//域值
|
||||
title: 'mode',//标题
|
||||
title: '<span langtag="word-scheme"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
formatter: function (value, row, index) {
|
||||
return '<span langtag="scheme-' + value + '"></span>'
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'Port',//域值
|
||||
title: 'port',//标题
|
||||
visible: true,//false表示不显示
|
||||
title: '<span langtag="word-port"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: 'Target',//域值
|
||||
title: 'target',//标题
|
||||
title: '<span langtag="word-target"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
formatter: function (value, row, index) {
|
||||
return row.Target.TargetStr
|
||||
@@ -121,122 +139,74 @@
|
||||
},
|
||||
{
|
||||
field: 'Password',//域值
|
||||
title: 'secret',//标题
|
||||
visible: true,//false表示不显示
|
||||
|
||||
title: '<span langtag="word-identificationkey"></span>',//标题
|
||||
halign: 'center',
|
||||
visible: true//false表示不显示
|
||||
},
|
||||
{
|
||||
field: 'Status',//域值
|
||||
title: 'setting',//内容
|
||||
title: '<span langtag="word-status"></span>',//内容
|
||||
align: 'center',
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
if (value) {
|
||||
return '<span class="badge badge-primary">open</span>'
|
||||
return '<span class="badge badge-primary" langtag="word-open"></span>'
|
||||
} else {
|
||||
return '<span class="badge badge-badge">close</span>'
|
||||
return '<span class="badge badge-badge" langtag="word-close"></span>'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'RunStatus',//域值
|
||||
title: 'run',//内容
|
||||
title: '<span langtag="word-runstatus"></span>',//内容
|
||||
align: 'center',
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
if (value) {
|
||||
return '<span class="badge badge-primary">open</span>'
|
||||
return '<span class="badge badge-primary" langtag="word-open"></span>'
|
||||
} else {
|
||||
return '<span class="badge badge-badge">close</span>'
|
||||
return '<span class="badge badge-badge" langtag="word-close"></span>'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: '',//域值
|
||||
title: 'client',//内容
|
||||
title: '<span langtag="word-clientstatus"></span>',//内容
|
||||
align: 'center',
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
if (row.Client.IsConnect) {
|
||||
return '<span class="badge badge-primary">online</span>'
|
||||
return '<span class="badge badge-primary" langtag="word-online"></span>'
|
||||
} else {
|
||||
return '<span class="badge badge-badge">offline</span>'
|
||||
return '<span class="badge badge-badge" langtag="word-offline"></span>'
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'option',//域值
|
||||
title: 'option',//内容
|
||||
title: '<span langtag="word-option"></span>',//内容
|
||||
align: 'center',
|
||||
halign: 'center',
|
||||
visible: true,//false表示不显示
|
||||
|
||||
formatter: function (value, row, index) {
|
||||
btn_group = '<div class="btn-group">'
|
||||
btn = `<button onclick="del(` + row.Id + `)" class="btn-danger"><i class="fa fa-trash"></i></button><button onclick="edit(` + row.Id + `)" class="btn-primary"><i class="fa fa-edit"></i></button></div>`
|
||||
if (row.Status) {
|
||||
return btn_group + `<button onclick="stop(` + row.Id + `)" class="btn-dark"><i class="fa fa-close"></i></button>` + btn
|
||||
btn_group += "<a onclick=\"submitform('stop', '{{.web_base_url}}/index/stop', {'id':" + row.Id
|
||||
btn_group += '})" class="btn btn-outline btn-warning"><i class="fa fa-pause"></i></a>'
|
||||
} else {
|
||||
return btn_group + `<button onclick="start(` + row.Id + `)" class="btn-outline-primary"><i class="fa fa-check"></i></button>` + btn
|
||||
btn_group += "<a onclick=\"submitform('start', '{{.web_base_url}}/index/start', {\'id\':" + row.Id
|
||||
btn_group += '})" class="btn btn-outline btn-primary"><i class="fa fa-play"></i></a>'
|
||||
}
|
||||
btn_group += "<a onclick=\"submitform('delete', '{{.web_base_url}}/index/del', {'id':" + row.Id
|
||||
btn_group += '})" class="btn btn-outline btn-danger"><i class="fa fa-trash"></i></a>'
|
||||
btn_group += '<a href="{{.web_base_url}}/index/edit?id=' + row.Id
|
||||
btn_group += '" class="btn btn-outline btn-success"><i class="fa fa-edit"></i></a></div>'
|
||||
return btn_group
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
function del(id) {
|
||||
if (confirm("Are you sure you want to delete it??")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/index/del",
|
||||
data: {"id": id},
|
||||
success: function (res) {
|
||||
alert(res.msg)
|
||||
if (res.status) {
|
||||
document.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function start(id) {
|
||||
if (confirm("Are you sure you want to start it??")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/index/start",
|
||||
data: {"id": id},
|
||||
success: function (res) {
|
||||
alert(res.msg)
|
||||
if (res.status) {
|
||||
document.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function stop(id) {
|
||||
if (confirm("Are you sure you want to stop it??")) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "{{.web_base_url}}/index/stop",
|
||||
data: {"id": id},
|
||||
success: function (res) {
|
||||
alert(res.msg)
|
||||
if (res.status) {
|
||||
document.location.reload();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function edit(id) {
|
||||
window.location.href = "{{.web_base_url}}/index/edit?id=" + id
|
||||
}
|
||||
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user