mirror of
https://gitee.com/dromara/Jpom.git
synced 2024-12-02 03:48:05 +08:00
新版本 UI 同步添加 common.js
This commit is contained in:
parent
f87c5d9bfa
commit
1d20ecbf6a
13
CHANGELOG.md
13
CHANGELOG.md
@ -14,6 +14,7 @@
|
||||
7. 【server】节点升级上传新包成功后删除历史包
|
||||
8. 【server】新版本 UI 菜单系统管理、节点升级只有系统管理员可见
|
||||
9. 【server】新版本 UI 脚本模板同步添加执行参数(感谢@轻描淡写 [Gitee issues I43G4B](https://gitee.com/dromara/Jpom/issues/I43G4B) )
|
||||
10. 【server】新版本 UI 同步添加 common.js
|
||||
|
||||
### 解决BUG、优化功能
|
||||
|
||||
@ -77,8 +78,7 @@
|
||||
11. 【server】项目控制台新增心跳消息,避免超过一定时间后无法操作的情况
|
||||
12. 【server】ssh 新增心跳消息,避免超过一定时间后无法操作的情况
|
||||
13. 【server】系统缓存中的文件占用空间大小调整为定时更新(10分钟)
|
||||
14. 【server】修复 bug:分发列表页面点击【创建分发项目】按钮之后不能正常显示【分发节点】感谢
|
||||
@xingenhi [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/bd38528fbd3067d220b7569f08449d7796e07c74) [@Hotstrip](https://gitee.com/hotstrip)
|
||||
14. 【server】修复 bug:分发列表页面点击【创建分发项目】按钮之后不能正常显示【分发节点】感谢 @xingenhi [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/bd38528fbd3067d220b7569f08449d7796e07c74) [@Hotstrip](https://gitee.com/hotstrip)
|
||||
15. 【server】fix: 编辑管理员时用户名不可修改
|
||||
16. 【server】折叠显示部分列表操作按钮(减少误操作)
|
||||
|
||||
@ -104,12 +104,9 @@
|
||||
项目监控页面,线程数据加载失败问题 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/b11c5443db6468a2bf7f6a9fa933f8d965899624) [@Hotstrip](https://gitee.com/hotstrip)
|
||||
3. 【server】fix bug: 修复低版本浏览器不支持 `.replaceAll()`
|
||||
方法 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/0fb475963153b76546409ac3065a0efe9e647541) [@杨巍](https://gitee.com/fat_magpie_beijing_tony)
|
||||
4. 【server】update: 更新分发列表 --
|
||||
关联分发项目页面操作逻辑(跟老版本操作逻辑一致)[点击查看提交记录](https://gitee.com/dromara/Jpom/commit/cd6e4ae89f833e5e7ef11bd12c324a487de27b1a) [@李道甫](https://gitee.com/koushare_dfli)
|
||||
5. 【server】update: 优化项目文件管理页面,加载目录树时会多次显示 loading
|
||||
层 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/71b3779bffb36259e0980ce25d4e4082a9d7c2e6) [@Hotstrip](https://gitee.com/hotstrip)
|
||||
6. 【server】fix bug: 修复节点请求超时可能导致节点项目列表为空
|
||||
bug [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/e3182dfa04c27e63a29d67b292a7bfef834f875e) [@Hotstrip](https://gitee.com/hotstrip)
|
||||
4. 【server】update: 更新分发列表 -- 关联分发项目页面操作逻辑(跟老版本操作逻辑一致)[点击查看提交记录](https://gitee.com/dromara/Jpom/commit/cd6e4ae89f833e5e7ef11bd12c324a487de27b1a) [@李道甫](https://gitee.com/koushare_dfli)
|
||||
5. 【server】update: 优化项目文件管理页面,加载目录树时会多次显示 loading 层 [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/71b3779bffb36259e0980ce25d4e4082a9d7c2e6) [@Hotstrip](https://gitee.com/hotstrip)
|
||||
6. 【server】fix bug: 修复节点请求超时可能导致节点项目列表为空 bug [点击查看提交记录](https://gitee.com/dromara/Jpom/commit/e3182dfa04c27e63a29d67b292a7bfef834f875e) [@Hotstrip](https://gitee.com/hotstrip)
|
||||
7. 【agent】 fix bug: index 获取进程列表 NPE (感谢@夏末秋初)
|
||||
8. 【server】fix bug: 修复上传项目压缩文件创建项目目录异常[点击这里查看对应 issue](https://gitee.com/dromara/Jpom/issues/I29FRJ)
|
||||
9. 【server】fix bug:创建构建时,如果选择
|
||||
|
@ -28,16 +28,16 @@ public abstract class BaseJpomInterceptor extends BaseInterceptor {
|
||||
// return false;
|
||||
// }
|
||||
|
||||
public static void sendRedirects(HttpServletRequest request, HttpServletResponse response, String url) throws IOException {
|
||||
String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
|
||||
UrlRedirectUtil.sendRedirect(request, response, newUrl);
|
||||
}
|
||||
|
||||
public static String getRedirect(HttpServletRequest request, String url) {
|
||||
String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
|
||||
String redirect = UrlRedirectUtil.getRedirect(request, newUrl);
|
||||
return String.format("redirect:%s", redirect);
|
||||
}
|
||||
// public static void sendRedirects(HttpServletRequest request, HttpServletResponse response, String url) throws IOException {
|
||||
// String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
|
||||
// UrlRedirectUtil.sendRedirect(request, response, newUrl);
|
||||
// }
|
||||
//
|
||||
// public static String getRedirect(HttpServletRequest request, String url) {
|
||||
// String newUrl = UrlRedirectUtil.getHeaderProxyPath(request, PROXY_PATH) + url;
|
||||
// String redirect = UrlRedirectUtil.getRedirect(request, newUrl);
|
||||
// return String.format("redirect:%s", redirect);
|
||||
// }
|
||||
|
||||
public static String getHeaderProxyPath(HttpServletRequest request) {
|
||||
String proxyPath = ServletUtil.getHeaderIgnoreCase(request, PROXY_PATH);
|
||||
|
@ -171,41 +171,41 @@ public class LoginInterceptor extends BaseJpomInterceptor {
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
super.postHandle(request, response, handler, modelAndView);
|
||||
HttpSession session;
|
||||
try {
|
||||
session = getSession();
|
||||
} catch (Exception ignored) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
// 静态资源地址参数
|
||||
session.setAttribute("staticCacheTime", DateUtil.currentSeconds());
|
||||
// 代理二级路径
|
||||
Object jpomProxyPath = session.getAttribute("jpomProxyPath");
|
||||
if (jpomProxyPath == null) {
|
||||
String path = getHeaderProxyPath(request);
|
||||
session.setAttribute("jpomProxyPath", path);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
}
|
||||
try {
|
||||
// 统一的js 注入
|
||||
String jsCommonContext = (String) session.getAttribute("jsCommonContext");
|
||||
if (jsCommonContext == null) {
|
||||
String path = ExtConfigBean.getInstance().getPath();
|
||||
File file = FileUtil.file(String.format("%s/script/common.js", path));
|
||||
if (file.exists()) {
|
||||
jsCommonContext = FileUtil.readString(file, CharsetUtil.CHARSET_UTF_8);
|
||||
jsCommonContext = URLEncoder.DEFAULT.encode(jsCommonContext, CharsetUtil.CHARSET_UTF_8);
|
||||
}
|
||||
session.setAttribute("jsCommonContext", jsCommonContext);
|
||||
}
|
||||
} catch (IllegalStateException ignored) {
|
||||
}
|
||||
}
|
||||
// @Override
|
||||
// public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
|
||||
// super.postHandle(request, response, handler, modelAndView);
|
||||
// HttpSession session;
|
||||
// try {
|
||||
// session = getSession();
|
||||
// } catch (Exception ignored) {
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
// // 静态资源地址参数
|
||||
// session.setAttribute("staticCacheTime", DateUtil.currentSeconds());
|
||||
// // 代理二级路径
|
||||
// Object jpomProxyPath = session.getAttribute("jpomProxyPath");
|
||||
// if (jpomProxyPath == null) {
|
||||
// String path = getHeaderProxyPath(request);
|
||||
// session.setAttribute("jpomProxyPath", path);
|
||||
// }
|
||||
// } catch (Exception ignored) {
|
||||
// }
|
||||
// try {
|
||||
// // 统一的js 注入
|
||||
// String jsCommonContext = (String) session.getAttribute("jsCommonContext");
|
||||
// if (jsCommonContext == null) {
|
||||
// String path = ExtConfigBean.getInstance().getPath();
|
||||
// File file = FileUtil.file(String.format("%s/script/common.js", path));
|
||||
// if (file.exists()) {
|
||||
// jsCommonContext = FileUtil.readString(file, CharsetUtil.CHARSET_UTF_8);
|
||||
// jsCommonContext = URLEncoder.DEFAULT.encode(jsCommonContext, CharsetUtil.CHARSET_UTF_8);
|
||||
// }
|
||||
// session.setAttribute("jsCommonContext", jsCommonContext);
|
||||
// }
|
||||
// } catch (IllegalStateException ignored) {
|
||||
// }
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
|
||||
|
@ -3,6 +3,7 @@ package io.jpom.controller;
|
||||
import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.io.resource.ResourceUtil;
|
||||
import cn.hutool.core.net.URLEncoder;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.extra.servlet.ServletUtil;
|
||||
@ -18,6 +19,7 @@ import io.jpom.model.data.UserModel;
|
||||
import io.jpom.permission.CacheControllerFeature;
|
||||
import io.jpom.service.user.RoleService;
|
||||
import io.jpom.service.user.UserService;
|
||||
import io.jpom.system.ExtConfigBean;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@ -27,6 +29,7 @@ import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
@ -50,8 +53,6 @@ public class IndexControl extends BaseServerController {
|
||||
|
||||
/**
|
||||
* 加载首页
|
||||
*
|
||||
* @return page
|
||||
*/
|
||||
@GetMapping(value = {"index", "", "/"}, produces = MediaType.TEXT_HTML_VALUE)
|
||||
@NotLogin
|
||||
@ -59,12 +60,20 @@ public class IndexControl extends BaseServerController {
|
||||
public void index(HttpServletResponse response) throws IOException {
|
||||
InputStream inputStream = ResourceUtil.getStream("classpath:/dist/index.html");
|
||||
String html = IoUtil.read(inputStream, CharsetUtil.CHARSET_UTF_8);
|
||||
//<div id="jpomCommonJs"></div>
|
||||
String path = ExtConfigBean.getInstance().getPath();
|
||||
File file = FileUtil.file(String.format("%s/script/common.js", path));
|
||||
String jsCommonContext = StrUtil.EMPTY;
|
||||
if (file.exists()) {
|
||||
jsCommonContext = FileUtil.readString(file, CharsetUtil.CHARSET_UTF_8);
|
||||
}
|
||||
html = StrUtil.replace(html, "<div id=\"jpomCommonJs\"></div>", jsCommonContext);
|
||||
ServletUtil.write(response, html, ContentType.TEXT_HTML.getValue());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return
|
||||
* @return json
|
||||
* @author Hotstrip
|
||||
* 检查是否需要初始化系统
|
||||
* check if need to init system
|
||||
|
@ -21,5 +21,6 @@
|
||||
</script>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
<div id="jpomCommonJs"><!--Don't delete this line, place for public JS --></div>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user