Compare commits

...

90 Commits

Author SHA1 Message Date
kl
523623698a 4.2.0 release 2023-04-13 14:05:36 +08:00
kl
f714dffe70 4.2.0 release 2023-04-13 10:40:01 +08:00
kailing
7a9ad7546c !85 新增备案信息,禁止上传类型,删除支持密码功能
Merge pull request !85 from 高雄/master
2023-04-13 02:32:43 +00:00
高雄
138e58a1e1 修改删除提示错误
修改删除提示错误

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-11 01:39:31 +00:00
高雄
55ca17203f 支持删除密码,前端限制上传大小
支持删除密码,前端限制上传大小

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-11 01:38:08 +00:00
高雄
8916bee786 修改上传提示信息
修改上传提示信息

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-11 01:19:17 +00:00
高雄
c055d3d992 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:36:09 +00:00
高雄
7b699e08fc 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:35:15 +00:00
高雄
c7367dfcec 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:34:37 +00:00
高雄
75a46a14a8 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:33:22 +00:00
高雄
181897ec5a 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:32:51 +00:00
高雄
e5e9611646 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:32:26 +00:00
高雄
78d517a16e 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:31:58 +00:00
高雄
e855c9c7ed 新增备案信息,禁止上传类型,删除支持密码功能
新增备案信息,禁止上传类型,删除支持密码功能

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 09:30:07 +00:00
kailing
195f56e9b9 !84 新增 支持压缩包密码 修复压缩包LINUX下中文乱码 解压支持文件目录 统一JQ文件 精简一些代码
Merge pull request !84 from 高雄/master
2023-04-10 03:32:42 +00:00
高雄
888e550453 精简压缩包解析的无用代码
精简压缩包解析的无用代码

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 03:26:51 +00:00
高雄
f771d361ae 精简压缩包解析的无用代码
精简压缩包解析的无用代码

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-10 03:16:55 +00:00
高雄
2cd23b06f1 TIF转换修改 1转换PDF保留缓存 代码精简优化
TIF转换修改 1转换PDF保留缓存 代码精简优化

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-08 06:07:09 +00:00
高雄
75e568e15f 新增 支持压缩包密码 修复压缩包LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复压缩包LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-08 05:45:17 +00:00
高雄
60b91eb79f 新增 支持压缩包密码 修复压缩包LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复压缩包LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-08 05:44:52 +00:00
高雄
dd7a6465aa 压缩包 编码工具类
压缩包 编码工具类

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-08 05:44:10 +00:00
高雄
4cd6a4e4b9 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-08 05:43:02 +00:00
高雄
3942346f49 修复OFD页码只能显示10页的问题
修复OFD页码只能显示10页的问题

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-08 01:08:08 +00:00
高雄
e697c255fc 删除文件 server/src/main/resources/static/ofd/js/cnofd.umd.min.js 2023-04-08 01:07:43 +00:00
高雄
65fa326262 修复OFD页码只能显示10页的问题
修复OFD页码只能显示10页的问题

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-08 01:06:46 +00:00
高雄
81043034f9 删除文件 server/src/main/resources/static/ofd/js/cnofd.umd.min.js 2023-04-08 01:06:02 +00:00
高雄
6c5bceba41 TIF转换修改 1转换PDF保留缓存 代码精简优化
TIF转换修改 1转换PDF保留缓存 代码精简优化

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-04 01:13:03 +00:00
高雄
b524963892 删除文件 server/src/main/resources/static/xmind/js/jquery-3-c9f5aeeca3.2.1.min.js 2023-04-03 07:15:32 +00:00
高雄
dd4997cedc 删除不用的xmind组件
删除不用的xmind组件

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:15:22 +00:00
高雄
ead5505d53 支持IE的base64组件
支持IE的base64组件

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:14:33 +00:00
高雄
bf6cee4a6a 删除文件 server/src/main/resources/static/pptx/jquery-3.5.1.min.js 2023-04-03 07:13:43 +00:00
高雄
bd458bfbe9 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:13:30 +00:00
高雄
7895597176 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:12:51 +00:00
高雄
a44e5ba518 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:12:05 +00:00
高雄
cc7da00001 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:11:14 +00:00
高雄
41449aeea6 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:10:22 +00:00
高雄
33277bc457 修复TIF转换pdf问题
修复TIF转换pdf问题

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:09:30 +00:00
高雄
f2cfb4cf4a 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:08:33 +00:00
高雄
d646d72a26 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:08:04 +00:00
高雄
1807dbd615 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:07:30 +00:00
高雄
1e771ed649 新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录
新增 支持压缩包密码 修复LINUX下中文乱码 解压支持文件目录

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 07:06:46 +00:00
高雄
83d04ca45d 更新TIF转换PDF插件
更新TIF转换PDF插件

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 05:36:10 +00:00
高雄
ee2dadb40d 更新TIF转换PDF插件
更新TIF转换PDF插件

Signed-off-by: 高雄 <admin@cxcp.com>
2023-04-03 05:35:38 +00:00
kl
c9eb51213f Update README.cn.md 2023-03-31 12:25:29 +08:00
kl
81f28baabf Merge remote-tracking branch 'origin/master' 2023-03-31 12:22:39 +08:00
kl
1245e9f327 Update documentation 2023-03-31 12:22:34 +08:00
kl
007889339b Update README.md (#449) 2023-03-31 12:18:49 +08:00
kl
9cf5e8691d Update documentation 2023-03-31 12:13:13 +08:00
kl
ff1bfe5f98 Update documentation 2023-03-31 12:02:29 +08:00
kl
c2c870668b Refactoring the code for file uploads 2023-03-29 15:51:17 +08:00
kailing
b7ed284ae9 !78 修复OFD解析失败问题
Merge pull request !78 from 高雄/master
2023-03-25 02:38:05 +00:00
高雄
e33db39494 update server/src/main/resources/static/ofd/js/cnofd-view.js.
修复OFD解析失败问题

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-25 01:00:33 +00:00
kl
f13cccf5a6 Get the file list sorted in descending order 2023-03-24 13:41:19 +08:00
kailing
c355c915f8 !77 xlsm等格式类型转换成HTML
Merge pull request !77 from 高雄/master
2023-03-21 08:16:43 +00:00
高雄
92a95db34c 更新OFD组件为最新版本
Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-21 08:10:56 +00:00
高雄
1a821706ee 删除文件 server/src/main/resources/static/ofd/js/cnofd.umd.min.js 2023-03-21 08:10:03 +00:00
高雄
604e118036 update server/src/main/resources/static/ofd/js/cnofd-view.js.
更新OFD组件

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-21 08:06:40 +00:00
高雄
871a83e3b5 update server/src/main/resources/static/ofd/index.html.
更新OFD解析组件为1.4.1

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-21 08:05:50 +00:00
高雄
6d3f9e7cfc update server/src/main/java/cn/keking/service/impl/OfficeFilePreviewImpl.java.
规范转换格式

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-21 06:02:40 +00:00
kailing
b5e281a3b1 !76 修复安全限制 代码继续执行的问题
Merge pull request !76 from 高雄/master
2023-03-20 07:46:07 +00:00
高雄
60d9ef7069 update server/src/main/java/cn/keking/config/WebConfig.java.
加入安全限制

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-20 07:39:14 +00:00
高雄
98a7217b10 update server/src/main/java/cn/keking/web/filter/TrustHostFilter.java.
修复开启信任站点 继续执行

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-20 07:28:03 +00:00
高雄
a867effa68 update server/src/main/java/cn/keking/utils/DownloadUtils.java.
调整下载报错

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-20 07:26:23 +00:00
kl
058ebd8274 Optimised home page UI 2023-03-17 19:43:33 +08:00
kl
784eec99de Update README.cn.md 2023-03-15 14:00:44 +08:00
kailing
3e2e330fcb !75 修复xlsx7.4以上版本 乱码
Merge pull request !75 from 高雄/master
2023-03-15 02:46:03 +00:00
高雄
e50a664e64 update server/src/main/java/cn/keking/service/FileHandlerService.java.
修复LibreOffice7.4以上版本 出现乱码

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-15 02:40:32 +00:00
高雄
94503ddc39 update server/src/main/java/cn/keking/service/FileHandlerService.java.
修复xlsx7.4以上版本 乱码

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-15 02:34:52 +00:00
kl
99bdeef754 Add sponsored access and remove unused codes 2023-03-14 17:42:17 +08:00
kl
e08c41baa9 Modify demo site address (#443)
* Add workflow bpmn file preview support

* Adjusting the home page

* Modify demo site address
2023-03-14 15:19:04 +08:00
kl
ca9eefb80b Adjusting the home page (#442)
* Add workflow bpmn file preview support

* Adjusting the home page
2023-03-14 14:54:40 +08:00
kailing
4962b8b3ca !74 新增dotx文件类型支持
Merge pull request !74 from 高雄/master
2023-03-11 02:22:17 +00:00
高雄
eb372686e6 update server/src/main/java/cn/keking/model/FileType.java.
新增dotx文件类型支持

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-11 01:07:24 +00:00
高雄
daf506e1bd update README.cn.md.
Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-11 01:05:15 +00:00
高雄
b239d5b440 update README.md.
新增dotx文件支持

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-11 01:04:35 +00:00
kl
09a3fd2db8 Add workflow bpmn file preview support (#441) 2023-03-09 21:00:03 +08:00
kailing
eb12ced77f !73 更新组件,新增dotm,ett,xlt,xltm,wpt,dot,xlam,xla 格式支持
Merge pull request !73 from 高雄/master
2023-03-09 10:00:22 +00:00
高雄
5521386781 update README.md.
Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-09 08:59:46 +00:00
高雄
24698be8be update README.cn.md.
Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-09 08:58:51 +00:00
高雄
6183e8c3e5 update server/src/main/java/cn/keking/model/FileType.java.
新增dotm,ett,xlt,xltm,wpt,dot,xlam,xla 格式支持

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-09 08:39:43 +00:00
高雄
cdc146747b update pom.xml.
更新组件

Signed-off-by: 高雄 <admin@cxcp.com>
2023-03-09 08:37:36 +00:00
kl
ca9fcf6cf6 Update documentation 2023-03-09 13:02:46 +08:00
陈精华
daa081d46d !70 修正PDF转图片,内存无法回收导致的OOM
Merge pull request !70 from SawyerYong/N/A
2023-03-08 05:55:45 +00:00
kl
be23560ee4 Merge remote-tracking branch 'origin/master' 2023-03-08 11:27:35 +08:00
kl
134ff34c5e Disable the delete button 2023-03-08 11:27:24 +08:00
kl
f9e5fd01be Update README.cn.md 2023-03-06 22:55:37 +08:00
kl
e278d8f049 Update README.md 2023-03-06 22:55:11 +08:00
kl
7a25e0cb34 Update documentation 2023-03-06 18:09:43 +08:00
kl
e25cc2e47c Fixes an issue with xmind file preview in certain deployment scenarios (#439) 2023-03-06 14:27:36 +08:00
SawyerYong
8cb310ef93 修正PDF转图片,内存无法回收导致的OOM
Signed-off-by: SawyerYong <dev_yongs@163.com>
2023-02-18 07:27:35 +00:00
81 changed files with 66854 additions and 27385 deletions

View File

@@ -1,5 +1,5 @@
FROM keking/kkfileview-jdk:4.1.1
MAINTAINER chenjh "842761733@qq.com"
ADD server/target/kkFileView-*.tar.gz /opt/
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.2.0-SNAPSHOT/bin
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.2.0-SNAPSHOT/config/application.properties","-jar","/opt/kkFileView-4.2.0-SNAPSHOT/bin/kkFileView-4.2.0-SNAPSHOT.jar"]
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-4.2.0/bin
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dspring.config.location=/opt/kkFileView-4.2.0/config/application.properties","-jar","/opt/kkFileView-4.2.0/bin/kkFileView-4.2.0.jar"]

View File

@@ -1,14 +1,16 @@
# kkFileView
文档在线预览项目解决方案项目使用流行的spring boot搭建易上手和部署万能的文件预览开源项目基本支持主流文档格式预览
1. 支持 doc, docx, xls, xlsx, xlsm, ppt, pptx, csv, tsv Office 办公文档
2. 支持 wps, dps, et 等国产 WPS Office 办公文档
1. 支持 doc, docx, xls, xlsx, xlsm, ppt, pptx, csv, tsv, dotm, xlt, xltm, dot, dotx,xlam, xla Office 办公文档
2. 支持 wps, dps, et, ett, wpt 等国产 WPS Office 办公文档
3. 支持 odt, ods, ots, odp, otp, six, ott, fodt, fods 等OpenOfficeLibreOffice 办公文档
4. 支持 vsd, vsdx Visio 流程图文件
5. 支持 wmf, emf Windows 系统图像文件
6. 支持 psd Photoshop 软件模型文件
7. 支持 pdf ,ofd, rtf 等文档
8. 支持 xmind 软件模型文件
9. 支持 eml, epub 文档类型文件
9. 支持 bpmn 工作流文件
9. 支持 eml 邮件文件
10. 支持 epub 图书文档
10. 支持 obj, 3ds, stl, ply, gltf, glb, off, 3dm, fbx, dae, wrl, 3mf, ifc, brep, step, iges, fcstd, bim 3D 模型文件
11. 支持 dwg, dxf CAD 模型文件
12. 支持 txt, xml(渲染), md(渲染), java, php, py, js, css 等所有纯文本
@@ -17,7 +19,8 @@
15. 支持 tif, tiff 图信息模型文件
16. 支持 tga 图像格式文件
17. 支持 svg 矢量图像格式文件
18. 支持 avi, mov, wmv, mkv, 3gp, rm 众多音视频格式文件
18. 支持 mp3,wav,mp4,flv 等音视频格式文件
19. 支持 avi,mov,rm,webm,ts,rm,mkv,mpeg,ogg,mpg,rmvb,wmv,3gp,ts,swf 等视频格式转码预览
> 基于当前良好的架构模式支持的文件类型在进一步丰富中
### 项目特性
@@ -34,7 +37,7 @@
### 在线体验
> 请善待公共服务会不定时停用
地址[https://kkview.cn/preview/index](https://kkview.cn/preview/index)
地址[https://file.kkview.cn](https://file.kkview.cn)
### 项目文档Project documentation
1. 详细wiki文档https://gitee.com/kekingcn/file-online-preview/wikis/pages
@@ -44,8 +47,7 @@
### 联系我们加入组织
> 我们会用心回答解决大家在项目使用中的问题也请大家在提问前至少 Google baidu 珍爱生命远离无效的交流沟通
![](./doc/知识星球.png)
<img src="./doc/gitee星球.png/" width="60%">
### 文档预览效果
#### 1. 文本预览
@@ -275,7 +277,7 @@ epub 引用于 [ epub.js](https://github.com/futurepress/epub.js) 开源协议
[![Stargazers over time](https://starchart.cc/kekingcn/kkFileView.svg)](https://starchart.cc/kekingcn/kkFileView)
### 鸣谢
- 本项目诞生于[凯京集团]在取得公司高层同意后以 Apache 协议开源出来反哺社区在此特别感谢凯京集团以及集团领导@唐老大的支持@端木详笑的贡献
- 本项目诞生于[凯京集团]在取得公司高层同意后以 Apache 协议开源出来反哺社区在此特别感谢凯京集团以及集团领导[@唐老大](https://github.com/tangshd)的支持、@端木详笑的贡献。
- 本项目已脱离公司由[KK开源社区]维护发展壮大感谢所有给 kkFileView Issue Pr 开发者
- 本项目引入的第三方组件已在 '关于引用' 列表列出感谢这些项目 kkFileView 更出色

View File

@@ -4,15 +4,17 @@
Document online preview project solution, built using the popular Spring Boot framework for easy setup and deployment. This versatile open source project provides basic support for a wide range of document formats, including:
1. Supports Office documents such as `doc`, `docx`, `xls`, `xlsx`, `xlsm`, `ppt`, `pptx`, `csv`, `tsv`, etc.
2. Supports domestic WPS Office documents such as `wps`, `dps`, et.
1. Supports Office documents such as `doc`, `docx`, `xls`, `xlsx`, `xlsm`, `ppt`, `pptx`, `csv`, `tsv`, , `dotm`, `xlt`, `xltm`, `dot`, `xlam`, `dotx`, `xla,` etc.
2. Supports domestic WPS Office documents such as `wps`, `dps`, `et` , `ett`, ` wpt`.
3. Supports OpenOffice, LibreOffice office documents such as `odt`, `ods`, `ots`, `odp`, `otp`, `six`, `ott`, `fodt` and `fods`.
4. Supports Visio flowchart files such as `vsd`, `vsdx`.
5. Supports Windows system image files such as `wmf`, `emf`.
6. Supports Photoshop software model files such as `psd`.
7. Supports document formats like `pdf`, `ofd`, and `rtf`.
8. Supports software model files like `xmind`.
9. Supports document type files such as `eml`, `epub`.
8. Supports software model files like `xmind`.
9. Support for `bpmn` workflow files.
9. Support for `eml` mail files
10. Support for `epub` book documents
10. Supports 3D model files like `obj`, `3ds`, `stl`, `ply`, `gltf`, `glb`, `off`, `3dm`, `fbx`, `dae`, `wrl`, `3mf`, `ifc`, `brep`, `step`, `iges`, `fcstd`, `bim`, etc.
11. Supports CAD model files such as `dwg`, `dxf`.
12. Supports all plain text files such as `txt`, `xml` (rendering), `md` (rendering), `java`, `php`, `py`, `js`, `css`, etc.
@@ -37,7 +39,12 @@ URL[https://kkview.cn](https://kkview.cn/)
### Live demo
> Please treat public service kindly, or this would stop at any time.
URL[https://kkview.cn/preview/index](https://kkview.cn/preview/index)
URL[https://file.kkview.cn](https://file.kkview.cn)
### Contact Us
> We will answer your questions carefully and solve any problems you encounter while using the project. We also kindly ask that you at least Google or Baidu before asking questions in order to save time and avoid ineffective communication. Let's cherish our lives and stay away from ineffective communication.
<img src="./doc/github星球.png/" width="50%">
### Quick Start
> Technology stack

BIN
doc/gitee星球.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 156 KiB

BIN
doc/github星球.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 148 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

12
pom.xml
View File

@@ -6,24 +6,24 @@
<groupId>cn.keking</groupId>
<artifactId>kkFileView-parent</artifactId>
<version>4.2.0-SNAPSHOT</version>
<version>4.2.0</version>
<properties>
<java.version>1.8</java.version>
<jodconverter.version>4.4.5</jodconverter.version>
<jodconverter.version>4.4.6</jodconverter.version>
<spring.boot.version>2.4.2</spring.boot.version>
<poi.version>5.2.2</poi.version>
<xdocreport.version>1.0.6</xdocreport.version>
<xstream.version>1.4.19</xstream.version>
<junrar.version>7.4.1</junrar.version>
<xstream.version>1.4.20</xstream.version>
<junrar.version>7.5.4</junrar.version>
<redisson.version>3.2.0</redisson.version>
<sevenzipjbinding.version>16.02-2.01</sevenzipjbinding.version>
<jchardet.version>1.0</jchardet.version>
<antlr.version>2.7.7</antlr.version>
<concurrentlinkedhashmap.version>1.4.2</concurrentlinkedhashmap.version>
<rocksdb.version>5.17.2</rocksdb.version>
<pdfbox.version>2.0.26</pdfbox.version>
<pdfbox.version>2.0.27</pdfbox.version>
<jai-imageio.version>1.4.0</jai-imageio.version>
<jbig2-imageio.version>3.0.4</jbig2-imageio.version>
<galimatias.version>0.2.1</galimatias.version>
@@ -31,7 +31,7 @@
<opencv.version>4.1.2-1.5.2</opencv.version>
<openblas.version>0.3.6-1.5.1</openblas.version>
<ffmpeg.version>4.2.1-1.5.2</ffmpeg.version>
<itext.version>2.1.7</itext.version>
<itextpdf.version>5.5.13.3</itextpdf.version>
<httpclient.version>3.1</httpclient.version>
<commons-cli.version>1.2</commons-cli.version>

View File

@@ -6,7 +6,7 @@
<parent>
<artifactId>kkFileView-parent</artifactId>
<groupId>cn.keking</groupId>
<version>4.2.0-SNAPSHOT</version>
<version>4.2.0</version>
</parent>
<artifactId>kkFileView</artifactId>
@@ -244,10 +244,10 @@
<classifier>windows-x86_64</classifier>
</dependency>
<dependency>
<groupId>com.lowagie</groupId>
<artifactId>itext</artifactId>
<version>${itext.version}</version>
</dependency>
<groupId>com.itextpdf</groupId>
<artifactId>itextpdf</artifactId>
<version>${itextpdf.version}</version>
</dependency>
<dependency>
<groupId>javax.media</groupId>
@@ -338,4 +338,4 @@
</plugin>
</plugins>
</build>
</project>
</project>

View File

@@ -7,4 +7,4 @@ echo Please check log file in ../log/kkFileView.log for more information
echo You can get help in our official home site: https://kkview.cn
echo If you need further help, please join our kk opensource community: https://t.zsxq.com/09ZHSXbsQ
echo If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers
java -Dspring.config.location=..\config\application.properties -jar kkFileView-4.2.0-SNAPSHOT.jar -> ..\log\kkFileView.log
java -Dspring.config.location=..\config\application.properties -jar kkFileView-4.2.0.jar -> ..\log\kkFileView.log

View File

@@ -51,7 +51,7 @@ else
## 启动kkFileView
echo "Starting kkFileView..."
nohup java -Dfile.encoding=UTF-8 -Dspring.config.location=../config/application.properties -jar kkFileView-4.2.0-SNAPSHOT.jar > ../log/kkFileView.log 2>&1 &
nohup java -Dfile.encoding=UTF-8 -Dspring.config.location=../config/application.properties -jar kkFileView-4.2.0.jar > ../log/kkFileView.log 2>&1 &
echo "Please execute ./showlog.sh to check log for more information"
echo "You can get help in our official home site: https://kkview.cn"
echo "If you need further help, please join our kk opensource community: https://t.zsxq.com/09ZHSXbsQ"

View File

@@ -2,8 +2,9 @@
server.port = ${KK_SERVER_PORT:8012}
server.servlet.context-path= ${KK_CONTEXT_PATH:/}
server.servlet.encoding.charset = utf-8
#文件上传限制
#文件上传限制前端
spring.servlet.multipart.max-file-size=500MB
#文件上传限制
spring.servlet.multipart.max-request-size=500MB
## Freemarker 配置
spring.freemarker.template-loader-path = classpath:/web/
@@ -117,3 +118,9 @@ watermark.angle = ${WATERMARK_ANGLE:10}
#Tif类型图片浏览模式tif利用前端js插件浏览jpg转换为jpg后前端显示pdf转换为pdf后显示便于打印
tif.preview.type = ${KK_TIF_PREVIEW_TYPE:tif}
# 备案信息
BeiAn =
#禁止上传类型
prohibit =exe,dll,dat
#删除密码
sc.password =123456

View File

@@ -42,6 +42,10 @@ public class ConfigConstants {
private static String pdfBookmarkDisable;
private static Boolean fileUploadDisable;
private static String tifPreviewType;
private static String BeiAn;
private static String[] prohibit= {};
private static String size;
private static String password;
public static final String DEFAULT_CACHE_ENABLED = "true";
public static final String DEFAULT_TXT_TYPE = "txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd";
@@ -62,6 +66,10 @@ public class ConfigConstants {
public static final String DEFAULT_PDF_BOOKMARK_DISABLE = "true";
public static final String DEFAULT_FILE_UPLOAD_DISABLE = "false";
public static final String DEFAULT_TIF_PREVIEW_TYPE = "tif";
public static final String DEFAULT_BeiAn_DISABLE = "";
public static final String DEFAULT_size_DISABLE = "500MB";
public static final String DEFAULT_prohibit_DISABLE = "exe,dll";
public static final String DEFAULT_password_DISABLE = "123456";
public static Boolean isCacheEnabled() {
return cacheEnabled;
@@ -353,4 +361,49 @@ public class ConfigConstants {
public static void setTifPreviewTypeValue(String tifPreviewType) {
ConfigConstants.tifPreviewType = tifPreviewType;
}
public static String getBeiAn() {
return BeiAn;
}
@Value("${BeiAn:无}")
public void setBeiAn(String BeiAn) {
setBeiAnValue(BeiAn);
}
public static void setBeiAnValue(String BeiAn) {
ConfigConstants.BeiAn = BeiAn;
}
public static String[] getprohibit() {
return prohibit;
}
@Value("${prohibit:exe,dll}")
public void setprohibit(String prohibit) {
String[] prohibittArr = prohibit.split(",");
setprohibitValue(prohibittArr);
}
public static void setprohibitValue(String[] prohibit) {
ConfigConstants.prohibit = prohibit;
}
public static String maxsize() {
return size;
}
@Value("${spring.servlet.multipart.max-file-size:500MB}")
public void setsize(String size) {
setsizeValue(size);
}
public static void setsizeValue(String size) {
ConfigConstants.size = size;
}
public static String getpassword() {
return password;
}
@Value("${sc.password:123456}")
public void setpassword(String password) {
setpasswordValue(password);
}
public static void setpasswordValue(String password) {
ConfigConstants.password = password;
}
}

View File

@@ -53,7 +53,11 @@ public class ConfigRefreshComponent {
String pdfBookmarkDisable;
boolean fileUploadDisable;
String tifPreviewType;
String prohibit;
String[] prohibitArray;
String BeiAn;
String size;
String password;
while (true) {
FileReader fileReader = new FileReader(configFilePath);
BufferedReader bufferedReader = new BufferedReader(fileReader);
@@ -78,6 +82,11 @@ public class ConfigRefreshComponent {
pdfBookmarkDisable = properties.getProperty("pdf.bookmark.disable", ConfigConstants.DEFAULT_PDF_BOOKMARK_DISABLE);
fileUploadDisable = Boolean.parseBoolean(properties.getProperty("file.upload.disable", ConfigConstants.DEFAULT_FILE_UPLOAD_DISABLE));
tifPreviewType = properties.getProperty("tif.preview.type", ConfigConstants.DEFAULT_TIF_PREVIEW_TYPE);
size = properties.getProperty("spring.servlet.multipart.max-file-size", ConfigConstants.DEFAULT_size_DISABLE);
BeiAn = properties.getProperty("BeiAn", ConfigConstants.DEFAULT_BeiAn_DISABLE);
prohibit = properties.getProperty("prohibit", ConfigConstants.DEFAULT_prohibit_DISABLE);
password = properties.getProperty("sc.password", ConfigConstants.DEFAULT_password_DISABLE);
prohibitArray = prohibit.split(",");
ConfigConstants.setCacheEnabledValueValue(cacheEnabled);
ConfigConstants.setSimTextValue(textArray);
@@ -96,6 +105,10 @@ public class ConfigRefreshComponent {
ConfigConstants.setPdfBookmarkDisableValue(pdfBookmarkDisable);
ConfigConstants.setFileUploadDisableValue(fileUploadDisable);
ConfigConstants.setTifPreviewTypeValue(tifPreviewType);
ConfigConstants.setBeiAnValue(BeiAn);
ConfigConstants.setsizeValue(size);
ConfigConstants.setprohibitValue(prohibitArray);
ConfigConstants.setpasswordValue(password);
setWatermarkConfig(properties);
bufferedReader.close();
fileReader.close();

View File

@@ -43,6 +43,7 @@ public class WebConfig implements WebMvcConfigurer {
Set<String> filterUri = new HashSet<>();
filterUri.add("/onlinePreview");
filterUri.add("/picturesPreview");
filterUri.add("/getCorsFile");
TrustHostFilter filter = new TrustHostFilter();
FilterRegistrationBean<TrustHostFilter> registrationBean = new FilterRegistrationBean<>();
registrationBean.setFilter(filter);
@@ -67,6 +68,7 @@ public class WebConfig implements WebMvcConfigurer {
public FilterRegistrationBean<BaseUrlFilter> getBaseUrlFilter() {
Set<String> filterUri = new HashSet<>();
filterUri.add("/index");
filterUri.add("/");
filterUri.add("/onlinePreview");
filterUri.add("/picturesPreview");
BaseUrlFilter filter = new BaseUrlFilter();
@@ -80,6 +82,7 @@ public class WebConfig implements WebMvcConfigurer {
public FilterRegistrationBean<AttributeSetFilter> getWatermarkConfigFilter() {
Set<String> filterUri = new HashSet<>();
filterUri.add("/index");
filterUri.add("/");
filterUri.add("/onlinePreview");
filterUri.add("/picturesPreview");
AttributeSetFilter filter = new AttributeSetFilter();

View File

@@ -29,9 +29,10 @@ public enum FileType {
Online3D("online3DFilePreviewImpl"),
XMIND("xmindFilePreviewImpl"),
SVG("svgFilePreviewImpl"),
Epub("epubFilePreviewImpl");
Epub("epubFilePreviewImpl"),
BPMN("bpmnFilePreviewImpl");
private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "docm", "xls", "xlsx", "csv" ,"xlsm", "ppt", "pptx", "vsd", "rtf", "odt", "wmf", "emf", "dps", "et", "ods", "ots", "tsv", "odp", "otp", "sxi", "ott", "vsdx", "fodt", "fods", "xltx","tga","psd"};
private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "docm", "xls", "xlsx", "csv" ,"xlsm", "ppt", "pptx", "vsd", "rtf", "odt", "wmf", "emf", "dps", "et", "ods", "ots", "tsv", "odp", "otp", "sxi", "ott", "vsdx", "fodt", "fods", "xltx","tga","psd","dotm","ett","xlt","xltm","wpt","dot","xlam","dotx","xla"};
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "jfif", "webp"};
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
private static final String[] Online3D_TYPES = {"obj", "3ds", "stl", "ply", "off", "3dm", "fbx", "dae", "wrl", "3mf", "ifc","glb","o3dv","gltf","stp","bim","fcstd","step","iges","brep"};
@@ -98,6 +99,7 @@ public enum FileType {
FILE_TYPE_MAPPER.put("xml", FileType.XML);
FILE_TYPE_MAPPER.put("pdf", FileType.PDF);
FILE_TYPE_MAPPER.put("flv", FileType.FLV);
FILE_TYPE_MAPPER.put("bpmn", FileType.BPMN);
}
private static FileType to(String fileType) {

View File

@@ -2,31 +2,22 @@ package cn.keking.service;
import cn.keking.config.ConfigConstants;
import cn.keking.model.FileType;
import cn.keking.utils.FileHeaderRar;
import cn.keking.utils.KkFileUtils;
import cn.keking.utils.RarUtils;
import cn.keking.web.filter.BaseUrlFilter;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.github.junrar.Archive;
import com.github.junrar.exception.RarException;
import com.github.junrar.rarfile.FileHeader;
import net.sf.sevenzipjbinding.*;
import net.sf.sevenzipjbinding.ExtractOperationResult;
import net.sf.sevenzipjbinding.IInArchive;
import net.sf.sevenzipjbinding.SevenZip;
import net.sf.sevenzipjbinding.SevenZipException;
import net.sf.sevenzipjbinding.impl.RandomAccessFileInStream;
import net.sf.sevenzipjbinding.simple.ISimpleInArchive;
import net.sf.sevenzipjbinding.simple.ISimpleInArchiveItem;
import org.apache.commons.io.IOUtils;
import org.springframework.stereotype.Component;
import java.io.*;
import java.math.BigDecimal;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.text.CollationKey;
import java.text.Collator;
import java.util.*;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.ArrayList;
import java.util.List;
/**
* @author yudian-it
@@ -34,171 +25,61 @@ import java.util.stream.Collectors;
*/
@Component
public class CompressFileReader {
private static final Pattern pattern = Pattern.compile("^\\d+");
private final FileHandlerService fileHandlerService;
private final String fileDir = ConfigConstants.getFileDir();
private final ExecutorService executors = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
public CompressFileReader(FileHandlerService fileHandlerService) {
this.fileHandlerService = fileHandlerService;
}
public static byte[] getUTF8BytesFromGBKString(String gbkStr) {
int n = gbkStr.length();
byte[] utfBytes = new byte[3 * n];
int k = 0;
for (int i = 0; i < n; i++) {
int m = gbkStr.charAt(i);
if (m < 128 && m >= 0) {
utfBytes[k++] = (byte) m;
continue;
}
utfBytes[k++] = (byte) (0xe0 | (m >> 12));
utfBytes[k++] = (byte) (0x80 | ((m >> 6) & 0x3f));
utfBytes[k++] = (byte) (0x80 | (m & 0x3f));
}
if (k < utfBytes.length) {
byte[] tmp = new byte[k];
System.arraycopy(utfBytes, 0, tmp, 0, k);
return tmp;
}
return utfBytes;
}
public String getUtf8String(String str) {
if (str != null && str.length() > 0) {
String needEncodeCode = "ISO-8859-1";
String neeEncodeCode = "ISO-8859-2";
String gbkEncodeCode = "GBK";
try {
if (Charset.forName(needEncodeCode).newEncoder().canEncode(str)) {
str = new String(str.getBytes(needEncodeCode), StandardCharsets.UTF_8);
}
if (Charset.forName(neeEncodeCode).newEncoder().canEncode(str)) {
str = new String(str.getBytes(neeEncodeCode), StandardCharsets.UTF_8);
}
if (Charset.forName(gbkEncodeCode).newEncoder().canEncode(str)) {
str = new String(getUTF8BytesFromGBKString(str), StandardCharsets.UTF_8);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return str;
}
/**
* 判断是否是中日韩文字
*/
private static boolean isChinese(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
if (ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS) {
return true;
}
return false;
}
public static boolean judge(char c){
if((c >='0' && c<='9')||(c >='a' && c<='z' || c >='A' && c<='Z')){
return true;
}
return false;
}
public static boolean isMessyCode(String strName) {
//去除字符串中的空格 制表符 换行 回车
Pattern p = Pattern.compile("\\s*|\t*|\r*|\n*");
Matcher m = p.matcher(strName);
String after = m.replaceAll("").replaceAll("\\+", "").replaceAll("#", "").replaceAll("&", "");
//去除字符串中的标点符号
String temp = after.replaceAll("\\p{P}", "");
//处理之后转换成字符数组
char[] ch = temp.trim().toCharArray();
for (int i = 0; i < ch.length; i++) {
char c = ch[i];
//判断是否是数字或者英文字符
if (!judge(c)) {
//判断是否是中日韩文
if (!isChinese(c)) {
//如果不是数字或者英文字符也不是中日韩文则表示是乱码返回true
return true;
}
}
}
//表示不是乱码 返回false
return false;
}
public String unRar(String filePath, String fileKey) {
Map<String, FileNode> appender = new HashMap<>();
public String unRar(String paths, String passWord, String fileName) throws Exception {
List<String> imgUrls = new ArrayList<>();
String baseUrl = BaseUrlFilter.getBaseUrl();
try {
List<FileHeaderRar> items = getRar4Paths(filePath);
String archiveFileName = fileHandlerService.getFileNameFromPath(filePath);
List<Map<String, FileHeaderRar>> headersToBeExtract = new ArrayList<>();
for (FileHeaderRar header : items) {
String fullName = header.getFileNameW();
String originName = getLastFileName(fullName);
String childName = originName;
boolean directory = header.getDirectory();
if (!directory) {
childName = archiveFileName + "_" + originName;
headersToBeExtract.add(Collections.singletonMap(childName, header));
}
String parentName = getLast2FileName(fullName, archiveFileName);
FileType type = FileType.typeFromUrl(childName);
if (type.equals(FileType.PICTURE)) {
imgUrls.add(baseUrl + childName);
}
FileNode node =
new FileNode(originName, childName, parentName, new ArrayList<>(), directory, fileKey);
addNodes(appender, parentName, node);
appender.put(childName, node);
}
fileHandlerService.putImgCache(fileKey, imgUrls);
executors.submit(new RarExtractorWorker(headersToBeExtract, filePath));
return new ObjectMapper().writeValueAsString(appender.get(""));
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
public List<FileHeaderRar> getRar4Paths(String paths) {
String archiveFileName = fileHandlerService.getFileNameFromPath(paths);
RandomAccessFile randomAccessFile = null;
IInArchive inArchive = null;
List<FileHeaderRar> itemPath = null;
try {
randomAccessFile = new RandomAccessFile(paths, "r");
inArchive = SevenZip.openInArchive(null, new RandomAccessFileInStream(randomAccessFile));
String folderName = paths.substring(paths.lastIndexOf(File.separator) + 1);
String extractPath = paths.substring(0, paths.lastIndexOf(folderName));
inArchive.extract(null, false, new ExtractCallback(inArchive, extractPath, folderName + "_"));
ISimpleInArchive simpleInArchive = inArchive.getSimpleInterface();
itemPath = Arrays.stream(simpleInArchive.getArchiveItems()).map(o -> {
try {
String path = getUtf8String(o.getPath());
if (isMessyCode(path)){
path = new String(o.getPath().getBytes(StandardCharsets.ISO_8859_1), "GBK");
}
return new FileHeaderRar(path, o.isFolder());
} catch (SevenZipException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return null;
})
.collect(Collectors.toList())
.stream()
.sorted(Comparator.comparing(FileHeaderRar::getFileNameW))
.collect(Collectors.toList());
ISimpleInArchive simpleInArchive = inArchive.getSimpleInterface();
final String[] str = {null};
for (final ISimpleInArchiveItem item : simpleInArchive.getArchiveItems()) {
if (!item.isFolder()) {
ExtractOperationResult result;
result = item.extractSlow(data -> {
try {
str[0] = RarUtils.getUtf8String(item.getPath());
if (RarUtils.isMessyCode(str[0])){
str[0] = new String(item.getPath().getBytes(StandardCharsets.ISO_8859_1), "gbk");
}
str[0] = str[0].replace("\\", File.separator); //Linux 下路径错误
String str1 = str[0].substring(0, str[0].lastIndexOf(File.separator)+ 1);
File file = new File(extractPath, folderName + "_" + File.separator + str1);
if (!file.exists()) {
file.mkdirs();
}
OutputStream out = new FileOutputStream( extractPath+ folderName + "_" + File.separator + str[0], true);
IOUtils.write(data, out);
out.close();
} catch (Exception e) {
e.printStackTrace();
}
return data.length;
}, passWord);
if (result == ExtractOperationResult.OK) {
FileType type = FileType.typeFromUrl(str[0]);
if (type.equals(FileType.PICTURE)) {
// System.out.println( baseUrl +folderName + "_" + str[0]);
imgUrls.add(baseUrl +folderName + "_/" + str[0].replace("\\", "/"));
}
fileHandlerService.putImgCache(fileName, imgUrls);
} else {
return null;
}
}
}
return archiveFileName + "_";
} catch (Exception e) {
System.err.println("Error occurs: " + e);
throw new Exception(e);
} finally {
if (inArchive != null) {
try {
@@ -215,276 +96,6 @@ public class CompressFileReader {
}
}
}
return itemPath;
}
private void addNodes(Map<String, FileNode> appender, String parentName, FileNode node) {
if (appender.containsKey(parentName)) {
appender.get(parentName).getChildList().add(node);
appender.get(parentName).getChildList().sort(sortComparator);
} else {
// 根节点
FileNode nodeRoot = new FileNode(parentName, parentName, "", new ArrayList<>(), true);
nodeRoot.getChildList().add(node);
appender.put("", nodeRoot);
appender.put(parentName, nodeRoot);
}
}
private static String getLast2FileName(String fullName, String rootName) {
if (fullName.endsWith(File.separator)) {
fullName = fullName.substring(0, fullName.length() - 1);
}
// 1.获取剩余部分
int endIndex = fullName.lastIndexOf(File.separator);
String leftPath = fullName.substring(0, endIndex == -1 ? 0 : endIndex);
if (leftPath.length() > 1) {
// 2.获取倒数第二个
return getLastFileName(leftPath);
} else {
return rootName;
}
}
private static String getLastFileName(String fullName) {
if (fullName.endsWith(File.separator)) {
fullName = fullName.substring(0, fullName.length() - 1);
}
String newName = fullName;
if (fullName.contains(File.separator)) {
newName = fullName.substring(fullName.lastIndexOf(File.separator) + 1);
}
return newName;
}
public static Comparator<FileNode> sortComparator = new Comparator<FileNode>() {
final Collator cmp = Collator.getInstance(Locale.US);
@Override
public int compare(FileNode o1, FileNode o2) {
// 判断两个对比对象是否是开头包含数字,如果包含数字则获取数字并按数字真正大小进行排序
BigDecimal num1, num2;
if (null != (num1 = isStartNumber(o1))
&& null != (num2 = isStartNumber(o2))) {
return num1.subtract(num2).intValue();
}
CollationKey c1 = cmp.getCollationKey(o1.getOriginName());
CollationKey c2 = cmp.getCollationKey(o2.getOriginName());
return cmp.compare(c1.getSourceString(), c2.getSourceString());
}
};
private static BigDecimal isStartNumber(FileNode src) {
Matcher matcher = pattern.matcher(src.getOriginName());
if (matcher.find()) {
return new BigDecimal(matcher.group());
}
return null;
}
public static class FileNode {
private String originName;
private String fileName;
private String parentFileName;
private boolean directory;
//用于图片预览时寻址
private String fileKey;
private List<FileNode> childList;
public FileNode(String originName, String fileName, String parentFileName, List<FileNode> childList, boolean directory) {
this.originName = originName;
this.fileName = fileName;
this.parentFileName = parentFileName;
this.childList = childList;
this.directory = directory;
}
public FileNode(String originName, String fileName, String parentFileName, List<FileNode> childList, boolean directory, String fileKey) {
this.originName = originName;
this.fileName = fileName;
this.parentFileName = parentFileName;
this.childList = childList;
this.directory = directory;
this.fileKey = fileKey;
}
public String getFileKey() {
return fileKey;
}
public void setFileKey(String fileKey) {
this.fileKey = fileKey;
}
public String getFileName() {
return fileName;
}
public void setFileName(String fileName) {
this.fileName = fileName;
}
public String getParentFileName() {
return parentFileName;
}
public void setParentFileName(String parentFileName) {
this.parentFileName = parentFileName;
}
public List<FileNode> getChildList() {
return childList;
}
public void setChildList(List<FileNode> childList) {
this.childList = childList;
}
@Override
public String toString() {
try {
return new ObjectMapper().writeValueAsString(this);
} catch (JsonProcessingException e) {
e.printStackTrace();
return "";
}
}
public String getOriginName() {
return originName;
}
public void setOriginName(String originName) {
this.originName = originName;
}
public boolean isDirectory() {
return directory;
}
public void setDirectory(boolean directory) {
this.directory = directory;
}
}
class RarExtractorWorker implements Runnable {
private final List<Map<String, FileHeader>> headersToBeExtracted;
private final List<Map<String, FileHeaderRar>> headersToBeExtract;
private final Archive archive;
/**
* 用以删除源文件
*/
private final String filePath;
public RarExtractorWorker(
List<Map<String, FileHeader>> headersToBeExtracted, Archive archive, String filePath) {
this.headersToBeExtracted = headersToBeExtracted;
this.archive = archive;
this.filePath = filePath;
headersToBeExtract = null;
}
public RarExtractorWorker(
List<Map<String, FileHeaderRar>> headersToBeExtract, String filePath) {
this.headersToBeExtract = headersToBeExtract;
this.filePath = filePath;
archive = null;
headersToBeExtracted = null;
}
@Override
public void run() {
for (Map<String, FileHeader> entryMap : headersToBeExtracted) {
String childName = entryMap.keySet().iterator().next();
extractRarFile(childName, entryMap.values().iterator().next(), archive);
}
try {
archive.close();
} catch (IOException e) {
e.printStackTrace();
}
KkFileUtils.deleteFileByPath(filePath);
}
private void extractRarFile(String childName, FileHeader header, Archive archive) {
String outPath = fileDir + childName;
try (OutputStream ot = new FileOutputStream(outPath)) {
archive.extractFile(header, ot);
} catch (IOException | RarException e) {
e.printStackTrace();
}
}
}
private static class ExtractCallback implements IArchiveExtractCallback {
private final IInArchive inArchive;
private final String extractPath;
private final String folderName;
public ExtractCallback(IInArchive inArchive, String extractPath, String folderName) {
this.inArchive = inArchive;
if (!extractPath.endsWith("/") && !extractPath.endsWith("\\")) {
extractPath += File.separator;
}
this.extractPath = extractPath;
this.folderName = folderName;
}
@Override
public void setTotal(long total) {
}
@Override
public void setCompleted(long complete) {
}
@Override
public ISequentialOutStream getStream(int index, ExtractAskMode extractAskMode) throws SevenZipException {
String filePath = inArchive.getStringProperty(index, PropID.PATH);
String real = folderName + filePath.substring(filePath.lastIndexOf(File.separator) + 1);
File f = new File(extractPath + real);
f.delete();
return data -> {
FileOutputStream fos = null;
try {
File path = new File(extractPath + real);
if (!path.getParentFile().exists()) {
path.getParentFile().mkdirs();
}
if (!path.exists()) {
path.createNewFile();
}
fos = new FileOutputStream(path, true);
fos.write(data);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (fos != null) {
fos.flush();
fos.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
return data.length;
};
}
@Override
public void prepareOperation(ExtractAskMode extractAskMode) {
}
@Override
public void setOperationResult(ExtractOperationResult extractOperationResult) {
}
}
}

View File

@@ -4,13 +4,14 @@ import cn.keking.config.ConfigConstants;
import cn.keking.model.FileAttribute;
import cn.keking.model.FileType;
import cn.keking.service.cache.CacheService;
import cn.keking.service.cache.NotResourceCache;
import cn.keking.utils.EncodingDetects;
import cn.keking.utils.KkFileUtils;
import cn.keking.utils.WebUtils;
import com.aspose.cad.CodePages;
import com.aspose.cad.Color;
import com.aspose.cad.Image;
import com.aspose.cad.LoadOptions;
import com.aspose.cad.fileformats.cad.CadDrawTypeMode;
import com.aspose.cad.imageoptions.CadRasterizationOptions;
import com.aspose.cad.imageoptions.PdfOptions;
import org.apache.pdfbox.pdmodel.PDDocument;
@@ -26,6 +27,8 @@ import org.springframework.util.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.awt.image.BufferedImage;
import java.io.*;
import java.net.URL;
import java.net.URLDecoder;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
@@ -40,8 +43,6 @@ import java.util.Map;
public class FileHandlerService {
private final Logger logger = LoggerFactory.getLogger(FileHandlerService.class);
private static final String DEFAULT_CONVERTER_CHARSET = System.getProperty("sun.jnu.encoding");
private final String fileDir = ConfigConstants.getFileDir();
private final CacheService cacheService;
@@ -141,9 +142,10 @@ public class FileHandlerService {
* @param outFilePath 文件绝对路径
*/
public void doActionConvertedFile(String outFilePath) {
String charset = EncodingDetects.getJavaEncode(outFilePath);
StringBuilder sb = new StringBuilder();
try (InputStream inputStream = new FileInputStream(outFilePath);
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, DEFAULT_CONVERTER_CHARSET))) {
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, charset))) {
String line;
while (null != (line = reader.readLine())) {
if (line.contains("charset=gb2312")) {
@@ -198,6 +200,7 @@ public class FileHandlerService {
return null;
}
PDDocument doc = PDDocument.load(pdfFile);
doc.setResourceCache(new NotResourceCache());
int pageCount = doc.getNumberOfPages();
PDFRenderer pdfRenderer = new PDFRenderer(doc);
@@ -272,6 +275,14 @@ public class FileHandlerService {
FileType type;
String fileName;
String fullFileName = WebUtils.getUrlParameterReg(url, "fullfilename");
String urlStrr = null;
URL urll;
try {
urll = new URL(url);
urlStrr = URLDecoder.decode(urll.getPath(), "UTF-8");
} catch (Exception e) {
}
if (StringUtils.hasText(fullFileName)) {
fileName = fullFileName;
type = FileType.typeFromFileName(fullFileName);
@@ -282,10 +293,12 @@ public class FileHandlerService {
suffix = WebUtils.suffixFromUrl(url);
}
if (url.contains("?fileKey=")) {
fileName=urlStrr;
attribute.setSkipDownLoad(true);
}
// System.out.println(fileName);
url = WebUtils.encodeUrlFileName(url);
fileName = KkFileUtils.htmlEscape(fileName); //文件名处理
fileName = KkFileUtils.htmlEscape(fileName); //文件名处理
attribute.setType(type);
attribute.setName(fileName);
attribute.setSuffix(suffix);

View File

@@ -28,6 +28,7 @@ public interface FilePreview {
String EXEL_FILE_PREVIEW_PAGE = "html";
String XML_FILE_PREVIEW_PAGE = "xml";
String MARKDOWN_FILE_PREVIEW_PAGE = "markdown";
String BPMN_FILE_PREVIEW_PAGE = "bpmn";
String NOT_SUPPORTED_FILE_PAGE = "fileNotSupported";
String filePreviewHandle(String url, Model model, FileAttribute fileAttribute);

View File

@@ -0,0 +1,20 @@
package cn.keking.service;
import java.util.List;
public class ZtreeNodeVo {
public String id;
public String pid;
public String name;
public List<ZtreeNodeVo> children;
public void setId(String id) {
this.id = id;
}
public void setName(String name) {
this.name = name;
}
public void setPid(String pid) {
this.pid = pid;
}
public void setChildren(List<ZtreeNodeVo> children) {
this.children = children;
}
}

View File

@@ -0,0 +1,20 @@
package cn.keking.service.cache;
import org.apache.pdfbox.cos.COSObject;
import org.apache.pdfbox.pdmodel.DefaultResourceCache;
import org.apache.pdfbox.pdmodel.graphics.PDXObject;
import java.io.IOException;
/**
* @author: Sawyer.Yong
* @since: 2023/02/18 14:45
* 解决图片 SoftReference 导致内存无法被回收导致的OOM, 详见 https://issues.apache.org/jira/browse/PDFBOX-3700
*/
public class NotResourceCache extends DefaultResourceCache {
@Override
public void put(COSObject indirect, PDXObject xobject) throws IOException {
// do nothing
}
}

View File

@@ -0,0 +1,27 @@
package cn.keking.service.impl;
import cn.keking.model.FileAttribute;
import cn.keking.service.FilePreview;
import org.springframework.stereotype.Component;
import org.springframework.ui.Model;
/**
* @author kl (http://kailing.pub)
* @since 2023/3/9
*/
@Component
public class BpmnFilePreviewImpl implements FilePreview {
private final CommonPreviewImpl commonPreview;
public BpmnFilePreviewImpl(CommonPreviewImpl commonPreview) {
this.commonPreview = commonPreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
commonPreview.filePreviewHandle(url,model,fileAttribute);
model.addAttribute("fileName", fileAttribute.getName());
return FilePreview.BPMN_FILE_PREVIEW_PAGE;
}
}

View File

@@ -0,0 +1,48 @@
package cn.keking.service.impl;
import cn.keking.model.FileAttribute;
import cn.keking.model.ReturnResponse;
import cn.keking.service.FileHandlerService;
import cn.keking.service.FilePreview;
import cn.keking.utils.DownloadUtils;
import cn.keking.utils.KkFileUtils;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.util.CollectionUtils;
import java.util.ArrayList;
import java.util.List;
/**
* Created by kl on 2018/1/17.
* Content :图片文件处理
*/
@Component("commonPreview")
public class CommonPreviewImpl implements FilePreview {
private final FileHandlerService fileHandlerService;
private final OtherFilePreviewImpl otherFilePreview;
public CommonPreviewImpl(FileHandlerService fileHandlerService, OtherFilePreviewImpl otherFilePreview) {
this.fileHandlerService = fileHandlerService;
this.otherFilePreview = otherFilePreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
// 不是http开头浏览器不能直接访问需下载到本地
if (url != null && !url.toLowerCase().startsWith("http")) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, null);
if (response.isFailure()) {
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
} else {
String file = fileHandlerService.getRelativePath(response.getContent());
model.addAttribute("currentUrl", file);
}
} else {
model.addAttribute("currentUrl", url);
}
return null;
}
}

View File

@@ -7,10 +7,15 @@ import cn.keking.service.FilePreview;
import cn.keking.utils.DownloadUtils;
import cn.keking.service.FileHandlerService;
import cn.keking.service.CompressFileReader;
import org.apache.commons.lang3.exception.ExceptionUtils;
import org.apache.poi.EncryptedDocumentException;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import java.io.IOException;
/**
* Created by kl on 2018/1/17.
* Content :处理压缩包文件
@@ -21,7 +26,7 @@ public class CompressFilePreviewImpl implements FilePreview {
private final FileHandlerService fileHandlerService;
private final CompressFileReader compressFileReader;
private final OtherFilePreviewImpl otherFilePreview;
private static final String Rar_PASSWORD_MSG = "password";
public CompressFilePreviewImpl(FileHandlerService fileHandlerService, CompressFileReader compressFileReader, OtherFilePreviewImpl otherFilePreview) {
this.fileHandlerService = fileHandlerService;
this.compressFileReader = compressFileReader;
@@ -31,7 +36,8 @@ public class CompressFilePreviewImpl implements FilePreview {
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
String fileName=fileAttribute.getName();
String fileTree;
String filePassword = fileAttribute.getFilePassword();
String fileTree = null;
// 判断文件名是否存在(redis缓存读取)
if (!StringUtils.hasText(fileHandlerService.getConvertedFile(fileName)) || !ConfigConstants.isCacheEnabled()) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, fileName);
@@ -39,21 +45,32 @@ public class CompressFilePreviewImpl implements FilePreview {
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
}
String filePath = response.getContent();
fileTree = compressFileReader.unRar(filePath, fileName);
if (fileTree != null && !"null".equals(fileTree)) {
try {
fileTree = compressFileReader.unRar(filePath, filePassword,fileName);
} catch (Exception e) {
Throwable[] throwableArray = ExceptionUtils.getThrowables(e);
for (Throwable throwable : throwableArray) {
if (throwable instanceof IOException || throwable instanceof EncryptedDocumentException) {
if (e.getMessage().toLowerCase().contains(Rar_PASSWORD_MSG)) {
model.addAttribute("needFilePassword", true);
return EXEL_FILE_PREVIEW_PAGE;
}
}
}
}
if (!ObjectUtils.isEmpty(fileTree)) {
if (ConfigConstants.isCacheEnabled()) {
// 加入缓存
fileHandlerService.addConvertedFile(fileName, fileTree);
}
}else {
return otherFilePreview.notSupportedFile(model, fileAttribute, "压缩文件密码错误! 压缩文件损坏! 压缩文件类型不受支持!");
}
} else {
fileTree = fileHandlerService.getConvertedFile(fileName);
}
if (fileTree != null && !"null".equals(fileTree)) {
model.addAttribute("fileName", fileName);
model.addAttribute("fileTree", fileTree);
return COMPRESS_FILE_PREVIEW_PAGE;
} else {
return otherFilePreview.notSupportedFile(model, fileAttribute, "压缩文件类型不受支持");
}
}
}

View File

@@ -11,15 +11,15 @@ import org.springframework.ui.Model;
@Service
public class EmlFilePreviewImpl implements FilePreview {
private final PictureFilePreviewImpl pictureFilePreview;
private final CommonPreviewImpl commonPreview;
public EmlFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
this.pictureFilePreview = pictureFilePreview;
public EmlFilePreviewImpl(CommonPreviewImpl commonPreview) {
this.commonPreview = commonPreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
pictureFilePreview.filePreviewHandle(url,model,fileAttribute);
commonPreview.filePreviewHandle(url,model,fileAttribute);
return EML_FILE_PREVIEW_PAGE;
}
}

View File

@@ -13,15 +13,15 @@ import org.springframework.ui.Model;
@Service
public class EpubFilePreviewImpl implements FilePreview {
private final PictureFilePreviewImpl pictureFilePreview;
private final CommonPreviewImpl commonPreview;
public EpubFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
this.pictureFilePreview = pictureFilePreview;
public EpubFilePreviewImpl(CommonPreviewImpl commonPreview) {
this.commonPreview = commonPreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
pictureFilePreview.filePreviewHandle(url,model,fileAttribute);
commonPreview.filePreviewHandle(url,model,fileAttribute);
return EpubFilePreviewImpl;
}
}

View File

@@ -13,15 +13,15 @@ import org.springframework.ui.Model;
@Service
public class OfdFilePreviewImpl implements FilePreview {
private final PictureFilePreviewImpl pictureFilePreview;
private final CommonPreviewImpl commonPreview;
public OfdFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
this.pictureFilePreview = pictureFilePreview;
public OfdFilePreviewImpl(CommonPreviewImpl commonPreview) {
this.commonPreview = commonPreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
pictureFilePreview.filePreviewHandle(url,model,fileAttribute);
commonPreview.filePreviewHandle(url,model,fileAttribute);
return OFD_FILE_PREVIEW_PAGE;
}
}

View File

@@ -47,7 +47,7 @@ public class OfficeFilePreviewImpl implements FilePreview {
String fileName = fileAttribute.getName();
String filePassword = fileAttribute.getFilePassword();
String userToken = fileAttribute.getUserToken();
boolean isHtml = suffix.equalsIgnoreCase("xls") || suffix.equalsIgnoreCase("xlsx") || suffix.equalsIgnoreCase("csv");
boolean isHtml = suffix.equalsIgnoreCase("xls") || suffix.equalsIgnoreCase("xlsx") || suffix.equalsIgnoreCase("csv") || suffix.equalsIgnoreCase("xlsm") || suffix.equalsIgnoreCase("xlt") || suffix.equalsIgnoreCase("xltm") || suffix.equalsIgnoreCase("et") || suffix.equalsIgnoreCase("ett") || suffix.equalsIgnoreCase("xlam");
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + (isHtml ? "html" : "pdf");
String cacheFileName = userToken == null ? pdfName : userToken + "_" + pdfName;
String outFilePath = FILE_DIR + cacheFileName;

View File

@@ -12,15 +12,15 @@ import org.springframework.ui.Model;
@Service
public class Online3DFilePreviewImpl implements FilePreview {
private final PictureFilePreviewImpl pictureFilePreview;
private final CommonPreviewImpl commonPreview;
public Online3DFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
this.pictureFilePreview = pictureFilePreview;
public Online3DFilePreviewImpl(CommonPreviewImpl commonPreview) {
this.commonPreview = commonPreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
pictureFilePreview.filePreviewHandle(url,model,fileAttribute);
commonPreview.filePreviewHandle(url,model,fileAttribute);
return Online3D_FILE_PAGE;
}
}

View File

@@ -18,12 +18,13 @@ import java.util.List;
* Content :图片文件处理
*/
@Service
public class PictureFilePreviewImpl implements FilePreview {
public class PictureFilePreviewImpl extends CommonPreviewImpl {
private final FileHandlerService fileHandlerService;
private final OtherFilePreviewImpl otherFilePreview;
public PictureFilePreviewImpl(FileHandlerService fileHandlerService, OtherFilePreviewImpl otherFilePreview) {
super(fileHandlerService, otherFilePreview);
this.fileHandlerService = fileHandlerService;
this.otherFilePreview = otherFilePreview;
}
@@ -39,21 +40,8 @@ public class PictureFilePreviewImpl implements FilePreview {
imgUrls.addAll(zipImgUrls);
}
// 不是http开头浏览器不能直接访问需下载到本地
if (url != null && !url.toLowerCase().startsWith("http")) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, null);
if (response.isFailure()) {
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
} else {
String file = fileHandlerService.getRelativePath(response.getContent());
imgUrls.clear();
imgUrls.add(file);
model.addAttribute("imgUrls", imgUrls);
model.addAttribute("currentUrl", file);
}
} else {
model.addAttribute("imgUrls", imgUrls);
model.addAttribute("currentUrl", url);
}
super.filePreviewHandle(url, model, fileAttribute);
model.addAttribute("imgUrls", imgUrls);
return PICTURE_FILE_PREVIEW_PAGE;
}
}

View File

@@ -13,15 +13,15 @@ import org.springframework.ui.Model;
@Service
public class SvgFilePreviewImpl implements FilePreview {
private final PictureFilePreviewImpl pictureFilePreview;
private final CommonPreviewImpl commonPreview;
public SvgFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
this.pictureFilePreview = pictureFilePreview;
public SvgFilePreviewImpl(CommonPreviewImpl commonPreview) {
this.commonPreview = commonPreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
pictureFilePreview.filePreviewHandle(url,model,fileAttribute);
commonPreview.filePreviewHandle(url,model,fileAttribute);
return SVG_FILE_PREVIEW_PAGE;
}
}

View File

@@ -3,13 +3,11 @@ package cn.keking.service.impl;
import cn.keking.config.ConfigConstants;
import cn.keking.model.FileAttribute;
import cn.keking.model.ReturnResponse;
import cn.keking.service.FileHandlerService;
import cn.keking.service.FilePreview;
import cn.keking.utils.ConvertPicUtil;
import cn.keking.utils.DownloadUtils;
import cn.keking.utils.WebUtils;
import cn.keking.web.filter.BaseUrlFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
@@ -27,72 +25,64 @@ import java.util.List;
@Service
public class TiffFilePreviewImpl implements FilePreview {
private final static Logger logger = LoggerFactory.getLogger(TiffFilePreviewImpl.class);
private final PictureFilePreviewImpl pictureFilePreview;
private static final String INITIALIZE_MEMORY_SIZE = "initializeMemorySize";
//默认初始化 50MB 内存
private static final long INITIALIZE_MEMORY_SIZE_VALUE_DEFAULT = 1024L * 1024 * 50;
private final String fileDir = ConfigConstants.getFileDir();
public TiffFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
this.pictureFilePreview = pictureFilePreview;
private final FileHandlerService fileHandlerService;
private final OtherFilePreviewImpl otherFilePreview;
public TiffFilePreviewImpl(FileHandlerService fileHandlerService,OtherFilePreviewImpl otherFilePreview) {
this.fileHandlerService = fileHandlerService;
this.otherFilePreview = otherFilePreview;
}
private final String fileDir = ConfigConstants.getFileDir();
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
String fileName = fileAttribute.getName();
String baseUrl = BaseUrlFilter.getBaseUrl();
String tifPreviewType = ConfigConstants.getTifPreviewType();
String tifOnLinePreviewType = fileAttribute.getTifPreviewType();
if (StringUtils.hasText(tifOnLinePreviewType)) {
tifPreviewType = tifOnLinePreviewType;
}
if ("tif".equalsIgnoreCase(tifPreviewType)) {
pictureFilePreview.filePreviewHandle(url, model, fileAttribute);
String fileSize = WebUtils.getUrlParameterReg(url, INITIALIZE_MEMORY_SIZE);
if (StringUtils.hasText(fileSize)) {
model.addAttribute(INITIALIZE_MEMORY_SIZE, fileSize);
} else {
model.addAttribute(INITIALIZE_MEMORY_SIZE, Long.toString(INITIALIZE_MEMORY_SIZE_VALUE_DEFAULT));
}
model.addAttribute("currentUrl", url);
return TIFF_FILE_PREVIEW_PAGE;
} else if ("jpg".equalsIgnoreCase(tifPreviewType) || "pdf".equalsIgnoreCase(tifPreviewType)) {
String inputFileName = url.substring(url.lastIndexOf("/") + 1);
String inputFileNamePrefix = inputFileName.substring(0, inputFileName.lastIndexOf("."));
String strLocalTif = fileDir + inputFileName;
File fileTiff = new File(strLocalTif);
// 如果本地不存在这个tif文件则下载
if (!fileTiff.exists()) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, inputFileName);
if (response.isFailure()) {
return NOT_SUPPORTED_FILE_PAGE;
}
}
String baseUrl = BaseUrlFilter.getBaseUrl();
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + "pdf";
String jpgName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + "jpg";
String strLocalTif = fileDir + fileName;
String outFilePath = fileDir + pdfName;
if ("pdf".equalsIgnoreCase(tifPreviewType)) {
// 以PDF模式预览的过程
File filePdf = new File(fileDir + inputFileNamePrefix + ".pdf");
// 如果本地不存在对应的pdf则调用转换过程。否则直接用现有的pdf文件
if (!filePdf.exists()) {
filePdf = ConvertPicUtil.convertTif2Pdf(strLocalTif, fileDir + inputFileNamePrefix + ".pdf");
}
// 如果pdf已经存在则将url路径加入到对象中返回给页面
assert filePdf != null;
if (filePdf.exists()) {
String pdfUrl = baseUrl + inputFileNamePrefix + ".pdf";
model.addAttribute("pdfUrl", pdfUrl);
//当文件不存在时,就去下载
if (!fileHandlerService.listConvertedFiles().containsKey(pdfName) || !ConfigConstants.isCacheEnabled()) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, fileName);
if (response.isFailure()) {
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
}
String filePath = response.getContent();
if (ConfigConstants.isCacheEnabled()) {
// 加入缓存
fileHandlerService.addConvertedFile(pdfName, fileHandlerService.getRelativePath(outFilePath));
}
if(ConvertPicUtil.convertJpg2Pdf(filePath, outFilePath)){
model.addAttribute("pdfUrl", pdfName);
return PDF_FILE_PREVIEW_PAGE;
}
}
else {
model.addAttribute("pdfUrl", pdfName);
return PDF_FILE_PREVIEW_PAGE;
}
} else {
File fileTiff = new File(strLocalTif);
// 如果本地不存在这个tif文件则下载
if (!fileTiff.exists()) {
ReturnResponse<String> response = DownloadUtils.downLoad(fileAttribute, fileName);
if (response.isFailure()) {
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
}
strLocalTif = response.getContent();
}
// 以JPG模式预览的过程
String strJpgFilePathName = fileDir + inputFileNamePrefix + ".jpg";
String strJpgFilePathName = fileDir + jpgName;
// 将tif转换为jpg返回转换后的文件路径、文件名的list
List<String> listPic2Jpg = ConvertPicUtil.convertTif2Jpg(strLocalTif, strJpgFilePathName);
// 将返回页面的图片url的list对象
@@ -101,19 +91,11 @@ public class TiffFilePreviewImpl implements FilePreview {
for (String strJpg : listPic2Jpg) {
listImageUrls.add(baseUrl + strJpg);
}
model.addAttribute("imgUrls", listImageUrls);
model.addAttribute("currentUrl", listImageUrls.get(0));
}
// 转换后的tif没用了可以删掉了
if (fileTiff.exists() && !fileTiff.delete()) {
logger.error("{} 清理失败", strLocalTif);
}
return PICTURE_FILE_PREVIEW_PAGE;
}
return NOT_SUPPORTED_FILE_PAGE;
}
}

View File

@@ -13,15 +13,15 @@ import org.springframework.ui.Model;
@Service
public class XmindFilePreviewImpl implements FilePreview {
private final PictureFilePreviewImpl pictureFilePreview;
private final CommonPreviewImpl commonPreview;
public XmindFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
this.pictureFilePreview = pictureFilePreview;
public XmindFilePreviewImpl(CommonPreviewImpl commonPreview) {
this.commonPreview = commonPreview;
}
@Override
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
pictureFilePreview.filePreviewHandle(url,model,fileAttribute);
commonPreview.filePreviewHandle(url,model,fileAttribute);
return XMIND_FILE_PREVIEW_PAGE;
}
}

View File

@@ -1,16 +1,17 @@
package cn.keking.utils;
import com.lowagie.text.Document;
import com.lowagie.text.Image;
import com.lowagie.text.Rectangle;
import com.lowagie.text.pdf.PdfWriter;
import com.lowagie.text.pdf.RandomAccessFileOrArray;
import com.lowagie.text.pdf.codec.TiffImage;
import cn.keking.config.ConfigConstants;
import com.sun.media.jai.codec.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.itextpdf.text.Document;
import com.itextpdf.text.Image;
import com.itextpdf.text.io.FileChannelRandomAccessSource;
import com.itextpdf.text.pdf.PdfWriter;
import com.itextpdf.text.pdf.RandomAccessFileOrArray;
import com.itextpdf.text.pdf.codec.TiffImage;
import javax.media.jai.JAI;
import javax.media.jai.RenderedOp;
import java.awt.image.RenderedImage;
@@ -18,13 +19,14 @@ import java.awt.image.renderable.ParameterBlock;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.List;
public class ConvertPicUtil {
private final static Logger logger = LoggerFactory.getLogger(ConvertPicUtil.class);
private final static String fileDir = ConfigConstants.getFileDir();
/**
* Tif 转 JPG。
*
@@ -42,25 +44,21 @@ public class ConvertPicUtil {
logger.info("找不到文件【" + strInputFile + "");
return null;
}
strInputFile = strInputFile.replaceAll("\\\\", "/");
strOutputFile = strOutputFile.replaceAll("\\\\", "/");
FileSeekableStream fileSeekStream = null;
try {
JPEGEncodeParam jpegEncodeParam = new JPEGEncodeParam();
TIFFEncodeParam tiffEncodeParam = new TIFFEncodeParam();
tiffEncodeParam.setCompression(TIFFEncodeParam.COMPRESSION_GROUP4);
tiffEncodeParam.setLittleEndian(false);
String strFilePrefix = strInputFile.substring(strInputFile.lastIndexOf("/") + 1, strInputFile.lastIndexOf("."));
String jpgname = strInputFile.replace(fileDir.replace("\\","/"), "");
int index = jpgname.lastIndexOf(".");
String strFilePrefix = jpgname.substring(0, index);
fileSeekStream = new FileSeekableStream(strInputFile);
ImageDecoder imageDecoder = ImageCodec.createImageDecoder("TIFF", fileSeekStream, null);
int intTifCount = imageDecoder.getNumPages();
logger.info("该tif文件共有【" + intTifCount + "】页");
String strJpgPath;
String strJpgUrl;
if (intTifCount == 1) {
@@ -87,9 +85,7 @@ public class ConvertPicUtil {
strJpg = strJpgPath + "/" + i + ".jpg";
strJpgUrl = strFilePrefix + "/" + i + ".jpg";
}
File fileJpg = new File(strJpg);
// 如果文件不存在,则生成
if (!fileJpg.exists()) {
RenderedImage renderedImage = imageDecoder.decodeAsRenderedImage(i);
@@ -98,13 +94,11 @@ public class ConvertPicUtil {
pb.add(fileJpg.toString());
pb.add("JPEG");
pb.add(jpegEncodeParam);
RenderedOp renderedOp = JAI.create("filestore", pb);
renderedOp.dispose();
logger.info("每页分别保存至: " + fileJpg.getCanonicalPath());
} else {
logger.info("JPG文件已存在 " + fileJpg.getCanonicalPath());
// logger.info("JPG文件已存在 " + fileJpg.getCanonicalPath());
}
listImageFiles.add(strJpgUrl);
@@ -131,101 +125,45 @@ public class ConvertPicUtil {
* @param strJpgFile 输入的jpg的路径和文件名
* @param strPdfFile 输出的pdf的路径和文件名
*/
public static void convertJpg2Pdf(String strJpgFile, String strPdfFile) {
Document document = new Document();
// 设置文档页边距
document.setMargins(0, 0, 0, 0);
FileOutputStream fos = null;
private static final int FIT_WIDTH = 500;
private static final int FIT_HEIGHT = 900;
public static boolean convertJpg2Pdf(String strJpgFile, String strPdfFile) {
Document document= null;
RandomAccessFileOrArray rafa = null;
try {
fos = new FileOutputStream(strPdfFile);
PdfWriter.getInstance(document, fos);
// 打开文档
document = new Document();
PdfWriter.getInstance(document, new FileOutputStream(strPdfFile));
document.open();
// 获取图片的宽高
Image image = Image.getInstance(strJpgFile);
float floatImageHeight = image.getScaledHeight();
float floatImageWidth = image.getScaledWidth();
// 设置页面宽高与图片一致
Rectangle rectangle = new Rectangle(floatImageWidth, floatImageHeight);
document.setPageSize(rectangle);
// 图片居中
image.setAlignment(Image.ALIGN_CENTER);
//新建一页添加图片
document.newPage();
document.add(image);
} catch (Exception ioe) {
ioe.printStackTrace();
} finally {
//关闭文档
rafa = new RandomAccessFileOrArray(new FileChannelRandomAccessSource(new RandomAccessFile(strJpgFile, "r").getChannel()));
int pages = TiffImage.getNumberOfPages(rafa);
Image image;
for (int i = 1; i <= pages; i++) {
try {
image = TiffImage.getTiffImage(rafa, i);
image.scaleToFit(FIT_WIDTH, FIT_HEIGHT);
document.add(image);
} catch (Exception e) {
document.close();
rafa.close();
e.printStackTrace();
}
}
document.close();
rafa.close();
return true;
}
catch (Exception e)
{
System.out.println("错误:"+ e.getMessage());
}
finally {
document.close();
try {
assert fos != null;
fos.flush();
fos.close();
rafa.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return false;
}
/**
* 将Tif图片转换为Pdf文件支持多页Tif
*
* @param strTifFile 输入的tif的路径和文件名
* @param strPdfFile 输出的pdf的路径和文件名
* @return File
*/
public static File convertTif2Pdf(String strTifFile, String strPdfFile) {
try {
RandomAccessFileOrArray rafa = new RandomAccessFileOrArray(strTifFile);
Document document = new Document();
// 设置文档页边距
document.setMargins(0, 0, 0, 0);
PdfWriter.getInstance(document, new FileOutputStream(strPdfFile));
document.open();
int intPages = TiffImage.getNumberOfPages(rafa);
Image image;
File filePDF;
if (intPages == 1) {
String strJpg = strTifFile.substring(0, strTifFile.lastIndexOf(".")) + ".jpg";
File fileJpg = new File(strJpg);
List<String> listPic2Jpg = convertTif2Jpg(strTifFile, strJpg);
if (listPic2Jpg != null && fileJpg.exists()) {
convertJpg2Pdf(strJpg, strPdfFile);
}
} else {
for (int i = 1; i <= intPages; i++) {
image = TiffImage.getTiffImage(rafa, i);
// 设置页面宽高与图片一致
Rectangle pageSize = new Rectangle(image.getScaledWidth(), image.getScaledHeight());
document.setPageSize(pageSize);
// 图片居中
image.setAlignment(Image.ALIGN_CENTER);
//新建一页添加图片
document.newPage();
document.add(image);
}
document.close();
}
rafa.close();
filePDF = new File(strPdfFile);
return filePDF;
} catch (Exception e) {
logger.error(e.getMessage(), e);
}
return null;
}
}

View File

@@ -3,16 +3,17 @@ package cn.keking.utils;
import cn.keking.config.ConfigConstants;
import cn.keking.model.FileAttribute;
import cn.keking.model.ReturnResponse;
import cn.keking.service.FileHandlerService;
import io.mola.galimatias.GalimatiasParseException;
import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.StringUtils;
import org.springframework.web.util.HtmlUtils;
import java.io.*;
import java.net.*;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.net.URLDecoder;
import java.util.UUID;
import static cn.keking.utils.KkFileUtils.isFtpUrl;
@@ -36,13 +37,30 @@ public class DownloadUtils {
*/
public static ReturnResponse<String> downLoad(FileAttribute fileAttribute, String fileName) {
// 忽略ssl证书
String urlStr = null;
String urlStrr = null;
URL urll;
try {
SslUtils.ignoreSsl();
urlStr = fileAttribute.getUrl().replaceAll("\\+", "%20");
urll = new URL(urlStr);
urlStrr = URLDecoder.decode(urll.getPath(), "UTF-8");
} catch (Exception e) {
logger.error("忽略SSL证书异常:", e);
}
String urlStr = fileAttribute.getUrl().replaceAll("\\+", "%20");
ReturnResponse<String> response = new ReturnResponse<>(0, "下载成功!!!", "");
if (!KkFileUtils.isAllowedUpload(fileName)) {
response.setCode(1);
response.setContent(null);
response.setMsg("下载失败:不支持的类型!" + urlStr);
return response;
}
assert urlStr != null;
if (urlStr.contains("?fileKey=")) {
response.setContent(fileDir + urlStrr);
response.setMsg(fileName);
return response;
}
String realPath = DownloadUtils.getRelFilePath(fileName, fileAttribute);
if(!StringUtils.hasText(realPath)){
response.setCode(1);
@@ -75,7 +93,7 @@ public class DownloadUtils {
response.setMsg(fileName);
return response;
} catch (IOException | GalimatiasParseException e) {
logger.error("文件下载失败url{}", urlStr, e);
logger.error("文件下载失败url{}", urlStr);
response.setCode(1);
response.setContent(null);
if (e instanceof FileNotFoundException) {

View File

@@ -1,7 +1,9 @@
package cn.keking.utils;
import cn.keking.config.ConfigConstants;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.util.HtmlUtils;
@@ -174,4 +176,19 @@ public class KkFileUtils {
return true;
}
/**
* 判断文件是否允许上传
*
* @param file 文件扩展名
* @return 是否允许上传
*/
public static boolean isAllowedUpload(String file) {
String fileType = suffixFromFileName(file);
for (String type : ConfigConstants.getprohibit()) {
if (type.equals(fileType))
return false;
}
return !ObjectUtils.isEmpty(fileType);
}
}

View File

@@ -0,0 +1,130 @@
package cn.keking.utils;
import cn.keking.config.ConfigConstants;
import cn.keking.service.ZtreeNodeVo;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
* @author : Gao
* create : 2023-04-08
**/
public class RarUtils {
private static final String fileDir = ConfigConstants.getFileDir();
public static byte[] getUTF8BytesFromGBKString(String gbkStr) {
int n = gbkStr.length();
byte[] utfBytes = new byte[3 * n];
int k = 0;
for (int i = 0; i < n; i++) {
int m = gbkStr.charAt(i);
if (m < 128 && m >= 0) {
utfBytes[k++] = (byte) m;
continue;
}
utfBytes[k++] = (byte) (0xe0 | (m >> 12));
utfBytes[k++] = (byte) (0x80 | ((m >> 6) & 0x3f));
utfBytes[k++] = (byte) (0x80 | (m & 0x3f));
}
if (k < utfBytes.length) {
byte[] tmp = new byte[k];
System.arraycopy(utfBytes, 0, tmp, 0, k);
return tmp;
}
return utfBytes;
}
public static String getUtf8String(String str) {
if (str != null && str.length() > 0) {
String needEncodeCode = "ISO-8859-1";
String neeEncodeCode = "ISO-8859-2";
String gbkEncodeCode = "GBK";
try {
if (Charset.forName(needEncodeCode).newEncoder().canEncode(str)) {
str = new String(str.getBytes(needEncodeCode), StandardCharsets.UTF_8);
}
if (Charset.forName(neeEncodeCode).newEncoder().canEncode(str)) {
str = new String(str.getBytes(neeEncodeCode), StandardCharsets.UTF_8);
}
if (Charset.forName(gbkEncodeCode).newEncoder().canEncode(str)) {
str = new String(getUTF8BytesFromGBKString(str), StandardCharsets.UTF_8);
}
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
}
return str;
}
/**
* 判断是否是中日韩文字
*/
private static boolean isChinese(char c) {
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION
|| ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS;
}
public static boolean judge(char c){
return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z');
}
public static boolean isMessyCode(String strName) {
//去除字符串中的空格 制表符 换行 回车
Pattern p = Pattern.compile("\\s*|\t*|\r*|\n*");
Matcher m = p.matcher(strName);
String after = m.replaceAll("").replaceAll("\\+", "").replaceAll("#", "").replaceAll("&", "");
//去除字符串中的标点符号
String temp = after.replaceAll("\\p{P}", "");
//处理之后转换成字符数组
char[] ch = temp.trim().toCharArray();
for (char c : ch) {
//判断是否是数字或者英文字符
if (!judge(c)) {
//判断是否是中日韩文
if (!isChinese(c)) {
//如果不是数字或者英文字符也不是中日韩文则表示是乱码返回true
return true;
}
}
}
//表示不是乱码 返回false
return false;
}
/**
* 读取文件目录树
*/
public static List<ZtreeNodeVo> getTree(String rootPath) {
List<ZtreeNodeVo> nodes = new ArrayList<>();
File file = new File(fileDir+rootPath);
ZtreeNodeVo node = traverse(file);
nodes.add(node);
return nodes;
}
private static ZtreeNodeVo traverse(File file) {
ZtreeNodeVo pathNodeVo = new ZtreeNodeVo();
pathNodeVo.setId(file.getAbsolutePath().replace(fileDir, "").replace("\\", "/"));
pathNodeVo.setName(file.getName());
pathNodeVo.setPid(file.getParent().replace(fileDir, "").replace("\\", "/"));
if (file.isDirectory()) {
List<ZtreeNodeVo> subNodeVos = new ArrayList<>();
File[] subFiles = file.listFiles();
if (subFiles == null) {
return pathNodeVo;
}
for (File subFile : subFiles) {
ZtreeNodeVo subNodeVo = traverse(subFile);
subNodeVos.add(subNodeVo);
}
pathNodeVo.setChildren(subNodeVos);
}
return pathNodeVo;
}
}

View File

@@ -3,6 +3,8 @@ package cn.keking.utils;
import io.mola.galimatias.GalimatiasParseException;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.Base64Utils;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.util.HtmlUtils;
import javax.servlet.ServletRequest;
import java.io.UnsupportedEncodingException;
@@ -103,6 +105,30 @@ public class WebUtils {
return noQueryUrl.substring(noQueryUrl.lastIndexOf("/") + 1);
}
/**
* 从url中剥离出文件名
* @param file 文件
* @return 文件名
*/
public static String getFileNameFromMultipartFile(MultipartFile file) {
String fileName = file.getOriginalFilename();
//判断是否为IE浏览器的文件名IE浏览器下文件名会带有盘符信
// escaping dangerous characters to prevent XSS
assert fileName != null;
fileName = HtmlUtils.htmlEscape(fileName, KkFileUtils.DEFAULT_FILE_ENCODING);
// Check for Unix-style path
int unixSep = fileName.lastIndexOf('/');
// Check for Windows-style path
int winSep = fileName.lastIndexOf('\\');
// Cut off at latest possible point
int pos = (Math.max(winSep, unixSep));
if (pos != -1) {
fileName = fileName.substring(pos + 1);
}
return fileName;
}
/**
* 从url中获取文件后缀

View File

@@ -3,22 +3,22 @@ package cn.keking.web.controller;
import cn.keking.config.ConfigConstants;
import cn.keking.model.ReturnResponse;
import cn.keking.utils.KkFileUtils;
import cn.keking.utils.RarUtils;
import cn.keking.utils.WebUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StreamUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.util.HtmlUtils;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.*;
@@ -36,50 +36,21 @@ public class FileController {
private final String demoDir = "demo";
private final String demoPath = demoDir + File.separator;
public static final String BASE64_DECODE_ERROR_MSG = "Base64解码失败请检查你的 %s 是否采用 Base64 + urlEncode 双重编码了!";
@PostMapping("/fileUpload")
public ReturnResponse<Object> fileUpload(@RequestParam("file") MultipartFile file) {
if (ConfigConstants.getFileUploadDisable()) {
return ReturnResponse.failure("文件传接口已禁用");
}
// 获取文件名
String fileName = file.getOriginalFilename();
//判断是否为IE浏览器的文件名IE浏览器下文件名会带有盘符信息
// escaping dangerous characters to prevent XSS
assert fileName != null;
fileName = HtmlUtils.htmlEscape(fileName, StandardCharsets.UTF_8.name());
// Check for Unix-style path
int unixSep = fileName.lastIndexOf('/');
// Check for Windows-style path
int winSep = fileName.lastIndexOf('\\');
// Cut off at latest possible point
int pos = (Math.max(winSep, unixSep));
if (pos != -1) {
fileName = fileName.substring(pos + 1);
}
String fileType= "";
int i = fileName.lastIndexOf('.');
if (i > 0) {
fileType= fileName.substring(i+1);
fileType= fileType.toLowerCase();
}
if (fileType.length() == 0 || fileType.equals("dll") || fileType.equals("exe") || fileType.equals("msi") ){
return ReturnResponse.failure(fileName+"不允许上传的文件");
}
// 判断是否存在同名文件
if (existsFile(fileName)) {
return ReturnResponse.failure("存在同名文件,请先删除原有文件再次上传");
ReturnResponse<Object> checkResult = this.fileUploadCheck(file);
if (checkResult.isFailure()) {
return checkResult;
}
File outFile = new File(fileDir + demoPath);
if (!outFile.exists() && !outFile.mkdirs()) {
logger.error("创建文件夹【{}】失败,请检查目录权限!", fileDir + demoPath);
}
logger.info("上传文件:{}", fileDir + demoPath + fileName);
String fileName = checkResult.getContent().toString();
logger.info("上传文件:{}{}{}", fileDir, demoPath, fileName);
try (InputStream in = file.getInputStream(); OutputStream out = Files.newOutputStream(Paths.get(fileDir + demoPath + fileName))) {
StreamUtils.copy(in, out);
in.close();
out.close();
return ReturnResponse.success(null);
} catch (IOException e) {
logger.error("文件上传失败", e);
@@ -88,21 +59,15 @@ public class FileController {
}
@GetMapping("/deleteFile")
public ReturnResponse<Object> deleteFile(String fileName) {
if (fileName == null || fileName.length() == 0) {
return ReturnResponse.failure("文件名为空,删除失败!");
public ReturnResponse<Object> deleteFile(String fileName,String password) {
ReturnResponse<Object> checkResult = this.deleteFileCheck(fileName);
if (checkResult.isFailure()) {
return checkResult;
}
try {
fileName = WebUtils.decodeUrl(fileName);
} catch (Exception ex) {
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "url");
return ReturnResponse.failure(errorMsg+"删除失败!");
}
if (fileName.contains("/")) {
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
}
if (KkFileUtils.isIllegalFileName(fileName)) {
return ReturnResponse.failure("非法文件名,删除失败!");
fileName = checkResult.getContent().toString();
if(!ConfigConstants.getpassword().equalsIgnoreCase(password)){
logger.error("删除文件【{}】失败,密码错误!",fileName);
return ReturnResponse.failure("删除文件失败,密码错误!");
}
File file = new File(fileDir + demoPath + fileName);
logger.info("删除文件:{}", file.getAbsolutePath());
@@ -119,7 +84,9 @@ public class FileController {
List<Map<String, String>> list = new ArrayList<>();
File file = new File(fileDir + demoPath);
if (file.exists()) {
Arrays.stream(Objects.requireNonNull(file.listFiles())).forEach(file1 -> {
File[] files = Objects.requireNonNull(file.listFiles());
Arrays.sort(files, (f1, f2) -> Long.compare(f2.lastModified(), f1.lastModified()));
Arrays.stream(files).forEach(file1 -> {
Map<String, String> fileName = new HashMap<>();
fileName.put("fileName", demoDir + "/" + file1.getName());
list.add(fileName);
@@ -128,6 +95,75 @@ public class FileController {
return list;
}
/**
* 上传文件前校验
*
* @param file 文件
* @return 校验结果
*/
private ReturnResponse<Object> fileUploadCheck(MultipartFile file) {
if (ConfigConstants.getFileUploadDisable()) {
return ReturnResponse.failure("文件传接口已禁用");
}
String fileName = WebUtils.getFileNameFromMultipartFile(file);
if(fileName.lastIndexOf(".")==-1){
return ReturnResponse.failure("不允许上传的类型");
}
if (!KkFileUtils.isAllowedUpload(fileName)) {
return ReturnResponse.failure("不允许上传的文件类型: " + fileName);
}
if (KkFileUtils.isIllegalFileName(fileName)) {
return ReturnResponse.failure("不允许上传的文件名: " + fileName);
}
// 判断是否存在同名文件
if (existsFile(fileName)) {
return ReturnResponse.failure("存在同名文件,请先删除原有文件再次上传");
}
return ReturnResponse.success(fileName);
}
/**
* 删除文件前校验
*
* @param fileName 文件名
* @return 校验结果
*/
private ReturnResponse<Object> deleteFileCheck(String fileName) {
if (ObjectUtils.isEmpty(fileName)) {
return ReturnResponse.failure("文件名为空,删除失败!");
}
try {
fileName = WebUtils.decodeUrl(fileName);
} catch (Exception ex) {
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, fileName);
return ReturnResponse.failure(errorMsg + "删除失败!");
}
assert fileName != null;
if (fileName.contains("/")) {
fileName = fileName.substring(fileName.lastIndexOf("/") + 1);
}
if (KkFileUtils.isIllegalFileName(fileName)) {
return ReturnResponse.failure("非法文件名,删除失败!");
}
return ReturnResponse.success(fileName);
}
@GetMapping("/directory")
public Object directory(String urls) {
String fileUrl;
try {
fileUrl = WebUtils.decodeUrl(urls);
} catch (Exception ex) {
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "url");
return ReturnResponse.failure(errorMsg);
}
if (KkFileUtils.isIllegalFileName(fileUrl)) {
return ReturnResponse.failure("不允许访问的路径:");
}
return RarUtils.getTree(fileUrl);
}
private boolean existsFile(String fileName) {
File file = new File(fileDir + demoPath + fileName);
return file.exists();

View File

@@ -13,21 +13,28 @@ public class IndexController {
@GetMapping( "/index")
public String go2Index(){
return "index";
return "/main/index";
}
@GetMapping( "/record")
public String go2Record(){
return "record";
return "/main/record";
}
@GetMapping( "/comment")
public String go2Comment(){
return "comment";
@GetMapping( "/sponsor")
public String go2Sponsor(){
return "/main/sponsor";
}
@GetMapping( "/integrated")
public String go2Integrated(){
return "/main/integrated";
}
@GetMapping( "/")
public String root() {
return "redirect:/index";
return "/main/index";
}
}

View File

@@ -40,6 +40,8 @@ public class AttributeSetFilter implements Filter {
request.setAttribute("fileKey", httpRequest.getParameter("fileKey"));
request.setAttribute("switchDisabled", ConfigConstants.getOfficePreviewSwitchDisabled());
request.setAttribute("fileUploadDisable", ConfigConstants.getFileUploadDisable());
request.setAttribute("BeiAn", ConfigConstants.getBeiAn());
request.setAttribute("size", ConfigConstants.maxsize());
}
/**

View File

@@ -42,7 +42,9 @@ public class TrustHostFilter implements Filter {
response.getWriter().write(html);
response.getWriter().close();
}
chain.doFilter(request, response);
else {
chain.doFilter(request, response);
}
}
@Override

View File

@@ -7,7 +7,7 @@
|_|\_\ |_|\_\ |_| |_| |_| \___| \/ |_| \___| \_/\_/
=> Spring Boot :: ${spring-boot.version}
=> kkFileView :: 4.2.0-SNAPSHOT
=> kkFileView :: 4.2.0
=> Home site :: https://kkview.cn
=> Github :: https://github.com/kekingcn/kkFileView
=> Gitee :: https://gitee.com/kekingcn/file-online-preview

View File

@@ -0,0 +1,144 @@
.bjs-container {
--bjs-font-family: Arial, sans-serif;
--color-grey-225-10-15: hsl(225, 10%, 15%);
--color-grey-225-10-35: hsl(225, 10%, 35%);
--color-grey-225-10-55: hsl(225, 10%, 55%);
--color-grey-225-10-75: hsl(225, 10%, 75%);
--color-grey-225-10-80: hsl(225, 10%, 80%);
--color-grey-225-10-85: hsl(225, 10%, 85%);
--color-grey-225-10-90: hsl(225, 10%, 90%);
--color-grey-225-10-95: hsl(225, 10%, 95%);
--color-grey-225-10-97: hsl(225, 10%, 97%);
--color-blue-205-100-45: hsl(205, 100%, 45%);
--color-blue-205-100-45-opacity-30: hsla(205, 100%, 45%, 30%);
--color-blue-205-100-50: hsl(205, 100%, 50%);
--color-blue-205-100-95: hsl(205, 100%, 95%);
--color-green-150-86-44: hsl(150, 86%, 44%);
--color-red-360-100-40: hsl(360, 100%, 40%);
--color-red-360-100-45: hsl(360, 100%, 45%);
--color-red-360-100-92: hsl(360, 100%, 92%);
--color-red-360-100-97: hsl(360, 100%, 97%);
--color-white: hsl(0, 0%, 100%);
--color-black: hsl(0, 0%, 0%);
--color-black-opacity-05: hsla(0, 0%, 0%, 5%);
--color-black-opacity-10: hsla(0, 0%, 0%, 10%);
--breadcrumbs-font-family: var(--bjs-font-family);
--breadcrumbs-item-color: var(--color-blue-205-100-50);
--breadcrumbs-arrow-color: var(--color-black);
--drilldown-fill-color: var(--color-white);
--drilldown-background-color: var(--color-blue-205-100-50);
}
.bjs-breadcrumbs {
position: absolute;
display: none;
flex-wrap: wrap;
align-items: center;
top: 30px;
left: 30px;
padding: 0px;
margin: 0px;
font-family: var(--breadcrumbs-font-family);
font-size: 16px;
line-height: normal;
}
.bjs-breadcrumbs-shown .bjs-breadcrumbs {
display: flex;
}
.djs-palette-shown .bjs-breadcrumbs {
left: 90px;
}
.djs-palette-shown.djs-palette-two-column .bjs-breadcrumbs {
left: 140px;
}
.bjs-breadcrumbs li {
display: inline-flex;
padding-bottom: 5px;
}
.bjs-breadcrumbs li a {
cursor: pointer;
color: var(--breadcrumbs-item-color);
}
.bjs-breadcrumbs li:last-of-type a {
color: inherit;
cursor: default;
}
.bjs-breadcrumbs li:not(:first-child)::before {
content: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="17" height="17" viewBox="0 0 24 24"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z" /><path d="M0 0h24v24H0z" fill="none" /></svg>');
padding: 0 8px;
color: var(--breadcrumbs-arrow-color);
height: 1em;
}
.bjs-breadcrumbs .bjs-crumb {
display: inline-block;
max-width: 200px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.bjs-drilldown {
width: 20px;
height: 20px;
padding: 0px;
margin-left: -20px;
cursor: pointer;
border: none;
border-radius: 2px;
outline: none;
fill: var(--drilldown-fill-color);
background-color: var(--drilldown-background-color);
}
.bjs-drilldown-empty {
display: none;
}
.selected .bjs-drilldown-empty {
display: inherit;
}
[data-popup="align-elements"] .djs-popup-results {
display: flex;
}
[data-popup="align-elements"] .djs-popup-body [data-group] + [data-group] {
border-left: 1px solid var(--popup-border-color);
}
[data-popup="align-elements"] [data-group="align"] {
display: grid;
grid-template-columns: repeat(3, 1fr);
}
[data-popup="align-elements"] .djs-popup-body .entry {
padding: 6px 8px;
}
[data-popup="align-elements"] .djs-popup-body .entry:not(:first-child) {
margin-top: 0;
}
[data-popup="align-elements"] .djs-popup-entry-icon {
display: block;
margin: 0;
height: 20px;
width: 20px;
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,163 @@
@font-face {
font-family: 'bpmn';
src: url('../font/bpmn.eot?21877404');
src: url('../font/bpmn.eot?21877404#iefix') format('embedded-opentype'),
url('../font/bpmn.woff2?21877404') format('woff2'),
url('../font/bpmn.woff?21877404') format('woff'),
url('../font/bpmn.ttf?21877404') format('truetype'),
url('../font/bpmn.svg?21877404#bpmn') format('svg');
font-weight: normal;
font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'bpmn';
src: url('../font/bpmn.svg?21877404#bpmn') format('svg');
}
}
*/
[class^="bpmn-icon-"]:before, [class*=" bpmn-icon-"]:before {
font-family: "bpmn";
font-style: normal;
font-weight: normal;
speak: never;
display: inline-block;
text-decoration: inherit;
width: 1em;
/* margin-right: .2em; */
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
/* margin-left: .2em; */
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}
.bpmn-icon-trash:before { content: '\e801'; } /* '' */
.bpmn-icon-gateway-parallel:before { content: '\e804'; } /* '' */
.bpmn-icon-intermediate-event-catch-cancel:before { content: '\e805'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-message:before { content: '\e806'; } /* '' */
.bpmn-icon-start-event-compensation:before { content: '\e807'; } /* '' */
.bpmn-icon-start-event-non-interrupting-parallel-multiple:before { content: '\e808'; } /* '' */
.bpmn-icon-loop-marker:before { content: '\e809'; } /* '' */
.bpmn-icon-parallel-mi-marker:before { content: '\e80a'; } /* '' */
.bpmn-icon-start-event-non-interrupting-signal:before { content: '\e80b'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-timer:before { content: '\e80c'; } /* '' */
.bpmn-icon-intermediate-event-catch-parallel-multiple:before { content: '\e80d'; } /* '' */
.bpmn-icon-intermediate-event-catch-compensation:before { content: '\e80e'; } /* '' */
.bpmn-icon-gateway-xor:before { content: '\e80f'; } /* '' */
.bpmn-icon-end-event-cancel:before { content: '\e811'; } /* '' */
.bpmn-icon-intermediate-event-catch-condition:before { content: '\e812'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-parallel-multiple:before { content: '\e813'; } /* '' */
.bpmn-icon-start-event-condition:before { content: '\e814'; } /* '' */
.bpmn-icon-start-event-non-interrupting-timer:before { content: '\e815'; } /* '' */
.bpmn-icon-sequential-mi-marker:before { content: '\e816'; } /* '' */
.bpmn-icon-user-task:before { content: '\e817'; } /* '' */
.bpmn-icon-business-rule:before { content: '\e818'; } /* '' */
.bpmn-icon-sub-process-marker:before { content: '\e819'; } /* '' */
.bpmn-icon-start-event-parallel-multiple:before { content: '\e81a'; } /* '' */
.bpmn-icon-start-event-error:before { content: '\e81b'; } /* '' */
.bpmn-icon-intermediate-event-catch-signal:before { content: '\e81c'; } /* '' */
.bpmn-icon-intermediate-event-catch-error:before { content: '\e81d'; } /* '' */
.bpmn-icon-end-event-compensation:before { content: '\e81e'; } /* '' */
.bpmn-icon-subprocess-collapsed:before { content: '\e81f'; } /* '' */
.bpmn-icon-subprocess-expanded:before { content: '\e820'; } /* '' */
.bpmn-icon-task:before { content: '\e821'; } /* '' */
.bpmn-icon-end-event-error:before { content: '\e822'; } /* '' */
.bpmn-icon-intermediate-event-catch-escalation:before { content: '\e823'; } /* '' */
.bpmn-icon-intermediate-event-catch-timer:before { content: '\e824'; } /* '' */
.bpmn-icon-start-event-escalation:before { content: '\e825'; } /* '' */
.bpmn-icon-start-event-signal:before { content: '\e826'; } /* '' */
.bpmn-icon-business-rule-task:before { content: '\e827'; } /* '' */
.bpmn-icon-manual:before { content: '\e828'; } /* '' */
.bpmn-icon-receive:before { content: '\e829'; } /* '' */
.bpmn-icon-call-activity:before { content: '\e82a'; } /* '' */
.bpmn-icon-start-event-timer:before { content: '\e82b'; } /* '' */
.bpmn-icon-start-event-message:before { content: '\e82c'; } /* '' */
.bpmn-icon-intermediate-event-none:before { content: '\e82d'; } /* '' */
.bpmn-icon-intermediate-event-catch-link:before { content: '\e82e'; } /* '' */
.bpmn-icon-end-event-escalation:before { content: '\e82f'; } /* '' */
.bpmn-icon-bpmn-io:before { content: '\e831'; } /* '' */
.bpmn-icon-gateway-complex:before { content: '\e832'; } /* '' */
.bpmn-icon-gateway-eventbased:before { content: '\e833'; } /* '' */
.bpmn-icon-gateway-none:before { content: '\e834'; } /* '' */
.bpmn-icon-gateway-or:before { content: '\e835'; } /* '' */
.bpmn-icon-end-event-terminate:before { content: '\e836'; } /* '' */
.bpmn-icon-end-event-signal:before { content: '\e837'; } /* '' */
.bpmn-icon-end-event-none:before { content: '\e838'; } /* '' */
.bpmn-icon-end-event-multiple:before { content: '\e839'; } /* '' */
.bpmn-icon-end-event-message:before { content: '\e83a'; } /* '' */
.bpmn-icon-end-event-link:before { content: '\e83b'; } /* '' */
.bpmn-icon-intermediate-event-catch-message:before { content: '\e83c'; } /* '' */
.bpmn-icon-intermediate-event-throw-compensation:before { content: '\e83d'; } /* '' */
.bpmn-icon-start-event-multiple:before { content: '\e83e'; } /* '' */
.bpmn-icon-script:before { content: '\e83f'; } /* '' */
.bpmn-icon-manual-task:before { content: '\e840'; } /* '' */
.bpmn-icon-send:before { content: '\e841'; } /* '' */
.bpmn-icon-service:before { content: '\e842'; } /* '' */
.bpmn-icon-receive-task:before { content: '\e843'; } /* '' */
.bpmn-icon-user:before { content: '\e844'; } /* '' */
.bpmn-icon-start-event-none:before { content: '\e845'; } /* '' */
.bpmn-icon-intermediate-event-throw-escalation:before { content: '\e846'; } /* '' */
.bpmn-icon-intermediate-event-catch-multiple:before { content: '\e847'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-escalation:before { content: '\e848'; } /* '' */
.bpmn-icon-intermediate-event-throw-link:before { content: '\e849'; } /* '' */
.bpmn-icon-start-event-non-interrupting-condition:before { content: '\e84a'; } /* '' */
.bpmn-icon-data-object:before { content: '\e84b'; } /* '' */
.bpmn-icon-script-task:before { content: '\e84c'; } /* '' */
.bpmn-icon-send-task:before { content: '\e84d'; } /* '' */
.bpmn-icon-data-store:before { content: '\e84e'; } /* '' */
.bpmn-icon-start-event-non-interrupting-escalation:before { content: '\e84f'; } /* '' */
.bpmn-icon-intermediate-event-throw-message:before { content: '\e850'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-multiple:before { content: '\e851'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-signal:before { content: '\e852'; } /* '' */
.bpmn-icon-intermediate-event-throw-multiple:before { content: '\e853'; } /* '' */
.bpmn-icon-start-event-non-interrupting-message:before { content: '\e854'; } /* '' */
.bpmn-icon-ad-hoc-marker:before { content: '\e855'; } /* '' */
.bpmn-icon-service-task:before { content: '\e856'; } /* '' */
.bpmn-icon-task-none:before { content: '\e857'; } /* '' */
.bpmn-icon-compensation-marker:before { content: '\e858'; } /* '' */
.bpmn-icon-start-event-non-interrupting-multiple:before { content: '\e859'; } /* '' */
.bpmn-icon-intermediate-event-throw-signal:before { content: '\e85a'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-condition:before { content: '\e85b'; } /* '' */
.bpmn-icon-participant:before { content: '\e85c'; } /* '' */
.bpmn-icon-event-subprocess-expanded:before { content: '\e85d'; } /* '' */
.bpmn-icon-lane-insert-below:before { content: '\e85e'; } /* '' */
.bpmn-icon-space-tool:before { content: '\e85f'; } /* '' */
.bpmn-icon-connection-multi:before { content: '\e860'; } /* '' */
.bpmn-icon-lane:before { content: '\e861'; } /* '' */
.bpmn-icon-lasso-tool:before { content: '\e862'; } /* '' */
.bpmn-icon-lane-insert-above:before { content: '\e863'; } /* '' */
.bpmn-icon-lane-divide-three:before { content: '\e864'; } /* '' */
.bpmn-icon-lane-divide-two:before { content: '\e865'; } /* '' */
.bpmn-icon-data-input:before { content: '\e866'; } /* '' */
.bpmn-icon-data-output:before { content: '\e867'; } /* '' */
.bpmn-icon-hand-tool:before { content: '\e868'; } /* '' */
.bpmn-icon-group:before { content: '\e869'; } /* '' */
.bpmn-icon-text-annotation:before { content: '\e86b'; } /* '' */
.bpmn-icon-transaction:before { content: '\e8c4'; } /* '' */
.bpmn-icon-screw-wrench:before { content: '\e8db'; } /* '' */
.bpmn-icon-connection:before { content: '\e8dc'; } /* '' */
.bpmn-icon-conditional-flow:before { content: '\e8e0'; } /* '' */
.bpmn-icon-default-flow:before { content: '\e8e1'; } /* '' */

View File

@@ -0,0 +1,108 @@
.bpmn-icon-trash:before { content: '\e801'; } /* '' */
.bpmn-icon-gateway-parallel:before { content: '\e804'; } /* '' */
.bpmn-icon-intermediate-event-catch-cancel:before { content: '\e805'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-message:before { content: '\e806'; } /* '' */
.bpmn-icon-start-event-compensation:before { content: '\e807'; } /* '' */
.bpmn-icon-start-event-non-interrupting-parallel-multiple:before { content: '\e808'; } /* '' */
.bpmn-icon-loop-marker:before { content: '\e809'; } /* '' */
.bpmn-icon-parallel-mi-marker:before { content: '\e80a'; } /* '' */
.bpmn-icon-start-event-non-interrupting-signal:before { content: '\e80b'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-timer:before { content: '\e80c'; } /* '' */
.bpmn-icon-intermediate-event-catch-parallel-multiple:before { content: '\e80d'; } /* '' */
.bpmn-icon-intermediate-event-catch-compensation:before { content: '\e80e'; } /* '' */
.bpmn-icon-gateway-xor:before { content: '\e80f'; } /* '' */
.bpmn-icon-end-event-cancel:before { content: '\e811'; } /* '' */
.bpmn-icon-intermediate-event-catch-condition:before { content: '\e812'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-parallel-multiple:before { content: '\e813'; } /* '' */
.bpmn-icon-start-event-condition:before { content: '\e814'; } /* '' */
.bpmn-icon-start-event-non-interrupting-timer:before { content: '\e815'; } /* '' */
.bpmn-icon-sequential-mi-marker:before { content: '\e816'; } /* '' */
.bpmn-icon-user-task:before { content: '\e817'; } /* '' */
.bpmn-icon-business-rule:before { content: '\e818'; } /* '' */
.bpmn-icon-sub-process-marker:before { content: '\e819'; } /* '' */
.bpmn-icon-start-event-parallel-multiple:before { content: '\e81a'; } /* '' */
.bpmn-icon-start-event-error:before { content: '\e81b'; } /* '' */
.bpmn-icon-intermediate-event-catch-signal:before { content: '\e81c'; } /* '' */
.bpmn-icon-intermediate-event-catch-error:before { content: '\e81d'; } /* '' */
.bpmn-icon-end-event-compensation:before { content: '\e81e'; } /* '' */
.bpmn-icon-subprocess-collapsed:before { content: '\e81f'; } /* '' */
.bpmn-icon-subprocess-expanded:before { content: '\e820'; } /* '' */
.bpmn-icon-task:before { content: '\e821'; } /* '' */
.bpmn-icon-end-event-error:before { content: '\e822'; } /* '' */
.bpmn-icon-intermediate-event-catch-escalation:before { content: '\e823'; } /* '' */
.bpmn-icon-intermediate-event-catch-timer:before { content: '\e824'; } /* '' */
.bpmn-icon-start-event-escalation:before { content: '\e825'; } /* '' */
.bpmn-icon-start-event-signal:before { content: '\e826'; } /* '' */
.bpmn-icon-business-rule-task:before { content: '\e827'; } /* '' */
.bpmn-icon-manual:before { content: '\e828'; } /* '' */
.bpmn-icon-receive:before { content: '\e829'; } /* '' */
.bpmn-icon-call-activity:before { content: '\e82a'; } /* '' */
.bpmn-icon-start-event-timer:before { content: '\e82b'; } /* '' */
.bpmn-icon-start-event-message:before { content: '\e82c'; } /* '' */
.bpmn-icon-intermediate-event-none:before { content: '\e82d'; } /* '' */
.bpmn-icon-intermediate-event-catch-link:before { content: '\e82e'; } /* '' */
.bpmn-icon-end-event-escalation:before { content: '\e82f'; } /* '' */
.bpmn-icon-bpmn-io:before { content: '\e831'; } /* '' */
.bpmn-icon-gateway-complex:before { content: '\e832'; } /* '' */
.bpmn-icon-gateway-eventbased:before { content: '\e833'; } /* '' */
.bpmn-icon-gateway-none:before { content: '\e834'; } /* '' */
.bpmn-icon-gateway-or:before { content: '\e835'; } /* '' */
.bpmn-icon-end-event-terminate:before { content: '\e836'; } /* '' */
.bpmn-icon-end-event-signal:before { content: '\e837'; } /* '' */
.bpmn-icon-end-event-none:before { content: '\e838'; } /* '' */
.bpmn-icon-end-event-multiple:before { content: '\e839'; } /* '' */
.bpmn-icon-end-event-message:before { content: '\e83a'; } /* '' */
.bpmn-icon-end-event-link:before { content: '\e83b'; } /* '' */
.bpmn-icon-intermediate-event-catch-message:before { content: '\e83c'; } /* '' */
.bpmn-icon-intermediate-event-throw-compensation:before { content: '\e83d'; } /* '' */
.bpmn-icon-start-event-multiple:before { content: '\e83e'; } /* '' */
.bpmn-icon-script:before { content: '\e83f'; } /* '' */
.bpmn-icon-manual-task:before { content: '\e840'; } /* '' */
.bpmn-icon-send:before { content: '\e841'; } /* '' */
.bpmn-icon-service:before { content: '\e842'; } /* '' */
.bpmn-icon-receive-task:before { content: '\e843'; } /* '' */
.bpmn-icon-user:before { content: '\e844'; } /* '' */
.bpmn-icon-start-event-none:before { content: '\e845'; } /* '' */
.bpmn-icon-intermediate-event-throw-escalation:before { content: '\e846'; } /* '' */
.bpmn-icon-intermediate-event-catch-multiple:before { content: '\e847'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-escalation:before { content: '\e848'; } /* '' */
.bpmn-icon-intermediate-event-throw-link:before { content: '\e849'; } /* '' */
.bpmn-icon-start-event-non-interrupting-condition:before { content: '\e84a'; } /* '' */
.bpmn-icon-data-object:before { content: '\e84b'; } /* '' */
.bpmn-icon-script-task:before { content: '\e84c'; } /* '' */
.bpmn-icon-send-task:before { content: '\e84d'; } /* '' */
.bpmn-icon-data-store:before { content: '\e84e'; } /* '' */
.bpmn-icon-start-event-non-interrupting-escalation:before { content: '\e84f'; } /* '' */
.bpmn-icon-intermediate-event-throw-message:before { content: '\e850'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-multiple:before { content: '\e851'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-signal:before { content: '\e852'; } /* '' */
.bpmn-icon-intermediate-event-throw-multiple:before { content: '\e853'; } /* '' */
.bpmn-icon-start-event-non-interrupting-message:before { content: '\e854'; } /* '' */
.bpmn-icon-ad-hoc-marker:before { content: '\e855'; } /* '' */
.bpmn-icon-service-task:before { content: '\e856'; } /* '' */
.bpmn-icon-task-none:before { content: '\e857'; } /* '' */
.bpmn-icon-compensation-marker:before { content: '\e858'; } /* '' */
.bpmn-icon-start-event-non-interrupting-multiple:before { content: '\e859'; } /* '' */
.bpmn-icon-intermediate-event-throw-signal:before { content: '\e85a'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-condition:before { content: '\e85b'; } /* '' */
.bpmn-icon-participant:before { content: '\e85c'; } /* '' */
.bpmn-icon-event-subprocess-expanded:before { content: '\e85d'; } /* '' */
.bpmn-icon-lane-insert-below:before { content: '\e85e'; } /* '' */
.bpmn-icon-space-tool:before { content: '\e85f'; } /* '' */
.bpmn-icon-connection-multi:before { content: '\e860'; } /* '' */
.bpmn-icon-lane:before { content: '\e861'; } /* '' */
.bpmn-icon-lasso-tool:before { content: '\e862'; } /* '' */
.bpmn-icon-lane-insert-above:before { content: '\e863'; } /* '' */
.bpmn-icon-lane-divide-three:before { content: '\e864'; } /* '' */
.bpmn-icon-lane-divide-two:before { content: '\e865'; } /* '' */
.bpmn-icon-data-input:before { content: '\e866'; } /* '' */
.bpmn-icon-data-output:before { content: '\e867'; } /* '' */
.bpmn-icon-hand-tool:before { content: '\e868'; } /* '' */
.bpmn-icon-group:before { content: '\e869'; } /* '' */
.bpmn-icon-text-annotation:before { content: '\e86b'; } /* '' */
.bpmn-icon-transaction:before { content: '\e8c4'; } /* '' */
.bpmn-icon-screw-wrench:before { content: '\e8db'; } /* '' */
.bpmn-icon-connection:before { content: '\e8dc'; } /* '' */
.bpmn-icon-conditional-flow:before { content: '\e8e0'; } /* '' */
.bpmn-icon-default-flow:before { content: '\e8e1'; } /* '' */

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,163 @@
@font-face {
font-family: 'bpmn';
src: url('../font/bpmn.eot?21877404');
src: url('../font/bpmn.eot?21877404#iefix') format('embedded-opentype'),
url('../font/bpmn.woff2?21877404') format('woff2'),
url('../font/bpmn.woff?21877404') format('woff'),
url('../font/bpmn.ttf?21877404') format('truetype'),
url('../font/bpmn.svg?21877404#bpmn') format('svg');
font-weight: normal;
font-style: normal;
}
/* Chrome hack: SVG is rendered more smooth in Windozze. 100% magic, uncomment if you need it. */
/* Note, that will break hinting! In other OS-es font will be not as sharp as it could be */
/*
@media screen and (-webkit-min-device-pixel-ratio:0) {
@font-face {
font-family: 'bpmn';
src: url('../font/bpmn.svg?21877404#bpmn') format('svg');
}
}
*/
[class^="bpmn-icon-"]:before, [class*=" bpmn-icon-"]:before {
font-family: "bpmn";
font-style: normal;
font-weight: normal;
speak: never;
display: inline-block;
text-decoration: inherit;
width: 1em;
/* margin-right: .2em; */
text-align: center;
/* opacity: .8; */
/* For safety - reset parent styles, that can break glyph codes*/
font-variant: normal;
text-transform: none;
/* fix buttons height, for twitter bootstrap */
line-height: 1em;
/* Animation center compensation - margins should be symmetric */
/* remove if not needed */
/* margin-left: .2em; */
/* you can be more comfortable with increased icons size */
/* font-size: 120%; */
/* Font smoothing. That was taken from TWBS */
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
/* Uncomment for 3D effect */
/* text-shadow: 1px 1px 1px rgba(127, 127, 127, 0.3); */
}
.bpmn-icon-trash:before { content: '\e801'; } /* '' */
.bpmn-icon-gateway-parallel:before { content: '\e804'; } /* '' */
.bpmn-icon-intermediate-event-catch-cancel:before { content: '\e805'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-message:before { content: '\e806'; } /* '' */
.bpmn-icon-start-event-compensation:before { content: '\e807'; } /* '' */
.bpmn-icon-start-event-non-interrupting-parallel-multiple:before { content: '\e808'; } /* '' */
.bpmn-icon-loop-marker:before { content: '\e809'; } /* '' */
.bpmn-icon-parallel-mi-marker:before { content: '\e80a'; } /* '' */
.bpmn-icon-start-event-non-interrupting-signal:before { content: '\e80b'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-timer:before { content: '\e80c'; } /* '' */
.bpmn-icon-intermediate-event-catch-parallel-multiple:before { content: '\e80d'; } /* '' */
.bpmn-icon-intermediate-event-catch-compensation:before { content: '\e80e'; } /* '' */
.bpmn-icon-gateway-xor:before { content: '\e80f'; } /* '' */
.bpmn-icon-end-event-cancel:before { content: '\e811'; } /* '' */
.bpmn-icon-intermediate-event-catch-condition:before { content: '\e812'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-parallel-multiple:before { content: '\e813'; } /* '' */
.bpmn-icon-start-event-condition:before { content: '\e814'; } /* '' */
.bpmn-icon-start-event-non-interrupting-timer:before { content: '\e815'; } /* '' */
.bpmn-icon-sequential-mi-marker:before { content: '\e816'; } /* '' */
.bpmn-icon-user-task:before { content: '\e817'; } /* '' */
.bpmn-icon-business-rule:before { content: '\e818'; } /* '' */
.bpmn-icon-sub-process-marker:before { content: '\e819'; } /* '' */
.bpmn-icon-start-event-parallel-multiple:before { content: '\e81a'; } /* '' */
.bpmn-icon-start-event-error:before { content: '\e81b'; } /* '' */
.bpmn-icon-intermediate-event-catch-signal:before { content: '\e81c'; } /* '' */
.bpmn-icon-intermediate-event-catch-error:before { content: '\e81d'; } /* '' */
.bpmn-icon-end-event-compensation:before { content: '\e81e'; } /* '' */
.bpmn-icon-subprocess-collapsed:before { content: '\e81f'; } /* '' */
.bpmn-icon-subprocess-expanded:before { content: '\e820'; } /* '' */
.bpmn-icon-task:before { content: '\e821'; } /* '' */
.bpmn-icon-end-event-error:before { content: '\e822'; } /* '' */
.bpmn-icon-intermediate-event-catch-escalation:before { content: '\e823'; } /* '' */
.bpmn-icon-intermediate-event-catch-timer:before { content: '\e824'; } /* '' */
.bpmn-icon-start-event-escalation:before { content: '\e825'; } /* '' */
.bpmn-icon-start-event-signal:before { content: '\e826'; } /* '' */
.bpmn-icon-business-rule-task:before { content: '\e827'; } /* '' */
.bpmn-icon-manual:before { content: '\e828'; } /* '' */
.bpmn-icon-receive:before { content: '\e829'; } /* '' */
.bpmn-icon-call-activity:before { content: '\e82a'; } /* '' */
.bpmn-icon-start-event-timer:before { content: '\e82b'; } /* '' */
.bpmn-icon-start-event-message:before { content: '\e82c'; } /* '' */
.bpmn-icon-intermediate-event-none:before { content: '\e82d'; } /* '' */
.bpmn-icon-intermediate-event-catch-link:before { content: '\e82e'; } /* '' */
.bpmn-icon-end-event-escalation:before { content: '\e82f'; } /* '' */
.bpmn-icon-bpmn-io:before { content: '\e831'; } /* '' */
.bpmn-icon-gateway-complex:before { content: '\e832'; } /* '' */
.bpmn-icon-gateway-eventbased:before { content: '\e833'; } /* '' */
.bpmn-icon-gateway-none:before { content: '\e834'; } /* '' */
.bpmn-icon-gateway-or:before { content: '\e835'; } /* '' */
.bpmn-icon-end-event-terminate:before { content: '\e836'; } /* '' */
.bpmn-icon-end-event-signal:before { content: '\e837'; } /* '' */
.bpmn-icon-end-event-none:before { content: '\e838'; } /* '' */
.bpmn-icon-end-event-multiple:before { content: '\e839'; } /* '' */
.bpmn-icon-end-event-message:before { content: '\e83a'; } /* '' */
.bpmn-icon-end-event-link:before { content: '\e83b'; } /* '' */
.bpmn-icon-intermediate-event-catch-message:before { content: '\e83c'; } /* '' */
.bpmn-icon-intermediate-event-throw-compensation:before { content: '\e83d'; } /* '' */
.bpmn-icon-start-event-multiple:before { content: '\e83e'; } /* '' */
.bpmn-icon-script:before { content: '\e83f'; } /* '' */
.bpmn-icon-manual-task:before { content: '\e840'; } /* '' */
.bpmn-icon-send:before { content: '\e841'; } /* '' */
.bpmn-icon-service:before { content: '\e842'; } /* '' */
.bpmn-icon-receive-task:before { content: '\e843'; } /* '' */
.bpmn-icon-user:before { content: '\e844'; } /* '' */
.bpmn-icon-start-event-none:before { content: '\e845'; } /* '' */
.bpmn-icon-intermediate-event-throw-escalation:before { content: '\e846'; } /* '' */
.bpmn-icon-intermediate-event-catch-multiple:before { content: '\e847'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-escalation:before { content: '\e848'; } /* '' */
.bpmn-icon-intermediate-event-throw-link:before { content: '\e849'; } /* '' */
.bpmn-icon-start-event-non-interrupting-condition:before { content: '\e84a'; } /* '' */
.bpmn-icon-data-object:before { content: '\e84b'; } /* '' */
.bpmn-icon-script-task:before { content: '\e84c'; } /* '' */
.bpmn-icon-send-task:before { content: '\e84d'; } /* '' */
.bpmn-icon-data-store:before { content: '\e84e'; } /* '' */
.bpmn-icon-start-event-non-interrupting-escalation:before { content: '\e84f'; } /* '' */
.bpmn-icon-intermediate-event-throw-message:before { content: '\e850'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-multiple:before { content: '\e851'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-signal:before { content: '\e852'; } /* '' */
.bpmn-icon-intermediate-event-throw-multiple:before { content: '\e853'; } /* '' */
.bpmn-icon-start-event-non-interrupting-message:before { content: '\e854'; } /* '' */
.bpmn-icon-ad-hoc-marker:before { content: '\e855'; } /* '' */
.bpmn-icon-service-task:before { content: '\e856'; } /* '' */
.bpmn-icon-task-none:before { content: '\e857'; } /* '' */
.bpmn-icon-compensation-marker:before { content: '\e858'; } /* '' */
.bpmn-icon-start-event-non-interrupting-multiple:before { content: '\e859'; } /* '' */
.bpmn-icon-intermediate-event-throw-signal:before { content: '\e85a'; } /* '' */
.bpmn-icon-intermediate-event-catch-non-interrupting-condition:before { content: '\e85b'; } /* '' */
.bpmn-icon-participant:before { content: '\e85c'; } /* '' */
.bpmn-icon-event-subprocess-expanded:before { content: '\e85d'; } /* '' */
.bpmn-icon-lane-insert-below:before { content: '\e85e'; } /* '' */
.bpmn-icon-space-tool:before { content: '\e85f'; } /* '' */
.bpmn-icon-connection-multi:before { content: '\e860'; } /* '' */
.bpmn-icon-lane:before { content: '\e861'; } /* '' */
.bpmn-icon-lasso-tool:before { content: '\e862'; } /* '' */
.bpmn-icon-lane-insert-above:before { content: '\e863'; } /* '' */
.bpmn-icon-lane-divide-three:before { content: '\e864'; } /* '' */
.bpmn-icon-lane-divide-two:before { content: '\e865'; } /* '' */
.bpmn-icon-data-input:before { content: '\e866'; } /* '' */
.bpmn-icon-data-output:before { content: '\e867'; } /* '' */
.bpmn-icon-hand-tool:before { content: '\e868'; } /* '' */
.bpmn-icon-group:before { content: '\e869'; } /* '' */
.bpmn-icon-text-annotation:before { content: '\e86b'; } /* '' */
.bpmn-icon-transaction:before { content: '\e8c4'; } /* '' */
.bpmn-icon-screw-wrench:before { content: '\e8db'; } /* '' */
.bpmn-icon-connection:before { content: '\e8dc'; } /* '' */
.bpmn-icon-conditional-flow:before { content: '\e8e0'; } /* '' */
.bpmn-icon-default-flow:before { content: '\e8e1'; } /* '' */

View File

@@ -0,0 +1,986 @@
/**
* color definitions
*/
.djs-parent {
--color-grey-225-10-15: hsl(225, 10%, 15%);
--color-grey-225-10-35: hsl(225, 10%, 35%);
--color-grey-225-10-55: hsl(225, 10%, 55%);
--color-grey-225-10-75: hsl(225, 10%, 75%);
--color-grey-225-10-80: hsl(225, 10%, 80%);
--color-grey-225-10-85: hsl(225, 10%, 85%);
--color-grey-225-10-90: hsl(225, 10%, 90%);
--color-grey-225-10-95: hsl(225, 10%, 95%);
--color-grey-225-10-97: hsl(225, 10%, 97%);
--color-blue-205-100-45: hsl(205, 100%, 45%);
--color-blue-205-100-45-opacity-30: hsla(205, 100%, 45%, 30%);
--color-blue-205-100-50: hsl(205, 100%, 50%);
--color-blue-205-100-50-opacity-15: hsla(205, 100%, 50%, 15%);
--color-blue-205-100-70: hsl(205, 100%, 75%);
--color-blue-205-100-95: hsl(205, 100%, 95%);
--color-green-150-86-44: hsl(150, 86%, 44%);
--color-red-360-100-40: hsl(360, 100%, 40%);
--color-red-360-100-45: hsl(360, 100%, 45%);
--color-red-360-100-92: hsl(360, 100%, 92%);
--color-red-360-100-97: hsl(360, 100%, 97%);
--color-white: hsl(0, 0%, 100%);
--color-black: hsl(0, 0%, 0%);
--color-black-opacity-10: hsla(0, 0%, 0%, 10%);
--color-black-opacity-30: hsla(0, 0%, 0%, 30%);
--canvas-fill-color: var(--color-white);
--bendpoint-fill-color: var(--color-blue-205-100-45);
--bendpoint-stroke-color: var(--canvas-fill-color);
--context-pad-entry-background-color: var(--color-white);
--context-pad-entry-hover-background-color: var(--color-grey-225-10-95);
--element-dragger-color: var(--color-blue-205-100-50);
--element-hover-outline-fill-color: var(--color-blue-205-100-45);
--element-selected-outline-stroke-color: var(--color-blue-205-100-50);
--element-selected-outline-secondary-stroke-color: var(--color-blue-205-100-70);
--lasso-fill-color: var(--color-blue-205-100-50-opacity-15);
--lasso-stroke-color: var(--element-selected-outline-stroke-color);
--palette-entry-color: var(--color-grey-225-10-15);
--palette-entry-hover-color: var(--color-blue-205-100-45);
--palette-entry-selected-color: var(--color-blue-205-100-50);
--palette-separator-color: var(--color-grey-225-10-75);
--palette-toggle-hover-background-color: var(--color-grey-225-10-55);
--palette-background-color: var(--color-grey-225-10-97);
--palette-border-color: var(--color-grey-225-10-75);
--popup-font-size: 14px;
--popup-header-entry-selected-color: var(--color-blue-205-100-50);
--popup-header-font-weight: bolder;
--popup-background-color: var(--color-white);
--popup-border-color: transparent;
--popup-shadow-color: var(--color-black-opacity-30);
--popup-description-color: var(--color-grey-225-10-55);
--popup-no-results-color: var(--color-grey-225-10-55);
--popup-entry-title-color: var(--color-grey-225-10-55);
--popup-entry-hover-color: var(--color-grey-225-10-95);
--popup-search-border-color: var(--color-grey-225-10-75);
--popup-search-focus-border-color: var(--color-blue-205-100-50);
--popup-search-focus-background-color: var(--color-blue-205-100-95);
--resizer-fill-color: var(--color-blue-205-100-45);
--resizer-stroke-color: var(--canvas-fill-color);
--search-container-background-color: var(--color-grey-225-10-97);
--search-container-border-color: var(--color-blue-205-100-50);
--search-container-box-shadow-color: var(--color-blue-205-100-95);
--search-container-box-shadow-inset-color: var(--color-grey-225-10-80);
--search-input-border-color: var(--color-grey-225-10-75);
--search-result-border-color: var(--color-grey-225-10-75);
--search-result-highlight-color: var(--color-black);
--search-result-selected-color: var(--color-blue-205-100-45-opacity-30);
--shape-attach-allowed-stroke-color: var(--color-blue-205-100-50);
--shape-connect-allowed-fill-color: var(--color-grey-225-10-97);
--shape-drop-allowed-fill-color: var(--color-grey-225-10-97);
--shape-drop-not-allowed-fill-color: var(--color-red-360-100-97);
--shape-resize-preview-stroke-color: var(--color-blue-205-100-50);
--snap-line-stroke-color: var(--color-blue-205-100-45-opacity-30);
--space-tool-crosshair-stroke-color: var(--color-black);
--tooltip-error-background-color: var(--color-red-360-100-97);
--tooltip-error-border-color: var(--color-red-360-100-45);
--tooltip-error-color: var(--color-red-360-100-45);
}
/**
* outline styles
*/
.djs-outline,
.djs-selection-outline {
fill: none;
shape-rendering: geometricPrecision;
stroke-width: 2px;
}
.djs-outline {
visibility: hidden;
}
.djs-selection-outline {
stroke: var(--element-selected-outline-stroke-color);
}
.djs-element.selected .djs-outline {
visibility: visible;
stroke: var(--element-selected-outline-stroke-color);
}
.djs-multi-select .djs-element.selected .djs-outline {
stroke: var(--element-selected-outline-secondary-stroke-color);
}
.djs-shape.connect-ok .djs-visual > :nth-child(1) {
fill: var(--shape-connect-allowed-fill-color) !important;
}
.djs-shape.connect-not-ok .djs-visual > :nth-child(1),
.djs-shape.drop-not-ok .djs-visual > :nth-child(1) {
fill: var(--shape-drop-not-allowed-fill-color) !important;
}
.djs-shape.new-parent .djs-visual > :nth-child(1) {
fill: var(--shape-drop-allowed-fill-color) !important;
}
svg.drop-not-ok {
background: var(--shape-drop-not-allowed-fill-color) !important;
}
svg.new-parent {
background: var(--shape-drop-allowed-fill-color) !important;
}
/* Override move cursor during drop and connect */
.drop-not-ok,
.connect-not-ok,
.drop-not-ok *,
.connect-not-ok * {
cursor: not-allowed !important;
}
.drop-ok,
.connect-ok,
.drop-ok *,
.connect-ok * {
cursor: default !important;
}
.djs-element.attach-ok .djs-visual > :nth-child(1) {
stroke-width: 5px !important;
stroke: var(--shape-attach-allowed-stroke-color) !important;
}
.djs-frame.connect-not-ok .djs-visual > :nth-child(1),
.djs-frame.drop-not-ok .djs-visual > :nth-child(1) {
stroke-width: 3px !important;
stroke: var(--shape-drop-not-allowed-fill-color) !important;
fill: none !important;
}
/**
* Selection box style
*
*/
.djs-lasso-overlay {
fill: var(--lasso-fill-color);
stroke: var(--lasso-stroke-color);
stroke-width: 2px;
shape-rendering: geometricPrecision;
pointer-events: none;
}
/**
* Resize styles
*/
.djs-resize-overlay {
fill: none;
stroke-dasharray: 5 1 3 1;
stroke: var(--shape-resize-preview-stroke-color);
pointer-events: none;
}
.djs-resizer-hit {
fill: none;
pointer-events: all;
}
.djs-resizer-visual {
fill: var(--resizer-fill-color);
stroke-width: 1px;
stroke: var(--resizer-stroke-color);
shape-rendering: geometricPrecision;
}
.djs-resizer:hover .djs-resizer-visual {
stroke: var(--resizer-stroke-color);
stroke-opacity: 1;
}
.djs-cursor-resize-ns,
.djs-resizer-n,
.djs-resizer-s {
cursor: ns-resize;
}
.djs-cursor-resize-ew,
.djs-resizer-e,
.djs-resizer-w {
cursor: ew-resize;
}
.djs-cursor-resize-nwse,
.djs-resizer-nw,
.djs-resizer-se {
cursor: nwse-resize;
}
.djs-cursor-resize-nesw,
.djs-resizer-ne,
.djs-resizer-sw {
cursor: nesw-resize;
}
.djs-shape.djs-resizing > .djs-outline {
visibility: hidden !important;
}
.djs-shape.djs-resizing > .djs-resizer {
visibility: hidden;
}
.djs-dragger > .djs-resizer {
visibility: hidden;
}
/**
* drag styles
*/
.djs-dragger * {
fill: none !important;
stroke: var(--element-dragger-color) !important;
}
.djs-dragger tspan,
.djs-dragger text {
fill: var(--element-dragger-color) !important;
stroke: none !important;
}
marker.djs-dragger circle,
marker.djs-dragger path,
marker.djs-dragger polygon,
marker.djs-dragger polyline,
marker.djs-dragger rect {
fill: var(--element-dragger-color) !important;
stroke: none !important;
}
marker.djs-dragger text,
marker.djs-dragger tspan {
fill: none !important;
stroke: var(--element-dragger-color) !important;
}
.djs-dragging {
opacity: 0.3;
}
.djs-dragging,
.djs-dragging > * {
pointer-events: none !important;
}
.djs-dragging .djs-context-pad,
.djs-dragging .djs-outline {
display: none !important;
}
/**
* no pointer events for visual
*/
.djs-visual,
.djs-outline {
pointer-events: none;
}
.djs-element.attach-ok .djs-hit {
stroke-width: 60px !important;
}
/**
* all pointer events for hit shape
*/
.djs-element > .djs-hit-all,
.djs-element > .djs-hit-no-move {
pointer-events: all;
}
.djs-element > .djs-hit-stroke,
.djs-element > .djs-hit-click-stroke {
pointer-events: stroke;
}
/**
* shape / connection basic styles
*/
.djs-connection .djs-visual {
stroke-width: 2px;
fill: none;
}
.djs-cursor-grab {
cursor: -webkit-grab;
cursor: -moz-grab;
cursor: grab;
}
.djs-cursor-grabbing {
cursor: -webkit-grabbing;
cursor: -moz-grabbing;
cursor: grabbing;
}
.djs-cursor-crosshair {
cursor: crosshair;
}
.djs-cursor-move {
cursor: move;
}
.djs-cursor-resize-ns {
cursor: ns-resize;
}
.djs-cursor-resize-ew {
cursor: ew-resize;
}
/**
* snapping
*/
.djs-snap-line {
stroke: var(--snap-line-stroke-color);
stroke-linecap: round;
stroke-width: 2px;
pointer-events: none;
}
/**
* snapping
*/
.djs-crosshair {
stroke: var(--space-tool-crosshair-stroke-color);
stroke-linecap: round;
stroke-width: 1px;
pointer-events: none;
shape-rendering: geometricPrecision;
stroke-dasharray: 5, 5;
}
/**
* palette
*/
.djs-palette {
position: absolute;
left: 20px;
top: 20px;
box-sizing: border-box;
width: 48px;
}
.djs-palette .separator {
margin: 5px;
padding-top: 5px;
border: none;
border-bottom: solid 1px var(--palette-separator-color);
clear: both;
}
.djs-palette .entry:before {
vertical-align: initial;
}
.djs-palette .djs-palette-toggle {
cursor: pointer;
}
.djs-palette .entry,
.djs-palette .djs-palette-toggle {
color: var(--palette-entry-color);
font-size: 30px;
text-align: center;
}
.djs-palette .entry {
float: left;
}
.djs-palette .entry img {
max-width: 100%;
}
.djs-palette .djs-palette-entries:after {
content: '';
display: table;
clear: both;
}
.djs-palette .djs-palette-toggle:hover {
background: var(--palette-toggle-hover-background-color);
}
.djs-palette .entry:hover {
color: var(--palette-entry-hover-color);
}
.djs-palette .highlighted-entry {
color: var(--palette-entry-selected-color) !important;
}
.djs-palette .entry,
.djs-palette .djs-palette-toggle {
width: 46px;
height: 46px;
line-height: 46px;
cursor: default;
}
/**
* Palette open / two-column layout is controlled via
* classes on the palette. Events to hook into palette
* changed life-cycle are available in addition.
*/
.djs-palette.two-column.open {
width: 94px;
}
.djs-palette:not(.open) .djs-palette-entries {
display: none;
}
.djs-palette:not(.open) {
overflow: hidden;
}
.djs-palette.open .djs-palette-toggle {
display: none;
}
/**
* context-pad
*/
.djs-overlay-context-pad {
width: 72px;
z-index: 100;
}
.djs-context-pad {
position: absolute;
display: none;
pointer-events: none;
line-height: 1;
}
.djs-context-pad .entry {
width: 22px;
height: 22px;
text-align: center;
display: inline-block;
font-size: 22px;
margin: 0 2px 2px 0;
border-radius: 3px;
cursor: default;
background-color: var(--context-pad-entry-background-color);
box-shadow: 0 0 2px 1px var(--context-pad-entry-background-color);
pointer-events: all;
vertical-align: middle;
}
.djs-context-pad .entry:hover {
background: var(--context-pad-entry-hover-background-color);
}
.djs-context-pad.open {
display: block;
}
/**
* popup styles
*/
.djs-popup-backdrop {
position: fixed;
width: 100vw;
height: 100vh;
top: 0;
left: 0;
z-index: 200;
line-height: 1;
font-family: "IBM Plex Sans", sans-serif;
}
.djs-popup {
box-sizing: border-box;
width: min-content;
background: var(--popup-background-color);
overflow: hidden;
position: absolute;
box-shadow: 0px 2px 6px var(--popup-shadow-color);
border: solid 1px var(--popup-border-color);
min-width: 120px;
outline: none;
font-size: var(--popup-font-size);
}
.djs-popup-search input {
width: 100%;
box-sizing: border-box;
font-size: var(--popup-font-size);
padding: 3px 6px;
border-radius: 2px;
border: solid 1px var(--popup-search-border-color);
line-height: 21px;
}
.djs-popup-search input:focus {
background-color: var(--popup-search-focus-background-color);
border: solid 1px var(--popup-search-focus-border-color);
outline: none;
}
.djs-popup-header {
display: flex;
align-items: stretch;
line-height: 20px;
margin: 10px 12px 10px 12px;
}
.djs-popup-header .entry {
border-radius: 2px;
}
.djs-popup-header .entry.active {
color: var(--popup-header-entry-selected-color);
}
.djs-popup-header .entry.disabled {
color: inherit;
}
.djs-popup-search {
margin: 10px 12px;
}
.djs-popup-title {
font-size: var(--popup-font-size);
font-weight: var(--popup-header-font-weight);
flex: 1;
margin: 0;
}
.djs-popup-search {
position: relative;
width: auto;
}
.djs-popup-search-icon {
position: absolute;
left: 8px;
top: 7px;
}
.djs-popup-search input {
padding-left: 25px;
}
.djs-popup-results {
margin: 7px 3px 7px 12px;
list-style: none;
max-height: 280px;
overflow: auto;
padding-right: 9px;
}
.djs-popup-group {
margin: 0;
padding: 0;
width: 100%;
}
.djs-popup-body .entry,
.djs-popup-body .entry-header {
padding: 5px 7px;
cursor: default;
border-radius: 4px;
}
.djs-popup-body .entry-header {
font-weight: var(--popup-header-font-weight);
color: var(--popup-entry-title-color);
padding-left: 0;
}
.djs-popup [class*="icon"] .djs-popup-label,
.djs-popup-label:not(:first-child) {
margin-left: .5em;
}
.djs-popup [class*="icon"]:before,
.djs-popup-entry-icon {
width: 1em;
height: 1em;
display: inline-block;
font-size: 1.4em;
vertical-align: middle;
}
.djs-popup-body .entry-header:not(:first-child) {
margin-top: 8px;
margin-bottom: 2px;
}
.djs-popup-body .entry {
display: flex;
flex-direction: row;
align-items: stretch;
height: min-content;
}
.djs-popup .entry.selected {
background-color: var(--popup-entry-hover-color);
}
.djs-popup-body .entry:not(:first-child) {
margin-top: 2px;
}
.djs-popup-entry-content {
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
.djs-popup-entry-description {
color: var(--popup-description-color);
}
.djs-popup-label,
.djs-popup-entry-description {
line-height: 1.4em;
}
.djs-popup-title,
.djs-popup-label,
.djs-popup-entry-description,
.djs-popup .entry-header {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.djs-popup-entry-name {
display: flex;
}
.entry-content {
display: flex;
flex-direction: column;
flex: 1;
overflow: hidden;
}
.djs-popup-body {
flex-direction: column;
width: auto;
}
.djs-popup *::-webkit-scrollbar {
width: 6px;
}
.djs-popup *::-webkit-scrollbar-thumb {
border-radius: 3px;
background-color: rgba(0, 0, 0, 0.2);
}
.djs-popup *::-webkit-scrollbar-track {
box-shadow: none;
background: transparent;
margin: 0;
padding: 5px;
}
.djs-popup-no-results {
padding: 0 12px 12px 12px;
color: var(--popup-no-results-color);
}
.djs-popup-entry-docs {
flex: 0;
flex-direction: row;
align-items: center;
padding-left: 5px;
display: none;
}
.djs-popup-body .entry:hover .djs-popup-entry-docs {
display: flex;
}
.djs-popup-entry-docs svg {
vertical-align: middle;
margin: auto 2px auto 5px;
}
/**
* palette styles
*/
.djs-palette {
background: var(--palette-background-color);
border: solid 1px var(--palette-border-color);
border-radius: 2px;
}
/**
* touch
*/
.djs-shape,
.djs-connection {
touch-action: none;
}
.djs-segment-dragger,
.djs-bendpoint {
display: none;
}
/**
* bendpoints
*/
.djs-segment-dragger .djs-visual {
display: none;
fill: var(--bendpoint-fill-color);
stroke: var(--bendpoint-stroke-color);
stroke-width: 1px;
stroke-opacity: 1;
}
.djs-segment-dragger:hover .djs-visual {
display: block;
}
.djs-bendpoint .djs-visual {
fill: var(--bendpoint-fill-color);
stroke: var(--bendpoint-stroke-color);
stroke-width: 1px;
}
.djs-segment-dragger:hover,
.djs-bendpoints.hover .djs-segment-dragger,
.djs-bendpoints.selected .djs-segment-dragger,
.djs-bendpoint:hover,
.djs-bendpoints.hover .djs-bendpoint,
.djs-bendpoints.selected .djs-bendpoint {
display: block;
}
.djs-drag-active .djs-bendpoints * {
display: none;
}
.djs-bendpoints:not(.hover) .floating {
display: none;
}
.djs-segment-dragger:hover .djs-visual,
.djs-segment-dragger.djs-dragging .djs-visual,
.djs-bendpoint:hover .djs-visual,
.djs-bendpoint.floating .djs-visual {
fill: var(--bendpoint-fill-color);
stroke: var(--bendpoint-stroke-color);
stroke-opacity: 1;
}
.djs-bendpoint.floating .djs-hit {
pointer-events: none;
}
.djs-segment-dragger .djs-hit,
.djs-bendpoint .djs-hit {
fill: none;
pointer-events: all;
}
.djs-segment-dragger.horizontal .djs-hit {
cursor: ns-resize;
}
.djs-segment-dragger.vertical .djs-hit {
cursor: ew-resize;
}
.djs-segment-dragger.djs-dragging .djs-hit {
pointer-events: none;
}
.djs-updating,
.djs-updating > * {
pointer-events: none !important;
}
.djs-updating .djs-context-pad,
.djs-updating .djs-outline,
.djs-updating .djs-bendpoint,
.djs-multi-select .djs-bendpoint,
.djs-multi-select .djs-segment-dragger,
.connect-ok .djs-bendpoint,
.connect-not-ok .djs-bendpoint,
.drop-ok .djs-bendpoint,
.drop-not-ok .djs-bendpoint {
display: none !important;
}
.djs-segment-dragger.djs-dragging,
.djs-bendpoint.djs-dragging {
display: block;
opacity: 1.0;
}
/**
* tooltips
*/
.djs-tooltip-error {
width: 160px;
padding: 6px;
background: var(--tooltip-error-background-color);
border: solid 1px var(--tooltip-error-border-color);
border-radius: 2px;
color: var(--tooltip-error-color);
font-size: 12px;
line-height: 16px;
opacity: 0.75;
}
.djs-tooltip-error:hover {
opacity: 1;
}
/**
* search pad
*/
.djs-search-container {
position: absolute;
top: 20px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
width: 25%;
min-width: 300px;
max-width: 400px;
z-index: 10;
font-size: 1.05em;
opacity: 0.9;
background: var(--search-container-background-color);
border: solid 1px var(--search-container-border-color);
border-radius: 2px;
box-shadow: 0 0 0 2px var(--search-container-box-shadow-color), 0 0 0 1px var(--search-container-box-shadow-inset-color) inset;
}
.djs-search-container:not(.open) {
display: none;
}
.djs-search-input input {
font-size: 1.05em;
width: 100%;
padding: 6px 10px;
border: 1px solid var(--search-input-border-color);
box-sizing: border-box;
}
.djs-search-input input:focus {
outline: none;
border-color: var(--search-input-border-color);
}
.djs-search-results {
position: relative;
overflow-y: auto;
max-height: 200px;
}
.djs-search-results:hover {
cursor: pointer;
}
.djs-search-result {
width: 100%;
padding: 6px 10px;
background: white;
border-bottom: solid 1px var(--search-result-border-color);
border-radius: 1px;
}
.djs-search-highlight {
color: var(--search-result-highlight-color);
}
.djs-search-result-primary {
margin: 0 0 10px;
}
.djs-search-result-secondary {
font-family: monospace;
margin: 0;
}
.djs-search-result:hover {
background: var(--search-result-selected-color);
}
.djs-search-result-selected {
background: var(--search-result-selected-color);
}
.djs-search-result-selected:hover {
background: var(--search-result-selected-color);
}
.djs-search-overlay {
background: var(--search-result-selected-color);
}
/**
* hidden styles
*/
.djs-element-hidden,
.djs-element-hidden .djs-hit,
.djs-element-hidden .djs-outline,
.djs-label-hidden .djs-label {
display: none !important;
}
.djs-element .djs-hit-stroke,
.djs-element .djs-hit-click-stroke,
.djs-element .djs-hit-all {
cursor: move;
}

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 130 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@@ -1 +0,0 @@
{"version":3,"sources":[],"names":[],"mappings":"","file":"gitalk.css","sourceRoot":""}

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 211 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 130 KiB

View File

@@ -1,8 +1 @@
/**
* Minified by jsDelivr using Terser v5.3.5.
* Original file: /npm/js-base64@3.6.0/base64.js
*
* Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
*/
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):function(){const r=e.Base64,o=t();o.noConflict=()=>(e.Base64=r,o),e.Meteor&&(Base64=o),e.Base64=o}()}("undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:this,(function(){"use strict";const e="3.6.0",t="function"==typeof atob,r="function"==typeof btoa,o="function"==typeof Buffer,n="function"==typeof TextDecoder?new TextDecoder:void 0,a="function"==typeof TextEncoder?new TextEncoder:void 0,f=[..."ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="],i=(e=>{let t={};return e.forEach(((e,r)=>t[e]=r)),t})(f),c=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,u=String.fromCharCode.bind(String),s="function"==typeof Uint8Array.from?Uint8Array.from.bind(Uint8Array):(e,t=(e=>e))=>new Uint8Array(Array.prototype.slice.call(e,0).map(t)),d=e=>e.replace(/[+\/]/g,(e=>"+"==e?"-":"_")).replace(/=+$/m,""),l=e=>e.replace(/[^A-Za-z0-9\+\/]/g,""),h=e=>{let t,r,o,n,a="";const i=e.length%3;for(let i=0;i<e.length;){if((r=e.charCodeAt(i++))>255||(o=e.charCodeAt(i++))>255||(n=e.charCodeAt(i++))>255)throw new TypeError("invalid character found");t=r<<16|o<<8|n,a+=f[t>>18&63]+f[t>>12&63]+f[t>>6&63]+f[63&t]}return i?a.slice(0,i-3)+"===".substring(i):a},p=r?e=>btoa(e):o?e=>Buffer.from(e,"binary").toString("base64"):h,y=o?e=>Buffer.from(e).toString("base64"):e=>{let t=[];for(let r=0,o=e.length;r<o;r+=4096)t.push(u.apply(null,e.subarray(r,r+4096)));return p(t.join(""))},A=(e,t=!1)=>t?d(y(e)):y(e),b=e=>{if(e.length<2)return(t=e.charCodeAt(0))<128?e:t<2048?u(192|t>>>6)+u(128|63&t):u(224|t>>>12&15)+u(128|t>>>6&63)+u(128|63&t);var t=65536+1024*(e.charCodeAt(0)-55296)+(e.charCodeAt(1)-56320);return u(240|t>>>18&7)+u(128|t>>>12&63)+u(128|t>>>6&63)+u(128|63&t)},g=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,B=e=>e.replace(g,b),x=o?e=>Buffer.from(e,"utf8").toString("base64"):a?e=>y(a.encode(e)):e=>p(B(e)),C=(e,t=!1)=>t?d(x(e)):x(e),m=e=>C(e,!0),U=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,F=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return u(55296+(t>>>10))+u(56320+(1023&t));case 3:return u((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return u((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},w=e=>e.replace(U,F),S=e=>{if(e=e.replace(/\s+/g,""),!c.test(e))throw new TypeError("malformed base64.");e+="==".slice(2-(3&e.length));let t,r,o,n="";for(let a=0;a<e.length;)t=i[e.charAt(a++)]<<18|i[e.charAt(a++)]<<12|(r=i[e.charAt(a++)])<<6|(o=i[e.charAt(a++)]),n+=64===r?u(t>>16&255):64===o?u(t>>16&255,t>>8&255):u(t>>16&255,t>>8&255,255&t);return n},E=t?e=>atob(l(e)):o?e=>Buffer.from(e,"base64").toString("binary"):S,v=o?e=>s(Buffer.from(e,"base64")):e=>s(E(e),(e=>e.charCodeAt(0))),D=e=>v(z(e)),R=o?e=>Buffer.from(e,"base64").toString("utf8"):n?e=>n.decode(v(e)):e=>w(E(e)),z=e=>l(e.replace(/[-_]/g,(e=>"-"==e?"+":"/"))),T=e=>R(z(e)),Z=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),j=function(){const e=(e,t)=>Object.defineProperty(String.prototype,e,Z(t));e("fromBase64",(function(){return T(this)})),e("toBase64",(function(e){return C(this,e)})),e("toBase64URI",(function(){return C(this,!0)})),e("toBase64URL",(function(){return C(this,!0)})),e("toUint8Array",(function(){return D(this)}))},I=function(){const e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,Z(t));e("toBase64",(function(e){return A(this,e)})),e("toBase64URI",(function(){return A(this,!0)})),e("toBase64URL",(function(){return A(this,!0)}))},O={version:e,VERSION:"3.6.0",atob:E,atobPolyfill:S,btoa:p,btoaPolyfill:h,fromBase64:T,toBase64:C,encode:C,encodeURI:m,encodeURL:m,utob:B,btou:w,decode:T,isValid:e=>{if("string"!=typeof e)return!1;const t=e.replace(/\s+/g,"").replace(/=+$/,"");return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},fromUint8Array:A,toUint8Array:D,extendString:j,extendUint8Array:I,extendBuiltins:()=>{j(),I()},Base64:{}};return Object.keys(O).forEach((e=>O.Base64[e]=O[e])),O}));
//# sourceMappingURL=/sm/8bca8602e2256d240cef904e1c1df432ccfdd2a2a73f6911c60be79e526e3e1e.map
(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory(global):typeof define==="function"&&define.amd?define(factory):factory(global)}((typeof self!=="undefined"?self:typeof window!=="undefined"?window:typeof global!=="undefined"?global:this),function(global){global=global||{};var _Base64=global.Base64;var version="2.6.3";var b64chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var b64tab=function(bin){var t={};for(var i=0,l=bin.length;i<l;i++){t[bin.charAt(i)]=i}return t}(b64chars);var fromCharCode=String.fromCharCode;var cb_utob=function(c){if(c.length<2){var cc=c.charCodeAt(0);return cc<128?c:cc<2048?(fromCharCode(192|(cc>>>6))+fromCharCode(128|(cc&63))):(fromCharCode(224|((cc>>>12)&15))+fromCharCode(128|((cc>>>6)&63))+fromCharCode(128|(cc&63)))}else{var cc=65536+(c.charCodeAt(0)-55296)*1024+(c.charCodeAt(1)-56320);return(fromCharCode(240|((cc>>>18)&7))+fromCharCode(128|((cc>>>12)&63))+fromCharCode(128|((cc>>>6)&63))+fromCharCode(128|(cc&63)))}};var re_utob=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g;var utob=function(u){return u.replace(re_utob,cb_utob)};var cb_encode=function(ccc){var padlen=[0,2,1][ccc.length%3],ord=ccc.charCodeAt(0)<<16|((ccc.length>1?ccc.charCodeAt(1):0)<<8)|((ccc.length>2?ccc.charCodeAt(2):0)),chars=[b64chars.charAt(ord>>>18),b64chars.charAt((ord>>>12)&63),padlen>=2?"=":b64chars.charAt((ord>>>6)&63),padlen>=1?"=":b64chars.charAt(ord&63)];return chars.join("")};var btoa=global.btoa&&typeof global.btoa=="function"?function(b){return global.btoa(b)}:function(b){if(b.match(/[^\x00-\xFF]/)){throw new RangeError("The string contains invalid characters.")}return b.replace(/[\s\S]{1,3}/g,cb_encode)};var _encode=function(u){return btoa(utob(String(u)))};var mkUriSafe=function(b64){return b64.replace(/[+\/]/g,function(m0){return m0=="+"?"-":"_"}).replace(/=/g,"")};var encode=function(u,urisafe){return urisafe?mkUriSafe(_encode(u)):_encode(u)};var encodeURI=function(u){return encode(u,true)};var fromUint8Array;if(global.Uint8Array){fromUint8Array=function(a,urisafe){var b64="";for(var i=0,l=a.length;i<l;i+=3){var a0=a[i],a1=a[i+1],a2=a[i+2];var ord=a0<<16|a1<<8|a2;b64+=b64chars.charAt(ord>>>18)+b64chars.charAt((ord>>>12)&63)+(typeof a1!="undefined"?b64chars.charAt((ord>>>6)&63):"=")+(typeof a2!="undefined"?b64chars.charAt(ord&63):"=")}return urisafe?mkUriSafe(b64):b64}}var re_btou=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g;var cb_btou=function(cccc){switch(cccc.length){case 4:var cp=((7&cccc.charCodeAt(0))<<18)|((63&cccc.charCodeAt(1))<<12)|((63&cccc.charCodeAt(2))<<6)|(63&cccc.charCodeAt(3)),offset=cp-65536;return(fromCharCode((offset>>>10)+55296)+fromCharCode((offset&1023)+56320));case 3:return fromCharCode(((15&cccc.charCodeAt(0))<<12)|((63&cccc.charCodeAt(1))<<6)|(63&cccc.charCodeAt(2)));default:return fromCharCode(((31&cccc.charCodeAt(0))<<6)|(63&cccc.charCodeAt(1)))}};var btou=function(b){return b.replace(re_btou,cb_btou)};var cb_decode=function(cccc){var len=cccc.length,padlen=len%4,n=(len>0?b64tab[cccc.charAt(0)]<<18:0)|(len>1?b64tab[cccc.charAt(1)]<<12:0)|(len>2?b64tab[cccc.charAt(2)]<<6:0)|(len>3?b64tab[cccc.charAt(3)]:0),chars=[fromCharCode(n>>>16),fromCharCode((n>>>8)&255),fromCharCode(n&255)];chars.length-=[0,0,2,1][padlen];return chars.join("")};var _atob=global.atob&&typeof global.atob=="function"?function(a){return global.atob(a)}:function(a){return a.replace(/\S{1,4}/g,cb_decode)};var atob=function(a){return _atob(String(a).replace(/[^A-Za-z0-9\+\/]/g,""))};var _decode=function(a){return btou(_atob(a))};var _fromURI=function(a){return String(a).replace(/[-_]/g,function(m0){return m0=="-"?"+":"/"}).replace(/[^A-Za-z0-9\+\/]/g,"")};var decode=function(a){return _decode(_fromURI(a))};var toUint8Array;if(global.Uint8Array){toUint8Array=function(a){return Uint8Array.from(atob(_fromURI(a)),function(c){return c.charCodeAt(0)})}}var noConflict=function(){var Base64=global.Base64;global.Base64=_Base64;return Base64};global.Base64={VERSION:version,atob:atob,btoa:btoa,fromBase64:decode,toBase64:encode,utob:utob,encode:encode,encodeURI:encodeURI,btou:btou,decode:decode,noConflict:noConflict,fromUint8Array:fromUint8Array,toUint8Array:toUint8Array};if(typeof Object.defineProperty==="function"){var noEnum=function(v){return{value:v,enumerable:false,writable:true,configurable:true}};global.Base64.extendString=function(){Object.defineProperty(String.prototype,"fromBase64",noEnum(function(){return decode(this)}));Object.defineProperty(String.prototype,"toBase64",noEnum(function(urisafe){return encode(this,urisafe)}));Object.defineProperty(String.prototype,"toBase64URI",noEnum(function(){return encode(this,true)}))}}if(global["Meteor"]){Base64=global.Base64}if(typeof module!=="undefined"&&module.exports){module.exports.Base64=global.Base64}else{if(typeof define==="function"&&define.amd){define([],function(){return global.Base64})}}return{Base64:global.Base64}}));

View File

@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!DOCTYPE html>
<html>
<head>
@@ -45,6 +45,8 @@
</div>
<div id="zoomSelect" class="select-icon" title="缩放比例">
<select id="zoomValue">
<option value="width">适合页宽</option>
<option value="4.0">400%</option>
<option value="3.0">300%</option>
<option value="2.0">200%</option>
<option value="1.5">150%</option>

View File

@@ -53,6 +53,7 @@ window.onresize = function() {
} ();
};
// 手机端,隐藏缩放比例选择框,打开文件和打印按钮
if (this.isMobile()) {
if (document.getElementById("zoomSelect")) document.getElementById("zoomSelect").style.display = "none";
if (document.getElementById("openFile")) document.getElementById("openFile").style.display = "none";
@@ -61,11 +62,12 @@ if (this.isMobile()) {
if (document.getElementById("separator2")) document.getElementById("separator2").style.display = "none";
}
// 判断手机端还是PC端
function isMobile() {
var flag = navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);
return flag;
}
// 判断是否IE浏览器
function isIE() {
var navigator = window.navigator.userAgent;
if (navigator.indexOf("MSIE") > 0 || navigator.indexOf("Trident") > 0) {
@@ -96,9 +98,34 @@ data: function data() {
};
}
this.pageZoomScale = "1.0";
cnofd["setScaleValue"](this.pageZoomScale);
var scale = this.getQueryVariable("scale");
if (scale && (scale == "width" || Number(scale))) {
this.pageZoomScale = scale;
cnofd["setScaleValue"](scale);
}
var file = this.getQueryVariable("file");
file = decodeURIComponent(file);
if (file) this.loadOfdFile(file);
if (scale && (scale == "width" || Number(scale))) {
var selectZoom = document.getElementById("zoomValue");
selectZoom.selectedIndex = -1;
if (this.pageZoomScale == "width") {
selectZoom.selectedIndex = 0;
} else {
for (var i = 1; i < selectZoom.length; i++) {
if (Math.abs(this.pageZoomScale - selectZoom.options[i].value) < 0.01) {
selectZoom.selectedIndex = i;
break;
}
}
}
}
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
@@ -125,8 +152,7 @@ function loadOfdFile(ofdFile) {
that.ofdBase64 = base64String;
}
});
ofdFile = ofdFile = decodeURIComponent(ofdFile);
this.getOfdDocument(ofdFile, this.screenWidth);
this.getOfdDocument(ofdFile, this.screenWidth, this.pageZoomScale);
setPageInfo();
}
@@ -170,10 +196,12 @@ function fileChanged() {
return;
}
Object(cnofd["setScaleValue"])(1.0);
// 新打开OFD文件时还原成页面实际尺寸显示
//Object(cnofd["setScaleValue"])(1.0);
Object(cnofd["setScaleValue"])(this.pageZoomScale);
var selectZoom = document.getElementById("zoomValue");
if (selectZoom)
selectZoom.value = "1.0";
selectZoom.value = this.pageZoomScale;
var that = this;
var reader = new FileReader();
@@ -183,10 +211,11 @@ function fileChanged() {
that.ofdBase64 = e.target.result.split(",")[1];
};
this.getOfdDocument(this.file, this.screenWidth);
this.getOfdDocument(this.file, this.screenWidth, this.pageZoomScale);
//$("#file")[0].value = null;
}
function getOfdDocument(file, screenWidth) {
function getOfdDocument(file, screenWidth, pageZoomScale) {
var that = this;
$("#loading").show();
@@ -199,14 +228,18 @@ function getOfdDocument(file, screenWidth) {
that.ofdDoc = res;
that.pageIndex = 1;
that.pageCount = res.pageCount;
var divs = Object(cnofd["ofdRender"])(res, screenWidth);
that.displayOfdDiv(divs);
if (pageZoomScale == "width") {
var divs = Object(cnofd["ofdRender"])(res, screenWidth);
that.displayOfdDiv(divs);
} else {
var divs = Object(cnofd["ofdRenderByScale"])(res, screenWidth, pageZoomScale);
that.displayOfdDiv(divs);
}
$("#loading").hide();
},
fail: function fail(error) {
$("#loading").hide();
that.$alert("OFD打开失败", error, {
alert("OFD打开失败", error, {
confirmButtonText: "确定",
callback: function callback(action) {
this.$message({
@@ -242,7 +275,7 @@ function displayOfdDiv(divs) {
function zoomIn() {
var selectZoom = document.getElementById("zoomValue");
if (selectZoom.selectedIndex > 0) {
if (selectZoom.selectedIndex > 1) {
selectZoom.selectedIndex = selectZoom.selectedIndex - 1;
Object(cnofd["setScaleValue"])(selectZoom.options[selectZoom.selectedIndex].value);
@@ -259,6 +292,7 @@ function zoomOut() {
var selectZoom = document.getElementById("zoomValue");
if (selectZoom.selectedIndex < selectZoom.length-1) {
selectZoom.selectedIndex = selectZoom.selectedIndex + 1;
if (selectZoom.selectedIndex == 0) selectZoom.selectedIndex = 1;
Object(cnofd["setScaleValue"])(selectZoom.options[selectZoom.selectedIndex].value);
var divs = Object(cnofd["ofdRenderByScale"])(this.ofdDoc);
@@ -272,13 +306,23 @@ function zoomOut() {
function zoomChange() {
var selectZoom = document.getElementById("zoomValue");
Object(cnofd["setScaleValue"])(selectZoom.options[selectZoom.selectedIndex].value);
var divs = Object(cnofd["ofdRenderByScale"])(this.ofdDoc);
if (divs) {
this.displayOfdDiv(divs);
if (selectZoom.options[selectZoom.selectedIndex].value == "width") {
Object(cnofd["setScaleValue"])(selectZoom.options[selectZoom.selectedIndex].value);
var divs = Object(cnofd["ofdRender"])(this.ofdDoc, this.screenWidth);
if (divs) {
this.displayOfdDiv(divs);
} else {
this.getOfdDocument(this.file, this.screenWidth);
}
} else {
this.getOfdDocument(this.file, this.screenWidth);
}
Object(cnofd["setScaleValue"])(selectZoom.options[selectZoom.selectedIndex].value);
var divs = Object(cnofd["ofdRenderByScale"])(this.ofdDoc);
if (divs) {
this.displayOfdDiv(divs);
} else {
this.getOfdDocument(this.file, this.screenWidth);
}
}
}
function scrool() {
@@ -362,7 +406,7 @@ function print() {
if (list.length > 0) {
if (!isIE()) {
var mywindow = window.open("打印窗口", "_blank");
mywindow.document.write('<!DOCTYPE html><html><head>'
mywindow.document.write('<!DOCTYPE html><html><head>'
+'<style media="print">.page-break { page-break-inside: avoid; page-break-after: always; }</style>'
+'</head><body></body</html>');
var documentBody = mywindow.document.body;
@@ -399,7 +443,9 @@ function print() {
}
}
// IE浏览器在iframe里调用打印
function printIE(printhtml) {
//新建一个iframe
var iframe = document.createElement("iframe");
iframe.id = "printf";
iframe.style.width = "0";
@@ -407,6 +453,7 @@ function printIE(printhtml) {
iframe.style.height = "0";
iframe.style.border = "none";
//将iframe插入到printBody里
document.body.appendChild(iframe);
setTimeout(function () {

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@@ -10,18 +10,15 @@
<meta name=keywords content="Xmind,mindmap,mind map,mind mapping,mind mapping software,free mind mapping software,work from home,WFH,remote">
<link rel=stylesheet href=css/bootstrap-customized-2821153174.min.css>
<link rel=stylesheet href=css/index-5376440060.css>
<script src=js/jquery-3-c9f5aeeca3.2.1.min.js> </script>
<script src="../js/jquery-3.6.1.min.js"></script>
<meta name=viewport content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no">
<link rel=stylesheet href=css/share-embed-39eba5407f.css> </head>
<body>
<script>
window.manifests={snowbrush:"js/snowbrush.js"},window.metadataString=""
</script>
<script src=js/text-autospace-fed758f4a6.min.js> </script>
<script src=js/polyfill-45b9836beb.min.js> </script>
<script src=js/js-cookie-a978ac7394.js> </script>
<script src=js/popper-135fa9e662.min.js> </script>
<script src=js/bootstrap-26779614c4.min.js> </script>
<script src=js/base.61517cade8.js> </script>
<script src=js/share-embed.68f7476360.js> </script>
</body>

File diff suppressed because one or more lines are too long

View File

@@ -299,7 +299,7 @@
height: windowWidth,
width: windowHeight
} : a
, l = new o.IframeController(i,"/xmind/index.html")
, l = new o.IframeController(i,"xmind/index.html")
, u = new r.IframeEventChannelController(l,"");
this.iframeController = l,
this.iframeEventChannelController = u,

View File

@@ -0,0 +1,44 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<#include "*/commonHeader.ftl">
<style>
html, body, #diagram {
height: 100%
}
</style>
<title>kkFileView Bpmn</title>
</head>
<body>
<h2>kkFileView Bpmn : ${fileName}</h2>
<div id="diagram"></div>
<!-- required modeler styles -->
<link rel="stylesheet" href="bpmn/diagram-js.css">
<link rel="stylesheet" href="bpmn/bpmn-js.css">
<link rel="stylesheet" href="bpmn/css/bpmn.css">
<!-- modeler distro -->
<script src="bpmn/bpmn-modeler.development.js"></script>
<script src="js/jquery-3.6.1.min.js"></script>
<!-- app -->
<script>
const viewer = new BpmnJS({
container: '#diagram'
});
async function showDiagram(diagramXML) {
await viewer.importXML(diagramXML);
}
// load + show diagram
$.get('${currentUrl}', showDiagram, 'text');
</script>
</body>
</html>

View File

@@ -1,94 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<title>kkFileView相关交流</title>
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="css/viewer.min.css"/>
<link rel="stylesheet" href="css/loading.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="css/theme.css"/>
<link rel="stylesheet" href="gitalk/gitalk.css"/>
<script type="text/javascript" src="js/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery.form.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="gitalk/gitalk.min.js"></script>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://kkview.cn" target='_blank'>kkFileView</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="./index">首页</a></li>
<li><a href="./record">版本发布记录</a></li>
<li class="active"><a href="./comment">相关交流</a></li>
</ul>
</div>
</div>
</nav>
<div class="container theme-showcase" role="main">
<#-- 相关交流 -->
<div class="page-header">
<h1>相关交流</h1>
</div>
<div class="panel-body">
<div id="comments"></div>
</div>
</div>
<div class="loading_container">
<div class="spinner">
<div class="spinner-container container1">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container2">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
<div class="spinner-container container3">
<div class="circle1"></div>
<div class="circle2"></div>
<div class="circle3"></div>
<div class="circle4"></div>
</div>
</div>
</div>
<script>
$(function () {
var gitalk = new Gitalk({
clientID: '525d7f16e17aab08cef5',
clientSecret: 'd1154e3aee5c8f1cbdc918b5c97a4f4157e0bfd9',
repo: 'kkFileView',
owner: 'kekingcn',
admin: ['kekingcn,klboke,gitchenjh'],
language: 'zh-CN',
id: location.pathname,
distractionFreeMode: false
})
gitalk.render((document.getElementById('comments')))
});
</script>
</body>
</html>

View File

@@ -1,108 +1,71 @@
<!DOCTYPE html>
<html lang="en">
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0">
<#include "*/commonHeader.ftl">
<script src="js/jquery-3.6.1.min.js" type="text/javascript"></script>
<link href="css/zTreeStyle.css" rel="stylesheet" type="text/css">
<script src="js/base64.min.js" type="text/javascript"></script>
<style type="text/css">
<meta charset="utf-8"/>
<title>压缩包预览</title>
<script src="js/jquery-3.6.1.min.js"></script>
<#include "*/commonHeader.ftl">
<script src="js/base64.min.js" type="text/javascript"></script>
<link href="css/zTreeStyle.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery.ztree.core.js"></script>
<style type="text/css">
body {
background-color: #404040;
}
h1, h2, h3, h4, h5, h6 {color: #2f332a;font-weight: bold;font-family: Helvetica, Arial, sans-serif;padding-bottom: 5px;}
h1 {font-size: 24px;line-height: 34px;text-align: center;}
h2 {font-size: 14px;line-height: 24px;padding-top: 5px;}
h6 {font-weight: normal;font-size: 12px;letter-spacing: 1px;line-height: 24px;text-align: center;}
a {color:#3C6E31;text-decoration: underline;}
a:hover {background-color:#3C6E31;color:white;}
code {color: #2f332a;}
div.zTreeDemoBackground {width:600px;text-align:center;margin: 0 auto;background-color: #ffffff;}
div.zTreeDemoBackground {
max-width: 880px;
text-align:center;
margin:0 auto;
border-radius:3px;
box-shadow:rgba(0,0,0,0.15) 0 0 8px;
background:#FBFBFB;
border:1px solid #ddd;
margin:1px auto;
padding:5px;
}
</style>
</head>
<body>
<div class="zTreeDemoBackground left">
<h1>kkFileView</h1>
<ul id="treeDemo" class="ztree"></ul>
</div>
<script type="text/javascript" src="js/jquery.ztree.core.js"></script>
<script type="text/javascript">
const data = JSON.parse('${fileTree}');
var baseUrl = "${baseUrl}";
var setting = {
view: {
fontCss : {"color":"blue"},
showLine: true
},
<script>
var settings = {
data: {
key: {
children: 'childList',
name: 'originName'
simpleData: {
enable: true, //true 、 false 分别表示 使用 、 不使用 简单数据模式
idKey: "id", //节点数据中保存唯一标识的属性名称
pIdKey: "pid", //节点数据中保存其父节点唯一标识的属性名称
rootPId: ""
}
},
callback:{
beforeClick:function (treeId, treeNode, clickFlag) {
console.log("节点参数treeId-" + treeId + "treeNode-"
+ JSON.stringify(treeNode) + "clickFlag-" + clickFlag);
},
onClick:function (event, treeId, treeNode) {
if (!treeNode.directory) {
/**实现窗口最大化**/
var fulls = "left=0,screenX=0,top=0,screenY=0,scrollbars=1"; //定义弹出窗口的参数
if (window.screen) {
var ah = screen.availHeight - 30;
var aw = (screen.availWidth - 10) / 2;
fulls += ",height=" + ah;
fulls += ",innerHeight=" + ah;
fulls += ",width=" + aw;
fulls += ",innerWidth=" + aw;
fulls += ",resizable"
} else {
fulls += ",resizable"; // 对于不支持screen属性的浏览器可以手工进行最大化。 manually
}
var previewUrl = baseUrl + treeNode.fileName +"?fileKey="+ treeNode.fileKey;
window.open("onlinePreview?url=" + encodeURIComponent(Base64.encode(previewUrl)), "_blank",fulls);
}
}
callback: {
onClick: chooseNode,
}
};
var height = 0;
$(document).ready(function(){
var treeObj = $.fn.zTree.init($("#treeDemo"), setting, data);
treeObj.expandAll(true);
height = getZtreeDomHeight();
$(".zTreeDemoBackground").css("height", height);
function chooseNode(event, treeId, treeNode) {
var path = '${baseUrl}' + treeNode.id +"?fileKey="+'${fileName}';
location.href = "${baseUrl}onlinePreview?url=" + encodeURIComponent(Base64.encode(path));
}
$(document).ready(function () {
var url = '${fileTree}';
$.ajax({
type: "get",
url: "${baseUrl}directory?urls="+encodeURIComponent(Base64.encode(url)),
success: function (res) {
zTreeObj = $.fn.zTree.init($("#treeDemo"), settings, res); //初始化树
zTreeObj.expandAll(true); //true 节点全部展开、false节点收缩
}
});
});
/*初始化水印*/
window.onload = function() {
initWaterMark();
}
/**
* 计算ztreedom的高度
*/
function getZtreeDomHeight() {
return $("#treeDemo").height() > window.document.documentElement.clientHeight - 1
? $("#treeDemo").height() : window.document.documentElement.clientHeight - 1;
}
/**
* 页面变化调整高度
*/
window.onresize = function(){
height = getZtreeDomHeight();
$(".zTreeDemoBackground").css("height", height);
}
/**
* 滚动时调整高度
*/
window.onscroll = function(){
height = getZtreeDomHeight();
$(".zTreeDemoBackground").css("height", height);
}
</script>
</body>
</html>
</html>

View File

@@ -18,7 +18,7 @@
<script type="text/javascript" src="bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript" src="js/base64.min.js"></script>
<style>
.alert{
.alert {
width: 50%;
}
</style>
@@ -26,93 +26,100 @@
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://kkview.cn" target='_blank'>kkFileView</a>
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://kkview.cn" target='_blank'>kkFileView</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li class="active"><a href="./index">首页</a></li>
<li><a href="./record">版本发布记录</a></li>
<li><a href="./comment">相关交流</a></li>
</ul>
<ul class="nav navbar-nav">
<li class="active"><a href="./index">首页</a></li>
<li><a href="./integrated">接入说明</a></li>
<li><a href="./record">版本发布记录</a></li>
<li><a href="./sponsor">赞助开源</a></li>
</ul>
</div>
</div>
</nav>
</div>
</nav>
<div class="container theme-showcase" role="main">
<#-- 接入说明 -->
<div class="page-header">
<h1>接入说明</h1>
</div>
<div class="well">
<div style="font-size: 16px;">
如果你的项目需要接入文件预览项目达到对docxexcelpptjpg等文件的预览效果那么通过在你的项目中加入下面的代码就可以成功实现
<p style="background-color: #2f332a;color: #cccccc;font-size: 14px;padding:10px;margin-top:10px;">
var url = 'http://127.0.0.1:8080/file/test.txt'; //要预览文件的访问地址 <br>
window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(base64Encode(url)));
</p>
</div>
<div style="font-size: 16px;">
新增多图片同时预览功能接口如下
<p style="background-color: #2f332a;color: #cccccc;font-size: 14px;padding:10px;margin-top:10px;">
var fileUrl =url1+'|'+url2;//多url使用'|'字符隔开 <br>
window.open('http://127.0.0.1:8012/picturesPreview?urls='+encodeURIComponent(base64Encode(fileUrl)));
</p>
</div>
</div>
<#-- 输入下载地址预览文件 -->
<div class="panel panel-success">
<div class="container theme-showcase" role="main">
<#-- 接入说明 -->
<div class="page-header">
<h1>支持的文件类型</h1>
我们一直在扩展支持的文件类型不断优化预览的效果如果您有什么建议欢迎在kk开源社区留意反馈<a target='_blank' href="https://t.zsxq.com/09ZHSXbsQ">https://t.zsxq.com/09ZHSXbsQ</a>
</div>
<div >
<ol>
<li>支持 doc, docx, xls, xlsx, xlsm, ppt, pptx, csv, tsv, dotm, xlt, xltm, dot, dotx,xlam, xla Office 办公文档</li>
<li>支持 wps, dps, et, ett, wpt 等国产 WPS Office 办公文档</li>
<li>支持 odt, ods, ots, odp, otp, six, ott, fodt, fods 等OpenOfficeLibreOffice 办公文档</li>
<li>支持 vsd, vsdx Visio 流程图文件</li>
<li>支持 wmf, emf Windows 系统图像文件</li>
<li>支持 psd Photoshop 软件模型文件</li>
<li>支持 pdf ,ofd, rtf 等文档</li>
<li>支持 xmind 软件模型文件</li>
<li>支持 bpmn 工作流文件</li>
<li>支持 eml 邮件文件</li>
<li>支持 epub 图书文档</li>
<li>支持 obj, 3ds, stl, ply, gltf, glb, off, 3dm, fbx, dae, wrl, 3mf, ifc, brep, step, iges, fcstd, bim 3D 模型文件</li>
<li>支持 dwg, dxf CAD 模型文件</li>
<li>支持 txt, xml(渲染), md(渲染), java, php, py, js, css 等所有纯文本</li>
<li>支持 zip, rar, jar, tar, gzip, 7z 等压缩包</li>
<li>支持 jpg, jpeg, png, gif, bmp, ico, jfif, webp 等图片预览翻转缩放镜像</li>
<li>支持 tif, tiff 图信息模型文件</li>
<li>支持 tga 图像格式文件</li>
<li>支持 svg 矢量图像格式文件</li>
<li>支持 mp3,wav,mp4,flv 等音视频格式文件</li>
<li>支持 avi,mov,rm,webm,ts,rm,mkv,mpeg,ogg,mpg,rmvb,wmv,3gp,ts,swf 等视频格式转码预览</li>
</ol>
</div>
<#-- 输入下载地址预览文件 -->
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">输入下载地址预览文件</h3>
<h3 class="panel-title">输入下载地址预览</h3>
</div>
<div class="panel-body">
<form>
<div class="form-group">
<label>文件下载地址</label>
<input type="url" class="form-control" id="_url" placeholder="请输入下载地址">
<div class="row">
<div class="col-md-10">
<div class="form-group">
<input type="url" class="form-control" id="_url" placeholder="请输入预览文件 url">
</div>
</div>
<div class="col-md-2">
<button id="previewByUrl" type="button" class="btn btn-success">预览</button>
</div>
</div>
<div class="alert alert-danger alert-dismissable hide" role="alert" id="previewCheckAlert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<strong>请输入正确的url</strong>
</div>
<button id="previewByUrl" type="button" class="btn btn-success">预览</button>
</form>
</div>
</div>
</div>
<#-- 预览测试 -->
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">预览测试</h3>
<h3 class="panel-title">上传本地文件预览</h3>
</div>
<div class="panel-body">
<#if fileUploadDisable == false>
<div style="padding: 10px">
<div style="padding: 10px" >
<form enctype="multipart/form-data" id="fileUpload">
<div class="form-group">
<p id="fileName"></p>
<button type="button" class="btn btn-default" id="fileSelectBtn" style="margin-bottom:8px">
<span class="glyphicon glyphicon-cloud-upload" aria-hidden="true"></span> 选择文件
</button>
<input type="file" name="file" style="display: none" id="fileSelect" onchange="onFileSelected()"/>
<div class="alert alert-danger alert-dismissable hide" role="alert" id="postFileAlert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<strong>请选择需要上传的文件</strong>
</div>
</div>
<button id="btnSubmit" type="button" class="btn btn-success">上 传</button>
<input type="file" id="size" name="file"/>
<input type="button" id="btnSubmit" value=" 上 传 "/>
</form>
</div>
</#if>
@@ -145,22 +152,34 @@
</div>
</div>
</div>
<div style="display: grid; place-items: center;">
<div>
<a target="_blank" href="https://beian.miit.gov.cn/" >${BeiAn}</a>
</div>
</div>
<script>
function deleteFile(fileName) {
$.ajax({
url: '${baseUrl}deleteFile?fileName=' + fileName,
success: function (data) {
// 删除完成刷新table
if (1 === data.code) {
alert(data.msg);
} else {
$('#table').bootstrapTable('refresh', {});
function deleteFile(fileName,password) {
if(window.confirm('你确定要删除文件吗')){
password = prompt("请输入默认密码:123456");
$.ajax({
url: '${baseUrl}deleteFile?fileName=' + fileName +'&password='+password,
success: function (data) {
// console.log(data);
// 删除完成刷新table
if ("删除文件失败,密码错误!" === data.msg) {
alert(data.msg);
} else {
$('#table').bootstrapTable('refresh', {});
}
},
error: function (data) {
return false;
}
},
error: function (data) {
console.log(data);
}
})
})
}else{
return false;
}
}
function showLoadingDiv() {
@@ -168,12 +187,12 @@
$(".loading_container").css("height", height).show();
}
function onFileSelected(){
function onFileSelected() {
var file = $("#fileSelect").val();
$("#fileName").text(file);
}
function checkUrl(url){
function checkUrl(url) {
//url= 协议://(ftp的登录信息)[IP|域名](:端口号)(/?请求参数)
var strRegex = '^((https|http|ftp)://)'//(https或http或ftp)
+ '(([\\w_!~*\'()\\.&=+$%-]+: )?[\\w_!~*\'()\\.&=+$%-]+@)?' //ftp的user@ 可有可无
@@ -186,7 +205,7 @@
+ '(:[0-9]{1,5})?' // 端口- :80 ,1-5位数字
+ '((/?)|' // url无参数结尾 - 斜杆或这没有
+ '(/[\\w_!~*\'()\\.;?:@&=+$,%#-]+)+/?)$';//请求参数结尾- 英文或数字和[]内的各种字符
var re = new RegExp(strRegex,'i');//i不区分大小写
var re = new RegExp(strRegex, 'i');//i不区分大小写
//将url做uri转码后再匹配解除请求参数中的中文和空字符影响
if (re.test(encodeURI(url))) {
return (true);
@@ -216,40 +235,29 @@
return data;
});
$('#previewByUrl').on('click',function() {
$('#previewByUrl').on('click', function () {
var _url = $("#_url").val();
if (!checkUrl(_url)) {
$("#previewCheckAlert").addClass("show");
window.setTimeout(function(){
window.setTimeout(function () {
$("#previewCheckAlert").removeClass("show");
},3000);//显示的时间
}, 3000);//显示的时间
return false;
}
var b64Encoded = Base64.encode(_url);
window.open('${baseUrl}onlinePreview?url='+encodeURIComponent(b64Encoded));
window.open('${baseUrl}onlinePreview?url=' + encodeURIComponent(b64Encoded));
});
$('#fileSelectBtn').on('click',function() {
$('#fileSelectBtn').on('click', function () {
$('#fileSelect').click();
});
$("#btnSubmit").click(function () {
var _fileName = $("#fileName").text()
var index= _fileName.lastIndexOf(".");
//获取后缀
var ext = _fileName.substr(index+1);
if (!ext || ext == "dll"|| ext == "exe"|| ext == "msi" ){
window.alert(ext+"不支持上传")
return ;
}
if(!_fileName){
$("#postFileAlert").addClass("show");
window.setTimeout(function(){
$("#postFileAlert").removeClass("show");
},3000);//显示的时间
return;
var filepath = $("#size").val();
if(!checkFileSize(filepath)){
return false;
}
showLoadingDiv();
$("#fileUpload").ajaxSubmit({
@@ -265,7 +273,6 @@
},
error: function () {
alert('上传失败请联系管理员');
$("#fileName").text("");
$(".loading_container").hide();
},
url: 'fileUpload', /*设置post提交到的页面*/
@@ -274,6 +281,37 @@
});
});
});
function checkFileSize(filepath) {
var daxiao= "${size}";
daxiao= daxiao.replace("MB","");
// console.log(daxiao)
var maxsize = daxiao * 1024 * 1024;
var errMsg = "上传的文件不能超过${size}喔!!!";
var tipMsg = "您的浏览器暂不支持上传,确保上传文件不要超过${size}建议使用IE、FireFox、Chrome浏览器";
try {
var filesize = 0;
var ua = window.navigator.userAgent;
if (ua.indexOf("MSIE") >= 1) {
//IE
var img = new Image();
img.src = filepath;
filesize = img.fileSize;
} else {
filesize = $("#size")[0].files[0].size; //byte
}
if (filesize > 0 && filesize > maxsize) {
alert(errMsg);
return false;
} else if (filesize == -1) {
alert(tipMsg);
return false;
}
} catch (e) {
alert("上传失败,请重试");
return false;
}
return true;
}
</script>
</body>
</html>

View File

@@ -0,0 +1,98 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<title>接入说明</title>
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="css/viewer.min.css"/>
<link rel="stylesheet" href="css/loading.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="bootstrap-table/bootstrap-table.min.css"/>
<link rel="stylesheet" href="css/theme.css"/>
<script type="text/javascript" src="js/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery.form.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript" src="js/base64.min.js"></script>
<style>
.alert {
width: 50%;
}
</style>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://kkview.cn" target='_blank'>kkFileView</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="./index">首页</a></li>
<li class="active"><a href="./integrated">接入说明</a></li>
<li><a href="./record">版本发布记录</a></li>
<li><a href="./sponsor">赞助开源</a></li>
</ul>
</div>
</div>
</nav>
<div class="container theme-showcase" role="main">
<#-- 接入说明 -->
<div class="page-header">
<h1>接入说明</h1>
本文档针对前端项目接入 kkFileView 的说明,并假设 kkFileView 的服务地址为http://127.0.0.1:8012。
</div>
<div class="well">
<div style="font-size: 16px;">
【http/https 资源文件预览】如果你的项目需要接入文件预览项目达到对docx、excel、ppt、jpg等文件的预览效果那么通过在你的项目中加入下面的代码就可以成功实现
<p style="background-color: #2f332a;color: #cccccc;font-size: 14px;padding:10px;margin-top:10px;">
var url = 'http://127.0.0.1:8080/file/test.txt'; //要预览文件的访问地址 <br>
window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(base64Encode(url)));
</p>
</div>
<br>
<div style="font-size: 16px;">
【http/https 流资源文件预览】很多系统内不是直接暴露文件下载地址而是请求通过id、code等参数到通过统一的接口后端通过id或code等参数定位文件再通过OutputStream输出下载此时下载url是不带文件后缀名的预览时需要拿到文件名传一个参数fullfilename=xxx.xxx来指定文件名示例如下
<p style="background-color: #2f332a;color: #cccccc;font-size: 14px;padding:10px;margin-top:10px;">
var originUrl = 'http://127.0.0.1:8080/filedownload?fileId=1'; //要预览文件的访问地址<br>
var previewUrl = originUrl + '&fullfilename=test.txt'<br>
window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl)));
</p>
</div>
<br>
<div style="font-size: 16px;">
【ftp 资源文件预览】如果要预览的FTP url是可以匿名访问的不需要用户名密码则可以直接通过下载url预览示例如下
<p style="background-color: #2f332a;color: #cccccc;font-size: 14px;padding:10px;margin-top:10px;">
var url = 'ftp://127.0.0.1/file/test.txt'; //要预览文件的访问地址<br>
window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(url)));
</p>
</div>
<br>
<div style="font-size: 16px;">
【ftp 加密资源文件预览】如果 FTP 需要认证访问服,可以通过在 url 中加入用户名密码等参数预览,示例如下
<p style="background-color: #2f332a;color: #cccccc;font-size: 14px;padding:10px;margin-top:10px;">
var originUrl = 'ftp://127.0.0.1/file/test.txt'; //要预览文件的访问地址<br>
var previewUrl = originUrl + '?ftp.username=xx&ftp.password=xx&ftp.control.encoding=xx';<br>
window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(Base64.encode(previewUrl)));
</p>
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,307 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<title>kkFileView版本记录</title>
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="css/viewer.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="css/theme.css"/>
<script type="text/javascript" src="js/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery.form.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://kkview.cn" target='_blank'>kkFileView</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="./index">首页</a></li>
<li><a href="./integrated">接入说明</a></li>
<li class="active"><a href="./record">版本发布记录</a></li>
<li><a href="./sponsor">赞助开源</a></li>
</ul>
</div>
</div>
</nav>
<div class="container theme-showcase" role="main">
<#-- 版本发布记录 -->
<div class="page-header">
<h1>版本发布记录</h1>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2023年04月13日v4.2.0 版本</h3>
</div>
<div class="panel-body">
<div>
1. 新增 SVG 格式文件预览支持<br>
2. 新增加密的 Office 文件预览支持<br>
3. 新增加密的 zip、rar 等压缩包文件预览支持<br>
4. 新增 xmind 软件模型文件预览支持<br>
5. 新增 bpmn 工作流模型文件预览支持<br>
6. 新增 eml 邮件文件预览支持<br>
7. 新增 epub 电子书文件预览支持<br>
8. 新增 dotm,ett,xlt,xltm,wpt,dot,xlam,xla,dotx 等格式的办公文档预览支持<br>
9. 新增 obj, 3ds, stl, ply, gltf, glb, off, 3dm, fbx, dae, wrl, 3mf, ifc, brep, step, iges, fcstd, bim 等 3D 模型文件预览支持<br>
10. 新增可配置限制高风险文件上传的功能,比如 exe 文件<br>
11. 新增可配置站点的备案信息<br>
12. 新增演示站点删除文件需要密码的功能<br>
13. 文本文档预览加入缓存<br>
14. 美化 404、500 报错页<br>
15. 优化发票等 ofd 文件预览的印证渲染兼容性<br>
16. 移除 office-plugin 模块, 使用新版 jodconverter组件<br>
17. 优化 Excel 文件的预览效果<br>
18. 优化 CAD 文件的预览效果<br>
19. 更新 xstream 、junrar、pdfbox 等依赖的版本<br>
20. 更新 TIF 文件转换 PDF 的插件,添加转换缓存<br>
21. 优化演示页 UI 部署<br>
22. 压缩包文件预览支持目录<br>
23. 修复部分接口 XSS 问题<br>
24. 修复控制台打印的演示地址不跟着 content-path 配置走的问题<br>
25. 修复 ofd 文件预览跨域问题<br>
26. 修复内部自签证书 https 协议 url 文件无法下载的问题<br>
27. 修复特殊符号的文件无法删除的问题<br>
28. 修复 PDF 转图片,内存无法回收导致的 OOM<br>
29. 修复 xlsx7.4 以上版本文件预览乱码的问题<br>
30. 修复 TrustHostFilter 未拦截跨域接口的问题,这是一个安全问题,有使用到 TrustHost 功能的务必升级<br>
31. 修复压缩包文件预览在 Linux 系统下文件名乱码的问题<br>
32. 修复 ofd 文件预览页码只能显示 10 页的问题<br>
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2022年12月14日v4.1.0 版本</h3>
</div>
<div class="panel-body">
<div>
1. 全新首页视觉 @wsd7747 <br>
2. tif图片预览兼容多页tif的pdf转换、jpg转换以及jpg在线多页预览功能 @zhangzhen1979<br>
3. 优化docker构建方案使用分层构建方式 @yl-yue<br>
4. 实现基于userToken缓存加密文件 @yl-yue<br>
5. 实现加密word、ppt、excel文件预览 @yl-yue<br>
6. Linux & Docker镜像升级LibreOffice 7.3<br>
7. 更新OFD预览组件、更新tif预览组件、更新PPT水印支持<br>
8. 大量其他升级优化 & 已知问题修复<br>
<br>
感谢 @yl-yue @wsd7747 @zhangzhen1979 @tomhusky @shenghuadun @kischn.sun 的代码贡献
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2021年7月6日v4.0.0 版本</h3>
</div>
<div class="panel-body">
<div>
1. 底层集成OpenOffice替换为LibreOfficeOffice文件兼容性增强预览效果提升<br>
2. 修复压缩文件目录穿越漏洞<br>
3. 修复PPT预览使用PDF模式无效<br>
4. 修复PPT图片预览模式前端显示异常<br>
5. 新增功能:首页文件上传功能可通过配置实时开启或禁用<br>
6. 优化增加Office进程关闭日志<br>
7. 优化Windows环境下查找Office组件逻辑(内置的LibreOffice优先)<br>
8. 优化启动Office进程改同步执行
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2021年6月17日v3.6.0版本</h3>
</div>
<div class="panel-body">
<div>
** ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献,感谢 @gaoxingzaq、@zhangxiaoxiao9527 的代码贡献
**<br>
1. 新增 ofd 类型文件预览支持ofd 是国产的类似 pdf 格式的文件<br>
2. 新增了 ffmpeg 视频文件转码预览支持,打开转码功能后,理论上支持所有主流视频的预览,如 rm、rmvb、flv 等<br>
3. 美化了 ppt、pptx 类型文件预览效果,比之前版本好看太多<br>
4. 更新了 pdfbox、xstream、common-io 等依赖的版本
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2021年1月28日</h3>
</div>
<div class="panel-body">
<div>
** 2020农历年最后一个版本发布主要包含了部分 UI 改进,和解决了 QQ 群友、 Issue 里反馈的 Bug
修复,最最重要的是发个新版,过个好年 **<br>
1. 引入galimatias,解决不规范文件名导致文件下载异常<br>
2. 更新index接入演示界面UI风格<br>
3. 更新markdown文件预览UI风格<br>
4. 更新XML文件预览UI风格调整类文本预览架构更方便扩展<br>
5. 更新simTxT文件预览UI风格<br>
6. 调整多图连续预览上下翻图的UI<br>
7. 采用apache-common-io包简化所有的文件下载io操作<br>
8. XML文件预览支持切换纯文本模式<br>
9. 增强url base64解码失败时的提示信息<br>
10. 修复导包错误以及图片预览 bug<br>
11. 修复发行包运行时找不到日志目录的问题<br>
12. 修复压缩包内多图连续预览的bug<br>
13. 修复大小写文件类型后缀没通用匹配的问题<br>
14. 指定Base64转码采用Apache Commons-code中的实现修复base64部分jdk版本下出现的异常<br>
15. 修复类文本类型HTML文件预览的bug<br>
16. 修复dwg文件预览时无法在jpg和pdf两种类型之间切换<br>
17. escaping of dangerous characters to prevent reflected xss<br>
18. 修复重复编码导致文档转图片预览失败的问题&编码规范
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2020年12月27日</h3>
</div>
<div class="panel-body">
<div>
** 2020年年终大版本更新架构全面设计代码全面重构代码质量全面提升二次开发更便捷欢迎拉源码品鉴提issue、pr共同建设
**<br>
1. 架构模块调整,大量的代码重构代码质量提升N个等级欢迎品鉴<br>
2. 增强XML文件预览效果新增XML文档数结构预览<br>
3. 新增markdown文件预览支持预览支持md渲染和源文本切换支持<br>
4. 切换底层web server为jetty解决这个issue<a href="https://github.com/kekingcn/kkFileView/issues/168">#issues/168</a><br>
5. 引入cpdetector解决文件编码识别问题<br>
6. url采用base64+urlencode双编码彻底解决各种奇葩文件名预览问题<br>
7. 新增配置项office.preview.switch.disabled控制offic文件预览切换开关<br>
8. 优化文本类型文件预览逻辑采用Base64传输内容避免预览时再次请求文件内容<br>
9. office预览图片模式禁用图片放大效果达到图片和pdf预览效果一致的体验<br>
10. 直接代码静态设置pdfbox兼容低版本jdk在IDEA中运行也不会有警告提示<br>
11. 移除guavahutool等非必须的工具包减少代码体积<br>
12. Office组件加载异步化提速应用启动速度最快到5秒内<br>
13. 合理设置预览消费队列的线程数<br>
14. 修复压缩包里文件再次预览失败的bug<br>
15. 修复图片预览的bug
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2020年05月20日</h3>
</div>
<div class="panel-body">
<div>
1. 新增支持全局水印,并支持通过参数动态改变水印内容<br>
2. 新增支持CAD文件预览<br>
3. 新增base.url配置支持使用nginx反向代理和使用context-path<br>
4. 支持所有配置项支持从环境变量里读取方便Docker镜像部署和集群中大规模使用<br>
5. 支持配置限信任站点(只能预览来自信任点的文件源),保护预览服务不被滥用<br>
6. 支持配置自定义缓存清理时间cron表达式<br>
7. 全部能识别的纯文本直接预览,不用再转跳下载,如.md .java .py等<br>
8. 支持配置限制转换后的PDF文件下载<br>
9. 优化maven打包配置解决 .sh 脚本可能出现换行符问题<br>
10. 将前端所有CDN依赖放到本地方便没有外网连接的用户使用<br>
11. 首页评论服务由搜狐畅言切换到Gitalk<br>
12. 修复url中包含特殊字符可能会引起的预览异常<br>
13. 修复转换文件队列addTask异常<br>
14. 修复其他已经问题<br>
15. 官网建设:<a href="https://kkview.cn">https://kkview.cn</a><br>
16. 官方Docker镜像仓库建设<a href="https://hub.docker.com/r/keking/kkfileview">https://hub.docker.com/r/keking/kkfileview</a>
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2019年06月18日</h3>
</div>
<div class="panel-body">
<div>
1. 支持自动清理缓存及预览文件<br>
2. 支持http/https下载流url文件预览<br>
3. 支持FTP url文件预览<br>
4. 加入Docker构建
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2019年04月08日</h3>
</div>
<div class="panel-body">
<div>
1. 缓存及队列实现抽象提供JDK和REDIS两种实现(REDIS成为可选依赖)<br>
2. 打包方式提供zip和tar.gz包并提供一键启动脚本
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月19日</h3>
</div>
<div class="panel-body">
<div>
1. 大文件入队提前处理<br>
2. 新增addTask文件转换入队接口<br>
3. 采用redis队列支持kkFIleView接口和异构系统入队两种方式
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月15日</h3>
</div>
<div class="panel-body">
<div>
1. 首页新增社会化评论框
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月12日</h3>
</div>
<div class="panel-body">
<div>
1. 新增多图片同时预览<br>
2. 支持压缩包内图片轮番预览
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月02日</h3>
</div>
<div class="panel-body">
<div>
1. 修复txt等文本编码问题导致预览乱码<br>
2. 修复项目模块依赖引入不到的问题<br>
3. 新增spring boot profile支持多环境配置<br>
4. 引入pdf.js预览doc等文件支持doc标题生成pdf预览菜单支持手机端预览
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2017年12月12日</h3>
</div>
<div class="panel-body">
<div>
1. 项目gitee开源:<a href="https://gitee.com/kekingcn/file-online-preview" target="_blank">https://gitee.com/kekingcn/file-online-preview</a><br>
2. 项目github开源:<a href="https://github.com/kekingcn/kkFileView" target="_blank">https://github.com/kekingcn/kkFileView</a>
</div>
</div>
</div>
</div>
<script>
</script>
</body>
</html>

View File

@@ -0,0 +1,90 @@
<!DOCTYPE html>
<html lang="en" xmlns="http://www.w3.org/1999/html">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<title>赞助开源</title>
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="css/viewer.min.css"/>
<link rel="stylesheet" href="css/loading.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="bootstrap-table/bootstrap-table.min.css"/>
<link rel="stylesheet" href="css/theme.css"/>
<script type="text/javascript" src="js/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery.form.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
<script type="text/javascript" src="bootstrap-table/bootstrap-table.min.js"></script>
<script type="text/javascript" src="js/base64.min.js"></script>
<style>
.alert {
width: 50%;
}
</style>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar"
aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://kkview.cn" target='_blank'>kkFileView</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="./index">首页</a></li>
<li><a href="./integrated">接入说明</a></li>
<li><a href="./record">版本发布记录</a></li>
<li class="active"><a href="./sponsor">赞助开源</a></li>
</ul>
</div>
</div>
</nav>
<div class="container theme-showcase" role="main">
<#-- 接入说明 -->
<div class="page-header">
<h1>赞助开源</h1>
<ur style="font-size: 16px;">
<li>kkFileView 开源至今已 6 个年头,积累 <a target="_blank" href="https://gitee.com/kekingcn/file-online-preview">Gitee(16.9K)</a>、<a target="_blank" href="https://github.com/kekingcn/kkFileView">GitHub(8k)</a> 多的 star</li>
<li>kkFileView 被广泛应用于金融教育银行政务计算机等行业, 不完全统计有 200+ 企业在使用</li>
<li>kkFileView 每年的文档站点演示站点的服务器CDN 资源, 至少在 1000元以上</li>
<li>kkFileView 是一款完全开源的在线预览项目如果你觉得 kkFileView 对你有帮助可以通过下面的方式来赞助我们谢谢</li>
</ur>
</div>
<div>
<div style="font-size: 16px;">
<img width="400px" height="550px" src="/images/alipay.jpeg"/> &nbsp;&nbsp;&nbsp;<img width="400px" height="550px" src="/images/wxpay.jpeg"/>
</div>
</div>
<div>
<h3>赞助记录</h3>
2023-03-14 开启赞助通道赞助记录为手动录入的存在周级别延迟如有遗漏请联系作者补充
<br/>
<table class="table table-striped table-bordered">
<tr>
<th>赞助人</th>
<th>赞助金额</th>
<th>赞助时间</th>
</tr>
<tr>
<td>陈**</td>
<td>99</td>
<td>2023-03-14</td>
</tr>
</table>
</div>
</div>
</body>
</html>

View File

@@ -80,7 +80,7 @@
</div>
<!-- JavaSript ================================================== -->
<script src="pptx/jquery-3.5.1.min.js"></script>
<script src="js/jquery-3.6.1.min.js"></script>
<script src="pptx/jquery.contextMenu.js?v=11.2.5_20210128"></script>
<script src="pptx/idocv/idocv_common.min.js"></script>
<script src="pptx/jquery.mobile-events.min.js"></script>

View File

@@ -1,261 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, user-scalable=yes, initial-scale=1.0"/>
<title>kkFileView版本记录</title>
<link rel="icon" href="./favicon.ico" type="image/x-icon">
<link rel="stylesheet" href="css/viewer.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap.min.css"/>
<link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css"/>
<link rel="stylesheet" href="css/theme.css"/>
<script type="text/javascript" src="js/jquery-3.6.1.min.js"></script>
<script type="text/javascript" src="js/jquery.form.min.js"></script>
<script type="text/javascript" src="bootstrap/js/bootstrap.min.js"></script>
</head>
<body>
<!-- Fixed navbar -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="https://kkview.cn" target='_blank'>kkFileView</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="./index">首页</a></li>
<li class="active"><a href="./record">版本发布记录</a></li>
<li><a href="./comment">相关交流</a></li>
</ul>
</div>
</div>
</nav>
<div class="container theme-showcase" role="main">
<#-- 版本发布记录 -->
<div class="page-header">
<h1>版本发布记录</h1>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2022年12月14日v4.1.0 版本</h3>
</div>
<div class="panel-body">
<div>
1. 全新首页视觉 @wsd7747 <br>
2. tif图片预览兼容多页tif的pdf转换、jpg转换以及jpg在线多页预览功能 @zhangzhen1979<br>
3. 优化docker构建方案使用分层构建方式 @yl-yue<br>
4. 实现基于userToken缓存加密文件 @yl-yue<br>
5. 实现加密word、ppt、excel文件预览 @yl-yue<br>
6. Linux & Docker镜像升级LibreOffice 7.3<br>
7. 更新OFD预览组件、更新tif预览组件、更新PPT水印支持<br>
8. 大量其他升级优化 & 已知问题修复<br>
<br>
感谢 @yl-yue @wsd7747 @zhangzhen1979 @tomhusky @shenghuadun @kischn.sun 的代码贡献
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2021年7月6日v4.0.0 版本</h3>
</div>
<div class="panel-body">
<div>
1. 底层集成OpenOffice替换为LibreOfficeOffice文件兼容性增强预览效果提升<br>
2. 修复压缩文件目录穿越漏洞<br>
3. 修复PPT预览使用PDF模式无效<br>
4. 修复PPT图片预览模式前端显示异常<br>
5. 新增功能:首页文件上传功能可通过配置实时开启或禁用<br>
6. 优化增加Office进程关闭日志<br>
7. 优化Windows环境下查找Office组件逻辑(内置的LibreOffice优先)<br>
8. 优化启动Office进程改同步执行
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2021年6月17日v3.6.0版本</h3>
</div>
<div class="panel-body">
<div>
** ofd 类型文件支持版本,本次版本重要功能均由社区开发贡献,感谢 @gaoxingzaq、@zhangxiaoxiao9527 的代码贡献 **<br>
1. 新增 ofd 类型文件预览支持ofd 是国产的类似 pdf 格式的文件<br>
2. 新增了 ffmpeg 视频文件转码预览支持,打开转码功能后,理论上支持所有主流视频的预览,如 rm、rmvb、flv 等<br>
3. 美化了 ppt、pptx 类型文件预览效果,比之前版本好看太多<br>
4. 更新了 pdfbox、xstream、common-io 等依赖的版本
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2021年1月28日</h3>
</div>
<div class="panel-body">
<div>
** 2020农历年最后一个版本发布主要包含了部分 UI 改进,和解决了 QQ 群友、 Issue 里反馈的 Bug 修复,最最重要的是发个新版,过个好年 **<br>
1. 引入galimatias,解决不规范文件名导致文件下载异常<br>
2. 更新index接入演示界面UI风格<br>
3. 更新markdown文件预览UI风格<br>
4. 更新XML文件预览UI风格调整类文本预览架构更方便扩展<br>
5. 更新simTxT文件预览UI风格<br>
6. 调整多图连续预览上下翻图的UI<br>
7. 采用apache-common-io包简化所有的文件下载io操作<br>
8. XML文件预览支持切换纯文本模式<br>
9. 增强url base64解码失败时的提示信息<br>
10. 修复导包错误以及图片预览 bug<br>
11. 修复发行包运行时找不到日志目录的问题<br>
12. 修复压缩包内多图连续预览的bug<br>
13. 修复大小写文件类型后缀没通用匹配的问题<br>
14. 指定Base64转码采用Apache Commons-code中的实现修复base64部分jdk版本下出现的异常<br>
15. 修复类文本类型HTML文件预览的bug<br>
16. 修复dwg文件预览时无法在jpg和pdf两种类型之间切换<br>
17. escaping of dangerous characters to prevent reflected xss<br>
18. 修复重复编码导致文档转图片预览失败的问题&编码规范
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2020年12月27日</h3>
</div>
<div class="panel-body">
<div>
** 2020年年终大版本更新架构全面设计代码全面重构代码质量全面提升二次开发更便捷欢迎拉源码品鉴提issue、pr共同建设 **<br>
1. 架构模块调整,大量的代码重构代码质量提升N个等级欢迎品鉴<br>
2. 增强XML文件预览效果新增XML文档数结构预览<br>
3. 新增markdown文件预览支持预览支持md渲染和源文本切换支持<br>
4. 切换底层web server为jetty解决这个issue<a href="https://github.com/kekingcn/kkFileView/issues/168">#issues/168</a><br>
5. 引入cpdetector解决文件编码识别问题<br>
6. url采用base64+urlencode双编码彻底解决各种奇葩文件名预览问题<br>
7. 新增配置项office.preview.switch.disabled控制offic文件预览切换开关<br>
8. 优化文本类型文件预览逻辑采用Base64传输内容避免预览时再次请求文件内容<br>
9. office预览图片模式禁用图片放大效果达到图片和pdf预览效果一致的体验<br>
10. 直接代码静态设置pdfbox兼容低版本jdk在IDEA中运行也不会有警告提示<br>
11. 移除guavahutool等非必须的工具包减少代码体积<br>
12. Office组件加载异步化提速应用启动速度最快到5秒内<br>
13. 合理设置预览消费队列的线程数<br>
14. 修复压缩包里文件再次预览失败的bug<br>
15. 修复图片预览的bug
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2020年05月20日</h3>
</div>
<div class="panel-body">
<div>
1. 新增支持全局水印,并支持通过参数动态改变水印内容<br>
2. 新增支持CAD文件预览<br>
3. 新增base.url配置支持使用nginx反向代理和使用context-path<br>
4. 支持所有配置项支持从环境变量里读取方便Docker镜像部署和集群中大规模使用<br>
5. 支持配置限信任站点(只能预览来自信任点的文件源),保护预览服务不被滥用<br>
6. 支持配置自定义缓存清理时间cron表达式<br>
7. 全部能识别的纯文本直接预览,不用再转跳下载,如.md .java .py等<br>
8. 支持配置限制转换后的PDF文件下载<br>
9. 优化maven打包配置解决 .sh 脚本可能出现换行符问题<br>
10. 将前端所有CDN依赖放到本地方便没有外网连接的用户使用<br>
11. 首页评论服务由搜狐畅言切换到Gitalk<br>
12. 修复url中包含特殊字符可能会引起的预览异常<br>
13. 修复转换文件队列addTask异常<br>
14. 修复其他已经问题<br>
15. 官网建设:<a href="https://kkview.cn">https://kkview.cn</a><br>
16. 官方Docker镜像仓库建设<a href="https://hub.docker.com/r/keking/kkfileview">https://hub.docker.com/r/keking/kkfileview</a>
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2019年06月18日</h3>
</div>
<div class="panel-body">
<div>
1. 支持自动清理缓存及预览文件<br>
2. 支持http/https下载流url文件预览<br>
3. 支持FTP url文件预览<br>
4. 加入Docker构建
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2019年04月08日</h3>
</div>
<div class="panel-body">
<div>
1. 缓存及队列实现抽象提供JDK和REDIS两种实现(REDIS成为可选依赖)<br>
2. 打包方式提供zip和tar.gz包并提供一键启动脚本
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月19日</h3>
</div>
<div class="panel-body">
<div>
1. 大文件入队提前处理<br>
2. 新增addTask文件转换入队接口<br>
3. 采用redis队列支持kkFIleView接口和异构系统入队两种方式
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月15日</h3>
</div>
<div class="panel-body">
<div>
1. 首页新增社会化评论框
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月12日</h3>
</div>
<div class="panel-body">
<div>
1. 新增多图片同时预览<br>
2. 支持压缩包内图片轮番预览
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2018年01月02日</h3>
</div>
<div class="panel-body">
<div>
1. 修复txt等文本编码问题导致预览乱码<br>
2. 修复项目模块依赖引入不到的问题<br>
3. 新增spring boot profile支持多环境配置<br>
4. 引入pdf.js预览doc等文件支持doc标题生成pdf预览菜单支持手机端预览
</div>
</div>
</div>
<div class="panel panel-success">
<div class="panel-heading">
<h3 class="panel-title">2017年12月12日</h3>
</div>
<div class="panel-body">
<div>
1. 项目gitee开源:<a href="https://gitee.com/kekingcn/file-online-preview" target="_blank">https://gitee.com/kekingcn/file-online-preview</a><br>
2. 项目github开源:<a href="https://github.com/kekingcn/kkFileView" target="_blank">https://github.com/kekingcn/kkFileView</a>
</div>
</div>
</div>
</div>
<script>
</script>
</body>
</html>