From 9aa1f100626734065d506785bcaf652a5e0a20a6 Mon Sep 17 00:00:00 2001 From: lovexy-fun Date: Tue, 23 Aug 2022 15:58:50 +0800 Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=E7=99=BB=E5=BD=95=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E8=B7=B3=E8=BD=AC=E7=99=BB=E5=BD=95=E9=A1=B5=E9=97=AE?= =?UTF-8?q?=E9=A2=98=202.=E4=BC=98=E5=8C=96=E5=90=AF=E5=8A=A8=E8=84=9A?= =?UTF-8?q?=E6=9C=AC=EF=BC=8C=E8=AE=BE=E7=BD=AE=E5=90=AF=E5=8A=A8=E4=BD=8D?= =?UTF-8?q?=E7=BD=AE=E5=8F=98=E9=87=8F=203.=E5=A2=9E=E5=8A=A0=E5=81=9C?= =?UTF-8?q?=E6=AD=A2=E8=84=9A=E6=9C=AC=204.=E4=BC=98=E5=8C=96nginx.pid?= =?UTF-8?q?=E6=AE=8B=E7=95=99=E8=87=B4=E4=BD=BF=E5=90=AF=E5=8A=A8=E5=90=8E?= =?UTF-8?q?=E8=AE=A4=E4=B8=BAnginx=E5=B7=B2=E5=90=AF=E5=8A=A8=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 1 + pom.xml | 3 ++- .../interceptor/LoginInterceptor.java | 2 +- src/main/resources/application.yml | 6 +++--- src/main/resources/static/js/common.js | 15 +++++++++++++++ src/main/resources/templates/manage.html | 1 + start.bat | 9 ++++++++- stop.bat | 8 ++++++++ 8 files changed, 39 insertions(+), 6 deletions(-) create mode 100644 stop.bat diff --git a/.gitignore b/.gitignore index 45bbf73..546d29c 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ hs_err_pid* /reverse-proxy.iml /target/ /.idea/ +/nginx/logs/nginx.pid diff --git a/pom.xml b/pom.xml index 54effdd..4a550c4 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ fun.lovexy reverse-proxy - 1.0.0-SNAPSHOT + 1.0.1 jar @@ -81,6 +81,7 @@ + reverse-proxy org.springframework.boot diff --git a/src/main/java/fun/lovexy/reverseproxy/interceptor/LoginInterceptor.java b/src/main/java/fun/lovexy/reverseproxy/interceptor/LoginInterceptor.java index 7fde0eb..e887aca 100644 --- a/src/main/java/fun/lovexy/reverseproxy/interceptor/LoginInterceptor.java +++ b/src/main/java/fun/lovexy/reverseproxy/interceptor/LoginInterceptor.java @@ -13,7 +13,7 @@ public class LoginInterceptor implements HandlerInterceptor { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { Object user = request.getSession().getAttribute("user"); if (null == user) { - response.sendRedirect("/login"); + response.sendRedirect("/login?redirect=/login"); return false; } return true; diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index f7f582a..5db13a8 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -8,14 +8,14 @@ admin: password: admin nginx: - home: E:\ProjectSpace\IDEAProjects\reverse-proxy\nginx + home: ${BASEPATH}nginx server: port: 8999 spring: datasource: - url: jdbc:sqlite:E:\ProjectSpace\IDEAProjects\reverse-proxy\reverse-proxy.db + url: jdbc:sqlite:${BASEPATH}reverse-proxy.db driver-class-name: org.sqlite.JDBC jackson: time-zone: GMT+8 @@ -29,7 +29,7 @@ spring: logging: level: - fun.lovexy.reverseproxy: debug + fun.lovexy.reverseproxy: info file: path: logs diff --git a/src/main/resources/static/js/common.js b/src/main/resources/static/js/common.js index 440621d..9fa41fa 100644 --- a/src/main/resources/static/js/common.js +++ b/src/main/resources/static/js/common.js @@ -1,3 +1,18 @@ +$(function () { + redirect() +}) + +/** + * 重定向 + */ +function redirect() { + var params = getUrlParams(); + var redirectUri = params['redirect'] + if (redirectUri != undefined && redirectUri != null && redirectUri.length != 0) { + top.location.href = redirectUri; + } +} + /** * ajax post请求 * @param url diff --git a/src/main/resources/templates/manage.html b/src/main/resources/templates/manage.html index bd80a77..758b3f1 100644 --- a/src/main/resources/templates/manage.html +++ b/src/main/resources/templates/manage.html @@ -124,6 +124,7 @@ {{# } else { }} {{# } }} + 返回查看页面