支持在线浏览图片, 文本, 视频, 使用 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

@@ -46,6 +46,9 @@ public interface FileService {
return siteConfig;
}
/**
* 获取文件内容.
*/
default String getTextContent(String path) throws Exception {
return HttpUtil.get(URLDecoder.decode(getDownloadUrl(path), "utf8"));
}
@@ -68,6 +71,9 @@ public interface FileService {
@Cacheable
default ImageInfo getImageInfo(String url) throws Exception {
url = URLUtil.decode(url);
URL urlObject = new URL(url);
String originPath = urlObject.getPath();
url = url.replace(originPath, URLUtil.encode(originPath));
InputStream inputStream = new URL(url).openStream();
BufferedImage sourceImg = ImageIO.read(inputStream);
return new ImageInfo(sourceImg.getWidth(), sourceImg.getHeight());