mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-16 12:23:03 +00:00
1. 默认缓存时间修改
2. 文件夹解析异常处理 3. 首页优化
This commit is contained in:
@@ -46,6 +46,7 @@ public class ParserApi {
|
||||
}
|
||||
|
||||
private final CacheManager cacheManager = new CacheManager();
|
||||
private final ServerApi serverApi = new ServerApi();
|
||||
|
||||
@RouteMapping(value = "/linkInfo", method = RouteMethod.GET)
|
||||
public Future<LinkInfoResp> parse(HttpServerRequest request, String pwd) {
|
||||
@@ -56,6 +57,7 @@ public class ParserApi {
|
||||
LinkInfoResp build = LinkInfoResp.builder()
|
||||
.downLink(getDownLink(parserCreate, false))
|
||||
.apiLink(getDownLink(parserCreate, true))
|
||||
.viewLink(getViewLink(parserCreate))
|
||||
.shareLinkInfo(shareLinkInfo).build();
|
||||
// 解析次数统计
|
||||
shareLinkInfo.getOtherParam().put("UA",request.headers().get("user-agent"));
|
||||
@@ -83,6 +85,15 @@ public class ParserApi {
|
||||
return linkPrefix + (isJson ? "/json/" : "/d/") + create.genPathSuffix();
|
||||
}
|
||||
|
||||
private static String getViewLink(ParserCreate create) {
|
||||
|
||||
String linkPrefix = SharedDataUtil.getJsonStringForServerConfig("domainName");
|
||||
if (StringUtils.isBlank(linkPrefix)) {
|
||||
return "";
|
||||
}
|
||||
return linkPrefix + "/v2/view/" + create.genPathSuffix();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取支持的网盘列表
|
||||
* @return list-map: name: 网盘名, type: 网盘标识, url: 网盘域名地址
|
||||
@@ -151,7 +162,7 @@ public class ParserApi {
|
||||
@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 -> {
|
||||
serverApi.parseKeyJson(request, type, key).onSuccess(res -> {
|
||||
redirect(response, previewURL, res);
|
||||
}).onFailure(e -> {
|
||||
ResponseUtil.fireJsonResultResponse(response, JsonResult.error(e.toString()));
|
||||
@@ -164,7 +175,7 @@ public class ParserApi {
|
||||
}
|
||||
|
||||
/**
|
||||
* 预览媒体文件
|
||||
* 预览媒体文件-目录预览
|
||||
*/
|
||||
@RouteMapping(value = "/preview", method = RouteMethod.GET, order = 9)
|
||||
public void viewURL(HttpServerRequest request, HttpServerResponse response, String pwd) {
|
||||
|
||||
@@ -63,7 +63,7 @@ cache:
|
||||
# 该配置未使用,后续加入其他Cache实现时,区分类型
|
||||
type: h2db
|
||||
# 默认时长: 单位分钟,大部分网盘未严格验证,建议不要太大
|
||||
defaultDuration: 59
|
||||
defaultDuration: 5
|
||||
# 具体网盘的缓存配置,如果不加配置则不缓存,每次请求都会请求网盘API,格式:网盘标识: 时长
|
||||
duration:
|
||||
ce: 5
|
||||
@@ -93,7 +93,3 @@ proxy:
|
||||
# username:
|
||||
# password:
|
||||
|
||||
|
||||
# 代理池配置
|
||||
#ip-pool:
|
||||
# api-url:
|
||||
|
||||
Reference in New Issue
Block a user