页面调整

master
fengfei 7 years ago
parent 7db0805b23
commit b4b81f0921
  1. 11
      proxy-server/src/main/java/org/fengfei/lanproxy/server/config/web/routes/RouteConfig.java
  2. 25
      proxy-server/webpages/lanproxy-config/index.html

@ -56,6 +56,14 @@ public class RouteConfig {
}
}
String auth = request.headers().get(HttpHeaders.Names.AUTHORIZATION);
if (!authenticated && auth != null) {
String[] authArr = auth.split(" ");
if (authArr.length == 2 && authArr[0].equals(ProxyConfig.getInstance().getConfigAdminUsername()) && authArr[1].equals(ProxyConfig.getInstance().getConfigAdminPassword())) {
authenticated = true;
}
}
if (!request.getUri().equals("/login") && !authenticated) {
throw new ContextException(ResponseInfo.CODE_UNAUTHORIZED);
}
@ -118,8 +126,7 @@ public class RouteConfig {
return ResponseInfo.build(ResponseInfo.CODE_INVILID_PARAMS, "Error username or password");
}
if (username.equals(ProxyConfig.getInstance().getConfigAdminUsername())
&& password.equals(ProxyConfig.getInstance().getConfigAdminPassword())) {
if (username.equals(ProxyConfig.getInstance().getConfigAdminUsername()) && password.equals(ProxyConfig.getInstance().getConfigAdminPassword())) {
token = UUID.randomUUID().toString().replace("-", "");
return ResponseInfo.build(token);
}

@ -17,14 +17,13 @@
<div class="layui-header">
<div class="layui-logo">LanProxy内网穿透</div>
<ul class="layui-nav layui-layout-right">
<li class="layui-nav-item"><a href="javascript:;" class="logout">退出</a></li>
<li class="layui-nav-item"><a href="javascript:;"
class="logout">退出</a></li>
</ul>
</div>
<div class="layui-side layui-bg-black">
<div class="layui-side-scroll">
</div>
<div class="layui-side-scroll"></div>
</div>
<div class="layui-body"></div>
@ -38,14 +37,16 @@
<script src="/jquery/jquery-3.1.1.min.js"></script>
<script src="/template/template.js"></script>
<script>
window.clientList = [];
layui.use('layer', function() {
window.layer = layui.layer;
update_menu();
load_page("html/client/list.html");
});
function api_invoke(uri, params, callback) {
var index = layer.load(1, {
shade: [0.1,'#fff'] //0.1透明度的白色背景
shade : [ 0.1, '#fff' ]
});
$.ajax({
url : uri,
@ -61,7 +62,7 @@
error : function(XMLHttpRequest, textStatus, errorThrown) {
layer.close(index);
if ("undefined" == typeof (XMLHttpRequest.responseJSON)) {
alert("System error, please try again later.");
layer.alert("System error, please try again later.");
return;
}
@ -81,14 +82,12 @@
$(".layui-body").load(pageUrl);
}
function check_lan(ip)
{
function check_lan(ip) {
var re = /^(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5])\.(\d{1,2}|1\d\d|2[0-4]\d|25[0-5]):([0-9]|[1-9]\d{1,3}|[1-5]\d{4}|6[0-5]{2}[0-3][0-5])$/
return re.test(ip);
}
function check_port(port)
{
function check_port(port) {
if (port > 65535) {
return false;
}
@ -114,20 +113,20 @@
History.pushState('forward', null, '?state=1');
}
load_page("html/client/list.html");
$(".logout").click(function() {
api_invoke("/logout", {}, function(data) {
location.href = "/";
})
});
window.clientList = [];
});
function update_menu() {
api_invoke("/config/detail", {}, function(data) {
if (data.code == 20000) {
clientList = data.data;
var html = template($("#menu-tpl").html(), {list: clientList});
var html = template($("#menu-tpl").html(), {
list : clientList
});
$(".layui-side-scroll").html(html);
layui.use('element', function() {
var element = layui.element;

Loading…
Cancel
Save