diff --git a/server/src/main/java/cn/keking/service/FileHandlerService.java b/server/src/main/java/cn/keking/service/FileHandlerService.java index 28f495a9..0aae8722 100644 --- a/server/src/main/java/cn/keking/service/FileHandlerService.java +++ b/server/src/main/java/cn/keking/service/FileHandlerService.java @@ -175,8 +175,8 @@ public class FileHandlerService implements InitializingBean { } // 添加sheet控制头 sb.append(""); - sb.append(""); - sb.append(""); + sb.append(""); + sb.append(""); } catch (IOException e) { e.printStackTrace(); } diff --git a/server/src/main/java/cn/keking/utils/CaptchaUtil.java b/server/src/main/java/cn/keking/utils/CaptchaUtil.java index 0fe25262..db9dbdff 100644 --- a/server/src/main/java/cn/keking/utils/CaptchaUtil.java +++ b/server/src/main/java/cn/keking/utils/CaptchaUtil.java @@ -8,16 +8,14 @@ import java.util.Random; public class CaptchaUtil { - public static final String captcha_code = "captchaCode"; - public static final String captcha_generate_time = "captchaTime"; + public static final String CAPTCHA_CODE = "captchaCode"; + public static final String CAPTCHA_GENERATE_TIME = "captchaTime"; - private static final int width = 100;// 定义图片的width - private static final int height = 30;// 定义图片的height - private static final int codeLength = 4;// 定义图片上显示验证码的个数 - private static final int xx = 18; - private static final int fontHeight = 28; - private static final int codeY = 27; - private static final char[] codeSequence = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', + private static final int WIDTH = 100;// 定义图片的width + private static final int HEIGHT = 30;// 定义图片的height + private static final int CODE_LENGTH = 4;// 定义图片上显示验证码的个数 + private static final int FONT_HEIGHT = 28; + private static final char[] CODE_SEQUENCE = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'M', 'N', 'P', 'Q', 'R', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', '2', '3', '4', '5', '6', '7', '8', '9'}; /** @@ -28,23 +26,23 @@ public class CaptchaUtil { public static BufferedImage generateCaptchaPic(final String captchaCode) { Assert.notNull(captchaCode, "captchaCode must not be null"); // 定义图像buffer - BufferedImage buffImg = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB); + BufferedImage buffImg = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); Graphics gd = buffImg.getGraphics(); Random random = new Random(); // 将图像填充为白色 gd.setColor(Color.WHITE); - gd.fillRect(0, 0, width, height); - Font font = new Font("Times New Roman", Font.BOLD, fontHeight); + gd.fillRect(0, 0, WIDTH, HEIGHT); + Font font = new Font("Times New Roman", Font.BOLD, FONT_HEIGHT); gd.setFont(font); // 画边框。 gd.setColor(Color.BLACK); - gd.drawRect(0, 0, width - 1, height - 1); + gd.drawRect(0, 0, WIDTH - 1, HEIGHT - 1); // 随机产生40条干扰线,使图象中的认证码不易被其它程序探测到。 gd.setColor(Color.BLACK); for (int i = 0; i < 30; i++) { - int x = random.nextInt(width); - int y = random.nextInt(height); + int x = random.nextInt(WIDTH); + int y = random.nextInt(HEIGHT); int xl = random.nextInt(12); int yl = random.nextInt(12); gd.drawLine(x, y, x + xl, y + yl); @@ -57,7 +55,7 @@ public class CaptchaUtil { blue = random.nextInt(255); // 用随机产生的颜色将验证码绘制到图像中。 gd.setColor(new Color(red, green, blue)); - gd.drawString(captchaCode, 18, codeY); + gd.drawString(captchaCode, 18, 27); return buffImg; } @@ -68,8 +66,8 @@ public class CaptchaUtil { public static String generateCaptchaCode() { Random random = new Random(); StringBuilder randomCode = new StringBuilder(); - for (int i = 0; i < codeLength; i++) { - randomCode.append(codeSequence[random.nextInt(52)]); + for (int i = 0; i < CODE_LENGTH; i++) { + randomCode.append(CODE_SEQUENCE[random.nextInt(52)]); } return randomCode.toString(); } diff --git a/server/src/main/java/cn/keking/web/controller/FileController.java b/server/src/main/java/cn/keking/web/controller/FileController.java index 41330e7c..9a145d32 100644 --- a/server/src/main/java/cn/keking/web/controller/FileController.java +++ b/server/src/main/java/cn/keking/web/controller/FileController.java @@ -35,8 +35,8 @@ import java.util.List; import java.util.Map; import java.util.Objects; -import static cn.keking.utils.CaptchaUtil.captcha_code; -import static cn.keking.utils.CaptchaUtil.captcha_generate_time; +import static cn.keking.utils.CaptchaUtil.CAPTCHA_CODE; +import static cn.keking.utils.CaptchaUtil.CAPTCHA_GENERATE_TIME; /** * @author yudian-it @@ -88,7 +88,7 @@ public class FileController { logger.error(msg); return ReturnResponse.failure(msg); } - WebUtils.removeSessionAttr(request, captcha_code); //删除缓存验证码 + WebUtils.removeSessionAttr(request, CAPTCHA_CODE); //删除缓存验证码 return ReturnResponse.success(); } @@ -105,16 +105,16 @@ public class FileController { response.setHeader("Pragma", "no-cache"); response.setHeader("Cache-Control", "no-cache"); response.setDateHeader("Expires", -1); - String captchaCode = WebUtils.getSessionAttr(request, captcha_code); - long captchaGenerateTime = WebUtils.getLongSessionAttr(request, captcha_generate_time); + String captchaCode = WebUtils.getSessionAttr(request, CAPTCHA_CODE); + long captchaGenerateTime = WebUtils.getLongSessionAttr(request, CAPTCHA_GENERATE_TIME); long timeDifference = DateUtils.calculateCurrentTimeDifference(captchaGenerateTime); // 验证码为空,且生成验证码超过50秒,重新生成验证码 if (timeDifference > 50 && ObjectUtils.isEmpty(captchaCode)) { captchaCode = CaptchaUtil.generateCaptchaCode(); // 更新验证码 - WebUtils.setSessionAttr(request, captcha_code, captchaCode); - WebUtils.setSessionAttr(request, captcha_generate_time, DateUtils.getCurrentSecond()); + WebUtils.setSessionAttr(request, CAPTCHA_CODE, captchaCode); + WebUtils.setSessionAttr(request, CAPTCHA_GENERATE_TIME, DateUtils.getCurrentSecond()); } else { captchaCode = ObjectUtils.isEmpty(captchaCode) ? "wait" : captchaCode; } @@ -195,7 +195,7 @@ public class FileController { return ReturnResponse.failure("密码 or 验证码为空,删除失败!"); } - String expectedPassword = ConfigConstants.getDeleteCaptcha() ? WebUtils.getSessionAttr(request, captcha_code) : ConfigConstants.getPassword(); + String expectedPassword = ConfigConstants.getDeleteCaptcha() ? WebUtils.getSessionAttr(request, CAPTCHA_CODE) : ConfigConstants.getPassword(); if (!password.equalsIgnoreCase(expectedPassword)) { logger.error("删除文件【{}】失败,密码错误!", fileName); diff --git a/server/src/main/resources/static/bootstrap/css/xlsx.css b/server/src/main/resources/static/excel/excel.css similarity index 100% rename from server/src/main/resources/static/bootstrap/css/xlsx.css rename to server/src/main/resources/static/excel/excel.css diff --git a/server/src/main/resources/static/excel/excel.header.js b/server/src/main/resources/static/excel/excel.header.js new file mode 100644 index 00000000..eaa72bae --- /dev/null +++ b/server/src/main/resources/static/excel/excel.header.js @@ -0,0 +1,56 @@ +/**创建一个div并固定在底部,将center中的所有a标签放在改div中**/ +$("body").append($("
").css({"width":"100%","height":"100%px","position":"fixed","top":"0","left":"0" + ,"background-color":"rgba(53, 53, 53, 1)","line-height":"30px","font-size":"13px"}).attr("id","excel-header-nav")); +$("center").css("display", "none"); +var centerChildrenA = $("center").children("a"); +if (centerChildrenA.length === 0) { + $("#excel-header-nav").hide(); +} +$(centerChildrenA).each(function (a, b) { + // 获取a标签对应的target的name值,并设置name对应标签的样式以避免锚点标签标题被覆盖 + var href = $(b).attr("href"); + var name = href.substr(1); + $("[name=" + name + "]").css({"display":"block","padding-top":"14.01px"}); + $(b).css({"padding":"5px","border-right":"1px solid white","color":"#f9f9f9"}); + $("#excel-header-nav").append(b); +}); +/**给所有的table添加class=table table-striped样式**/ +$("table").addClass("table table-striped"); +/** + * openoffice,只有一个 colgroup,用col子标签来描述列,liboffice 每一列都是一个colgroup + * var meta = $("meta[name=generator]"); + * LibreOffice //OpenOffice + * console.log(meta[0].content); + */ +/**计算表头宽度----start**/ +function ______getColgroupWidth(colgroups){ + var twidth = 0; + $(colgroups).each(function (i, g) { + var w = $(g).attr("width"); + var s = $(g).attr("span"); + if(null==s || undefined==s){ + s=1; + } + twidth +=1*w*s; + }); + return twidth; +} +$("table").each(function (a, b) { + var twidth = 0; + var tableChildrenColgroup = $(b).children("colgroup"); + if(0==tableChildrenColgroup.length){ + }else if(1==tableChildrenColgroup.length){ + var cols = tableChildrenColgroup.children("col"); + if(0==cols.length){ + twidth=______getColgroupWidth(tableChildrenColgroup); + }else{ + $(cols).each(function (i, g) { + var w = $(g).attr("width"); + twidth +=1*w; + }); + } + }else{ + twidth = ______getColgroupWidth(tableChildrenColgroup); + } + $(b).css({"width":twidth}); +}); \ No newline at end of file diff --git a/server/src/main/resources/static/favicon.ico b/server/src/main/resources/static/favicon.ico index e69de29b..16309db2 100644 Binary files a/server/src/main/resources/static/favicon.ico and b/server/src/main/resources/static/favicon.ico differ diff --git a/server/src/main/resources/web/main/index.ftl b/server/src/main/resources/web/main/index.ftl index 0d2c1e60..964d854e 100644 --- a/server/src/main/resources/web/main/index.ftl +++ b/server/src/main/resources/web/main/index.ftl @@ -3,10 +3,9 @@ - + kkFileView演示首页 - @@ -21,69 +20,49 @@ .alert { width: 50%; } - #size{ - float:left; - - } - <#-- 删除吗CSS样式 --> - <#if deleteCaptcha > - - +<#-- 删除文件验证码弹窗 --> +<#if deleteCaptcha > + + + @@ -148,10 +127,7 @@
- <#-- 删除吗弹窗 --> - <#if deleteCaptcha > -
- + <#-- 预览测试 -->
@@ -160,7 +136,8 @@
<#if fileUploadDisable == false>
- + +
@@ -199,97 +176,47 @@ - - - - - diff --git a/server/src/main/resources/web/main/record.ftl b/server/src/main/resources/web/main/record.ftl index e8ac5d0f..729900eb 100644 --- a/server/src/main/resources/web/main/record.ftl +++ b/server/src/main/resources/web/main/record.ftl @@ -3,41 +3,28 @@ - + kkFileView版本记录 - - - - @@ -67,6 +54,7 @@ 13.其他功能优化及已知问题修复
+

2023年07月04日,v4.3.0版本

@@ -95,9 +83,10 @@ 20. 其他功能优化及已知问题修复
+
-

2023年04月18日,v4.2.1 版本

+

2023年04月18日,v4.2.1版本

@@ -107,7 +96,7 @@
-

2023年04月13日,v4.2.0 版本

+

2023年04月13日,v4.2.0版本

@@ -148,7 +137,7 @@
-

2022年12月14日,v4.1.0 版本

+

2022年12月14日,v4.1.0版本

@@ -167,7 +156,7 @@
-

2021年7月6日,v4.0.0 版本

+

2021年7月6日,v4.0.0版本

@@ -184,12 +173,11 @@
-

2021年6月17日,v3.6.0版本

+

2021年06月17日,v3.6.0版本

- ** ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献,感谢 @gaoxingzaq、@zhangxiaoxiao9527 的代码贡献 - **
+ ** ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献,感谢 @gaoxingzaq、@zhangxiaoxiao9527 的代码贡献 **
1. 新增 ofd 类型文件预览支持,ofd 是国产的类似 pdf 格式的文件
2. 新增了 ffmpeg 视频文件转码预览支持,打开转码功能后,理论上支持所有主流视频的预览,如 rm、rmvb、flv 等
3. 美化了 ppt、pptx 类型文件预览效果,比之前版本好看太多
@@ -199,7 +187,43 @@
-

2021年1月28日

+

2021年04月06日,v3.5.1版本

+
+
+
+ 3.5.1版本发布,修复已知问题
+ 1. 修复 tif、tiff 文件预览初始内存太小预览失败的问题
+ 2. 修复PDF预览模式跨域问题
+
+
+
+
+
+

2021年03月17日,v3.5.0版本

+
+
+
+ 2021 一季度 v3.5 性能升级版发布
+ 1. 新增 office-plugin 转换进程、任务超时可配置
+ 2. 更新 spring-boot 到最新的 v2.4.2 版本
+ 3. 新增 tiff 、tif 图像文件格式预览支持
+ 4. 新增依赖 highlightjs 代码文件预览高亮支持
+ 5. 新增 wps 文档预览支持
+ 6. 新增 stars 增长趋势图
+ 7. 新增启动完成,打印启动耗时、演示页访问地址
+ 8. 新增 kkFIleView 的 banner 信息
+ 9. 优化启动脚本
+ 10. 优化项目结构、优化 maven 结构
+ 11. 移除多余的 repositories 配置,移除针对 tomcat 的配置
+ 12. 优化下载文件 io 操作
+ 13. 修复:优化项目目录结构之后,windows下启动报错“找不到office组件”
+ 14. 修复:jodd.io.NetUtil.downloadFile下载大于16M文件报错问题
+
+
+
+
+
+

2021年1月28日,v3.3.1版本

@@ -228,7 +252,7 @@
-

2020年12月27日

+

2020年12月27日,v3.3.0版本

@@ -254,7 +278,21 @@
-

2020年05月20日

+

2020年08月12日,v2.2.1版本

+
+
+
+ 1. 支持纯文本预览原样格式输出
+ 2. 修复PDF预览出现文字缺失异常,升级pdf.js组件
+ 3. docker镜像底层使用ubuntu,镜像体积更小、构建更快
+ 4. 预览接口同时支持get和post请求
+ 5. 修复上传到demo中的压缩文件预览异常
+
+
+
+
+
+

2020年05月20日,v2.2.0版本

@@ -279,7 +317,7 @@
-

2019年06月18日

+

2019年06月20日

@@ -359,6 +397,5 @@
-
diff --git a/server/src/main/resources/web/main/sponsor.ftl b/server/src/main/resources/web/main/sponsor.ftl index 9a2cc7ca..57e87fe9 100644 --- a/server/src/main/resources/web/main/sponsor.ftl +++ b/server/src/main/resources/web/main/sponsor.ftl @@ -3,25 +3,13 @@ - + 赞助开源 - - - - - - - - @@ -30,23 +18,14 @@ @@ -54,16 +33,16 @@ <#-- 接入说明 -->
-
-     +
+ alipay    wxpay