Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8798d344b6 | |||
| 63e62ab57b | |||
| 9a027674ac | |||
| e4407467dd | |||
| 551eeb0390 | |||
| 11d6ad1ed3 | |||
| e57db6925c | |||
| 87096364d8 | |||
| ad8027a7d0 |
@ -27,5 +27,5 @@ RUN yum install -y kde-l10n-Chinese &&\
|
||||
mkfontdir &&\
|
||||
fc-cache -fv
|
||||
ENV LC_ALL zh_CN.UTF-8
|
||||
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-2.1.0/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"]
|
||||
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.2/conf/application.properties","-jar","/opt/kkFileView-2.1.2/bin/kkFileView-2.1.2.jar"]
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>kkFileView</artifactId>
|
||||
<version>2.1.0</version>
|
||||
<version>2.1.2</version>
|
||||
|
||||
|
||||
<properties>
|
||||
|
||||
@ -4,4 +4,4 @@ cd "%KKFILEVIEW_BIN_FOLDER%"
|
||||
echo Using KKFILEVIEW_BIN_FOLDER %KKFILEVIEW_BIN_FOLDER%
|
||||
echo Starting kkFileView...
|
||||
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
|
||||
@ -27,4 +27,4 @@ else
|
||||
fi
|
||||
echo "Starting kkFileView..."
|
||||
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 &
|
||||
|
||||
@ -123,30 +123,35 @@ public class DownloadUtils {
|
||||
* 对最有一个路径进行转码
|
||||
* @param urlAddress
|
||||
* http://192.168.2.111:8013/demo/Handle中文.zip
|
||||
* http://192.168.2.111:8013/download?id=1&filename=中文.zip
|
||||
* @return
|
||||
*/
|
||||
private String encodeUrlParam(String urlAddress) {
|
||||
String newUrl = "";
|
||||
try {
|
||||
String path = "";
|
||||
String param = "";
|
||||
if (urlAddress.contains("?")) {
|
||||
path = urlAddress.substring(0, urlAddress.indexOf("?"));
|
||||
param = urlAddress.substring(urlAddress.indexOf("?"));
|
||||
}else {
|
||||
path = urlAddress;
|
||||
|
||||
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 {
|
||||
//指定需要的编码类型
|
||||
b = String.valueOf(c).getBytes("utf-8");
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex);
|
||||
b = new byte[0];
|
||||
}
|
||||
for (int j = 0; j < b.length; j++) {
|
||||
int k = b[j];
|
||||
if (k < 0) {
|
||||
k += 256;
|
||||
}
|
||||
sb.append("%" + Integer.toHexString(k).toUpperCase());
|
||||
}
|
||||
}
|
||||
String lastPath = path.substring(path.lastIndexOf("/") + 1);
|
||||
String leftPath = path.substring(0, path.lastIndexOf("/") + 1);
|
||||
String encodeLastPath = URLEncoder.encode(lastPath, "UTF-8");
|
||||
newUrl += leftPath + encodeLastPath;
|
||||
if (urlAddress.contains("?")) {
|
||||
newUrl += param;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return newUrl;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -37,7 +37,19 @@ public class FileController {
|
||||
@RequestMapping(value = "fileUpload", method = RequestMethod.POST)
|
||||
public String fileUpload(@RequestParam("file") MultipartFile file,
|
||||
HttpServletRequest request) throws JsonProcessingException {
|
||||
// 获取文件名
|
||||
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)) {
|
||||
return new ObjectMapper().writeValueAsString(new ReturnResponse<String>(1, "每一种类型只可以上传一个文件,请先删除原有文件再次上传", null));
|
||||
|
||||
@ -1,41 +1,65 @@
|
||||
function isInSight(el) {
|
||||
const bound = el.getBoundingClientRect();
|
||||
const clientHeight = window.innerHeight;
|
||||
//只考虑向下滚动加载
|
||||
//const clientWidth=window.innerWeight;
|
||||
return bound.top <= clientHeight + 100;
|
||||
var bound = el.getBoundingClientRect();
|
||||
var clientHeight = window.innerHeight;
|
||||
//只考虑向下滚动加载
|
||||
//const clientWidth=window.innerWeight;
|
||||
return bound.top <= clientHeight + 100;
|
||||
}
|
||||
|
||||
let index = 0;
|
||||
var index = 0;
|
||||
|
||||
function checkImgs() {
|
||||
const imgs = document.querySelectorAll('.my-photo');
|
||||
for (let i = index; i < imgs.length; i++) {
|
||||
if (isInSight(imgs[i])) {
|
||||
loadImg(imgs[i]);
|
||||
index = i;
|
||||
var imgs = document.querySelectorAll('.my-photo');
|
||||
for (var i = index; i < imgs.length; i++) {
|
||||
if (isInSight(imgs[i])) {
|
||||
loadImg(imgs[i]);
|
||||
index = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function loadImg(el) {
|
||||
const source = el.dataset.src;
|
||||
el.src = source;
|
||||
var source = el.getAttribute("data-src");
|
||||
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) {
|
||||
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;
|
||||
setTimeout(refresh(fn, remaining, context, args, previous, now));
|
||||
}
|
||||
}
|
||||
|
||||
function throttle(fn, mustRun = 500) {
|
||||
const timer = null;
|
||||
let previous = null;
|
||||
return function() {
|
||||
const now = new Date();
|
||||
const context = this;
|
||||
const args = arguments;
|
||||
if (!previous) {
|
||||
previous = now;
|
||||
function refresh(fn, remaining, context, args, previous, now) {
|
||||
if (remaining >= 500) {
|
||||
fn.apply(context, args);
|
||||
previous = now;
|
||||
}
|
||||
const remaining = now - previous;
|
||||
if (mustRun && remaining >= mustRun) {
|
||||
fn.apply(context, args);
|
||||
previous = now;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -27,17 +27,9 @@ See https://github.com/adobe-type-tools/cmap-resources
|
||||
<meta name="google" content="notranslate">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<title>PDF.js viewer</title>
|
||||
|
||||
|
||||
<link rel="stylesheet" href="viewer.css">
|
||||
|
||||
|
||||
<!-- 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>
|
||||
<link rel="resource" type="application/l10n" href="locale/locale.properties">
|
||||
<script src="../build/pdf.js"></script>
|
||||
<script src="viewer.js"></script>
|
||||
|
||||
</head>
|
||||
|
||||
@ -1897,7 +1897,7 @@ var validateFileURL = void 0;
|
||||
}
|
||||
var fileOrigin = new URL(file, window.location.href).origin;
|
||||
if (fileOrigin !== viewerOrigin) {
|
||||
return '/getCorsFile?urlPath=' + file;
|
||||
return '/getCorsFile?urlPath=' + encodeURIComponent(file);
|
||||
}
|
||||
} catch (ex) {
|
||||
var message = ex && ex.message;
|
||||
|
||||
@ -29,22 +29,15 @@
|
||||
如果你的项目需要接入文件预览项目,达到对docx、excel、ppt、jpg等文件的预览效果,那么通过在你的项目中加入下面的代码就可以
|
||||
成功实现:
|
||||
<pre style="background-color: #2f332a;color: #cccccc">
|
||||
$scope.openWin = function (fileUrl) {
|
||||
var url = configuration.previewUrl + 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");
|
||||
};
|
||||
var url = 'http://127.0.0.1:8080/file/test.txt'; //要预览文件的访问地址
|
||||
window.open('http://127.0.0.1:8012/onlinePreview?url='+encodeURIComponent(url));
|
||||
</pre>
|
||||
</div>
|
||||
<div>
|
||||
新增多图片同时预览功能,接口如下:
|
||||
<pre style="background-color: #2f332a;color: #cccccc">
|
||||
var fileUrl =url1+"|"+"url2";//多文件使用“|”字符隔开
|
||||
var url = "http://localhost: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");
|
||||
var fileUrl =url1+"|"+"url2";//多文件使用“|”字符隔开
|
||||
window.open('http://127.0.0.1:8012/picturesPreview?urls='+encodeURIComponent(fileUrl));
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
@ -86,8 +79,23 @@
|
||||
<div id="collapseThree" class="panel-collapse collapse in">
|
||||
<div class="panel-body">
|
||||
<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>
|
||||
1.首页新增社会化评论框<br><br>
|
||||
1.首页新增社会化评论框<br><br>
|
||||
|
||||
2018年01月12日 :<br>
|
||||
1.新增多图片同时预览<br>
|
||||
@ -100,7 +108,7 @@
|
||||
4.引入pdf.js预览doc等文件,支持doc标题生成pdf预览菜单,支持手机端预览<br><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>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user