diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java index 51c9ba8fd..baf464241 100644 --- a/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java +++ b/maxkey-webs/maxkey-web-maxkey/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java @@ -1,5 +1,5 @@ /* - * Copyright [2020] [MaxKey of copyright http://www.maxkey.top] + * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,19 +17,9 @@ package org.maxkey.web.contorller; -import java.io.IOException; - -import javax.servlet.ServletException; -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.maxkey.configuration.ApplicationConfig; -import org.maxkey.entity.Institutions; -import org.maxkey.web.WebConstants; import org.maxkey.web.WebContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -42,35 +32,12 @@ import org.springframework.web.servlet.ModelAndView; @Controller public class IndexEndpoint { private static Logger _logger = LoggerFactory.getLogger(IndexEndpoint.class); - - @Autowired - ApplicationConfig applicationConfig; - - @RequestMapping(value={"/forwardindex"}) - public ModelAndView forwardindex(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - _logger.debug("IndexEndpoint /forwardindex."); - Institutions inst = (Institutions)WebContext.getAttribute(WebConstants.CURRENT_INST); - String defaultUri = inst.getDefaultUri(); - if (defaultUri != null && !defaultUri.equals("")) { - _logger.debug("defaultUri " + defaultUri); - return WebContext.redirect(defaultUri); - } - _logger.debug("Uri /appList"); - return new ModelAndView("/appList"); - } - - @RequestMapping(value={"/index"}) - public ModelAndView home(HttpServletRequest request, - HttpServletResponse response) throws ServletException, IOException { - _logger.debug("home /index."); - return new ModelAndView("index"); - } - + @RequestMapping(value={"/"}) public ModelAndView index() { _logger.debug("IndexEndpoint /."); - return new ModelAndView("index"); + return new ModelAndView("index") + .addObject("appVersion", WebContext.properties.getProperty("application.formatted-version")); } diff --git a/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl new file mode 100644 index 000000000..a443d20a3 --- /dev/null +++ b/maxkey-webs/maxkey-web-maxkey/src/main/resources/templates/views/index.ftl @@ -0,0 +1,21 @@ + + + + + + + MaxKey Single Sign-On + + +
+
+ Maxkey Community Edition
+ Single Sign On ( SSO )
+ Version ${appVersion}
+
+ ©Copyright 2018 - ${.now?string["yyyy"]} https://www.maxkey.top/
+ Licensed under the Apache License, Version 2.0
+
+
+ + diff --git a/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java new file mode 100644 index 000000000..baf464241 --- /dev/null +++ b/maxkey-webs/maxkey-web-mgt/src/main/java/org/maxkey/web/contorller/IndexEndpoint.java @@ -0,0 +1,44 @@ +/* + * Copyright [2022] [MaxKey of copyright http://www.maxkey.top] + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +package org.maxkey.web.contorller; + +import org.maxkey.web.WebContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.ModelAndView; + +/** + * Index + * @author Crystal.Sea + * + */ +@Controller +public class IndexEndpoint { + private static Logger _logger = LoggerFactory.getLogger(IndexEndpoint.class); + + @RequestMapping(value={"/"}) + public ModelAndView index() { + _logger.debug("IndexEndpoint /."); + return new ModelAndView("index") + .addObject("appVersion", WebContext.properties.getProperty("application.formatted-version")); + + } + +} diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties b/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties index d0fb68660..53556ec52 100644 --- a/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties +++ b/maxkey-webs/maxkey-web-mgt/src/main/resources/application-http.properties @@ -206,6 +206,18 @@ maxkey.swagger.title =MaxKey\u5355\u70b9\u767b\u5f55\ maxkey.swagger.description =MaxKey\u5355\u70b9\u767b\u5f55\u8ba4\u8bc1\u7cfb\u7edfAPI\u6587\u6863 maxkey.swagger.version =${application.formatted-version} +############################################################################ +#freemarker configuration # +############################################################################ +spring.freemarker.template-loader-path =classpath:/templates/views +spring.freemarker.cache =false +spring.freemarker.charset =UTF-8 +spring.freemarker.check-template-location =true +spring.freemarker.content-type =text/html +spring.freemarker.expose-request-attributes =false +spring.freemarker.expose-session-attributes =false +spring.freemarker.request-context-attribute =request +spring.freemarker.suffix =.ftl ############################################################################ #static resources configuration # diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/static/favicon.ico b/maxkey-webs/maxkey-web-mgt/src/main/resources/static/favicon.ico new file mode 100644 index 000000000..51f280f3f Binary files /dev/null and b/maxkey-webs/maxkey-web-mgt/src/main/resources/static/favicon.ico differ diff --git a/maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl b/maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl new file mode 100644 index 000000000..a443d20a3 --- /dev/null +++ b/maxkey-webs/maxkey-web-mgt/src/main/resources/templates/views/index.ftl @@ -0,0 +1,21 @@ + + + + + + + MaxKey Single Sign-On + + +
+
+ Maxkey Community Edition
+ Single Sign On ( SSO )
+ Version ${appVersion}
+
+ ©Copyright 2018 - ${.now?string["yyyy"]} https://www.maxkey.top/
+ Licensed under the Apache License, Version 2.0
+
+
+ +