mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2025-12-15 11:53:02 +00:00
1. 默认缓存时间修改
2. 文件夹解析异常处理 3. 首页优化
This commit is contained in:
@@ -1,22 +0,0 @@
|
||||
@echo off
|
||||
setlocal
|
||||
|
||||
rem 获取当前 Java 版本信息并搜索是否包含 "17."
|
||||
java -version 2>&1 | find "17." >nul
|
||||
|
||||
rem 如果找不到 JDK 17.x,则下载并安装
|
||||
if errorlevel 1 (
|
||||
echo JDK 17.x not found. Downloading and installing...
|
||||
|
||||
REM 这里添加下载和安装 JDK 的代码
|
||||
|
||||
rem 验证安装
|
||||
java -version
|
||||
|
||||
echo JDK 17.x installation complete.
|
||||
) else (
|
||||
echo JDK 17.x is already installed.
|
||||
)
|
||||
|
||||
endlocal
|
||||
pause
|
||||
@@ -149,7 +149,7 @@ public class FjTool extends PanBase {
|
||||
.setTemplateParam("ts", tsEncode2)
|
||||
.setTemplateParam("auth", auth)
|
||||
.setTemplateParam("dataKey", shareId);
|
||||
System.out.println(httpRequest.toString());
|
||||
// System.out.println(httpRequest.toString());
|
||||
httpRequest.send().onSuccess(res2 -> {
|
||||
MultiMap headers = res2.headers();
|
||||
if (!headers.contains("Location")) {
|
||||
@@ -179,7 +179,11 @@ public class FjTool extends PanBase {
|
||||
return promise.future();
|
||||
}
|
||||
parse().onSuccess(id -> {
|
||||
parserDir(id, shareId, promise);
|
||||
if (id != null && id.matches("^[a-zA-Z0-9]+$")) {
|
||||
parserDir(id, shareId, promise);
|
||||
} else {
|
||||
promise.fail("解析目录ID失败");
|
||||
}
|
||||
}).onFailure(failRes -> {
|
||||
log.error("解析目录失败: {}", failRes.getMessage());
|
||||
promise.fail(failRes);
|
||||
@@ -198,8 +202,14 @@ public class FjTool extends PanBase {
|
||||
.setTemplateParam("ts", tsEncode)
|
||||
.setTemplateParam("folderId", id)
|
||||
.send().onSuccess(res -> {
|
||||
JsonObject jsonObject = asJson(res);
|
||||
System.out.println(jsonObject.encodePrettily());
|
||||
JsonObject jsonObject;
|
||||
try {
|
||||
jsonObject = asJson(res);
|
||||
} catch (Exception e) {
|
||||
promise.fail(FIRST_REQUEST_URL + " 解析JSON失败: " + res.bodyAsString());
|
||||
return;
|
||||
}
|
||||
// System.out.println(jsonObject.encodePrettily());
|
||||
JsonArray list = jsonObject.getJsonArray("list");
|
||||
ArrayList<FileInfo> result = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
@@ -269,7 +279,10 @@ public class FjTool extends PanBase {
|
||||
result.add(fileInfo);
|
||||
});
|
||||
promise.complete(result);
|
||||
});
|
||||
}).onFailure(failRes -> {
|
||||
log.error("解析目录请求失败: {}", failRes.getMessage());
|
||||
promise.fail(failRes);
|
||||
});;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -158,7 +158,11 @@ public class IzTool extends PanBase {
|
||||
return promise.future();
|
||||
}
|
||||
parse().onSuccess(id -> {
|
||||
parserDir(id, shareId, promise);
|
||||
if (id != null && id.matches("^[a-zA-Z0-9]+$")) {
|
||||
parserDir(id, shareId, promise);
|
||||
} else {
|
||||
promise.fail("解析目录ID失败");
|
||||
}
|
||||
}).onFailure(failRes -> {
|
||||
log.error("解析目录失败: {}", failRes.getMessage());
|
||||
promise.fail(failRes);
|
||||
@@ -177,8 +181,14 @@ public class IzTool extends PanBase {
|
||||
.setTemplateParam("ts", tsEncode)
|
||||
.setTemplateParam("folderId", id)
|
||||
.send().onSuccess(res -> {
|
||||
JsonObject jsonObject = asJson(res);
|
||||
System.out.println(jsonObject.encodePrettily());
|
||||
JsonObject jsonObject;
|
||||
try {
|
||||
jsonObject = asJson(res);
|
||||
} catch (Exception e) {
|
||||
promise.fail(FIRST_REQUEST_URL + " 解析JSON失败: " + res.bodyAsString());
|
||||
return;
|
||||
}
|
||||
// System.out.println(jsonObject.encodePrettily());
|
||||
JsonArray list = jsonObject.getJsonArray("list");
|
||||
ArrayList<FileInfo> result = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
@@ -244,6 +254,9 @@ public class IzTool extends PanBase {
|
||||
result.add(fileInfo);
|
||||
});
|
||||
promise.complete(result);
|
||||
}).onFailure(failRes -> {
|
||||
log.error("解析目录请求失败: {}", failRes.getMessage());
|
||||
promise.fail(failRes);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</div>
|
||||
<!-- 项目简介移到卡片内 -->
|
||||
<div class="project-intro">
|
||||
<div class="intro-title">NFD网盘直链解析0.1.9_bate6</div>
|
||||
<div class="intro-title">NFD网盘直链解析0.1.9_bate7</div>
|
||||
<div class="intro-desc">
|
||||
<div>支持网盘:蓝奏云、蓝奏云优享、小飞机盘、123云盘、奶牛快传、移动云空间、亿方云、文叔叔、QQ邮箱文件中转站等</div>
|
||||
<div>文件夹解析支持:蓝奏云、蓝奏云优享、小飞机盘、123云盘</div>
|
||||
@@ -161,6 +161,9 @@
|
||||
<el-descriptions-item label="302下载链接">
|
||||
<el-link target="_blank" :href="statisticsData.downLink">{{ statisticsData.downLink }}</el-link>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="302预览链接">
|
||||
<el-link target="_blank" :href="statisticsData.viewLink">{{ statisticsData.viewLink }}</el-link>
|
||||
</el-descriptions-item>
|
||||
<el-descriptions-item label="解析次数">{{ statisticsData.parserTotal }}</el-descriptions-item>
|
||||
<el-descriptions-item label="缓存命中次数">{{ statisticsData.cacheHitTotal }}</el-descriptions-item>
|
||||
<el-descriptions-item label="总请求次数">{{ statisticsData.sumTotal }}</el-descriptions-item>
|
||||
@@ -187,13 +190,19 @@
|
||||
</el-card>
|
||||
</el-row>
|
||||
<!-- 文件解析结果区下方加分享按钮 -->
|
||||
<div v-if="parseResult.code && downloadUrl" style="margin-top: 10px; text-align: right;">
|
||||
<el-button type="primary" @click="copyShowFileLink">分享文件直链</el-button>
|
||||
</div>
|
||||
<!-- <div v-if="parseResult.code && downloadUrl" style="margin-top: 10px; text-align: right;">-->
|
||||
<!-- <el-button type="primary" @click="copyShowFileLink">分享文件直链</el-button>-->
|
||||
<!-- </div>-->
|
||||
<!-- 目录解析结果区下方加分享按钮 -->
|
||||
<div v-if="showDirectoryTree && directoryData.length" style="margin-top: 10px; text-align: right;">
|
||||
<el-button type="primary" @click="copyShowListLink">分享目录直链</el-button>
|
||||
</div>
|
||||
<!-- <div v-if="showDirectoryTree && directoryData.length" style="margin-top: 10px; text-align: right;">-->
|
||||
<!-- <el-input :value="showListLink" readonly style="width: 350px; margin-right: 10px;">-->
|
||||
<!-- <template #append>-->
|
||||
<!-- <el-button v-clipboard:copy="showListLink" v-clipboard:success="onCopy" v-clipboard:error="onError">-->
|
||||
<!-- <el-icon><CopyDocument /></el-icon>复制分享链接-->
|
||||
<!-- </el-button>-->
|
||||
<!-- </template>-->
|
||||
<!-- </el-input>-->
|
||||
<!-- </div>-->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -246,7 +255,8 @@ export default {
|
||||
directoryViewMode: 'pane', // 新增,目录树展示模式
|
||||
hasClipboardSuccessTip: false, // 新增,聚焦期间只提示一次
|
||||
showRiskDialog: false,
|
||||
baseUrl: location.origin
|
||||
baseUrl: location.origin,
|
||||
showListLink: '',
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
@@ -334,7 +344,9 @@ export default {
|
||||
const directoryResult = await this.callAPI('/v2/getFileList', params)
|
||||
this.directoryData = directoryResult.data || []
|
||||
this.showDirectoryTree = true
|
||||
|
||||
// 自动赋值分享链接
|
||||
this.showListLink = `${this.baseUrl}/showList?url=${encodeURIComponent(this.link)}`
|
||||
|
||||
this.$message.success(`目录解析成功!共找到 ${this.directoryData.length} 个文件/文件夹`)
|
||||
} catch (error) {
|
||||
console.error('目录解析失败:', error)
|
||||
|
||||
@@ -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