mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-11-04 12:50:10 +00:00
feat: 新增客户端协议生成系统,支持8种主流下载工具
🚀 核心功能 - 新增完整的客户端下载链接生成器系统 - 支持ARIA2、Motrix、比特彗星、迅雷、wget、cURL、IDM、FDM、PowerShell等8种客户端 - 自动处理防盗链参数(User-Agent、Referer、Cookie等) - 提供可扩展的生成器架构,支持自定义客户端 🔧 技术实现 - ClientLinkGeneratorFactory: 工厂模式管理生成器 - DownloadLinkMeta: 元数据存储下载信息 - ClientLinkUtils: 便捷工具类 - 线程安全的ConcurrentHashMap设计 🌐 前端集成 - 新增ClientLinks.vue界面,支持客户端链接展示 - Element Plus图标系统,混合图标显示 - 客户端检测逻辑优化,避免自动打开外部应用 - 移动端和PC端环境判断 📚 文档完善 - 完整的CLIENT_LINK_GENERATOR_GUIDE.md使用指南 - API文档和测试用例 - 输出示例和最佳实践 从单纯的网盘解析工具升级为完整的下载解决方案生态
This commit is contained in:
@@ -5,6 +5,7 @@ import cn.qaiu.entity.ShareLinkInfo;
|
||||
import cn.qaiu.util.HttpResponseHelper;
|
||||
import io.vertx.core.Future;
|
||||
import io.vertx.core.Handler;
|
||||
import io.vertx.core.MultiMap;
|
||||
import io.vertx.core.Promise;
|
||||
import io.vertx.core.buffer.Buffer;
|
||||
import io.vertx.core.json.JsonObject;
|
||||
@@ -21,7 +22,9 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.zip.GZIPInputStream;
|
||||
|
||||
/**
|
||||
@@ -225,9 +228,39 @@ public abstract class PanBase implements IPanTool {
|
||||
}
|
||||
|
||||
protected void complete(String url) {
|
||||
// 自动将直链存储到 otherParam 中,以便客户端链接生成器使用
|
||||
shareLinkInfo.getOtherParam().put("downloadUrl", url);
|
||||
promise.complete(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成解析并存储下载元数据
|
||||
*
|
||||
* @param url 下载直链
|
||||
* @param headers 请求头Map
|
||||
*/
|
||||
protected void completeWithMeta(String url, Map<String, String> headers) {
|
||||
shareLinkInfo.getOtherParam().put("downloadUrl", url);
|
||||
if (headers != null && !headers.isEmpty()) {
|
||||
shareLinkInfo.getOtherParam().put("downloadHeaders", headers);
|
||||
}
|
||||
promise.complete(url);
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成解析并存储下载元数据(MultiMap版本)
|
||||
*
|
||||
* @param url 下载直链
|
||||
* @param headers MultiMap格式的请求头
|
||||
*/
|
||||
protected void completeWithMeta(String url, MultiMap headers) {
|
||||
Map<String, String> headerMap = new HashMap<>();
|
||||
if (headers != null) {
|
||||
headers.forEach(entry -> headerMap.put(entry.getKey(), entry.getValue()));
|
||||
}
|
||||
completeWithMeta(url, headerMap);
|
||||
}
|
||||
|
||||
protected Future<String> future() {
|
||||
return promise.future();
|
||||
}
|
||||
@@ -279,4 +312,9 @@ public abstract class PanBase implements IPanTool {
|
||||
protected String getDomainName(){
|
||||
return shareLinkInfo.getOtherParam().getOrDefault("domainName", "").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ShareLinkInfo getShareLinkInfo() {
|
||||
return shareLinkInfo;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user