支持在线浏览图片, 文本, 视频, 使用 HistoryAPI 页面不刷新优化用户体验.

This commit is contained in:
zhaojun1998
2019-08-22 23:33:02 +08:00
parent a5120effcc
commit 476de0aef4
21 changed files with 12045 additions and 5461 deletions

View File

@@ -1,5 +1,6 @@
package im.zhaojun.local.service;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.URLUtil;
import im.zhaojun.common.enums.FileTypeEnum;
import im.zhaojun.common.enums.StorageTypeEnum;
@@ -46,7 +47,7 @@ public class LocalService implements FileService {
public List<FileItem> fileList(String path) throws Exception {
List<FileItem> fileItemList = new ArrayList<>();
String fullPath = StringUtils.concatDomainAndPath(filePath, path);
String fullPath = StringUtils.concatPath(filePath, path);
File file = new File(fullPath);
File[] files = file.listFiles();
@@ -77,7 +78,7 @@ public class LocalService implements FileService {
int port = request.getServerPort();
// 项目发布名称
String webApp = request.getContextPath();
return StringUtils.concatDomainAndPath(networkProtocol + "://" + host + ":" + port + webApp, "local-download?fileName=" + path);
return StringUtils.concatPath(networkProtocol + "://" + host + ":" + port + webApp, "local-download?fileName=" + path);
}
@Override
@@ -89,6 +90,11 @@ public class LocalService implements FileService {
return new ImageInfo(sourceImg.getWidth(), sourceImg.getHeight());
}
@Override
public String getTextContent(String path) throws Exception {
return FileUtil.readUtf8String(StringUtils.concatPath(filePath, URLUtil.decode(path)));
}
public String getFilePath() {
return filePath;
}