From f42d839417312c9acfe0ce17d8ff628f40dba9bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=90=89?= Date: Fri, 21 May 2021 09:33:49 +0800 Subject: [PATCH] =?UTF-8?q?1.=E5=A2=9E=E5=8A=A0dataway=E9=A1=B5=E9=9D=A2UI?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=98=AF=E5=90=A6=E5=90=AF=E7=94=A8=E8=B7=A8?= =?UTF-8?q?=E5=9F=9F=E9=85=8D=E7=BD=AE=EF=BC=8C=E9=BB=98=E8=AE=A4=E4=B8=8D?= =?UTF-8?q?=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/net/hasor/dataway/config/DatawayModule.java | 2 +- .../net/hasor/dataway/service/InterfaceUiFilter.java | 9 +++++++-- .../META-INF/hasor-framework/dataway-hconfig.xml | 4 ++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/config/DatawayModule.java b/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/config/DatawayModule.java index 9da772df00..d495a60b30 100644 --- a/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/config/DatawayModule.java +++ b/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/config/DatawayModule.java @@ -126,7 +126,7 @@ protected void loadAdminService(WebApiBinder apiBinder, String apiBaseUri, Strin AdminUiAuthorization uiAuthorization = new AdminUiAuthorization(adminBaseUri, apiBinder.getEnvironment()); apiBinder.filter(fixUrl(adminBaseUri + "/*")).through(Integer.MAX_VALUE, HasorUtils.autoAware(apiBinder.getEnvironment(), uiAuthorization)); apiBinder.filter(fixUrl(adminBaseUri + "/*")).through(Integer.MAX_VALUE, new InterfaceAuthorizationFilter(adminBaseUri)); - apiBinder.filter(fixUrl(adminBaseUri + "/*")).through(Integer.MAX_VALUE, new InterfaceUiFilter(adminBaseUri)); + apiBinder.filter(fixUrl(adminBaseUri + "/*")).through(Integer.MAX_VALUE, new InterfaceUiFilter(apiBinder.getEnvironment(), adminBaseUri)); } private void loadController(WebApiBinder apiBinder, Class aClass, String adminBaseUri, String apiBaseUri) { diff --git a/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/service/InterfaceUiFilter.java b/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/service/InterfaceUiFilter.java index 386de38fbd..2b7ef9d224 100644 --- a/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/service/InterfaceUiFilter.java +++ b/hasor-dataql/dataql-dataway/src/main/java/net/hasor/dataway/service/InterfaceUiFilter.java @@ -15,6 +15,7 @@ */ package net.hasor.dataway.service; import com.alibaba.fastjson.JSON; +import net.hasor.core.Environment; import net.hasor.dataway.config.DatawayUtils; import net.hasor.utils.ResourcesUtils; import net.hasor.utils.StringUtils; @@ -47,8 +48,10 @@ public class InterfaceUiFilter implements InvokerFilter { private final String uiBaseUri; private final String uiAdminBaseUri; private final Map resourceSize; + private final Boolean enableCross; - public InterfaceUiFilter(String uiBaseUri) { + public InterfaceUiFilter(Environment environment, String uiBaseUri) { + this.enableCross = environment.getSettings().getBoolean("hasor.dataway.interfaceUICross", false); this.uiBaseUri = uiBaseUri; this.uiAdminBaseUri = fixUrl(uiBaseUri + "/api/"); this.resourceIndexUri = fixUrl(uiBaseUri + "/index.html"); @@ -64,7 +67,9 @@ public Object doInvoke(Invoker invoker, InvokerChain chain) throws Throwable { HttpServletRequest httpRequest = invoker.getHttpRequest(); HttpServletResponse httpResponse = invoker.getHttpResponse(); String requestURI = invoker.getRequestPath(); - setupInner(invoker); + if (this.enableCross) { + setupInner(invoker); + } if (requestURI.startsWith(this.uiAdminBaseUri)) { try { DatawayUtils.resetLocalTime(); diff --git a/hasor-dataql/dataql-dataway/src/main/resources/META-INF/hasor-framework/dataway-hconfig.xml b/hasor-dataql/dataql-dataway/src/main/resources/META-INF/hasor-framework/dataway-hconfig.xml index 1baadfc6a5..d4e8c967e3 100644 --- a/hasor-dataql/dataql-dataway/src/main/resources/META-INF/hasor-framework/dataway-hconfig.xml +++ b/hasor-dataql/dataql-dataway/src/main/resources/META-INF/hasor-framework/dataway-hconfig.xml @@ -34,6 +34,8 @@ admin classpath:/META-INF/hasor-framework/dataway-ui/login.html + + false @@ -72,6 +74,8 @@ ${HASOR_DATAQL_DATAWAY_UI_URL} + + ${HASOR_DATAQL_DATAWAY_INTERFACE_UI_CROSS}