Compare commits

...

9 Commits

Author SHA1 Message Date
陈精华
8798d344b6 2.1.2版 2019-07-30 16:31:53 +08:00
陈精华
63e62ab57b pdf.js使用里面一个bug 2019-07-30 16:31:53 +08:00
陈精华
9a027674ac 演示首页兼容IE 2019-07-30 16:31:53 +08:00
1045485954@qq.com
e4407467dd IE兼容性问题,目前已兼容到IE9 2019-07-17 09:03:32 +08:00
陈精华
551eeb0390 2.1.1版 2019-07-09 10:46:21 +08:00
陈精华
11d6ad1ed3 修复文件下载流URL参数中包含中文URL编码不正确导致HTTP-400异常 2019-07-09 10:46:21 +08:00
陈精华
e57db6925c 修复config.js 404问题 2019-07-09 10:46:21 +08:00
陈精华
87096364d8 首页示例修改、首页更新记录 2019-07-09 10:46:21 +08:00
陈精华
ad8027a7d0 2.1.1迭代 2019-07-09 10:46:21 +08:00
11 changed files with 120 additions and 79 deletions

View File

@@ -27,5 +27,5 @@ RUN yum install -y kde-l10n-Chinese &&\
mkfontdir &&\ mkfontdir &&\
fc-cache -fv fc-cache -fv
ENV LC_ALL zh_CN.UTF-8 ENV LC_ALL zh_CN.UTF-8
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-2.1.0/bin ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-2.1.2/bin
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-2.1.0/conf/application.properties","-jar","/opt/kkFileView-2.1.0/bin/kkFileView-2.1.0.jar"] ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-2.1.2/conf/application.properties","-jar","/opt/kkFileView-2.1.2/bin/kkFileView-2.1.2.jar"]

View File

@@ -12,7 +12,7 @@
<groupId>cn.keking</groupId> <groupId>cn.keking</groupId>
<artifactId>kkFileView</artifactId> <artifactId>kkFileView</artifactId>
<version>2.1.0</version> <version>2.1.2</version>
<properties> <properties>

View File

@@ -4,4 +4,4 @@ cd "%KKFILEVIEW_BIN_FOLDER%"
echo Using KKFILEVIEW_BIN_FOLDER %KKFILEVIEW_BIN_FOLDER% echo Using KKFILEVIEW_BIN_FOLDER %KKFILEVIEW_BIN_FOLDER%
echo Starting kkFileView... echo Starting kkFileView...
echo Please check log file for more information echo Please check log file for more information
java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\conf\application.properties -jar kkFileView-2.1.0.jar -> ..\log\kkFileView.log java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\conf\application.properties -jar kkFileView-2.1.2.jar -> ..\log\kkFileView.log

View File

@@ -27,4 +27,4 @@ else
fi fi
echo "Starting kkFileView..." echo "Starting kkFileView..."
echo "Please check log file for more information" echo "Please check log file for more information"
nohup java -Dfile.encoding=UTF-8 -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=../conf/application.properties -jar kkFileView-2.1.0.jar > ../log/kkFileView.log 2>&1 & nohup java -Dfile.encoding=UTF-8 -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=../conf/application.properties -jar kkFileView-2.1.2.jar > ../log/kkFileView.log 2>&1 &

View File

@@ -123,30 +123,35 @@ public class DownloadUtils {
* 对最有一个路径进行转码 * 对最有一个路径进行转码
* @param urlAddress * @param urlAddress
* http://192.168.2.111:8013/demo/Handle中文.zip * http://192.168.2.111:8013/demo/Handle中文.zip
* http://192.168.2.111:8013/download?id=1&filename=中文.zip
* @return * @return
*/ */
private String encodeUrlParam(String urlAddress) {
String newUrl = ""; private String encodeUrlParam(String urlAddress){
StringBuffer sb = new StringBuffer();
for (int i = 0; i < urlAddress.length(); i++) {
char c = urlAddress.charAt(i);
if (c >= 0 && c <= 255) {
sb.append(c);
} else {
byte[] b;
try { try {
String path = ""; //指定需要的编码类型
String param = ""; b = String.valueOf(c).getBytes("utf-8");
if (urlAddress.contains("?")) { } catch (Exception ex) {
path = urlAddress.substring(0, urlAddress.indexOf("?")); System.out.println(ex);
param = urlAddress.substring(urlAddress.indexOf("?")); b = new byte[0];
}else {
path = urlAddress;
} }
String lastPath = path.substring(path.lastIndexOf("/") + 1); for (int j = 0; j < b.length; j++) {
String leftPath = path.substring(0, path.lastIndexOf("/") + 1); int k = b[j];
String encodeLastPath = URLEncoder.encode(lastPath, "UTF-8"); if (k < 0) {
newUrl += leftPath + encodeLastPath; k += 256;
if (urlAddress.contains("?")) {
newUrl += param;
} }
} catch (UnsupportedEncodingException e) { sb.append("%" + Integer.toHexString(k).toUpperCase());
e.printStackTrace();
} }
return newUrl; }
}
return sb.toString();
} }

View File

@@ -37,7 +37,19 @@ public class FileController {
@RequestMapping(value = "fileUpload", method = RequestMethod.POST) @RequestMapping(value = "fileUpload", method = RequestMethod.POST)
public String fileUpload(@RequestParam("file") MultipartFile file, public String fileUpload(@RequestParam("file") MultipartFile file,
HttpServletRequest request) throws JsonProcessingException { HttpServletRequest request) throws JsonProcessingException {
// 获取文件名
String fileName = file.getOriginalFilename(); String fileName = file.getOriginalFilename();
//判断是否为IE浏览器的文件名IE浏览器下文件名会带有盘符信息
// Check for Unix-style path
int unixSep = fileName.lastIndexOf('/');
// Check for Windows-style path
int winSep = fileName.lastIndexOf('\\');
// Cut off at latest possible point
int pos = (winSep > unixSep ? winSep : unixSep);
if (pos != -1) {
fileName = fileName.substring(pos + 1);
}
// 判断该文件类型是否有上传过,如果上传过则提示不允许再次上传 // 判断该文件类型是否有上传过,如果上传过则提示不允许再次上传
if (existsTypeFile(fileName)) { if (existsTypeFile(fileName)) {
return new ObjectMapper().writeValueAsString(new ReturnResponse<String>(1, "每一种类型只可以上传一个文件,请先删除原有文件再次上传", null)); return new ObjectMapper().writeValueAsString(new ReturnResponse<String>(1, "每一种类型只可以上传一个文件,请先删除原有文件再次上传", null));

View File

@@ -1,15 +1,16 @@
function isInSight(el) { function isInSight(el) {
const bound = el.getBoundingClientRect(); var bound = el.getBoundingClientRect();
const clientHeight = window.innerHeight; var clientHeight = window.innerHeight;
//只考虑向下滚动加载 //只考虑向下滚动加载
//const clientWidth=window.innerWeight; //const clientWidth=window.innerWeight;
return bound.top <= clientHeight + 100; return bound.top <= clientHeight + 100;
} }
let index = 0; var index = 0;
function checkImgs() { function checkImgs() {
const imgs = document.querySelectorAll('.my-photo'); var imgs = document.querySelectorAll('.my-photo');
for (let i = index; i < imgs.length; i++) { for (var i = index; i < imgs.length; i++) {
if (isInSight(imgs[i])) { if (isInSight(imgs[i])) {
loadImg(imgs[i]); loadImg(imgs[i]);
index = i; index = i;
@@ -18,24 +19,47 @@ function checkImgs() {
} }
function loadImg(el) { function loadImg(el) {
const source = el.dataset.src; var source = el.getAttribute("data-src");
el.src = source; el.src = source;
} }
// var mustRun = 500
// function throttle(fn, mustRun) {
// var timer = null;
// var previous = null;
// return function() {
// var now = new Date();
// var context = this;
// var args = arguments;
// if (!previous) {
// previous = now;
// }
// var remaining = now - previous;
// if (mustRun && remaining >= mustRun) {
// fn.apply(context, args);
// previous = now;
// }
// }
// }
function throttle(fn, mustRun = 500) {
const timer = null; function throttle(fn) {
let previous = null; var timer = null;
return function() { var previous = null;
const now = new Date(); return function () {
const context = this; var now = new Date();
const args = arguments; var context = this;
var args = arguments;
if (!previous) { if (!previous) {
previous = now; previous = now;
} }
const remaining = now - previous; var remaining = now - previous;
if (mustRun && remaining >= mustRun) { setTimeout(refresh(fn, remaining, context, args, previous, now));
}
}
function refresh(fn, remaining, context, args, previous, now) {
if (remaining >= 500) {
fn.apply(context, args); fn.apply(context, args);
previous = now; previous = now;
} }
}
} }

View File

@@ -27,17 +27,9 @@ See https://github.com/adobe-type-tools/cmap-resources
<meta name="google" content="notranslate"> <meta name="google" content="notranslate">
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>PDF.js viewer</title> <title>PDF.js viewer</title>
<link rel="stylesheet" href="viewer.css"> <link rel="stylesheet" href="viewer.css">
<link rel="resource" type="application/l10n" href="locale/locale.properties">
<script src="../build/pdf.js"></script>
<!-- This snippet is used in production (included from viewer.html) -->
<link rel="resource" type="application/l10n" href="locale/locale.properties">
<script src="../build/pdf.js"></script>
<script src="../../config.js"></script>
<script src="viewer.js"></script> <script src="viewer.js"></script>
</head> </head>

View File

@@ -1897,7 +1897,7 @@ var validateFileURL = void 0;
} }
var fileOrigin = new URL(file, window.location.href).origin; var fileOrigin = new URL(file, window.location.href).origin;
if (fileOrigin !== viewerOrigin) { if (fileOrigin !== viewerOrigin) {
return '/getCorsFile?urlPath=' + file; return '/getCorsFile?urlPath=' + encodeURIComponent(file);
} }
} catch (ex) { } catch (ex) {
var message = ex && ex.message; var message = ex && ex.message;

View File

@@ -29,22 +29,15 @@
如果你的项目需要接入文件预览项目达到对docx、excel、ppt、jpg等文件的预览效果那么通过在你的项目中加入下面的代码就可以 如果你的项目需要接入文件预览项目达到对docx、excel、ppt、jpg等文件的预览效果那么通过在你的项目中加入下面的代码就可以
成功实现: 成功实现:
<pre style="background-color: #2f332a;color: #cccccc"> <pre style="background-color: #2f332a;color: #cccccc">
$scope.openWin = function (fileUrl) { var url = 'http://127.0.0.1:8080/file/test.txt'; //要预览文件的访问地址
var url = configuration.previewUrl + encodeURIComponent(fileUrl); window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(url));
var winHeight = window.document.documentElement.clientHeight-10;
$window.open(url, "_blank", "height=" + winHeight
+ ",top=80,left=80,toolbar=no, menubar=no, scrollbars=yes, resizable=yes");
};
</pre> </pre>
</div> </div>
<div> <div>
新增多图片同时预览功能,接口如下: 新增多图片同时预览功能,接口如下:
<pre style="background-color: #2f332a;color: #cccccc"> <pre style="background-color: #2f332a;color: #cccccc">
var fileUrl =url1+"|"+"url2";//多文件使用“|”字符隔开 var fileUrl =url1+"|"+"url2";//多文件使用“|”字符隔开
var url = "http://localhost:8012/picturesPreview?urls" + encodeURIComponent(fileUrl); window.open('http://127.0.0.1:8012/picturesPreview?urls='+encodeURIComponent(fileUrl));
var winHeight = window.document.documentElement.clientHeight-10;
$window.open(url, "_blank", "height=" + winHeight
+ ",top=80,left=80,toolbar=no, menubar=no, scrollbars=yes, resizable=yes");
</pre> </pre>
</div> </div>
</div> </div>
@@ -86,6 +79,21 @@
<div id="collapseThree" class="panel-collapse collapse in"> <div id="collapseThree" class="panel-collapse collapse in">
<div class="panel-body"> <div class="panel-body">
<div> <div>
2019年06月18日 <br>
1. 支持自动清理缓存及预览文件<br>
2. 支持http/https下载流url文件预览<br>
3. 支持FTP url文件预览<br>
4. 加入Docker构建<br><br>
2019年04月08日 <br>
1. 缓存及队列实现抽象提供JDK和REDIS两种实现(REDIS成为可选依赖)<br>
2. 打包方式提供zip和tar.gz包并提供一键启动脚本<br><br>
2018年01月19日 <br>
1. 大文件入队提前处理<br>
1. 新增addTask文件转换入队接口<br>
1. 采用redis队列支持kkFIleView接口和异构系统入队两种方式<br><br>
2018年01月15日 <br> 2018年01月15日 <br>
1.首页新增社会化评论框<br><br> 1.首页新增社会化评论框<br><br>
@@ -100,7 +108,7 @@
4.引入pdf.js预览doc等文件支持doc标题生成pdf预览菜单支持手机端预览<br><br> 4.引入pdf.js预览doc等文件支持doc标题生成pdf预览菜单支持手机端预览<br><br>
2017年12月12日<br> 2017年12月12日<br>
1.项目osc开源:<a href="https://gitee.com/kekingcn/file-online-preview" target="_blank">https://gitee.com/kekingcn/file-online-preview</a><br> 1.项目gitee开源:<a href="https://gitee.com/kekingcn/file-online-preview" target="_blank">https://gitee.com/kekingcn/file-online-preview</a><br>
2.项目github开源:<a href="https://github.com/kekingcn/kkFileView" target="_blank">https://github.com/kekingcn/kkFileView</a> 2.项目github开源:<a href="https://github.com/kekingcn/kkFileView" target="_blank">https://github.com/kekingcn/kkFileView</a>
</div> </div>
</div> </div>

View File

@@ -5,7 +5,7 @@
<groupId>cn.keking</groupId> <groupId>cn.keking</groupId>
<artifactId>filepreview</artifactId> <artifactId>filepreview</artifactId>
<version>0.0.1-SNAPSHOT</version> <version>2.1.2</version>
<modules> <modules>
<module>jodconverter-core</module> <module>jodconverter-core</module>
<module>jodconverter-web</module> <module>jodconverter-web</module>