mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 12:23:03 +00:00
lz目录解析预览
This commit is contained in:
@@ -5,6 +5,7 @@ import cn.qaiu.entity.FileInfo;
|
||||
import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.lz.common.cache.CacheManager;
|
||||
import cn.qaiu.lz.common.util.URLParamUtil;
|
||||
import cn.qaiu.lz.web.model.CacheLinkInfo;
|
||||
import cn.qaiu.lz.web.model.LinkInfoResp;
|
||||
import cn.qaiu.lz.web.model.StatisticsInfo;
|
||||
import cn.qaiu.lz.web.model.SysUser;
|
||||
@@ -15,6 +16,7 @@ import cn.qaiu.parser.ParserCreate;
|
||||
import cn.qaiu.vx.core.annotaions.RouteHandler;
|
||||
import cn.qaiu.vx.core.annotaions.RouteMapping;
|
||||
import cn.qaiu.vx.core.enums.RouteMethod;
|
||||
import cn.qaiu.vx.core.model.JsonResult;
|
||||
import cn.qaiu.vx.core.util.AsyncServiceUtil;
|
||||
import cn.qaiu.vx.core.util.ResponseUtil;
|
||||
import cn.qaiu.vx.core.util.SharedDataUtil;
|
||||
@@ -142,6 +144,39 @@ public class ParserApi {
|
||||
return promise.future();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 预览媒体文件
|
||||
*/
|
||||
@RouteMapping(value = "/view/:type/:key", method = RouteMethod.GET, order = 2)
|
||||
public void view(HttpServerRequest request, HttpServerResponse response, String type, String key) {
|
||||
String previewURL = SharedDataUtil.getJsonStringForServerConfig("previewURL");
|
||||
new ServerApi().parseKeyJson(request, type, key).onSuccess(res -> {
|
||||
redirect(response, previewURL, res);
|
||||
}).onFailure(e -> {
|
||||
ResponseUtil.fireJsonResultResponse(response, JsonResult.error(e.toString()));
|
||||
});
|
||||
}
|
||||
|
||||
private static void redirect(HttpServerResponse response, String previewURL, CacheLinkInfo res) {
|
||||
String directLink = res.getDirectLink();
|
||||
ResponseUtil.redirect(response, previewURL + URLEncoder.encode(directLink, StandardCharsets.UTF_8));
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览媒体文件
|
||||
*/
|
||||
@RouteMapping(value = "/preview", method = RouteMethod.GET, order = 9)
|
||||
public void viewURL(HttpServerRequest request, HttpServerResponse response, String pwd) {
|
||||
String previewURL = SharedDataUtil.getJsonStringForServerConfig("previewURL");
|
||||
new ServerApi().parseJson(request, pwd).onSuccess(res -> {
|
||||
redirect(response, previewURL, res);
|
||||
}).onFailure(e -> {
|
||||
ResponseUtil.fireJsonResultResponse(response, JsonResult.error(e.toString()));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@RouteMapping("/viewUrl/:type/:param")
|
||||
public Future<Void> viewUrl(HttpServerResponse response, String type, String param) {
|
||||
Promise<Void> promise = Promise.promise();
|
||||
|
||||
Reference in New Issue
Block a user