mirror of
https://gitee.com/kekingcn/file-online-preview.git
synced 2026-04-28 19:16:43 +00:00
Compare commits
2 Commits
dependabot
...
jodd
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
27ae58a0f4 | ||
|
|
4d83674806 |
@@ -28,5 +28,5 @@ ENV CLASSPATH $JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
|
|||||||
ENV PATH $PATH:$JAVA_HOME/bin
|
ENV PATH $PATH:$JAVA_HOME/bin
|
||||||
ENV LANG zh_CN.UTF-8
|
ENV LANG zh_CN.UTF-8
|
||||||
ENV LC_ALL zh_CN.UTF-8
|
ENV LC_ALL zh_CN.UTF-8
|
||||||
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-3.5.1/bin
|
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-3.3.0/bin
|
||||||
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-3.5.1/config/application.properties","-jar","/opt/kkFileView-3.5.1/bin/kkFileView-3.5.1.jar"]
|
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-3.3.0/config/application.properties","-jar","/opt/kkFileView-3.3.0/bin/kkFileView-3.3.0.jar"]
|
||||||
46
README.md
46
README.md
@@ -2,12 +2,12 @@
|
|||||||
此项目为文件文档在线预览项目解决方案,对标业内付费产品有【[永中office](http://dcs.yozosoft.com/)】【[office365](http://www.officeweb365.com/)】【[idocv](https://www.idocv.com/)】等,在取得公司高层同意后以Apache协议开源出来反哺社区,在此特别感谢@唐老大的支持以及@端木详笑的贡献。该项目使用流行的spring boot搭建,易上手和部署,基本支持主流办公文档的在线预览,如doc,docx,Excel,pdf,txt,zip,rar,图片等等
|
此项目为文件文档在线预览项目解决方案,对标业内付费产品有【[永中office](http://dcs.yozosoft.com/)】【[office365](http://www.officeweb365.com/)】【[idocv](https://www.idocv.com/)】等,在取得公司高层同意后以Apache协议开源出来反哺社区,在此特别感谢@唐老大的支持以及@端木详笑的贡献。该项目使用流行的spring boot搭建,易上手和部署,基本支持主流办公文档的在线预览,如doc,docx,Excel,pdf,txt,zip,rar,图片等等
|
||||||
### 项目特性
|
### 项目特性
|
||||||
|
|
||||||
1. 支持 office, pdf, cad 等办公文档
|
1. 支持office,pdf, cad等办公文档
|
||||||
1. 支持 txt, xml(渲染), md(渲染), java, php, py, js, css 等所有纯文本
|
1. 支持txt,java,php,py,md,js,css等所有纯文本
|
||||||
1. 支持zip,rar,jar,tar,gzip等压缩包
|
1. 支持zip,rar,jar,tar,gzip等压缩包
|
||||||
1. 支持 jpg, jpeg, png, gif, tif, tiff 等图片预览(翻转,缩放,镜像)
|
1. 支持jpg,jpeg,png,gif等图片预览(翻转,缩放,镜像)
|
||||||
1. 使用 spring-boot 开发,预览服务搭建部署非常简便
|
1. 使用spring boot开发,预览服务搭建部署非常简便
|
||||||
1. rest 接口提供服务,跨语言、跨平台特性(java,php,python,go,php,....)都支持,应用接入简单方便
|
1. rest接口提供服务,跨平台特性(java,php,python,go,php,....)都支持,应用接入简单方便
|
||||||
1. 抽象预览服务接口,方便二次开发,非常方便添加其他类型文件预览支持
|
1. 抽象预览服务接口,方便二次开发,非常方便添加其他类型文件预览支持
|
||||||
1. 最最重要Apache协议开源,代码pull下来想干嘛就干嘛
|
1. 最最重要Apache协议开源,代码pull下来想干嘛就干嘛
|
||||||
|
|
||||||
@@ -99,40 +99,16 @@ pdf预览模式预览效果如下
|
|||||||
- jodconverter
|
- jodconverter
|
||||||
> 依赖外部环境
|
> 依赖外部环境
|
||||||
- redis (可选,默认不用)
|
- redis (可选,默认不用)
|
||||||
- OpenOffice 或者 LibreOffice( Windows 下已内置,Linux 脚本启动模式会自动安装,Mac OS 下需要手动安装)
|
- OpenOffice或者LibreOffice(Windows下已内置,Linux会自动安装,Mac OS下需要手动安装)
|
||||||
|
|
||||||
1. 第一步:pull项目https://github.com/kekingcn/file-online-preview.git
|
1. 第一步:pull项目https://github.com/kekingcn/file-online-preview.git
|
||||||
|
|
||||||
3. 第二步:运行 ServerMain 的 main 方法,服务启动后,访问 http://localhost:8012/
|
3. 第二步:运行FilePreviewApplication的main方法,服务启动后,访问http://localhost:8012/
|
||||||
会看到如下界面,代表服务启动成功
|
会看到如下界面,代表服务启动成功
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
### 历史更新记录
|
### 历史更新记录
|
||||||
|
|
||||||
> 2021年1月28日 :
|
|
||||||
|
|
||||||
2020农历年最后一个版本发布,主要包含了部分 UI 改进,和解决了 QQ 群友、 Issue 里反馈的 Bug 修复,最最重要的是发个新版,过个好年
|
|
||||||
|
|
||||||
1. 引入galimatias,解决不规范文件名导致文件下载异常
|
|
||||||
2. 更新index接入演示界面UI风格
|
|
||||||
3. 更新markdown文件预览UI风格
|
|
||||||
4. 更新XML文件预览UI风格,调整类文本预览架构,更方便扩展
|
|
||||||
5. 更新simTxT文件预览UI风格
|
|
||||||
6. 调整多图连续预览上下翻图的UI
|
|
||||||
7. 采用apache-common-io包简化所有的文件下载io操作
|
|
||||||
8. XML文件预览支持切换纯文本模式
|
|
||||||
9. 增强url base64解码失败时的提示信息
|
|
||||||
10. 修复导包错误以及图片预览 bug
|
|
||||||
11. 修复发行包运行时找不到日志目录的问题
|
|
||||||
12. 修复压缩包内多图连续预览的bug
|
|
||||||
13. 修复大小写文件类型后缀没通用匹配的问题
|
|
||||||
14. 指定Base64转码采用Apache Commons-code中的实现,修复base64部分jdk版本下出现的异常
|
|
||||||
15. 修复类文本类型HTML文件预览的bug
|
|
||||||
16. 修复:dwg文件预览时无法在jpg和pdf两种类型之间切换
|
|
||||||
17. escaping of dangerous characters to prevent reflected xss
|
|
||||||
18. 修复重复编码导致文档转图片预览失败的问题&编码规范
|
|
||||||
|
|
||||||
> 2020年12月27日 :
|
> 2020年12月27日 :
|
||||||
|
|
||||||
2020年年终大版本更新,架构全面设计,代码全面重构,代码质量全面提升,二次开发更便捷,欢迎拉源码品鉴,提issue、pr共同建设
|
2020年年终大版本更新,架构全面设计,代码全面重构,代码质量全面提升,二次开发更便捷,欢迎拉源码品鉴,提issue、pr共同建设
|
||||||
@@ -209,11 +185,3 @@ pdf预览模式预览效果如下
|
|||||||
### 使用登记
|
### 使用登记
|
||||||
如果这个项目解决了你的实际问题,可在https://gitee.com/kekingcn/file-online-preview/issues/IGSBV
|
如果这个项目解决了你的实际问题,可在https://gitee.com/kekingcn/file-online-preview/issues/IGSBV
|
||||||
登记下,如果节省了你的三方预览服务费用,也愿意支持下的话,可点击下方【捐助】请作者喝杯咖啡,也是非常感谢
|
登记下,如果节省了你的三方预览服务费用,也愿意支持下的话,可点击下方【捐助】请作者喝杯咖啡,也是非常感谢
|
||||||
|
|
||||||
### Stars 趋势图
|
|
||||||
#### Gitee
|
|
||||||
[](https://whnb.wang/kekingcn/file-online-preview?e=86400)
|
|
||||||
|
|
||||||
#### GitHub
|
|
||||||
|
|
||||||
[](https://starchart.cc/kekingcn/kkFileView)
|
|
||||||
|
|||||||
@@ -3,15 +3,13 @@
|
|||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
<parent>
|
|
||||||
<artifactId>filepreview</artifactId>
|
|
||||||
<groupId>cn.keking</groupId>
|
<groupId>cn.keking</groupId>
|
||||||
<version>3.5.1</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>office-plugin</artifactId>
|
<artifactId>office-plugin</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<packaging>jar</packaging>
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
</properties>
|
||||||
<repositories>
|
<repositories>
|
||||||
<repository>
|
<repository>
|
||||||
<!-- required for org.hyperic:sigar -->
|
<!-- required for org.hyperic:sigar -->
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ public class OfficeUtils {
|
|||||||
}
|
}
|
||||||
if (PlatformUtils.isWindows()) {
|
if (PlatformUtils.isWindows()) {
|
||||||
// %ProgramFiles(x86)% on 64-bit machines; %ProgramFiles% on 32-bit ones
|
// %ProgramFiles(x86)% on 64-bit machines; %ProgramFiles% on 32-bit ones
|
||||||
String officePluginPath = ConfigUtils.getOfficePluginPath();
|
String homePath = ConfigUtils.getHomePath();
|
||||||
String programFiles = System.getenv("ProgramFiles(x86)");
|
String programFiles = System.getenv("ProgramFiles(x86)");
|
||||||
if (programFiles == null) {
|
if (programFiles == null) {
|
||||||
programFiles = System.getenv("ProgramFiles");
|
programFiles = System.getenv("ProgramFiles");
|
||||||
@@ -89,7 +89,7 @@ public class OfficeUtils {
|
|||||||
return findOfficeHome(
|
return findOfficeHome(
|
||||||
programFiles + File.separator + "OpenOffice 4",
|
programFiles + File.separator + "OpenOffice 4",
|
||||||
programFiles + File.separator + "LibreOffice 4",
|
programFiles + File.separator + "LibreOffice 4",
|
||||||
officePluginPath + File.separator + "windows-office"
|
homePath + File.separator + "office"
|
||||||
);
|
);
|
||||||
} else if (PlatformUtils.isMac()) {
|
} else if (PlatformUtils.isMac()) {
|
||||||
return findOfficeHome(
|
return findOfficeHome(
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import java.io.File;
|
|||||||
public class ConfigUtils {
|
public class ConfigUtils {
|
||||||
|
|
||||||
private static final String MAIN_DIRECTORY_NAME = "server";
|
private static final String MAIN_DIRECTORY_NAME = "server";
|
||||||
private static final String OFFICE_PLUGIN_NAME = "office-plugin";
|
|
||||||
|
|
||||||
public static String getHomePath() {
|
public static String getHomePath() {
|
||||||
String userDir = System.getenv("KKFILEVIEW_BIN_FOLDER");
|
String userDir = System.getenv("KKFILEVIEW_BIN_FOLDER");
|
||||||
@@ -29,23 +28,6 @@ public class ConfigUtils {
|
|||||||
return userDir;
|
return userDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static String getOfficePluginPath() {
|
|
||||||
String userDir = System.getenv("KKFILEVIEW_BIN_FOLDER");
|
|
||||||
if (userDir == null) {
|
|
||||||
userDir = System.getProperty("user.dir");
|
|
||||||
}
|
|
||||||
if (userDir.endsWith("bin")) {
|
|
||||||
userDir = userDir.substring(0, userDir.length() - 4);
|
|
||||||
} else {
|
|
||||||
String separator = File.separator;
|
|
||||||
if (!userDir.contains(OFFICE_PLUGIN_NAME)) {
|
|
||||||
userDir = userDir + separator + OFFICE_PLUGIN_NAME;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return userDir;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getCustomizedConfigPath() {
|
public static String getCustomizedConfigPath() {
|
||||||
String homePath = getHomePath();
|
String homePath = getHomePath();
|
||||||
String separator = java.io.File.separator;
|
String separator = java.io.File.separator;
|
||||||
|
|||||||
@@ -1,5 +0,0 @@
|
|||||||
|
|
||||||
======================================================================
|
|
||||||
OpenOffice 4.1.6 ReadMe
|
|
||||||
======================================================================
|
|
||||||
Windows 内置集成的的 OpenOffice
|
|
||||||
68
pom.xml
68
pom.xml
@@ -2,60 +2,36 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<packaging>pom</packaging>
|
|
||||||
|
|
||||||
<groupId>cn.keking</groupId>
|
<groupId>cn.keking</groupId>
|
||||||
<artifactId>filepreview</artifactId>
|
<artifactId>filepreview</artifactId>
|
||||||
<version>3.5.1</version>
|
<version>3.3.0</version>
|
||||||
|
|
||||||
<properties>
|
|
||||||
<java.version>1.8</java.version>
|
|
||||||
<spring.boot.version>2.4.2</spring.boot.version>
|
|
||||||
<maven.compiler.source>${java.version}</maven.compiler.source>
|
|
||||||
<maven.compiler.target>${java.version}</maven.compiler.target>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
|
||||||
</properties>
|
|
||||||
|
|
||||||
<modules>
|
<modules>
|
||||||
<module>office-plugin</module>
|
<module>office-plugin</module>
|
||||||
<module>server</module>
|
<module>server</module>
|
||||||
</modules>
|
</modules>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>dev</id>
|
||||||
|
<properties>
|
||||||
|
<build.exclude.resource></build.exclude.resource>
|
||||||
|
</properties>
|
||||||
|
<activation>
|
||||||
|
<!--默认激活开发环境-->
|
||||||
|
<activeByDefault>true</activeByDefault>
|
||||||
|
</activation>
|
||||||
|
</profile>
|
||||||
|
|
||||||
|
<profile>
|
||||||
|
<id>release</id>
|
||||||
|
<properties>
|
||||||
|
<build.exclude.resource>*.properties</build.exclude.resource>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
|
||||||
<name>file-online-preview</name>
|
<name>file-online-preview</name>
|
||||||
<description>专注文件在线预览服务</description>
|
<description>专注文件在线预览服务</description>
|
||||||
<url>https://github.com/kekingcn/kkFileView</url>
|
|
||||||
|
|
||||||
<licenses>
|
|
||||||
<license>
|
|
||||||
<name>Apache License, Version 2.0</name>
|
|
||||||
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
|
|
||||||
</license>
|
|
||||||
</licenses>
|
|
||||||
|
|
||||||
<scm>
|
|
||||||
<url>https://github.com/kekingcn/kkFileView</url>
|
|
||||||
<connection>scm:git:git://github.com/kekingcn/kkFileView.git</connection>
|
|
||||||
<developerConnection>scm:git:ssh://git@github.com/kekingcn/kkFileView.git</developerConnection>
|
|
||||||
</scm>
|
|
||||||
|
|
||||||
<developers>
|
|
||||||
<developer>
|
|
||||||
<id>klboke</id>
|
|
||||||
<name>kl</name>
|
|
||||||
<email>g632104866@gmail.com</email>
|
|
||||||
<url>http://www.kailing.pub</url>
|
|
||||||
</developer>
|
|
||||||
<developer>
|
|
||||||
<id>gitchenjh</id>
|
|
||||||
<name>chenjinghua</name>
|
|
||||||
<email>842761733@qq.com</email>
|
|
||||||
</developer>
|
|
||||||
</developers>
|
|
||||||
|
|
||||||
<issueManagement>
|
|
||||||
<system>github</system>
|
|
||||||
<url>https://github.com/kekingcn/kkFileView/issues</url>
|
|
||||||
</issueManagement>
|
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
119
server/pom.xml
119
server/pom.xml
@@ -2,27 +2,31 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
<parent>
|
||||||
<artifactId>filepreview</artifactId>
|
|
||||||
<groupId>cn.keking</groupId>
|
|
||||||
<version>3.5.1</version>
|
|
||||||
</parent>
|
|
||||||
|
|
||||||
<artifactId>kkFileView</artifactId>
|
|
||||||
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-dependencies</artifactId>
|
<artifactId>spring-boot-starter-parent</artifactId>
|
||||||
<version>${spring.boot.version}</version>
|
<version>1.5.8.RELEASE</version>
|
||||||
<scope>import</scope>
|
<relativePath/> <!-- lookup parent from repository -->
|
||||||
<type>pom</type>
|
</parent>
|
||||||
</dependency>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
|
|
||||||
|
<groupId>cn.keking</groupId>
|
||||||
|
<artifactId>kkFileView</artifactId>
|
||||||
|
<version>3.3.0</version>
|
||||||
|
|
||||||
|
<properties>
|
||||||
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
|
<java.version>1.8</java.version>
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<repositories>
|
||||||
|
<repository>
|
||||||
|
<!-- required for org.hyperic:sigar -->
|
||||||
|
<id>jboss-public-repository-group</id>
|
||||||
|
<url>https://repository.jboss.org/nexus/content/groups/public-jboss/</url>
|
||||||
|
</repository>
|
||||||
|
</repositories>
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
@@ -51,7 +55,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.keking</groupId>
|
<groupId>cn.keking</groupId>
|
||||||
<artifactId>office-plugin</artifactId>
|
<artifactId>office-plugin</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.commons</groupId>
|
<groupId>org.apache.commons</groupId>
|
||||||
@@ -67,7 +71,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi</artifactId>
|
<artifactId>poi</artifactId>
|
||||||
<version>3.17</version>
|
<version>3.12</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
@@ -149,7 +153,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.thoughtworks.xstream</groupId>
|
<groupId>com.thoughtworks.xstream</groupId>
|
||||||
<artifactId>xstream</artifactId>
|
<artifactId>xstream</artifactId>
|
||||||
<version>1.4.17</version>
|
<version>1.4.15</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.googlecode.concurrentlinkedhashmap</groupId>
|
<groupId>com.googlecode.concurrentlinkedhashmap</groupId>
|
||||||
@@ -192,66 +196,7 @@
|
|||||||
<artifactId>galimatias</artifactId>
|
<artifactId>galimatias</artifactId>
|
||||||
<version>0.2.1</version>
|
<version>0.2.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- 以下是bytedeco 基于opencv ffmpeg封装的javacv,用于视频处理 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>javacv</artifactId>
|
|
||||||
<version>1.5.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>javacpp</artifactId>
|
|
||||||
<version>1.5.2</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<!-- 此版本中主要兼容linux和windows系统,如需兼容其他系统平台,请引入对应依赖即可 -->
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>opencv</artifactId>
|
|
||||||
<version>4.1.2-1.5.2</version>
|
|
||||||
<classifier>linux-x86_64</classifier>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>opencv</artifactId>
|
|
||||||
<version>4.1.2-1.5.2</version>
|
|
||||||
<classifier>windows-x86_64</classifier>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>openblas</artifactId>
|
|
||||||
<version>0.3.6-1.5.1</version>
|
|
||||||
<classifier>linux-x86_64</classifier>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>openblas</artifactId>
|
|
||||||
<version>0.3.6-1.5.1</version>
|
|
||||||
<classifier>windows-x86_64</classifier>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>ffmpeg</artifactId>
|
|
||||||
<version>4.2.1-1.5.2</version>
|
|
||||||
<classifier>linux-x86_64</classifier>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.bytedeco</groupId>
|
|
||||||
<artifactId>ffmpeg</artifactId>
|
|
||||||
<version>4.2.1-1.5.2</version>
|
|
||||||
<classifier>windows-x86_64</classifier>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
<resources>
|
<resources>
|
||||||
<resource>
|
<resource>
|
||||||
@@ -263,6 +208,9 @@
|
|||||||
</resource>
|
</resource>
|
||||||
<resource>
|
<resource>
|
||||||
<directory>src/main/config</directory>
|
<directory>src/main/config</directory>
|
||||||
|
<excludes>
|
||||||
|
<exclude>${build.exclude.resource}</exclude>
|
||||||
|
</excludes>
|
||||||
<filtering>true</filtering>
|
<filtering>true</filtering>
|
||||||
</resource>
|
</resource>
|
||||||
</resources>
|
</resources>
|
||||||
@@ -270,25 +218,16 @@
|
|||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
<version>${spring.boot.version}</version>
|
|
||||||
<configuration>
|
<configuration>
|
||||||
<includeSystemScope>true</includeSystemScope>
|
<includeSystemScope>true</includeSystemScope>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
|
||||||
<execution>
|
|
||||||
<goals>
|
|
||||||
<goal>repackage</goal>
|
|
||||||
</goals>
|
|
||||||
</execution>
|
|
||||||
</executions>
|
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
<plugin>
|
||||||
<artifactId>maven-assembly-plugin</artifactId>
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<appendAssemblyId>false</appendAssemblyId>
|
<appendAssemblyId>false</appendAssemblyId>
|
||||||
<descriptors>
|
<descriptors>
|
||||||
<descriptor>src/main/assembly/dist-win32.xml</descriptor>
|
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||||
<descriptor>src/main/assembly/dist-linux.xml</descriptor>
|
|
||||||
</descriptors>
|
</descriptors>
|
||||||
</configuration>
|
</configuration>
|
||||||
<executions>
|
<executions>
|
||||||
|
|||||||
@@ -35,8 +35,8 @@
|
|||||||
<outputDirectory>${file.separator}log</outputDirectory>
|
<outputDirectory>${file.separator}log</outputDirectory>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>../office-plugin/windows-office</directory>
|
<directory>src/main/office</directory>
|
||||||
<outputDirectory>${file.separator}windows-office</outputDirectory>
|
<outputDirectory>${file.separator}office</outputDirectory>
|
||||||
</fileSet>
|
</fileSet>
|
||||||
<fileSet>
|
<fileSet>
|
||||||
<directory>${project.build.directory}</directory>
|
<directory>${project.build.directory}</directory>
|
||||||
|
|||||||
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<assembly
|
|
||||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
|
||||||
<id>make-assembly</id>
|
|
||||||
<formats>
|
|
||||||
<format>tar.gz</format>
|
|
||||||
</formats>
|
|
||||||
<includeBaseDirectory>true</includeBaseDirectory>
|
|
||||||
<fileSets>
|
|
||||||
<fileSet>
|
|
||||||
<directory>src/main/bin</directory>
|
|
||||||
<outputDirectory>${file.separator}bin</outputDirectory>
|
|
||||||
<includes>
|
|
||||||
<include>*.sh</include>
|
|
||||||
</includes>
|
|
||||||
<fileMode>755</fileMode>
|
|
||||||
<lineEnding>unix</lineEnding>
|
|
||||||
</fileSet>
|
|
||||||
<fileSet>
|
|
||||||
<directory>src/main/config</directory>
|
|
||||||
<outputDirectory>${file.separator}config</outputDirectory>
|
|
||||||
<lineEnding>unix</lineEnding>
|
|
||||||
</fileSet>
|
|
||||||
<fileSet>
|
|
||||||
<directory>src/main/log</directory>
|
|
||||||
<outputDirectory>${file.separator}log</outputDirectory>
|
|
||||||
<lineEnding>unix</lineEnding>
|
|
||||||
</fileSet>
|
|
||||||
<fileSet>
|
|
||||||
<directory>${project.build.directory}</directory>
|
|
||||||
<outputDirectory>${file.separator}bin</outputDirectory>
|
|
||||||
<includes>
|
|
||||||
<include>*.jar</include>
|
|
||||||
</includes>
|
|
||||||
</fileSet>
|
|
||||||
</fileSets>
|
|
||||||
</assembly>
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<assembly
|
|
||||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
|
||||||
<id>make-assembly</id>
|
|
||||||
<formats>
|
|
||||||
<format>zip</format>
|
|
||||||
</formats>
|
|
||||||
<includeBaseDirectory>true</includeBaseDirectory>
|
|
||||||
<fileSets>
|
|
||||||
<fileSet>
|
|
||||||
<directory>src/main/bin</directory>
|
|
||||||
<outputDirectory>${file.separator}bin</outputDirectory>
|
|
||||||
<includes>
|
|
||||||
<include>*.bat</include>
|
|
||||||
</includes>
|
|
||||||
</fileSet>
|
|
||||||
<fileSet>
|
|
||||||
<directory>src/main/config</directory>
|
|
||||||
<outputDirectory>${file.separator}config</outputDirectory>
|
|
||||||
</fileSet>
|
|
||||||
<fileSet>
|
|
||||||
<directory>src/main/log</directory>
|
|
||||||
<outputDirectory>${file.separator}log</outputDirectory>
|
|
||||||
</fileSet>
|
|
||||||
<fileSet>
|
|
||||||
<directory>../office-plugin/windows-office</directory>
|
|
||||||
<outputDirectory>${file.separator}windows-office</outputDirectory>
|
|
||||||
</fileSet>
|
|
||||||
<fileSet>
|
|
||||||
<directory>${project.build.directory}</directory>
|
|
||||||
<outputDirectory>${file.separator}bin</outputDirectory>
|
|
||||||
<includes>
|
|
||||||
<include>*.jar</include>
|
|
||||||
</includes>
|
|
||||||
</fileSet>
|
|
||||||
</fileSets>
|
|
||||||
</assembly>
|
|
||||||
@@ -6,4 +6,4 @@ echo Starting kkFileView...
|
|||||||
echo Please check log file in ../log/kkFileView.log for more information
|
echo Please check log file in ../log/kkFileView.log for more information
|
||||||
echo You can get help in our official homesite: https://kkFileView.keking.cn
|
echo You can get help in our official homesite: https://kkFileView.keking.cn
|
||||||
echo If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers
|
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-3.5.1.jar -> ..\log\kkFileView.log
|
java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\config\application.properties -jar kkFileView-3.3.0.jar -> ..\log\kkFileView.log
|
||||||
@@ -29,4 +29,4 @@ echo "Starting kkFileView..."
|
|||||||
echo "Please execute ./showlog.sh to check log for more information"
|
echo "Please execute ./showlog.sh to check log for more information"
|
||||||
echo "You can get help in our official homesite: https://kkFileView.keking.cn"
|
echo "You can get help in our official homesite: https://kkFileView.keking.cn"
|
||||||
echo "If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers"
|
echo "If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers"
|
||||||
nohup java -Dfile.encoding=UTF-8 -Dspring.config.location=../config/application.properties -jar kkFileView-3.5.1.jar > ../log/kkFileView.log 2>&1 &
|
nohup java -Dfile.encoding=UTF-8 -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=../config/application.properties -jar kkFileView-3.3.0.jar > ../log/kkFileView.log 2>&1 &
|
||||||
|
|||||||
@@ -1,10 +1,7 @@
|
|||||||
#######################################不可动态配置,需要重启生效#######################################
|
#######################################不可动态配置,需要重启生效#######################################
|
||||||
server.port = ${KK_SERVER_PORT:8012}
|
server.port = ${KK_SERVER_PORT:8012}
|
||||||
server.servlet.context-path= ${KK_CONTEXT_PATH:/}
|
server.context-path = ${KK_CONTEXT_PATH:/}
|
||||||
server.servlet.encoding.charset = utf-8
|
spring.http.encoding.charset = utf8
|
||||||
#文件上传限制
|
|
||||||
spring.servlet.multipart.max-file-size=500MB
|
|
||||||
spring.servlet.multipart.max-request-size=500MB
|
|
||||||
## Freemarker 配置
|
## Freemarker 配置
|
||||||
spring.freemarker.template-loader-path = classpath:/web/
|
spring.freemarker.template-loader-path = classpath:/web/
|
||||||
spring.freemarker.cache = false
|
spring.freemarker.cache = false
|
||||||
@@ -16,11 +13,10 @@ spring.freemarker.expose-session-attributes = true
|
|||||||
spring.freemarker.request-context-attribute = request
|
spring.freemarker.request-context-attribute = request
|
||||||
spring.freemarker.suffix = .ftl
|
spring.freemarker.suffix = .ftl
|
||||||
|
|
||||||
# office-plugin
|
server.tomcat.uri-encoding = UTF-8
|
||||||
## office转换服务的进程数,默认开启两个进程
|
#文件上传限制
|
||||||
office.plugin.server.ports = 2001,2002
|
spring.http.multipart.max-request-size=500MB
|
||||||
## office 转换服务 task 超时时间,默认五分钟
|
spring.http.multipart.max-file-size=500MB
|
||||||
office.plugin.task.timeout = 5m
|
|
||||||
|
|
||||||
#文件资源路径(默认为打包根路径下的file目录下)
|
#文件资源路径(默认为打包根路径下的file目录下)
|
||||||
#file.dir = D:\\kkFileview\\
|
#file.dir = D:\\kkFileview\\
|
||||||
@@ -33,7 +29,7 @@ office.home = ${KK_OFFICE_HOME:default}
|
|||||||
cache.type = ${KK_CACHE_TYPE:jdk}
|
cache.type = ${KK_CACHE_TYPE:jdk}
|
||||||
#redis连接,只有当cache.type = redis时才有用
|
#redis连接,只有当cache.type = redis时才有用
|
||||||
spring.redisson.address = ${KK_SPRING_REDISSON_ADDRESS:127.0.0.1:6379}
|
spring.redisson.address = ${KK_SPRING_REDISSON_ADDRESS:127.0.0.1:6379}
|
||||||
spring.redisson.password = ${KK_SPRING_REDISSON_PASSWORD:}
|
spring.redisson.password = ${KK_SPRING_REDISSON_PASSWORD:123456}
|
||||||
#缓存是否自动清理 true 为开启,注释掉或其他值都为关闭
|
#缓存是否自动清理 true 为开启,注释掉或其他值都为关闭
|
||||||
cache.clean.enabled = ${KK_CACHE_CLEAN_ENABLED:true}
|
cache.clean.enabled = ${KK_CACHE_CLEAN_ENABLED:true}
|
||||||
#缓存自动清理时间,cache.clean.enabled = true时才有用,cron表达式,基于Quartz cron
|
#缓存自动清理时间,cache.clean.enabled = true时才有用,cron表达式,基于Quartz cron
|
||||||
@@ -55,11 +51,6 @@ cache.enabled = ${KK_CACHE_ENABLED:true}
|
|||||||
simText = ${KK_SIMTEXT:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}
|
simText = ${KK_SIMTEXT:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}
|
||||||
#多媒体类型,默认如下,可自定义添加
|
#多媒体类型,默认如下,可自定义添加
|
||||||
media = ${KK_MEDIA:mp3,wav,mp4,flv}
|
media = ${KK_MEDIA:mp3,wav,mp4,flv}
|
||||||
#是否开启多媒体类型转视频格式转换,目前可转换视频格式有:avi,mov,wmv,3gp,rm
|
|
||||||
#请谨慎开启此功能,建议异步调用添加到处理队列,并且增加任务队列处理线程,防止视频转换占用完线程资源,转换比较耗费时间,并且控制了只能串行处理转换任务
|
|
||||||
media.convert.disable = ${KK_MEDIA_CONVERT_DISABLE:false}
|
|
||||||
#支持转换的视频类型
|
|
||||||
convertMedias = ${KK_CONVERTMEDIAS:avi,mov,wmv,mkv,3gp,rm}
|
|
||||||
#office类型文档(word ppt)样式,默认为图片(image),可配置为pdf(预览时也有按钮切换)
|
#office类型文档(word ppt)样式,默认为图片(image),可配置为pdf(预览时也有按钮切换)
|
||||||
office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:image}
|
office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:image}
|
||||||
#是否关闭office预览切换开关,默认为false,可配置为true关闭
|
#是否关闭office预览切换开关,默认为false,可配置为true关闭
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
[#ftl]
|
[#ftl]
|
||||||
[#-- @implicitly included --]
|
[#-- @implicitly included --]
|
||||||
[#-- @ftlvariable name="initializeMemorySize" type="java.lang.Number" --]
|
|
||||||
[#-- @ftlvariable name="currentUrl" type="java.lang.String" --]
|
|
||||||
[#-- @ftlvariable name="file" type="cn.keking.model.FileAttribute" --]
|
[#-- @ftlvariable name="file" type="cn.keking.model.FileAttribute" --]
|
||||||
[#-- @ftlvariable name="fileName" type="java.lang.String" --]
|
[#-- @ftlvariable name="fileName" type="java.lang.String" --]
|
||||||
[#-- @ftlvariable name="fileTree" type="java.lang.String" --]
|
[#-- @ftlvariable name="fileTree" type="java.lang.String" --]
|
||||||
|
|||||||
@@ -1,33 +1,22 @@
|
|||||||
package cn.keking;
|
package cn.keking;
|
||||||
|
|
||||||
import cn.keking.config.AppBanner;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.slf4j.Logger;
|
|
||||||
import org.slf4j.LoggerFactory;
|
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
import org.springframework.boot.autoconfigure.web.ServerProperties;
|
|
||||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
|
||||||
import org.springframework.context.ConfigurableApplicationContext;
|
|
||||||
import org.springframework.context.annotation.ComponentScan;
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
import org.springframework.util.StopWatch;
|
|
||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
@EnableScheduling
|
@EnableScheduling
|
||||||
@ComponentScan(value = "cn.keking.*")
|
@ComponentScan(value = "cn.keking.*")
|
||||||
public class ServerMain {
|
public class ServerMain {
|
||||||
|
|
||||||
private static final Logger logger = LoggerFactory.getLogger(ServerMain.class);
|
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
StopWatch stopWatch = new StopWatch();
|
ServerMain.staticInitSystemProperty();
|
||||||
stopWatch.start();
|
SpringApplication.run(ServerMain.class, args);
|
||||||
ConfigurableApplicationContext context = new SpringApplicationBuilder(ServerMain.class)
|
|
||||||
.logStartupInfo(false)
|
|
||||||
.banner(new AppBanner())
|
|
||||||
.run(args);
|
|
||||||
stopWatch.stop();
|
|
||||||
Integer port = context.getBean(ServerProperties.class).getPort();
|
|
||||||
logger.info("kkFileView 服务启动完成,耗时:{}s,演示页请访问: http://127.0.0.1:{} ", stopWatch.getTotalTimeSeconds(), port);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static void staticInitSystemProperty(){
|
||||||
|
//pdfbox兼容低版本jdk
|
||||||
|
System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +0,0 @@
|
|||||||
package cn.keking.config;
|
|
||||||
|
|
||||||
import org.springframework.boot.Banner;
|
|
||||||
import org.springframework.core.env.Environment;
|
|
||||||
|
|
||||||
import java.io.PrintStream;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author kl (http://kailing.pub)
|
|
||||||
* @since 2021/2/8
|
|
||||||
*/
|
|
||||||
public class AppBanner implements Banner {
|
|
||||||
@Override
|
|
||||||
public void printBanner(Environment environment, Class<?> sourceClass, PrintStream out) {
|
|
||||||
out.println(
|
|
||||||
" _ _ ______ _ _ __ __ _ \n" +
|
|
||||||
" | | | | | ____| (_) | | \\ \\ / / (_) \n" +
|
|
||||||
" | | __ | | __ | |__ _ | | ___ \\ \\ / / _ ___ __ __\n" +
|
|
||||||
" | |/ / | |/ / | __| | | | | / _ \\ \\ \\/ / | | / _ \\ \\ \\ /\\ / /\n" +
|
|
||||||
" | < | < | | | | | | | __/ \\ / | | | __/ \\ V V / \n" +
|
|
||||||
" |_|\\_\\ |_|\\_\\ |_| |_| |_| \\___| \\/ |_| \\___| \\_/\\_/ \n" +
|
|
||||||
" \n" +
|
|
||||||
" => Spring Boot :: (v2.4.2) QQ1 :: 613025121\n" +
|
|
||||||
" => kkFileView :: (v3.5) QQ2 :: 484680571\n" +
|
|
||||||
" => github :: https://github.com/kekingcn/kkFileView\n" +
|
|
||||||
" => gitee :: https://gitee.com/kekingcn/file-online-preview\n");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -16,25 +16,18 @@ import java.util.Set;
|
|||||||
@Component
|
@Component
|
||||||
public class ConfigConstants {
|
public class ConfigConstants {
|
||||||
|
|
||||||
static {
|
private static Boolean CACHE_ENABLED;
|
||||||
//pdfbox兼容低版本jdk
|
private static String[] SIM_TEXT = {};
|
||||||
System.setProperty("sun.java2d.cmm", "sun.java2d.cmm.kcms.KcmsServiceProvider");
|
private static String[] MEDIA = {};
|
||||||
}
|
private static String OFFICE_PREVIEW_TYPE;
|
||||||
|
private static String OFFICE_PREVIEW_SWITCH_DISABLED;
|
||||||
private static Boolean cacheEnabled;
|
private static String FTP_USERNAME;
|
||||||
private static String[] simTexts = {};
|
private static String FTP_PASSWORD;
|
||||||
private static String[] medias = {};
|
private static String FTP_CONTROL_ENCODING;
|
||||||
private static String[] convertMedias = {};
|
private static String BASE_URL;
|
||||||
private static String mediaConvertDisable;
|
private static String FILE_DIR = ConfigUtils.getHomePath() + File.separator + "file" + File.separator;
|
||||||
private static String officePreviewType;
|
private static CopyOnWriteArraySet<String> TRUST_HOST_SET;
|
||||||
private static String officePreviewSwitchDisabled;
|
private static String PDF_DOWNLOAD_DISABLE;
|
||||||
private static String ftpUsername;
|
|
||||||
private static String ftpPassword;
|
|
||||||
private static String ftpControlEncoding;
|
|
||||||
private static String baseUrl;
|
|
||||||
private static String fileDir = ConfigUtils.getHomePath() + File.separator + "file" + File.separator;
|
|
||||||
private static CopyOnWriteArraySet<String> trustHostSet;
|
|
||||||
private static String pdfDownloadDisable;
|
|
||||||
|
|
||||||
public static final String DEFAULT_CACHE_ENABLED = "true";
|
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";
|
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";
|
||||||
@@ -49,9 +42,8 @@ public class ConfigConstants {
|
|||||||
public static final String DEFAULT_TRUST_HOST = "default";
|
public static final String DEFAULT_TRUST_HOST = "default";
|
||||||
public static final String DEFAULT_PDF_DOWNLOAD_DISABLE = "true";
|
public static final String DEFAULT_PDF_DOWNLOAD_DISABLE = "true";
|
||||||
|
|
||||||
|
|
||||||
public static Boolean isCacheEnabled() {
|
public static Boolean isCacheEnabled() {
|
||||||
return cacheEnabled;
|
return CACHE_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${cache.enabled:true}")
|
@Value("${cache.enabled:true}")
|
||||||
@@ -60,11 +52,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setCacheEnabledValueValue(Boolean cacheEnabled) {
|
public static void setCacheEnabledValueValue(Boolean cacheEnabled) {
|
||||||
ConfigConstants.cacheEnabled = cacheEnabled;
|
CACHE_ENABLED = cacheEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getSimText() {
|
public static String[] getSimText() {
|
||||||
return simTexts;
|
return SIM_TEXT;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${simText:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}")
|
@Value("${simText:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,log,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}")
|
||||||
@@ -74,11 +66,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setSimTextValue(String[] simText) {
|
public static void setSimTextValue(String[] simText) {
|
||||||
ConfigConstants.simTexts = simText;
|
SIM_TEXT = simText;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String[] getMedia() {
|
public static String[] getMedia() {
|
||||||
return medias;
|
return MEDIA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${media:mp3,wav,mp4,flv}")
|
@Value("${media:mp3,wav,mp4,flv}")
|
||||||
@@ -88,38 +80,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setMediaValue(String[] Media) {
|
public static void setMediaValue(String[] Media) {
|
||||||
ConfigConstants.medias = Media;
|
MEDIA = Media;
|
||||||
}
|
|
||||||
|
|
||||||
public static String[] getConvertMedias() {
|
|
||||||
return convertMedias;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Value("${convertMedias:avi,mov,wmv,mkv,3gp,rm}")
|
|
||||||
public void setConvertMedias(String convertMedia) {
|
|
||||||
String[] mediaArr = convertMedia.split(",");
|
|
||||||
setConvertMediaValue(mediaArr);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void setConvertMediaValue(String[] ConvertMedia) {
|
|
||||||
ConfigConstants.convertMedias = ConvertMedia;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getMediaConvertDisable() {
|
|
||||||
return mediaConvertDisable;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Value("${media.convert.disable:true}")
|
|
||||||
public void setMediaConvertDisable(String mediaConvertDisable) {
|
|
||||||
setMediaConvertDisableValue(mediaConvertDisable);
|
|
||||||
}
|
|
||||||
public static void setMediaConvertDisableValue(String mediaConvertDisable) {
|
|
||||||
ConfigConstants.mediaConvertDisable = mediaConvertDisable;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOfficePreviewType() {
|
public static String getOfficePreviewType() {
|
||||||
return officePreviewType;
|
return OFFICE_PREVIEW_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${office.preview.type:image}")
|
@Value("${office.preview.type:image}")
|
||||||
@@ -128,11 +93,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setOfficePreviewTypeValue(String officePreviewType) {
|
public static void setOfficePreviewTypeValue(String officePreviewType) {
|
||||||
ConfigConstants.officePreviewType = officePreviewType;
|
OFFICE_PREVIEW_TYPE = officePreviewType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFtpUsername() {
|
public static String getFtpUsername() {
|
||||||
return ftpUsername;
|
return FTP_USERNAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${ftp.username:}")
|
@Value("${ftp.username:}")
|
||||||
@@ -141,11 +106,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setFtpUsernameValue(String ftpUsername) {
|
public static void setFtpUsernameValue(String ftpUsername) {
|
||||||
ConfigConstants.ftpUsername = ftpUsername;
|
FTP_USERNAME = ftpUsername;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFtpPassword() {
|
public static String getFtpPassword() {
|
||||||
return ftpPassword;
|
return FTP_PASSWORD;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${ftp.password:}")
|
@Value("${ftp.password:}")
|
||||||
@@ -154,11 +119,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setFtpPasswordValue(String ftpPassword) {
|
public static void setFtpPasswordValue(String ftpPassword) {
|
||||||
ConfigConstants.ftpPassword = ftpPassword;
|
FTP_PASSWORD = ftpPassword;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFtpControlEncoding() {
|
public static String getFtpControlEncoding() {
|
||||||
return ftpControlEncoding;
|
return FTP_CONTROL_ENCODING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${ftp.control.encoding:UTF-8}")
|
@Value("${ftp.control.encoding:UTF-8}")
|
||||||
@@ -167,11 +132,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setFtpControlEncodingValue(String ftpControlEncoding) {
|
public static void setFtpControlEncodingValue(String ftpControlEncoding) {
|
||||||
ConfigConstants.ftpControlEncoding = ftpControlEncoding;
|
FTP_CONTROL_ENCODING = ftpControlEncoding;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getBaseUrl() {
|
public static String getBaseUrl() {
|
||||||
return baseUrl;
|
return BASE_URL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${base.url:default}")
|
@Value("${base.url:default}")
|
||||||
@@ -180,11 +145,11 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void setBaseUrlValue(String baseUrl) {
|
public static void setBaseUrlValue(String baseUrl) {
|
||||||
ConfigConstants.baseUrl = baseUrl;
|
BASE_URL = baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getFileDir() {
|
public static String getFileDir() {
|
||||||
return fileDir;
|
return FILE_DIR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${file.dir:default}")
|
@Value("${file.dir:default}")
|
||||||
@@ -197,7 +162,7 @@ public class ConfigConstants {
|
|||||||
if (!fileDir.endsWith(File.separator)) {
|
if (!fileDir.endsWith(File.separator)) {
|
||||||
fileDir = fileDir + File.separator;
|
fileDir = fileDir + File.separator;
|
||||||
}
|
}
|
||||||
ConfigConstants.fileDir = fileDir;
|
FILE_DIR = fileDir;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,15 +184,15 @@ public class ConfigConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static Set<String> getTrustHostSet() {
|
public static Set<String> getTrustHostSet() {
|
||||||
return trustHostSet;
|
return TRUST_HOST_SET;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void setTrustHostSet(CopyOnWriteArraySet<String> trustHostSet) {
|
private static void setTrustHostSet(CopyOnWriteArraySet<String> trustHostSet) {
|
||||||
ConfigConstants.trustHostSet = trustHostSet;
|
ConfigConstants.TRUST_HOST_SET = trustHostSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getPdfDownloadDisable() {
|
public static String getPdfDownloadDisable() {
|
||||||
return pdfDownloadDisable;
|
return PDF_DOWNLOAD_DISABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -236,18 +201,17 @@ public class ConfigConstants {
|
|||||||
setPdfDownloadDisableValue(pdfDownloadDisable);
|
setPdfDownloadDisableValue(pdfDownloadDisable);
|
||||||
}
|
}
|
||||||
public static void setPdfDownloadDisableValue(String pdfDownloadDisable) {
|
public static void setPdfDownloadDisableValue(String pdfDownloadDisable) {
|
||||||
ConfigConstants.pdfDownloadDisable = pdfDownloadDisable;
|
PDF_DOWNLOAD_DISABLE = pdfDownloadDisable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getOfficePreviewSwitchDisabled() {
|
public static String getOfficePreviewSwitchDisabled() {
|
||||||
return officePreviewSwitchDisabled;
|
return OFFICE_PREVIEW_SWITCH_DISABLED;
|
||||||
}
|
}
|
||||||
@Value("${office.preview.switch.disabled:true}")
|
@Value("${office.preview.switch.disabled:true}")
|
||||||
public void setOfficePreviewSwitchDisabled(String officePreviewSwitchDisabled) {
|
public void setOfficePreviewSwitchDisabled(String officePreviewSwitchDisabled) {
|
||||||
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
OFFICE_PREVIEW_SWITCH_DISABLED = officePreviewSwitchDisabled;
|
||||||
}
|
}
|
||||||
public static void setOfficePreviewSwitchDisabledValue(String officePreviewSwitchDisabled) {
|
public static void setOfficePreviewSwitchDisabledValue(String officePreviewSwitchDisabled) {
|
||||||
ConfigConstants.officePreviewSwitchDisabled = officePreviewSwitchDisabled;
|
OFFICE_PREVIEW_SWITCH_DISABLED = officePreviewSwitchDisabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ public class ConfigRefreshComponent {
|
|||||||
text = properties.getProperty("simText", ConfigConstants.DEFAULT_TXT_TYPE);
|
text = properties.getProperty("simText", ConfigConstants.DEFAULT_TXT_TYPE);
|
||||||
media = properties.getProperty("media", ConfigConstants.DEFAULT_MEDIA_TYPE);
|
media = properties.getProperty("media", ConfigConstants.DEFAULT_MEDIA_TYPE);
|
||||||
officePreviewType = properties.getProperty("office.preview.type", ConfigConstants.DEFAULT_OFFICE_PREVIEW_TYPE);
|
officePreviewType = properties.getProperty("office.preview.type", ConfigConstants.DEFAULT_OFFICE_PREVIEW_TYPE);
|
||||||
officePreviewSwitchDisabled = properties.getProperty("office.preview.switch.disabled", ConfigConstants.DEFAULT_OFFICE_PREVIEW_SWITCH_DISABLED);
|
officePreviewSwitchDisabled = properties.getProperty("office.preview.switch.disabled", ConfigConstants.DEFAULT_OFFICE_PREVIEW_TYPE);
|
||||||
ftpUsername = properties.getProperty("ftp.username", ConfigConstants.DEFAULT_FTP_USERNAME);
|
ftpUsername = properties.getProperty("ftp.username", ConfigConstants.DEFAULT_FTP_USERNAME);
|
||||||
ftpPassword = properties.getProperty("ftp.password", ConfigConstants.DEFAULT_FTP_PASSWORD);
|
ftpPassword = properties.getProperty("ftp.password", ConfigConstants.DEFAULT_FTP_PASSWORD);
|
||||||
ftpControlEncoding = properties.getProperty("ftp.control.encoding", ConfigConstants.DEFAULT_FTP_CONTROL_ENCODING);
|
ftpControlEncoding = properties.getProperty("ftp.control.encoding", ConfigConstants.DEFAULT_FTP_CONTROL_ENCODING);
|
||||||
|
|||||||
19
server/src/main/java/cn/keking/config/RFCConfig.java
Normal file
19
server/src/main/java/cn/keking/config/RFCConfig.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package cn.keking.config;
|
||||||
|
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author chenjh
|
||||||
|
* @since 2020/5/18 13:41
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class RFCConfig {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public Boolean setRequestTargetAllow() {
|
||||||
|
// RFC 7230,RFC 3986规范不允许url相关特殊字符,手动指定Tomcat url允许特殊符号, 如{}做入参,其他符号按需添加。见tomcat的HttpParser源码。
|
||||||
|
System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow", "|{}");
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
package cn.keking.config;
|
package cn.keking.config;
|
||||||
|
|
||||||
import io.netty.channel.nio.NioEventLoopGroup;
|
import io.netty.channel.nio.NioEventLoopGroup;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.redisson.client.codec.Codec;
|
import org.redisson.client.codec.Codec;
|
||||||
import org.redisson.config.Config;
|
import org.redisson.config.Config;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||||
@@ -64,7 +63,7 @@ public class RedissonConfig {
|
|||||||
.setConnectTimeout(connectTimeout)
|
.setConnectTimeout(connectTimeout)
|
||||||
.setIdleConnectionTimeout(idleConnectionTimeout)
|
.setIdleConnectionTimeout(idleConnectionTimeout)
|
||||||
.setPingTimeout(pingTimeout)
|
.setPingTimeout(pingTimeout)
|
||||||
.setPassword(StringUtils.trimToNull(password));
|
.setPassword(password);
|
||||||
Codec codec=(Codec) ClassUtils.forName(getCodec(), ClassUtils.getDefaultClassLoader()).newInstance();
|
Codec codec=(Codec) ClassUtils.forName(getCodec(), ClassUtils.getDefaultClassLoader()).newInstance();
|
||||||
config.setCodec(codec);
|
config.setCodec(codec);
|
||||||
config.setThreads(thread);
|
config.setThreads(thread);
|
||||||
|
|||||||
@@ -4,14 +4,14 @@ import org.slf4j.Logger;
|
|||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author: chenjh
|
* @author: chenjh
|
||||||
* @since: 2019/4/16 20:04
|
* @since: 2019/4/16 20:04
|
||||||
*/
|
*/
|
||||||
@Configuration
|
@Configuration
|
||||||
public class WebConfig implements WebMvcConfigurer {
|
public class WebConfig extends WebMvcConfigurerAdapter {
|
||||||
|
|
||||||
private final static Logger LOGGER = LoggerFactory.getLogger(WebConfig.class);
|
private final static Logger LOGGER = LoggerFactory.getLogger(WebConfig.class);
|
||||||
/**
|
/**
|
||||||
@@ -22,5 +22,6 @@ public class WebConfig implements WebMvcConfigurer {
|
|||||||
String filePath = ConfigConstants.getFileDir();
|
String filePath = ConfigConstants.getFileDir();
|
||||||
LOGGER.info("Add resource locations: {}", filePath);
|
LOGGER.info("Add resource locations: {}", filePath);
|
||||||
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath);
|
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath);
|
||||||
|
super.addResourceHandlers(registry);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,67 +11,52 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
public enum FileType {
|
public enum FileType {
|
||||||
|
|
||||||
PICTURE("pictureFilePreviewImpl"),
|
picture("pictureFilePreviewImpl"),
|
||||||
COMPRESS("compressFilePreviewImpl"),
|
compress("compressFilePreviewImpl"),
|
||||||
OFFICE("officeFilePreviewImpl"),
|
office("officeFilePreviewImpl"),
|
||||||
SIMTEXT("simTextFilePreviewImpl"),
|
simText("simTextFilePreviewImpl"),
|
||||||
PDF("pdfFilePreviewImpl"),
|
pdf("pdfFilePreviewImpl"),
|
||||||
CODE("codeFilePreviewImpl"),
|
other("otherFilePreviewImpl"),
|
||||||
OTHER("otherFilePreviewImpl"),
|
media("mediaFilePreviewImpl"),
|
||||||
MEDIA("mediaFilePreviewImpl"),
|
markdown("markdownFilePreviewImpl"),
|
||||||
MARKDOWN("markdownFilePreviewImpl"),
|
xml("xmlFilePreviewImpl"),
|
||||||
XML("xmlFilePreviewImpl"),
|
flv("flvFilePreviewImpl"),
|
||||||
FLV("flvFilePreviewImpl"),
|
cad("cadFilePreviewImpl");
|
||||||
CAD("cadFilePreviewImpl"),
|
|
||||||
TIFF("tiffFilePreviewImpl");
|
|
||||||
|
|
||||||
|
private static final String[] OFFICE_TYPES = {"docx", "doc", "xls", "xlsx", "ppt", "pptx"};
|
||||||
private static final String[] OFFICE_TYPES = {"docx", "wps", "doc", "xls", "xlsx", "ppt", "pptx"};
|
|
||||||
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "raw"};
|
private static final String[] PICTURE_TYPES = {"jpg", "jpeg", "png", "gif", "bmp", "ico", "raw"};
|
||||||
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
|
private static final String[] ARCHIVE_TYPES = {"rar", "zip", "jar", "7-zip", "tar", "gzip", "7z"};
|
||||||
private static final String[] TIFF_TYPES = {"tif", "tiff"};
|
|
||||||
private static final String[] SSIM_TEXT_TYPES = ConfigConstants.getSimText();
|
private static final String[] SSIM_TEXT_TYPES = ConfigConstants.getSimText();
|
||||||
private static final String[] CODES = {"java", "c", "php", "go", "python", "py", "js", "html", "ftl", "css", "lua", "sh", "rb", "yml", "json", "h", "cpp", "cs", "aspx", "jsp"};
|
|
||||||
private static final String[] MEDIA_TYPES = ConfigConstants.getMedia();
|
private static final String[] MEDIA_TYPES = ConfigConstants.getMedia();
|
||||||
public static final String[] MEDIA_TYPES_CONVERT = ConfigConstants.getConvertMedias();
|
|
||||||
private static final Map<String, FileType> FILE_TYPE_MAPPER = new HashMap<>();
|
private static final Map<String, FileType> FILE_TYPE_MAPPER = new HashMap<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
for (String office : OFFICE_TYPES) {
|
for (String office : OFFICE_TYPES) {
|
||||||
FILE_TYPE_MAPPER.put(office, FileType.OFFICE);
|
FILE_TYPE_MAPPER.put(office, FileType.office);
|
||||||
}
|
}
|
||||||
for (String picture : PICTURE_TYPES) {
|
for (String picture : PICTURE_TYPES) {
|
||||||
FILE_TYPE_MAPPER.put(picture, FileType.PICTURE);
|
FILE_TYPE_MAPPER.put(picture, FileType.picture);
|
||||||
}
|
}
|
||||||
for (String archive : ARCHIVE_TYPES) {
|
for (String archive : ARCHIVE_TYPES) {
|
||||||
FILE_TYPE_MAPPER.put(archive, FileType.COMPRESS);
|
FILE_TYPE_MAPPER.put(archive, FileType.compress);
|
||||||
}
|
}
|
||||||
for (String text : SSIM_TEXT_TYPES) {
|
for (String text : SSIM_TEXT_TYPES) {
|
||||||
FILE_TYPE_MAPPER.put(text, FileType.SIMTEXT);
|
FILE_TYPE_MAPPER.put(text, FileType.simText);
|
||||||
}
|
}
|
||||||
for (String media : MEDIA_TYPES) {
|
for (String media : MEDIA_TYPES) {
|
||||||
FILE_TYPE_MAPPER.put(media, FileType.MEDIA);
|
FILE_TYPE_MAPPER.put(media, FileType.media);
|
||||||
}
|
}
|
||||||
for (String media : MEDIA_TYPES_CONVERT) {
|
FILE_TYPE_MAPPER.put("md", FileType.markdown);
|
||||||
FILE_TYPE_MAPPER.put(media, FileType.MEDIA);
|
FILE_TYPE_MAPPER.put("xml", FileType.xml);
|
||||||
}
|
FILE_TYPE_MAPPER.put("pdf", FileType.pdf);
|
||||||
for (String tif : TIFF_TYPES) {
|
FILE_TYPE_MAPPER.put("dwg", FileType.cad);
|
||||||
FILE_TYPE_MAPPER.put(tif, FileType.TIFF);
|
FILE_TYPE_MAPPER.put("flv", FileType.flv);
|
||||||
}
|
|
||||||
for (String code : CODES) {
|
|
||||||
FILE_TYPE_MAPPER.put(code, FileType.CODE);
|
|
||||||
}
|
|
||||||
FILE_TYPE_MAPPER.put("md", FileType.MARKDOWN);
|
|
||||||
FILE_TYPE_MAPPER.put("xml", FileType.XML);
|
|
||||||
FILE_TYPE_MAPPER.put("pdf", FileType.PDF);
|
|
||||||
FILE_TYPE_MAPPER.put("dwg", FileType.CAD);
|
|
||||||
FILE_TYPE_MAPPER.put("flv", FileType.FLV);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FileType to(String fileType){
|
private static FileType to(String fileType){
|
||||||
return FILE_TYPE_MAPPER.getOrDefault(fileType, OTHER);
|
return FILE_TYPE_MAPPER.getOrDefault(fileType,other);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查看文件类型(防止参数中存在.点号或者其他特殊字符,所以先抽取文件名,然后再获取文件类型)
|
* 查看文件类型(防止参数中存在.点号或者其他特殊字符,所以先抽取文件名,然后再获取文件类型)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ public class CompressFileReader {
|
|||||||
String parentName = getLast2FileName(fullName, archiveSeparator, archiveFileName);
|
String parentName = getLast2FileName(fullName, archiveSeparator, archiveFileName);
|
||||||
parentName = (level - 1) + "_" + parentName;
|
parentName = (level - 1) + "_" + parentName;
|
||||||
FileType type = FileType.typeFromUrl(childName);
|
FileType type = FileType.typeFromUrl(childName);
|
||||||
if (type.equals(FileType.PICTURE)) {//添加图片文件到图片列表
|
if (type.equals(FileType.picture)) {//添加图片文件到图片列表
|
||||||
imgUrls.add(baseUrl + childName);
|
imgUrls.add(baseUrl + childName);
|
||||||
}
|
}
|
||||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory, fileKey);
|
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory, fileKey);
|
||||||
@@ -121,7 +121,7 @@ public class CompressFileReader {
|
|||||||
}
|
}
|
||||||
String parentName = getLast2FileName(fullName, "\\", archiveFileName);
|
String parentName = getLast2FileName(fullName, "\\", archiveFileName);
|
||||||
FileType type = FileType.typeFromUrl(childName);
|
FileType type = FileType.typeFromUrl(childName);
|
||||||
if (type.equals(FileType.PICTURE)) {//添加图片文件到图片列表
|
if (type.equals(FileType.picture)) {//添加图片文件到图片列表
|
||||||
imgUrls.add(baseUrl + childName);
|
imgUrls.add(baseUrl + childName);
|
||||||
}
|
}
|
||||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory, fileKey);
|
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory, fileKey);
|
||||||
@@ -164,7 +164,7 @@ public class CompressFileReader {
|
|||||||
String parentName = getLast2FileName(fullName, archiveSeparator, archiveFileName);
|
String parentName = getLast2FileName(fullName, archiveSeparator, archiveFileName);
|
||||||
parentName = (level - 1) + "_" + parentName;
|
parentName = (level - 1) + "_" + parentName;
|
||||||
FileType type = FileType.typeFromUrl(childName);
|
FileType type = FileType.typeFromUrl(childName);
|
||||||
if (type.equals(FileType.PICTURE)) {//添加图片文件到图片列表
|
if (type.equals(FileType.picture)) {//添加图片文件到图片列表
|
||||||
imgUrls.add(baseUrl + childName);
|
imgUrls.add(baseUrl + childName);
|
||||||
}
|
}
|
||||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory, fileKey);
|
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory, fileKey);
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ public class FileConvertQueueTask {
|
|||||||
FileAttribute fileAttribute = fileHandlerService.getFileAttribute(url,null);
|
FileAttribute fileAttribute = fileHandlerService.getFileAttribute(url,null);
|
||||||
FileType fileType = fileAttribute.getType();
|
FileType fileType = fileAttribute.getType();
|
||||||
logger.info("正在处理预览转换任务,url:{},预览类型:{}", url, fileType);
|
logger.info("正在处理预览转换任务,url:{},预览类型:{}", url, fileType);
|
||||||
if(fileType.equals(FileType.COMPRESS) || fileType.equals(FileType.OFFICE) || fileType.equals(FileType.CAD)) {
|
if(fileType.equals(FileType.compress) || fileType.equals(FileType.office) || fileType.equals(FileType.cad)) {
|
||||||
FilePreview filePreview = previewFactory.get(fileAttribute);
|
FilePreview filePreview = previewFactory.get(fileAttribute);
|
||||||
filePreview.filePreviewHandle(url, new ExtendedModelMap(), fileAttribute);
|
filePreview.filePreviewHandle(url, new ExtendedModelMap(), fileAttribute);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -178,15 +178,14 @@ public class FileHandlerService {
|
|||||||
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
|
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
|
||||||
String urlPrefix;
|
String urlPrefix;
|
||||||
try {
|
try {
|
||||||
urlPrefix = baseUrl + URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20");
|
urlPrefix = baseUrl + URLEncoder.encode(URLEncoder.encode(pdfFolder, uriEncoding).replaceAll("\\+", "%20"), uriEncoding);
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
logger.error("UnsupportedEncodingException", e);
|
logger.error("UnsupportedEncodingException", e);
|
||||||
urlPrefix = baseUrl + pdfFolder;
|
urlPrefix = baseUrl + pdfFolder;
|
||||||
}
|
}
|
||||||
if (imageCount != null && imageCount > 0) {
|
if (imageCount != null && imageCount > 0) {
|
||||||
for (int i = 0; i < imageCount; i++) {
|
for (int i = 0; i < imageCount; i++)
|
||||||
imageUrls.add(urlPrefix + "/" + i + imageFileSuffix);
|
imageUrls.add(urlPrefix + "/" + i + imageFileSuffix);
|
||||||
}
|
|
||||||
return imageUrls;
|
return imageUrls;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@@ -286,27 +285,4 @@ public class FileHandlerService {
|
|||||||
}
|
}
|
||||||
return attribute;
|
return attribute;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @return 已转换过的视频文件集合(缓存)
|
|
||||||
*/
|
|
||||||
public Map<String, String> listConvertedMedias() {
|
|
||||||
return cacheService.getMediaConvertCache();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 添加转换后的视频文件缓存
|
|
||||||
* @param fileName
|
|
||||||
* @param value
|
|
||||||
*/
|
|
||||||
public void addConvertedMedias(String fileName, String value) {
|
|
||||||
cacheService.putMediaConvertCache(fileName, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return 已转换视频文件缓存,根据文件名获取
|
|
||||||
*/
|
|
||||||
public String getConvertedMedias(String key) {
|
|
||||||
return cacheService.getMediaConvertCache(key);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,8 @@ public interface FilePreview {
|
|||||||
String COMPRESS_FILE_PREVIEW_PAGE = "compress";
|
String COMPRESS_FILE_PREVIEW_PAGE = "compress";
|
||||||
String MEDIA_FILE_PREVIEW_PAGE = "media";
|
String MEDIA_FILE_PREVIEW_PAGE = "media";
|
||||||
String PICTURE_FILE_PREVIEW_PAGE = "picture";
|
String PICTURE_FILE_PREVIEW_PAGE = "picture";
|
||||||
String TIFF_FILE_PREVIEW_PAGE = "tiff";
|
|
||||||
String OFFICE_PICTURE_FILE_PREVIEW_PAGE = "officePicture";
|
String OFFICE_PICTURE_FILE_PREVIEW_PAGE = "officePicture";
|
||||||
String TXT_FILE_PREVIEW_PAGE = "txt";
|
String TXT_FILE_PREVIEW_PAGE = "txt";
|
||||||
String CODE_FILE_PREVIEW_PAGE = "code";
|
|
||||||
String EXEL_FILE_PREVIEW_PAGE = "html";
|
String EXEL_FILE_PREVIEW_PAGE = "html";
|
||||||
String XML_FILE_PREVIEW_PAGE = "xml";
|
String XML_FILE_PREVIEW_PAGE = "xml";
|
||||||
String MARKDOWN_FILE_PREVIEW_PAGE = "markdown";
|
String MARKDOWN_FILE_PREVIEW_PAGE = "markdown";
|
||||||
|
|||||||
@@ -8,8 +8,6 @@ import org.artofsolving.jodconverter.office.OfficeManager;
|
|||||||
import org.artofsolving.jodconverter.office.OfficeUtils;
|
import org.artofsolving.jodconverter.office.OfficeUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.convert.DurationStyle;
|
|
||||||
import org.springframework.core.Ordered;
|
import org.springframework.core.Ordered;
|
||||||
import org.springframework.core.annotation.Order;
|
import org.springframework.core.annotation.Order;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -21,11 +19,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.time.Duration;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
@@ -43,12 +37,6 @@ public class OfficePluginManager {
|
|||||||
|
|
||||||
private OfficeManager officeManager;
|
private OfficeManager officeManager;
|
||||||
|
|
||||||
@Value("${office.plugin.server.ports:2001,2002}")
|
|
||||||
private String serverPorts;
|
|
||||||
|
|
||||||
@Value("${office.plugin.task.timeout:5m}")
|
|
||||||
private String timeOut;
|
|
||||||
|
|
||||||
@PostConstruct
|
@PostConstruct
|
||||||
public void initOfficeManager() {
|
public void initOfficeManager() {
|
||||||
new Thread(this::startOfficeManager).start();
|
new Thread(this::startOfficeManager).start();
|
||||||
@@ -69,14 +57,9 @@ public class OfficePluginManager {
|
|||||||
try {
|
try {
|
||||||
DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
|
DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
|
||||||
configuration.setOfficeHome(officeHome);
|
configuration.setOfficeHome(officeHome);
|
||||||
String []portsString = serverPorts.split(",");
|
configuration.setPortNumber(8100);
|
||||||
|
|
||||||
int[] ports = Arrays.stream(portsString).mapToInt(Integer::parseInt).toArray();
|
|
||||||
|
|
||||||
configuration.setPortNumbers(ports);
|
|
||||||
long timeout = DurationStyle.detectAndParse(timeOut).toMillis();
|
|
||||||
// 设置任务执行超时为5分钟
|
// 设置任务执行超时为5分钟
|
||||||
configuration.setTaskExecutionTimeout(timeout);
|
configuration.setTaskExecutionTimeout(1000 * 60 * 5L);
|
||||||
// 设置任务队列超时为24小时
|
// 设置任务队列超时为24小时
|
||||||
//configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
|
//configuration.setTaskQueueTimeout(1000 * 60 * 60 * 24L);
|
||||||
officeManager = configuration.buildOfficeManager();
|
officeManager = configuration.buildOfficeManager();
|
||||||
|
|||||||
@@ -12,18 +12,15 @@ public interface CacheService {
|
|||||||
String FILE_PREVIEW_PDF_KEY = "converted-preview-pdf-file";
|
String FILE_PREVIEW_PDF_KEY = "converted-preview-pdf-file";
|
||||||
String FILE_PREVIEW_IMGS_KEY = "converted-preview-imgs-file";//压缩包内图片文件集合
|
String FILE_PREVIEW_IMGS_KEY = "converted-preview-imgs-file";//压缩包内图片文件集合
|
||||||
String FILE_PREVIEW_PDF_IMGS_KEY = "converted-preview-pdfimgs-file";
|
String FILE_PREVIEW_PDF_IMGS_KEY = "converted-preview-pdfimgs-file";
|
||||||
String FILE_PREVIEW_MEDIA_CONVERT_KEY = "converted-preview-media-file";
|
|
||||||
String TASK_QUEUE_NAME = "convert-task";
|
String TASK_QUEUE_NAME = "convert-task";
|
||||||
|
|
||||||
Integer DEFAULT_PDF_CAPACITY = 500000;
|
Integer DEFAULT_PDF_CAPACITY = 500000;
|
||||||
Integer DEFAULT_IMG_CAPACITY = 500000;
|
Integer DEFAULT_IMG_CAPACITY = 500000;
|
||||||
Integer DEFAULT_PDFIMG_CAPACITY = 500000;
|
Integer DEFAULT_PDFIMG_CAPACITY = 500000;
|
||||||
Integer DEFAULT_MEDIACONVERT_CAPACITY = 500000;
|
|
||||||
|
|
||||||
void initPDFCachePool(Integer capacity);
|
void initPDFCachePool(Integer capacity);
|
||||||
void initIMGCachePool(Integer capacity);
|
void initIMGCachePool(Integer capacity);
|
||||||
void initPdfImagesCachePool(Integer capacity);
|
void initPdfImagesCachePool(Integer capacity);
|
||||||
void initMediaConvertCachePool(Integer capacity);
|
|
||||||
void putPDFCache(String key, String value);
|
void putPDFCache(String key, String value);
|
||||||
void putImgCache(String key, List<String> value);
|
void putImgCache(String key, List<String> value);
|
||||||
Map<String, String> getPDFCache();
|
Map<String, String> getPDFCache();
|
||||||
@@ -32,9 +29,6 @@ public interface CacheService {
|
|||||||
List<String> getImgCache(String key);
|
List<String> getImgCache(String key);
|
||||||
Integer getPdfImageCache(String key);
|
Integer getPdfImageCache(String key);
|
||||||
void putPdfImageCache(String pdfFilePath, int num);
|
void putPdfImageCache(String pdfFilePath, int num);
|
||||||
Map<String, String> getMediaConvertCache();
|
|
||||||
void putMediaConvertCache(String key, String value);
|
|
||||||
String getMediaConvertCache(String key);
|
|
||||||
void cleanCache();
|
void cleanCache();
|
||||||
void addQueueTask(String url);
|
void addQueueTask(String url);
|
||||||
String takeQueueTask() throws InterruptedException;
|
String takeQueueTask() throws InterruptedException;
|
||||||
|
|||||||
@@ -26,7 +26,6 @@ public class CacheServiceJDKImpl implements CacheService {
|
|||||||
private Map<String, String> pdfCache;
|
private Map<String, String> pdfCache;
|
||||||
private Map<String, List<String>> imgCache;
|
private Map<String, List<String>> imgCache;
|
||||||
private Map<String, Integer> pdfImagesCache;
|
private Map<String, Integer> pdfImagesCache;
|
||||||
private Map<String, String> mediaConvertCache;
|
|
||||||
private static final int QUEUE_SIZE = 500000;
|
private static final int QUEUE_SIZE = 500000;
|
||||||
private final BlockingQueue<String> blockingQueue = new ArrayBlockingQueue<>(QUEUE_SIZE);
|
private final BlockingQueue<String> blockingQueue = new ArrayBlockingQueue<>(QUEUE_SIZE);
|
||||||
|
|
||||||
@@ -35,7 +34,6 @@ public class CacheServiceJDKImpl implements CacheService {
|
|||||||
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
||||||
initIMGCachePool(CacheService.DEFAULT_IMG_CAPACITY);
|
initIMGCachePool(CacheService.DEFAULT_IMG_CAPACITY);
|
||||||
initPdfImagesCachePool(CacheService.DEFAULT_PDFIMG_CAPACITY);
|
initPdfImagesCachePool(CacheService.DEFAULT_PDFIMG_CAPACITY);
|
||||||
initMediaConvertCachePool(CacheService.DEFAULT_MEDIACONVERT_CAPACITY);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -81,21 +79,6 @@ public class CacheServiceJDKImpl implements CacheService {
|
|||||||
pdfImagesCache.put(pdfFilePath, num);
|
pdfImagesCache.put(pdfFilePath, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, String> getMediaConvertCache() {
|
|
||||||
return mediaConvertCache;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putMediaConvertCache(String key, String value) {
|
|
||||||
mediaConvertCache.put(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMediaConvertCache(String key) {
|
|
||||||
return mediaConvertCache.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanCache() {
|
public void cleanCache() {
|
||||||
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
||||||
@@ -133,12 +116,4 @@ public class CacheServiceJDKImpl implements CacheService {
|
|||||||
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
|
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initMediaConvertCachePool(Integer capacity) {
|
|
||||||
mediaConvertCache = new ConcurrentLinkedHashMap.Builder<String, String>()
|
|
||||||
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -34,11 +34,6 @@ public class CacheServiceRedisImpl implements CacheService {
|
|||||||
@Override
|
@Override
|
||||||
public void initPdfImagesCachePool(Integer capacity) { }
|
public void initPdfImagesCachePool(Integer capacity) { }
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initMediaConvertCachePool(Integer capacity) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putPDFCache(String key, String value) {
|
public void putPDFCache(String key, String value) {
|
||||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_PDF_KEY);
|
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_PDF_KEY);
|
||||||
@@ -85,23 +80,6 @@ public class CacheServiceRedisImpl implements CacheService {
|
|||||||
convertedList.fastPut(pdfFilePath, num);
|
convertedList.fastPut(pdfFilePath, num);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, String> getMediaConvertCache() {
|
|
||||||
return redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putMediaConvertCache(String key, String value) {
|
|
||||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
|
|
||||||
convertedList.fastPut(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMediaConvertCache(String key) {
|
|
||||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(FILE_PREVIEW_MEDIA_CONVERT_KEY);
|
|
||||||
return convertedList.get(key);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanCache() {
|
public void cleanCache() {
|
||||||
cleanPdfCache();
|
cleanPdfCache();
|
||||||
|
|||||||
@@ -73,11 +73,6 @@ public class CacheServiceRocksDBImpl implements CacheService {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void initMediaConvertCachePool(Integer capacity) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void putPDFCache(String key, String value) {
|
public void putPDFCache(String key, String value) {
|
||||||
try {
|
try {
|
||||||
@@ -176,40 +171,6 @@ public class CacheServiceRocksDBImpl implements CacheService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public Map<String, String> getMediaConvertCache() {
|
|
||||||
Map<String, String> result = new HashMap<>();
|
|
||||||
try{
|
|
||||||
result = (Map<String, String>) toObject(db.get(FILE_PREVIEW_MEDIA_CONVERT_KEY.getBytes()));
|
|
||||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
|
||||||
LOGGER.error("Get from RocksDB Exception" + e);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void putMediaConvertCache(String key, String value) {
|
|
||||||
try {
|
|
||||||
Map<String, String> mediaConvertCacheItem = getMediaConvertCache();
|
|
||||||
mediaConvertCacheItem.put(key, value);
|
|
||||||
db.put(FILE_PREVIEW_MEDIA_CONVERT_KEY.getBytes(), toByteArray(mediaConvertCacheItem));
|
|
||||||
} catch (RocksDBException | IOException e) {
|
|
||||||
LOGGER.error("Put into RocksDB Exception" + e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getMediaConvertCache(String key) {
|
|
||||||
String result = "";
|
|
||||||
try{
|
|
||||||
Map<String, String> map = (Map<String, String>) toObject(db.get(FILE_PREVIEW_MEDIA_CONVERT_KEY.getBytes()));
|
|
||||||
result = map.get(key);
|
|
||||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
|
||||||
LOGGER.error("Get from RocksDB Exception" + e);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void cleanCache() {
|
public void cleanCache() {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public class CadFilePreviewImpl implements FilePreview {
|
|||||||
@Override
|
@Override
|
||||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||||
// 预览Type,参数传了就取参数的,没传取系统默认
|
// 预览Type,参数传了就取参数的,没传取系统默认
|
||||||
String officePreviewType = fileAttribute.getOfficePreviewType() == null ? ConfigConstants.getOfficePreviewType() : fileAttribute.getOfficePreviewType();
|
String officePreviewType = model.asMap().get("officePreviewType") == null ? ConfigConstants.getOfficePreviewType() : model.asMap().get("officePreviewType").toString();
|
||||||
String baseUrl = BaseUrlFilter.getBaseUrl();
|
String baseUrl = BaseUrlFilter.getBaseUrl();
|
||||||
String fileName = fileAttribute.getName();
|
String fileName = fileAttribute.getName();
|
||||||
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + "pdf";
|
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + "pdf";
|
||||||
|
|||||||
@@ -1,26 +0,0 @@
|
|||||||
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 2021/2/18
|
|
||||||
*/
|
|
||||||
@Component
|
|
||||||
public class CodeFilePreviewImpl implements FilePreview {
|
|
||||||
|
|
||||||
private final SimTextFilePreviewImpl filePreviewHandle;
|
|
||||||
|
|
||||||
public CodeFilePreviewImpl(SimTextFilePreviewImpl filePreviewHandle) {
|
|
||||||
this.filePreviewHandle = filePreviewHandle;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
|
||||||
filePreviewHandle.filePreviewHandle(url, model, fileAttribute);
|
|
||||||
return CODE_FILE_PREVIEW_PAGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,21 +1,13 @@
|
|||||||
package cn.keking.service.impl;
|
package cn.keking.service.impl;
|
||||||
|
|
||||||
import cn.keking.config.ConfigConstants;
|
|
||||||
import cn.keking.model.FileAttribute;
|
import cn.keking.model.FileAttribute;
|
||||||
import cn.keking.model.FileType;
|
|
||||||
import cn.keking.model.ReturnResponse;
|
import cn.keking.model.ReturnResponse;
|
||||||
import cn.keking.service.FilePreview;
|
import cn.keking.service.FilePreview;
|
||||||
import cn.keking.utils.DownloadUtils;
|
import cn.keking.utils.DownloadUtils;
|
||||||
import cn.keking.service.FileHandlerService;
|
import cn.keking.service.FileHandlerService;
|
||||||
import cn.keking.web.filter.BaseUrlFilter;
|
import cn.keking.web.filter.BaseUrlFilter;
|
||||||
import org.artofsolving.jodconverter.util.ConfigUtils;
|
|
||||||
import org.bytedeco.ffmpeg.global.avcodec;
|
|
||||||
import org.bytedeco.javacv.FFmpegFrameGrabber;
|
|
||||||
import org.bytedeco.javacv.FFmpegFrameRecorder;
|
|
||||||
import org.bytedeco.javacv.Frame;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import java.io.File;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author : kl
|
* @author : kl
|
||||||
@@ -29,8 +21,6 @@ public class MediaFilePreviewImpl implements FilePreview {
|
|||||||
private final FileHandlerService fileHandlerService;
|
private final FileHandlerService fileHandlerService;
|
||||||
private final OtherFilePreviewImpl otherFilePreview;
|
private final OtherFilePreviewImpl otherFilePreview;
|
||||||
|
|
||||||
private static Object LOCK=new Object();
|
|
||||||
|
|
||||||
public MediaFilePreviewImpl(FileHandlerService fileHandlerService, OtherFilePreviewImpl otherFilePreview) {
|
public MediaFilePreviewImpl(FileHandlerService fileHandlerService, OtherFilePreviewImpl otherFilePreview) {
|
||||||
this.fileHandlerService = fileHandlerService;
|
this.fileHandlerService = fileHandlerService;
|
||||||
this.otherFilePreview = otherFilePreview;
|
this.otherFilePreview = otherFilePreview;
|
||||||
@@ -44,123 +34,14 @@ public class MediaFilePreviewImpl implements FilePreview {
|
|||||||
if (response.isFailure()) {
|
if (response.isFailure()) {
|
||||||
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
|
return otherFilePreview.notSupportedFile(model, fileAttribute, response.getMsg());
|
||||||
} else {
|
} else {
|
||||||
url=BaseUrlFilter.getBaseUrl() + fileHandlerService.getRelativePath(response.getContent());
|
model.addAttribute("mediaUrl", BaseUrlFilter.getBaseUrl() + fileHandlerService.getRelativePath(response.getContent()));
|
||||||
fileAttribute.setUrl(url);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(checkNeedConvert(fileAttribute.getSuffix())){
|
|
||||||
url=convertUrl(fileAttribute);
|
|
||||||
} else {
|
} else {
|
||||||
//正常media类型
|
|
||||||
String[] medias = ConfigConstants.getMedia();
|
|
||||||
for(String media:medias){
|
|
||||||
if(media.equals(fileAttribute.getSuffix())){
|
|
||||||
model.addAttribute("mediaUrl", url);
|
model.addAttribute("mediaUrl", url);
|
||||||
return MEDIA_FILE_PREVIEW_PAGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return otherFilePreview.notSupportedFile(model, fileAttribute, "暂不支持");
|
|
||||||
}
|
}
|
||||||
model.addAttribute("mediaUrl", url);
|
model.addAttribute("mediaUrl", url);
|
||||||
return MEDIA_FILE_PREVIEW_PAGE;
|
return MEDIA_FILE_PREVIEW_PAGE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查视频文件处理逻辑
|
|
||||||
* 返回处理过后的url
|
|
||||||
* @return url
|
|
||||||
*/
|
|
||||||
private String convertUrl(FileAttribute fileAttribute) {
|
|
||||||
String url = fileAttribute.getUrl();
|
|
||||||
if(fileHandlerService.listConvertedMedias().containsKey(url)){
|
|
||||||
url= fileHandlerService.getConvertedMedias(url);
|
|
||||||
}else{
|
|
||||||
if(!fileHandlerService.listConvertedMedias().containsKey(url)){
|
|
||||||
synchronized(LOCK){
|
|
||||||
if(!fileHandlerService.listConvertedMedias().containsKey(url)){
|
|
||||||
String convertedUrl=convertToMp4(fileAttribute);
|
|
||||||
//加入缓存
|
|
||||||
fileHandlerService.addConvertedMedias(url,convertedUrl);
|
|
||||||
url=convertedUrl;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 检查视频文件转换是否已开启,以及当前文件是否需要转换
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private boolean checkNeedConvert(String suffix) {
|
|
||||||
//1.检查开关是否开启
|
|
||||||
if("false".equals(ConfigConstants.getMediaConvertDisable())){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
//2.检查当前文件是否需要转换
|
|
||||||
String[] mediaTypesConvert = FileType.MEDIA_TYPES_CONVERT;
|
|
||||||
String type = suffix;
|
|
||||||
for(String temp : mediaTypesConvert){
|
|
||||||
if(type.equals(temp)){
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 将浏览器不兼容视频格式转换成MP4
|
|
||||||
* @param fileAttribute
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
private static String convertToMp4(FileAttribute fileAttribute) {
|
|
||||||
|
|
||||||
//说明:这里做临时处理,取上传文件的目录
|
|
||||||
String homePath = ConfigUtils.getHomePath();
|
|
||||||
String filePath = homePath+File.separator+"file"+File.separator+"demo"+File.separator+fileAttribute.getName();
|
|
||||||
String convertFileName=fileAttribute.getUrl().replace(fileAttribute.getSuffix(),"mp4");
|
|
||||||
|
|
||||||
File file=new File(filePath);
|
|
||||||
FFmpegFrameGrabber frameGrabber = new FFmpegFrameGrabber(file);
|
|
||||||
String fileName = null;
|
|
||||||
Frame captured_frame = null;
|
|
||||||
FFmpegFrameRecorder recorder = null;
|
|
||||||
try {
|
|
||||||
fileName = file.getAbsolutePath().replace(fileAttribute.getSuffix(),"mp4");
|
|
||||||
File desFile=new File(fileName);
|
|
||||||
//判断一下防止穿透缓存
|
|
||||||
if(desFile.exists()){
|
|
||||||
return fileName;
|
|
||||||
}
|
|
||||||
|
|
||||||
frameGrabber.start();
|
|
||||||
recorder = new FFmpegFrameRecorder(fileName, frameGrabber.getImageWidth(), frameGrabber.getImageHeight(), frameGrabber.getAudioChannels());
|
|
||||||
recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264); //avcodec.AV_CODEC_ID_H264 //AV_CODEC_ID_MPEG4
|
|
||||||
recorder.setFormat("mp4");
|
|
||||||
recorder.setFrameRate(frameGrabber.getFrameRate());
|
|
||||||
//recorder.setSampleFormat(frameGrabber.getSampleFormat()); //
|
|
||||||
recorder.setSampleRate(frameGrabber.getSampleRate());
|
|
||||||
|
|
||||||
recorder.setAudioChannels(frameGrabber.getAudioChannels());
|
|
||||||
recorder.setFrameRate(frameGrabber.getFrameRate());
|
|
||||||
recorder.start();
|
|
||||||
while ((captured_frame = frameGrabber.grabFrame()) != null) {
|
|
||||||
try {
|
|
||||||
recorder.setTimestamp(frameGrabber.getTimestamp());
|
|
||||||
recorder.record(captured_frame);
|
|
||||||
} catch (Exception e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
recorder.stop();
|
|
||||||
recorder.release();
|
|
||||||
frameGrabber.stop();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
//是否删除源文件
|
|
||||||
//file.delete();
|
|
||||||
return convertFileName;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,11 +9,9 @@ import jodd.io.FileUtil;
|
|||||||
import org.apache.commons.codec.binary.Base64;
|
import org.apache.commons.codec.binary.Base64;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
import org.springframework.web.util.HtmlUtils;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by kl on 2018/1/17.
|
* Created by kl on 2018/1/17.
|
||||||
@@ -39,7 +37,6 @@ public class SimTextFilePreviewImpl implements FilePreview {
|
|||||||
File originFile = new File(response.getContent());
|
File originFile = new File(response.getContent());
|
||||||
String charset = KkFileUtils.getFileEncode(originFile);
|
String charset = KkFileUtils.getFileEncode(originFile);
|
||||||
String fileData = FileUtil.readString(originFile, charset);
|
String fileData = FileUtil.readString(originFile, charset);
|
||||||
fileData = HtmlUtils.htmlEscape(fileData, StandardCharsets.UTF_8.name());
|
|
||||||
model.addAttribute("textData", Base64.encodeBase64String(fileData.getBytes()));
|
model.addAttribute("textData", Base64.encodeBase64String(fileData.getBytes()));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
return otherFilePreview.notSupportedFile(model, fileAttribute, e.getLocalizedMessage());
|
return otherFilePreview.notSupportedFile(model, fileAttribute, e.getLocalizedMessage());
|
||||||
|
|||||||
@@ -1,38 +0,0 @@
|
|||||||
package cn.keking.service.impl;
|
|
||||||
|
|
||||||
import cn.keking.model.FileAttribute;
|
|
||||||
import cn.keking.service.FilePreview;
|
|
||||||
import cn.keking.utils.WebUtils;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import org.springframework.ui.Model;
|
|
||||||
import org.springframework.util.StringUtils;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* tiff 图片文件处理
|
|
||||||
* @author kl (http://kailing.pub)
|
|
||||||
* @since 2021/2/8
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class TiffFilePreviewImpl implements FilePreview {
|
|
||||||
|
|
||||||
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;
|
|
||||||
|
|
||||||
public TiffFilePreviewImpl(PictureFilePreviewImpl pictureFilePreview) {
|
|
||||||
this.pictureFilePreview = pictureFilePreview;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
|
||||||
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));
|
|
||||||
}
|
|
||||||
return TIFF_FILE_PREVIEW_PAGE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -4,7 +4,8 @@ import cn.keking.config.ConfigConstants;
|
|||||||
import cn.keking.model.FileAttribute;
|
import cn.keking.model.FileAttribute;
|
||||||
import cn.keking.model.ReturnResponse;
|
import cn.keking.model.ReturnResponse;
|
||||||
import io.mola.galimatias.GalimatiasParseException;
|
import io.mola.galimatias.GalimatiasParseException;
|
||||||
import org.apache.commons.io.FileUtils;
|
import jodd.io.FileUtil;
|
||||||
|
import jodd.io.NetUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
@@ -39,7 +40,7 @@ public class DownloadUtils {
|
|||||||
URL url = WebUtils.normalizedURL(urlStr);
|
URL url = WebUtils.normalizedURL(urlStr);
|
||||||
if (isHttpUrl(url)) {
|
if (isHttpUrl(url)) {
|
||||||
File realFile = new File(realPath);
|
File realFile = new File(realPath);
|
||||||
FileUtils.copyURLToFile(url,realFile);
|
NetUtil.downloadFile(url.toString(),realFile);
|
||||||
} else if (isFtpUrl(url)) {
|
} else if (isFtpUrl(url)) {
|
||||||
String ftpUsername = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_USERNAME);
|
String ftpUsername = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_USERNAME);
|
||||||
String ftpPassword = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_PASSWORD);
|
String ftpPassword = WebUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_PASSWORD);
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ public class KkFileUtils {
|
|||||||
* @return 文件后缀
|
* @return 文件后缀
|
||||||
*/
|
*/
|
||||||
public static String suffixFromFileName(String fileName) {
|
public static String suffixFromFileName(String fileName) {
|
||||||
return fileName.substring(fileName.lastIndexOf(".") + 1).toLowerCase();
|
return fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,9 +15,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import org.springframework.web.util.HtmlUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -38,10 +36,6 @@ public class FileController {
|
|||||||
// 获取文件名
|
// 获取文件名
|
||||||
String fileName = file.getOriginalFilename();
|
String fileName = file.getOriginalFilename();
|
||||||
//判断是否为IE浏览器的文件名,IE浏览器下文件名会带有盘符信息
|
//判断是否为IE浏览器的文件名,IE浏览器下文件名会带有盘符信息
|
||||||
|
|
||||||
// escaping dangerous characters to prevent XSS
|
|
||||||
fileName = HtmlUtils.htmlEscape(fileName, StandardCharsets.UTF_8.name());
|
|
||||||
|
|
||||||
// Check for Unix-style path
|
// Check for Unix-style path
|
||||||
int unixSep = fileName.lastIndexOf('/');
|
int unixSep = fileName.lastIndexOf('/');
|
||||||
// Check for Windows-style path
|
// Check for Windows-style path
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import javax.servlet.http.HttpServletRequest;
|
|||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -56,7 +55,7 @@ public class OnlinePreviewController {
|
|||||||
public String onlinePreview(String url, Model model, HttpServletRequest req) {
|
public String onlinePreview(String url, Model model, HttpServletRequest req) {
|
||||||
String fileUrl;
|
String fileUrl;
|
||||||
try {
|
try {
|
||||||
fileUrl = new String(Base64.decodeBase64(url), StandardCharsets.UTF_8);
|
fileUrl = new String(Base64.decodeBase64(url));
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "url");
|
String errorMsg = String.format(BASE64_DECODE_ERROR_MSG, "url");
|
||||||
return otherFilePreview.notSupportedFile(model, errorMsg);
|
return otherFilePreview.notSupportedFile(model, errorMsg);
|
||||||
|
|||||||
@@ -30,6 +30,8 @@ public class FilterConfiguration {
|
|||||||
Set<String> filterUri = new HashSet<>();
|
Set<String> filterUri = new HashSet<>();
|
||||||
filterUri.add("/onlinePreview");
|
filterUri.add("/onlinePreview");
|
||||||
filterUri.add("/picturesPreview");
|
filterUri.add("/picturesPreview");
|
||||||
|
filterUri.add("/getCorsFile");
|
||||||
|
filterUri.add("/addTask");
|
||||||
TrustHostFilter filter = new TrustHostFilter();
|
TrustHostFilter filter = new TrustHostFilter();
|
||||||
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
FilterRegistrationBean registrationBean = new FilterRegistrationBean();
|
||||||
registrationBean.setFilter(filter);
|
registrationBean.setFilter(filter);
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package cn.keking.web.filter;
|
|||||||
import cn.keking.config.ConfigConstants;
|
import cn.keking.config.ConfigConstants;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.core.io.ClassPathResource;
|
import org.springframework.core.io.ClassPathResource;
|
||||||
import org.springframework.util.Base64Utils;
|
|
||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
|
|
||||||
import javax.servlet.*;
|
import javax.servlet.*;
|
||||||
@@ -35,9 +34,6 @@ public class TrustHostFilter implements Filter {
|
|||||||
@Override
|
@Override
|
||||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||||
String url = getSourceUrl(request);
|
String url = getSourceUrl(request);
|
||||||
if(url != null){
|
|
||||||
url = new String(Base64Utils.decodeFromString(url), StandardCharsets.UTF_8);
|
|
||||||
}
|
|
||||||
String host = getHost(url);
|
String host = getHost(url);
|
||||||
if (host != null &&!ConfigConstants.getTrustHostSet().isEmpty() && !ConfigConstants.getTrustHostSet().contains(host)) {
|
if (host != null &&!ConfigConstants.getTrustHostSet().isEmpty() && !ConfigConstants.getTrustHostSet().contains(host)) {
|
||||||
String html = this.notTrustHost.replace("${current_host}", host);
|
String html = this.notTrustHost.replace("${current_host}", host);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user