mirror of
https://github.com/qaiu/netdisk-fast-download.git
synced 2026-10-11 09:14:25 +00:00
Compare commits
7
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ab8b687837 | ||
|
|
7616bf3144 | ||
|
|
01d7956de5 | ||
|
|
78e53c076e | ||
|
|
4d985cc96f | ||
|
|
13ccdb8adf | ||
|
|
ac1afcd35f |
@@ -18,6 +18,8 @@ QQ交流群:1017480890
|
||||

|
||||
|
||||
|
||||
> 本平台所有音乐解析工具不再维护,请移步[Sonder播放器](https://sodecode.qaiu.top)
|
||||
> 需要百度,迅雷,UC,夸克的完整支持请使用[专业版](https://189.qaiu.top)
|
||||
|
||||
## 介绍
|
||||
> netdisk-fast-download网盘直链解析可以把云盘分享链接转为直链,可广泛应用于各类下载站,资源站,个人博客,图床,APP下载更新,视频点播等领域。支持市面各大主流云盘的文件分享以及文件夹分享链接,已支持蓝奏云/蓝奏云优享/移动云云空间/小飞机盘/亿方云/123云盘/永硕E盘/Cloudreve等,支持加密分享,以及部分网盘文件夹分享。
|
||||
@@ -459,7 +461,7 @@ docker run --rm -v /var/run/docker.sock:/var/run/docker.sock containrrr/watchtow
|
||||
> 注意: netdisk-fast-download.service中的ExecStart的路径改为实际路径
|
||||
```shell
|
||||
cd ~
|
||||
wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v0.4.6/netdisk-fast-download-linux-amd64.zip
|
||||
wget -O netdisk-fast-download.zip https://github.com/qaiu/netdisk-fast-download/releases/download/v0.4.7/netdisk-fast-download-linux-amd64.zip
|
||||
unzip netdisk-fast-download.zip
|
||||
cd netdisk-fast-download
|
||||
bash service-install.sh
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.qaiu.parser.PanBase;
|
||||
import cn.qaiu.util.*;
|
||||
import io.netty.handler.codec.http.cookie.DefaultCookie;
|
||||
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;
|
||||
@@ -41,9 +42,37 @@ public class LzTool extends PanBase {
|
||||
|
||||
private final WebClientSession webClientSession;
|
||||
|
||||
/** 实测服务器出口 IP 上 wwww.lanzoux.com 可用,且个性域名目录内文件 ID 也能打开。 */
|
||||
public static final String SHARE_URL_PREFIX = "https://wwww.lanzoux.com/";
|
||||
private static final String SHARE_ORIGIN = "https://wwww.lanzoux.com";
|
||||
/**
|
||||
* 没有原始分享页主机时才使用(目录内文件 ID、shareKey 占位)。
|
||||
* 与 PanDomainTemplate.LZ 标准模板一致:{@code https://w1.lanzn.com/{shareKey}}。
|
||||
* 已有分享页不要改写到 wwww.lanzoux.com,部分出口连四个 w 的域名会超时。
|
||||
*/
|
||||
public static final String SHARE_URL_PREFIX = "https://w1.lanzn.com/";
|
||||
/** 页面 URL 解析失败时的源站兜底,与 {@link #SHARE_URL_PREFIX} 同主机。 */
|
||||
private static final String SHARE_ORIGIN = "https://w1.lanzn.com";
|
||||
/**
|
||||
* 目录 filemoreajax.php 换域顺序。个性域名上会立刻返回「已超时」。
|
||||
* wwww 只放最后,避免单一主机超时直接失败。
|
||||
* 文件 ajax 走 {@link #FILE_AJAX_FALLBACK_ORIGINS},不要把 apifile 混进目录列表。
|
||||
*/
|
||||
static final List<String> AJAX_FALLBACK_ORIGINS = List.of(
|
||||
"https://w1.lanzn.com",
|
||||
"https://www.lanzoux.com",
|
||||
"https://wwww.lanzoux.com"
|
||||
);
|
||||
/**
|
||||
* 文件页 iframe / 密码页里的 ajaxfile.php 经常是绝对地址
|
||||
* {@code https://apifile.lanzouw.com/ajaxfile.php?file=…}。
|
||||
* 相对路径打到页面源站或 w1/www 会空响应。apifile 放在文件 ajax 兜底的最前,
|
||||
* 页面源站空响应后立刻换过去,不在四 w 上耗光超时。
|
||||
*/
|
||||
static final String APIFILE_ORIGIN = "https://apifile.lanzouw.com";
|
||||
static final List<String> FILE_AJAX_FALLBACK_ORIGINS = List.of(
|
||||
APIFILE_ORIGIN,
|
||||
"https://w1.lanzn.com",
|
||||
"https://www.lanzoux.com",
|
||||
"https://wwww.lanzoux.com"
|
||||
);
|
||||
/** 分享页 / ajax 请求超时 */
|
||||
private static final long REQUEST_TIMEOUT = 8000;
|
||||
/** 下载域跳转与二次验证超时,链路更长 */
|
||||
@@ -54,6 +83,10 @@ public class LzTool extends PanBase {
|
||||
private static final Pattern P_AJAXDATA = Pattern.compile("ajaxdata\\s*=\\s*'([^']+)'");
|
||||
private static final Pattern P_WEBSIGN = Pattern.compile("'websign'\\s*:\\s*'([^']*)'");
|
||||
private static final Pattern P_WEBPAGE = Pattern.compile("[?&]webpage=([^&\"'\\s#]+)");
|
||||
/** 页面脚本里的绝对 ajax,例如 https://apifile.lanzouw.com/ajaxfile.php?file=123 */
|
||||
private static final Pattern P_AJAX_ABSOLUTE = Pattern.compile(
|
||||
"['\"]((?:https?:)?//[^'\"\\s<>]+/ajax(?:m|file)\\.php\\?file=\\d+)['\"]",
|
||||
Pattern.CASE_INSENSITIVE);
|
||||
private static final Pattern P_AJAX_PATH = Pattern.compile("(?:['\"/]|^)(ajax(?:m|file)\\.php\\?file=\\d+)");
|
||||
private static final Pattern P_SIGN = Pattern.compile("'sign'\\s*:\\s*'([^']+)'");
|
||||
private static final Pattern P_ISNGIS = Pattern.compile("var\\s+isngis\\s*=\\s*'([^']+)'");
|
||||
@@ -259,18 +292,17 @@ public class LzTool extends PanBase {
|
||||
return path.isEmpty() || "-".equals(path);
|
||||
}
|
||||
|
||||
/** 统一改写到 {@link #SHARE_URL_PREFIX},只保留分享路径。 */
|
||||
private String resolveShareUrl() {
|
||||
String u = shareLinkInfo.getShareUrl();
|
||||
/**
|
||||
* 分享页 / 目录页 GET 保留原始主机和路径。
|
||||
* 只有分享路径缺失(空链接、shareKey 占位)时才落到 {@link #SHARE_URL_PREFIX}。
|
||||
*/
|
||||
static String resolveSharePageUrl(String shareUrl, String standardUrl, String shareKey) {
|
||||
String u = shareUrl;
|
||||
if (isPlaceholderShare(u)) {
|
||||
u = shareLinkInfo.getStandardUrl();
|
||||
u = standardUrl;
|
||||
}
|
||||
if (isPlaceholderShare(u)) {
|
||||
String key = shareLinkInfo.getShareKey();
|
||||
if (key == null || key.isBlank() || "-".equals(key)) {
|
||||
return SHARE_URL_PREFIX;
|
||||
}
|
||||
return SHARE_URL_PREFIX + key;
|
||||
return canonicalShareUrl(shareKey, null);
|
||||
}
|
||||
int q = u.indexOf('?');
|
||||
String query = null;
|
||||
@@ -284,10 +316,167 @@ public class LzTool extends PanBase {
|
||||
}
|
||||
int pathStart = u.indexOf('/', schemeEnd + 3);
|
||||
if (pathStart < 0) {
|
||||
String key = shareLinkInfo.getShareKey();
|
||||
return appendWebpage(SHARE_URL_PREFIX + (key == null ? "" : key), query);
|
||||
String base = u.endsWith("/") ? u : u + "/";
|
||||
if (shareKey == null || shareKey.isBlank() || "-".equals(shareKey)) {
|
||||
return appendWebpage(base, query);
|
||||
}
|
||||
return appendWebpage(base + shareKey, query);
|
||||
}
|
||||
return appendWebpage(SHARE_ORIGIN + u.substring(pathStart), query);
|
||||
return appendWebpage(u, query);
|
||||
}
|
||||
|
||||
private String resolveShareUrl() {
|
||||
return resolveSharePageUrl(
|
||||
shareLinkInfo.getShareUrl(),
|
||||
shareLinkInfo.getStandardUrl(),
|
||||
shareLinkInfo.getShareKey());
|
||||
}
|
||||
|
||||
/** 无原始主机时用标准下载域拼分享路径,不再写死 wwww.lanzoux.com。 */
|
||||
private static String canonicalShareUrl(String shareKey, String query) {
|
||||
if (shareKey == null || shareKey.isBlank() || "-".equals(shareKey)) {
|
||||
return appendWebpage(SHARE_URL_PREFIX, query);
|
||||
}
|
||||
return appendWebpage(SHARE_URL_PREFIX + shareKey, query);
|
||||
}
|
||||
|
||||
/**
|
||||
* 目录内文件页主机:沿用已有分享主机,否则用 {@link #SHARE_URL_PREFIX}。
|
||||
*/
|
||||
static String sharePageHostBase(String shareUrl, String standardUrl) {
|
||||
String u = !isPlaceholderShare(shareUrl) ? shareUrl : standardUrl;
|
||||
if (!isPlaceholderShare(u)) {
|
||||
String origin = normalizeOrigin(originOf(u, SHARE_ORIGIN));
|
||||
return origin + "/";
|
||||
}
|
||||
return SHARE_URL_PREFIX;
|
||||
}
|
||||
|
||||
/**
|
||||
* 目录 filemore 的 POST 主机顺序:分享页源站优先(普通节点通常可用),
|
||||
* 然后是稳定下载域。wwww.lanzoux.com 固定排在最后。
|
||||
*/
|
||||
static List<String> ajaxOrigins(String pageUrl) {
|
||||
List<String> origins = new ArrayList<>();
|
||||
addAjaxOrigin(origins, normalizeOrigin(originOf(pageUrl, "")));
|
||||
for (String candidate : AJAX_FALLBACK_ORIGINS) {
|
||||
addAjaxOrigin(origins, candidate);
|
||||
}
|
||||
return origins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件 ajax 主机顺序。页面里若写出绝对 ajax URL,该主机最先尝试;
|
||||
* 否则先打页面源站。空响应后再试 {@link #APIFILE_ORIGIN},四 w 仍在最后。
|
||||
*
|
||||
* @param ajaxTarget {@link #fileAjaxTarget} 的返回值,绝对 URL 或相对路径;可为 null
|
||||
*/
|
||||
static List<String> fileAjaxOrigins(String pageUrl, String ajaxTarget) {
|
||||
List<String> origins = new ArrayList<>();
|
||||
addAjaxOrigin(origins, originFromAjaxTarget(ajaxTarget));
|
||||
addAjaxOrigin(origins, normalizeOrigin(originOf(pageUrl, "")));
|
||||
for (String candidate : FILE_AJAX_FALLBACK_ORIGINS) {
|
||||
addAjaxOrigin(origins, candidate);
|
||||
}
|
||||
return origins;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从分享页或 iframe HTML 取出文件 ajax 地址。
|
||||
* 绝对 URL(含协议相对 {@code //host/...})原样返回;否则返回以 {@code /} 开头的相对路径。
|
||||
*/
|
||||
static String fileAjaxTarget(String html) {
|
||||
if (html == null || html.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Matcher abs = P_AJAX_ABSOLUTE.matcher(html);
|
||||
if (abs.find()) {
|
||||
String url = abs.group(1);
|
||||
if (url.startsWith("//")) {
|
||||
url = "https:" + url;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
Matcher ajax = P_AJAX_PATH.matcher(html);
|
||||
if (!ajax.find()) {
|
||||
return null;
|
||||
}
|
||||
return "/" + ajax.group(1);
|
||||
}
|
||||
|
||||
private static void addAjaxOrigin(List<String> origins, String origin) {
|
||||
if (origin != null && origin.contains("://") && !origins.contains(origin)) {
|
||||
origins.add(origin);
|
||||
}
|
||||
}
|
||||
|
||||
private static String originFromAjaxTarget(String ajaxTarget) {
|
||||
if (ajaxTarget == null) {
|
||||
return "";
|
||||
}
|
||||
if (ajaxTarget.startsWith("http://") || ajaxTarget.startsWith("https://")) {
|
||||
return normalizeOrigin(originOf(ajaxTarget, ""));
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
private static String normalizeOrigin(String origin) {
|
||||
if (origin == null) {
|
||||
return "";
|
||||
}
|
||||
String o = origin.trim();
|
||||
while (o.endsWith("/")) {
|
||||
o = o.substring(0, o.length() - 1);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
/**
|
||||
* 个性域名常见 {@code inf=已超时},或响应根本不是 JSON。这类结果说明当前主机不可用,应换下一个域名。
|
||||
* 密码错误、分享失效等业务错误不换域名。
|
||||
*/
|
||||
static boolean ajaxResponseShouldFallback(String text) {
|
||||
if (text == null || text.isBlank()) {
|
||||
return true;
|
||||
}
|
||||
JsonObject json = parseLzJson(text);
|
||||
if (json == null) {
|
||||
return true;
|
||||
}
|
||||
Integer zt = jsonInt(json, "zt");
|
||||
if (zt != null && zt == 1) {
|
||||
return false;
|
||||
}
|
||||
String info = ajaxInfoText(json);
|
||||
return info != null && info.contains("超时");
|
||||
}
|
||||
|
||||
private static Integer jsonInt(JsonObject json, String key) {
|
||||
Object v = json.getValue(key);
|
||||
if (v instanceof Number n) {
|
||||
return n.intValue();
|
||||
}
|
||||
if (v instanceof CharSequence) {
|
||||
try {
|
||||
return Integer.parseInt(v.toString().trim());
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static String ajaxInfoText(JsonObject json) {
|
||||
for (String key : new String[]{"inf", "info"}) {
|
||||
Object v = json.getValue(key);
|
||||
if (v instanceof CharSequence) {
|
||||
String s = v.toString().trim();
|
||||
if (!s.isEmpty() && !"null".equalsIgnoreCase(s)) {
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/** 目录文件 ID 可能带 webpage=,必须保留;pwd 走独立字段,不拼进 URL。 */
|
||||
@@ -411,8 +600,12 @@ public class LzTool extends PanBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
/** 页面里提取出的 ajax 调用:相对路径 + 表单参数。 */
|
||||
private record AjaxCall(String path, Map<String, String> form) {
|
||||
/** 页面里提取出的 ajax 调用。absoluteUrl 非空时优先打该主机。 */
|
||||
private record AjaxCall(String path, Map<String, String> form, String absoluteUrl) {
|
||||
private AjaxCall(String path, Map<String, String> form) {
|
||||
this(path, form, null);
|
||||
}
|
||||
|
||||
MultiMap toForm() {
|
||||
MultiMap m = MultiMap.caseInsensitiveMultiMap();
|
||||
form.forEach(m::set);
|
||||
@@ -424,11 +617,12 @@ public class LzTool extends PanBase {
|
||||
if (html == null || html.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
Matcher ajax = P_AJAX_PATH.matcher(html);
|
||||
if (!ajax.find()) {
|
||||
String target = fileAjaxTarget(html);
|
||||
if (target == null) {
|
||||
return null;
|
||||
}
|
||||
String ajaxPath = ajax.group(1);
|
||||
String absolute = target.startsWith("http://") || target.startsWith("https://") ? target : null;
|
||||
String ajaxPath = absolute == null ? target : pathOfAbsolute(absolute);
|
||||
Map<String, String> data = new LinkedHashMap<>();
|
||||
data.put("action", "downprocess");
|
||||
Matcher wp = P_WP_SIGN.matcher(html);
|
||||
@@ -482,7 +676,23 @@ public class LzTool extends PanBase {
|
||||
data.put("signs", ad2.group(1));
|
||||
}
|
||||
}
|
||||
return new AjaxCall("/" + ajaxPath, data);
|
||||
return new AjaxCall(ajaxPath, data, absolute);
|
||||
}
|
||||
|
||||
private static String pathOfAbsolute(String url) {
|
||||
try {
|
||||
URL u = new URL(url);
|
||||
String path = u.getPath() == null ? "" : u.getPath();
|
||||
if (u.getQuery() != null && !u.getQuery().isEmpty()) {
|
||||
path = path + "?" + u.getQuery();
|
||||
}
|
||||
if (!path.startsWith("/")) {
|
||||
path = "/" + path;
|
||||
}
|
||||
return path;
|
||||
} catch (Exception e) {
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
private static AjaxCall extractFolderAjax(String html, String pwd) {
|
||||
@@ -576,12 +786,58 @@ public class LzTool extends PanBase {
|
||||
|
||||
private void getDownURL(String referer, AjaxCall call) {
|
||||
MultiMap headers = HeaderUtils.parseHeaders(DOWN_AJAX_HEADERS);
|
||||
// 个性域名 ajaxfile.php 会立刻 inf=已超时;POST 必须打 wwww。iframe 请求 Referer 用 iframe 地址。
|
||||
headers.set("referer", referer != null && !referer.isBlank() ? referer : resolveShareUrl());
|
||||
String url = joinUrl(SHARE_ORIGIN + "/", call.path());
|
||||
// 文件 ajax 优先用页面里的绝对地址(常见 apifile.lanzouw.com)。
|
||||
// 页面源站空响应再换 FILE_AJAX_FALLBACK_ORIGINS,wwww 仍在最后。
|
||||
// iframe / 分享页的 Referer 保持原主机,不把页面 GET 改写到 wwww。
|
||||
String page = referer != null && !referer.isBlank() ? referer : resolveShareUrl();
|
||||
headers.set("referer", page);
|
||||
String target = call.absoluteUrl() != null ? call.absoluteUrl() : call.path();
|
||||
postAjaxAt(fileAjaxOrigins(page, target), 0, call, headers, this::handleAjaxDownResponse, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 依次向 {@link #ajaxOrigins} 发 POST。连接失败或「已超时」换下一个主机;
|
||||
* wwww.lanzoux.com 只在最后尝试。业务错误(密码、失效)立即返回。
|
||||
*/
|
||||
private void postAjaxWithFallback(String pageUrl, AjaxCall call, MultiMap headers,
|
||||
Handler<String> onBody, Handler<Throwable> onFailure) {
|
||||
postAjaxAt(ajaxOrigins(pageUrl), 0, call, headers, onBody, onFailure);
|
||||
}
|
||||
|
||||
private void postAjaxAt(List<String> origins, int index, AjaxCall call, MultiMap headers,
|
||||
Handler<String> onBody, Handler<Throwable> onFailure) {
|
||||
if (index >= origins.size()) {
|
||||
String msg = "蓝奏 ajax 全部域名均失败";
|
||||
if (onFailure != null) {
|
||||
onFailure.handle(new RuntimeException(msg));
|
||||
} else {
|
||||
fail(msg);
|
||||
}
|
||||
return;
|
||||
}
|
||||
String url = joinUrl(origins.get(index) + "/", call.path());
|
||||
boolean hasNext = index + 1 < origins.size();
|
||||
postFormWithArg1Retry(url, headers, call.toForm())
|
||||
.onSuccess(this::handleAjaxDownResponse)
|
||||
.onFailure(handleFail(url));
|
||||
.onSuccess(text -> {
|
||||
if (hasNext && ajaxResponseShouldFallback(text)) {
|
||||
log.warn("蓝奏 ajax {} 不可用,改试下一域名", url);
|
||||
postAjaxAt(origins, index + 1, call, headers, onBody, onFailure);
|
||||
return;
|
||||
}
|
||||
onBody.handle(text);
|
||||
})
|
||||
.onFailure(err -> {
|
||||
if (hasNext) {
|
||||
log.warn("蓝奏 ajax {} 请求失败: {},改试下一域名", url, err.getMessage());
|
||||
postAjaxAt(origins, index + 1, call, headers, onBody, onFailure);
|
||||
return;
|
||||
}
|
||||
if (onFailure != null) {
|
||||
onFailure.handle(err);
|
||||
} else {
|
||||
handleFail(url).handle(err);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void handleAjaxDownResponse(String text) {
|
||||
@@ -913,10 +1169,9 @@ public class LzTool extends PanBase {
|
||||
}
|
||||
log.debug("解析参数: {}", call.form());
|
||||
|
||||
String url = joinUrl(originOf(sUrl, SHARE_ORIGIN) + "/", call.path());
|
||||
postFormWithArg1Retry(url, folderListHeaders(sUrl), call.toForm())
|
||||
.onSuccess(body -> handleFileListResponse(body, listPromise))
|
||||
.onFailure(listPromise::fail);
|
||||
postAjaxWithFallback(sUrl, call, folderListHeaders(sUrl),
|
||||
body -> handleFileListResponse(body, listPromise),
|
||||
listPromise::fail);
|
||||
} catch (ScriptException | NoSuchMethodException | RuntimeException e) {
|
||||
listPromise.fail(e);
|
||||
}
|
||||
@@ -1069,7 +1324,7 @@ public class LzTool extends PanBase {
|
||||
if (webpage == null || webpage.isBlank()) {
|
||||
webpage = extractWebpage(shareLinkInfo.getShareUrl(), null);
|
||||
}
|
||||
String fileUrl = SHARE_URL_PREFIX + id;
|
||||
String fileUrl = sharePageHostBase(shareLinkInfo.getShareUrl(), shareLinkInfo.getStandardUrl()) + id;
|
||||
if (webpage != null && !webpage.isBlank()) {
|
||||
fileUrl = fileUrl + "?webpage=" + webpage;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,178 @@
|
||||
package cn.qaiu.parser.impl;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
/**
|
||||
* 个性域名 a.lanzouw.com 不能被改写到 wwww.lanzoux.com(四个 w)。
|
||||
* 部分出口连不上四 w,页面请求会超时;ajax 只把四 w 当作最后兜底。
|
||||
*/
|
||||
public class LzToolShareUrlTest {
|
||||
|
||||
@Test
|
||||
public void personalDomainPageStaysOffWwww() {
|
||||
String resolved = LzTool.resolveSharePageUrl(
|
||||
"https://a.lanzouw.com/xxx",
|
||||
"https://w1.lanzn.com/xxx",
|
||||
"xxx");
|
||||
assertEquals("https://a.lanzouw.com/xxx", resolved);
|
||||
assertFalse(resolved.contains("wwww.lanzoux.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void folderPageKeepsOriginalHost() {
|
||||
String resolved = LzTool.resolveSharePageUrl(
|
||||
"https://a.lanzouw.com/b710887",
|
||||
"https://w1.lanzn.com/b710887",
|
||||
"b710887");
|
||||
assertEquals("https://a.lanzouw.com/b710887", resolved);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void nodeShareIsNotRewrittenToWwww() {
|
||||
String resolved = LzTool.resolveSharePageUrl(
|
||||
"https://wwn.lanzouy.com/ihLkw1gezutg",
|
||||
"https://w1.lanzn.com/ihLkw1gezutg",
|
||||
"ihLkw1gezutg");
|
||||
assertEquals("https://wwn.lanzouy.com/ihLkw1gezutg", resolved);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void webpageQueryStaysOnOriginalHost() {
|
||||
String resolved = LzTool.resolveSharePageUrl(
|
||||
"https://a.lanzouw.com/iabc?webpage=wp1&pwd=secret",
|
||||
"https://w1.lanzn.com/iabc",
|
||||
"iabc");
|
||||
assertEquals("https://a.lanzouw.com/iabc?webpage=wp1", resolved);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void placeholderUsesStandardHostNotWwww() {
|
||||
assertEquals("https://w1.lanzn.com/", LzTool.SHARE_URL_PREFIX);
|
||||
assertFalse(LzTool.SHARE_URL_PREFIX.contains("wwww"));
|
||||
String resolved = LzTool.resolveSharePageUrl(
|
||||
"https://w1.lanzn.com/-",
|
||||
"https://w1.lanzn.com/-",
|
||||
"iFileId");
|
||||
assertEquals("https://w1.lanzn.com/iFileId", resolved);
|
||||
assertFalse(resolved.contains("wwww.lanzoux.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingShareUrlKeepsRealStandardHost() {
|
||||
String resolved = LzTool.resolveSharePageUrl(
|
||||
null,
|
||||
"https://www.lanzoux.com/iabc",
|
||||
"iabc");
|
||||
assertEquals("https://www.lanzoux.com/iabc", resolved);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ajaxFallbackOrderPutsWwwwLast() {
|
||||
List<String> fallback = LzTool.AJAX_FALLBACK_ORIGINS;
|
||||
assertEquals("https://w1.lanzn.com", fallback.get(0));
|
||||
assertEquals("https://www.lanzoux.com", fallback.get(1));
|
||||
assertEquals("https://wwww.lanzoux.com", fallback.get(fallback.size() - 1));
|
||||
|
||||
List<String> origins = LzTool.ajaxOrigins("https://a.lanzouw.com/xxx");
|
||||
assertEquals("https://a.lanzouw.com", origins.get(0));
|
||||
assertEquals("https://w1.lanzn.com", origins.get(1));
|
||||
assertEquals("https://www.lanzoux.com", origins.get(2));
|
||||
assertEquals("https://wwww.lanzoux.com", origins.get(origins.size() - 1));
|
||||
assertTrue(origins.indexOf("https://wwww.lanzoux.com")
|
||||
> origins.indexOf("https://w1.lanzn.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void ajaxOriginsDoNotDuplicateKnownHost() {
|
||||
List<String> origins = LzTool.ajaxOrigins("https://www.lanzoux.com/iabc");
|
||||
assertEquals(3, origins.size());
|
||||
assertEquals("https://www.lanzoux.com", origins.get(0));
|
||||
assertEquals("https://w1.lanzn.com", origins.get(1));
|
||||
assertEquals("https://wwww.lanzoux.com", origins.get(2));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void timeoutAjaxFallsBackButBusinessErrorDoesNot() {
|
||||
assertTrue(LzTool.ajaxResponseShouldFallback("{\"zt\":0,\"inf\":\"已超时\"}"));
|
||||
assertTrue(LzTool.ajaxResponseShouldFallback("{\"info\":\"请求超时\"}"));
|
||||
assertTrue(LzTool.ajaxResponseShouldFallback(""));
|
||||
assertTrue(LzTool.ajaxResponseShouldFallback("<html>blocked</html>"));
|
||||
assertFalse(LzTool.ajaxResponseShouldFallback("{\"zt\":0,\"inf\":\"密码错误\"}"));
|
||||
assertFalse(LzTool.ajaxResponseShouldFallback(
|
||||
"{\"zt\":1,\"inf\":\"name.zip\",\"dom\":\"https://x\",\"url\":\"abc\"}"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void filePagePrefersExistingHostOverWwww() {
|
||||
assertEquals("https://a.lanzouw.com/",
|
||||
LzTool.sharePageHostBase("https://a.lanzouw.com/b123", "https://w1.lanzn.com/b123"));
|
||||
assertEquals("https://w1.lanzn.com/",
|
||||
LzTool.sharePageHostBase("https://w1.lanzn.com/-", "https://w1.lanzn.com/-"));
|
||||
assertFalse(LzTool.sharePageHostBase("https://a.lanzouw.com/b123", null).contains("wwww"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void absoluteAjaxUrlIsKeptAndTriedFirst() {
|
||||
String html = """
|
||||
url : 'https://apifile.lanzouw.com/ajaxfile.php?file=320665771',
|
||||
data : { 'action':'downprocess','sign':isngis,'kd':kdns,'p':pwd, },
|
||||
""";
|
||||
String target = LzTool.fileAjaxTarget(html);
|
||||
assertEquals("https://apifile.lanzouw.com/ajaxfile.php?file=320665771", target);
|
||||
|
||||
List<String> origins = LzTool.fileAjaxOrigins(
|
||||
"https://wwaqg.lanzouu.com/iqouM49vy9ib", target);
|
||||
assertEquals("https://apifile.lanzouw.com", origins.get(0));
|
||||
assertTrue(origins.contains("https://wwaqg.lanzouu.com"));
|
||||
assertEquals("https://wwww.lanzoux.com", origins.get(origins.size() - 1));
|
||||
assertTrue(origins.indexOf("https://apifile.lanzouw.com")
|
||||
< origins.indexOf("https://wwaqg.lanzouu.com"));
|
||||
assertTrue(origins.indexOf("https://wwww.lanzoux.com")
|
||||
> origins.indexOf("https://w1.lanzn.com"));
|
||||
assertEquals(1, origins.stream().filter("https://apifile.lanzouw.com"::equals).count());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void protocolRelativeAjaxBecomesHttps() {
|
||||
String html = "url : '//apifile.lanzouw.com/ajaxfile.php?file=9',";
|
||||
assertEquals("https://apifile.lanzouw.com/ajaxfile.php?file=9", LzTool.fileAjaxTarget(html));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void absoluteAjaxWinsOverRelativePathInSamePage() {
|
||||
String html = """
|
||||
//data : { url : '/ajaxfile.php?file=1' }
|
||||
url : "https://apifile.lanzouw.com/ajaxm.php?file=42",
|
||||
""";
|
||||
assertEquals("https://apifile.lanzouw.com/ajaxm.php?file=42", LzTool.fileAjaxTarget(html));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void relativeFileAjaxFallsThroughToApifileBeforeWwww() {
|
||||
String html = "url : '/ajaxfile.php?file=150233466',";
|
||||
assertEquals("/ajaxfile.php?file=150233466", LzTool.fileAjaxTarget(html));
|
||||
|
||||
List<String> origins = LzTool.fileAjaxOrigins("https://a.lanzouw.com/xxx", LzTool.fileAjaxTarget(html));
|
||||
assertEquals("https://a.lanzouw.com", origins.get(0));
|
||||
assertEquals("https://apifile.lanzouw.com", origins.get(1));
|
||||
assertEquals("https://wwww.lanzoux.com", origins.get(origins.size() - 1));
|
||||
assertTrue(origins.indexOf("https://apifile.lanzouw.com")
|
||||
< origins.indexOf("https://wwww.lanzoux.com"));
|
||||
assertFalse(LzTool.ajaxOrigins("https://a.lanzouw.com/xxx").contains("https://apifile.lanzouw.com"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void missingAjaxTargetStillPutsApifileBeforeWwww() {
|
||||
List<String> origins = LzTool.fileAjaxOrigins("https://www.lanzoux.com/ihLkw1gezutg", null);
|
||||
assertEquals("https://www.lanzoux.com", origins.get(0));
|
||||
assertEquals("https://apifile.lanzouw.com", origins.get(1));
|
||||
assertEquals("https://wwww.lanzoux.com", origins.get(origins.size() - 1));
|
||||
assertFalse(origins.get(0).contains("wwww"));
|
||||
}
|
||||
}
|
||||
@@ -17,7 +17,7 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<revision>0.4.6</revision>
|
||||
<revision>0.4.7</revision>
|
||||
<java.version>17</java.version>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "nfd-web",
|
||||
"version": "0.4.6",
|
||||
"version": "0.4.7",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
|
||||
@@ -139,114 +139,113 @@
|
||||
style="background:transparent;"
|
||||
/>
|
||||
</div>
|
||||
<TreeBatchActionBar
|
||||
v-if="batchMode"
|
||||
class="tree-sidebar-footer"
|
||||
v-bind="treeBatchBarBind"
|
||||
@browser-download="batchBrowserDownload"
|
||||
@send-downloader="batchSendToDownloader"
|
||||
@cancel="toggleBatchMode"
|
||||
/>
|
||||
<div v-if="batchMode" class="tree-sidebar-footer">
|
||||
<span class="tree-sidebar-count">已勾选 {{ selectedFiles.length }} 个文件</span>
|
||||
<div class="tree-sidebar-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="selectedFiles.length === 0 || batchDownloading || treeExpanding || batchBrowserDownloadDisabled"
|
||||
:loading="batchDownloading"
|
||||
@click="batchBrowserDownload"
|
||||
:title="batchBrowserDownloadDisabled ? '所选文件需使用下载器下载' : ''"
|
||||
>
|
||||
浏览器下载
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
:disabled="selectedFiles.length === 0 || batchDownloading || treeExpanding"
|
||||
:loading="batchDownloading"
|
||||
@click="batchSendToDownloader"
|
||||
>
|
||||
发送到下载器
|
||||
</el-button>
|
||||
<el-button
|
||||
size="small"
|
||||
@click="toggleBatchMode"
|
||||
>
|
||||
取消
|
||||
</el-button>
|
||||
</div>
|
||||
<div v-if="batchDownloading" class="batch-progress-info">
|
||||
<el-progress :percentage="batchProgressPercent" :status="batchProgressStatus" />
|
||||
<p>{{ batchProgress.current }} / {{ batchProgress.total }}
|
||||
<span v-if="batchProgress.failed > 0" style="color:#f56c6c;"> ({{ batchProgress.failed }} 失败)</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</pane>
|
||||
<pane>
|
||||
<div class="tree-content">
|
||||
<div class="tree-toolbar tree-content-toolbar">
|
||||
<span class="tree-toolbar-title">
|
||||
<i class="fas fa-file-alt" aria-hidden="true"></i> 详情
|
||||
</span>
|
||||
<el-button
|
||||
v-if="!batchMode"
|
||||
type="warning"
|
||||
size="small"
|
||||
@click="toggleBatchMode"
|
||||
>
|
||||
<div v-if="selectedNode" class="file-detail-panel">
|
||||
<div class="file-detail-icon-wrap">
|
||||
<i :class="getFileIcon(selectedNode)" class="file-detail-icon"></i>
|
||||
</div>
|
||||
<h4 class="file-detail-name">{{ selectedNode.fileName }}</h4>
|
||||
<div v-if="selectedNode.fileType !== 'folder'" class="file-detail-meta">
|
||||
<p>类型: {{ selectedNode.fileType === 'url' ? '超链接' : getFileTypeClass(selectedNode) }}</p>
|
||||
<p v-if="selectedNode.fileType !== 'url'">大小: {{ selectedNode.sizeStr || '0B' }}</p>
|
||||
<p v-if="selectedNode.fileType === 'url' && selectedNode.previewUrl" class="file-detail-link">
|
||||
链接: {{ selectedNode.previewUrl }}
|
||||
</p>
|
||||
<p v-if="formatDate(selectedNode.createTime)">创建时间: {{ formatDate(selectedNode.createTime) }}</p>
|
||||
<p v-if="formatDate(selectedNode.updateTime)">更新时间: {{ formatDate(selectedNode.updateTime) }}</p>
|
||||
</div>
|
||||
<div class="file-detail-actions">
|
||||
<el-button
|
||||
v-if="selectedNode.fileType === 'url' && selectedNode.previewUrl"
|
||||
type="primary" size="small"
|
||||
@click="openExternalLink(selectedNode)"
|
||||
>
|
||||
<i class="fas fa-external-link-alt"></i> 打开链接
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else-if="selectedNode.parserUrl || selectedNode.previewUrl"
|
||||
size="small"
|
||||
@click="previewFile(selectedNode)"
|
||||
>
|
||||
<i class="fas fa-external-link-alt"></i> 打开
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isDownloadableFile(selectedNode)"
|
||||
type="success" size="small"
|
||||
@click="handleDownload(selectedNode)"
|
||||
:loading="downloadLoading"
|
||||
:disabled="needsDownloader(selectedNode)"
|
||||
:title="needsDownloader(selectedNode) ? '该网盘需使用下载器下载' : ''"
|
||||
>
|
||||
<i class="fas fa-download"></i> 下载
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isDownloadableFile(selectedNode)"
|
||||
type="primary" size="small"
|
||||
@click="sendSingleToDownloader(selectedNode)"
|
||||
:loading="singleSendLoading"
|
||||
>
|
||||
<i class="fas fa-paper-plane"></i> 发送到下载器
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isDownloadableFile(selectedNode)"
|
||||
size="small"
|
||||
@click="copyDirectLink(selectedNode)"
|
||||
:loading="copyLinkLoading"
|
||||
:disabled="needsDownloader(selectedNode)"
|
||||
:title="needsDownloader(selectedNode) ? '该网盘需使用下载器,无法直接复制直链' : ''"
|
||||
>
|
||||
<i class="fas fa-link"></i> 复制直链
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="file-detail-empty">
|
||||
<i class="fas fa-hand-pointer" style="font-size:32px;color:#bbb;margin-bottom:12px;"></i>
|
||||
<p>请在左侧选择文件查看详情</p>
|
||||
</div>
|
||||
<div v-if="!batchMode" class="tree-batch-trigger">
|
||||
<el-button type="warning" size="small" @click="toggleBatchMode">
|
||||
<i class="fas fa-check-double"></i> 批量下载
|
||||
</el-button>
|
||||
<span v-else class="tree-toolbar-hint">
|
||||
{{ treeExpanding ? '正在展开并收集文件…' : `勾选左侧文件夹将自动展开(最多 ${effectiveBatchMaxDepth} 层)` }}
|
||||
</span>
|
||||
</div>
|
||||
<div class="tree-content-body">
|
||||
<div v-if="selectedNode" class="file-detail-panel">
|
||||
<div class="file-detail-icon-wrap">
|
||||
<i :class="getFileIcon(selectedNode)" class="file-detail-icon"></i>
|
||||
</div>
|
||||
<h4 class="file-detail-name">{{ selectedNode.fileName }}</h4>
|
||||
<div v-if="selectedNode.fileType !== 'folder'" class="file-detail-meta">
|
||||
<p>类型: {{ selectedNode.fileType === 'url' ? '超链接' : getFileTypeClass(selectedNode) }}</p>
|
||||
<p v-if="selectedNode.fileType !== 'url'">大小: {{ selectedNode.sizeStr || '0B' }}</p>
|
||||
<p v-if="selectedNode.fileType === 'url' && selectedNode.previewUrl" class="file-detail-link">
|
||||
链接: {{ selectedNode.previewUrl }}
|
||||
</p>
|
||||
<p v-if="formatDate(selectedNode.createTime)">创建时间: {{ formatDate(selectedNode.createTime) }}</p>
|
||||
<p v-if="formatDate(selectedNode.updateTime)">更新时间: {{ formatDate(selectedNode.updateTime) }}</p>
|
||||
</div>
|
||||
<div class="file-detail-actions">
|
||||
<el-button
|
||||
v-if="selectedNode.fileType === 'url' && selectedNode.previewUrl"
|
||||
type="primary" size="small"
|
||||
@click="openExternalLink(selectedNode)"
|
||||
>
|
||||
<i class="fas fa-external-link-alt"></i> 打开链接
|
||||
</el-button>
|
||||
<el-button
|
||||
v-else-if="selectedNode.parserUrl || selectedNode.previewUrl"
|
||||
size="small"
|
||||
@click="previewFile(selectedNode)"
|
||||
>
|
||||
<i class="fas fa-external-link-alt"></i> 打开
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isDownloadableFile(selectedNode)"
|
||||
type="success" size="small"
|
||||
@click="handleDownload(selectedNode)"
|
||||
:loading="downloadLoading"
|
||||
:disabled="needsDownloader(selectedNode)"
|
||||
:title="needsDownloader(selectedNode) ? '该网盘需使用下载器下载' : ''"
|
||||
>
|
||||
<i class="fas fa-download"></i> 下载
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isDownloadableFile(selectedNode)"
|
||||
type="primary" size="small"
|
||||
@click="sendSingleToDownloader(selectedNode)"
|
||||
:loading="singleSendLoading"
|
||||
>
|
||||
<i class="fas fa-paper-plane"></i> 发送到下载器
|
||||
</el-button>
|
||||
<el-button
|
||||
v-if="isDownloadableFile(selectedNode)"
|
||||
size="small"
|
||||
@click="copyDirectLink(selectedNode)"
|
||||
:loading="copyLinkLoading"
|
||||
:disabled="needsDownloader(selectedNode)"
|
||||
:title="needsDownloader(selectedNode) ? '该网盘需使用下载器,无法直接复制直链' : ''"
|
||||
>
|
||||
<i class="fas fa-link"></i> 复制直链
|
||||
</el-button>
|
||||
</div>
|
||||
</div>
|
||||
<div v-else class="file-detail-empty">
|
||||
<i class="fas fa-hand-pointer" style="font-size:32px;color:#bbb;margin-bottom:12px;"></i>
|
||||
<p>请在左侧选择文件查看详情</p>
|
||||
<p v-if="!batchMode" class="file-detail-empty-hint">或直接点击「批量下载」勾选多个文件</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tree-content-footer" :class="{ 'is-batch': batchMode }">
|
||||
<template v-if="!batchMode">
|
||||
<span class="tree-content-footer-hint">可直接勾选多个文件下载</span>
|
||||
<el-button type="warning" size="small" @click="toggleBatchMode">
|
||||
<i class="fas fa-check-double"></i> 批量下载
|
||||
</el-button>
|
||||
</template>
|
||||
<TreeBatchActionBar
|
||||
v-else
|
||||
v-bind="treeBatchBarBind"
|
||||
@browser-download="batchBrowserDownload"
|
||||
@send-downloader="batchSendToDownloader"
|
||||
@cancel="toggleBatchMode"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</pane>
|
||||
@@ -354,21 +353,26 @@
|
||||
<div v-else class="file-detail-empty">
|
||||
<i class="fas fa-hand-pointer" style="font-size:24px;color:#bbb;margin-bottom:8px;"></i>
|
||||
<p>请在上方选择文件查看详情</p>
|
||||
<p v-if="!batchMode" class="file-detail-empty-hint">或直接点击「批量下载」勾选多个文件</p>
|
||||
</div>
|
||||
<div v-if="!batchMode" class="mobile-batch-trigger">
|
||||
<el-button type="warning" size="small" @click="toggleBatchMode">
|
||||
<i class="fas fa-check-double"></i> 批量下载
|
||||
</el-button>
|
||||
</div>
|
||||
<TreeBatchActionBar
|
||||
v-if="batchMode"
|
||||
class="mobile-batch-footer"
|
||||
v-bind="treeBatchBarBind"
|
||||
@browser-download="batchBrowserDownload"
|
||||
@send-downloader="batchSendToDownloader"
|
||||
@cancel="toggleBatchMode"
|
||||
/>
|
||||
<div v-if="batchMode" class="mobile-batch-footer">
|
||||
<span class="tree-sidebar-count">已勾选 {{ selectedFiles.length }} 个文件</span>
|
||||
<div class="tree-sidebar-actions">
|
||||
<el-button type="primary" size="small" :disabled="selectedFiles.length === 0 || batchDownloading || treeExpanding || batchBrowserDownloadDisabled" :loading="batchDownloading" @click="batchBrowserDownload" :title="batchBrowserDownloadDisabled ? '所选文件需使用下载器下载' : ''">浏览器下载</el-button>
|
||||
<el-button type="success" size="small" :disabled="selectedFiles.length === 0 || batchDownloading || treeExpanding" :loading="batchDownloading" @click="batchSendToDownloader">发送到下载器</el-button>
|
||||
<el-button size="small" @click="toggleBatchMode">取消</el-button>
|
||||
</div>
|
||||
<div v-if="batchDownloading" class="batch-progress-info">
|
||||
<el-progress :percentage="batchProgressPercent" :status="batchProgressStatus" />
|
||||
<p>{{ batchProgress.current }} / {{ batchProgress.total }}
|
||||
<span v-if="batchProgress.failed > 0" style="color:#f56c6c;"> ({{ batchProgress.failed }} 失败)</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</div>
|
||||
@@ -449,7 +453,6 @@ import { Splitpanes, Pane } from 'splitpanes'
|
||||
import 'splitpanes/dist/splitpanes.css'
|
||||
import fileTypeUtils from '@/utils/fileTypeUtils'
|
||||
import DownloadDialog from '@/components/DownloadDialog.vue'
|
||||
import TreeBatchActionBar from '@/components/TreeBatchActionBar.vue'
|
||||
import { testConnection, autoDetect, addDownload, batchAddDownload, getConfig, saveConfig } from '@/utils/downloaderService'
|
||||
import batchTreeCollect from '@/utils/batchTreeCollect'
|
||||
|
||||
@@ -463,7 +466,7 @@ const {
|
||||
|
||||
export default {
|
||||
name: 'DirectoryTree',
|
||||
components: { ElTree, Splitpanes, Pane, DownloadDialog, TreeBatchActionBar },
|
||||
components: { ElTree, Splitpanes, Pane, DownloadDialog },
|
||||
props: {
|
||||
fileList: {
|
||||
type: Array,
|
||||
@@ -563,19 +566,6 @@ export default {
|
||||
effectiveBatchMaxDepth() {
|
||||
const depth = Number(this.batchMaxDepth)
|
||||
return Number.isFinite(depth) && depth >= 0 ? depth : DEFAULT_BATCH_MAX_DEPTH
|
||||
},
|
||||
treeBatchBarBind() {
|
||||
return {
|
||||
selectedCount: this.selectedFiles.length,
|
||||
batchDownloading: this.batchDownloading,
|
||||
treeExpanding: this.treeExpanding,
|
||||
browserDisabled: this.batchBrowserDownloadDisabled,
|
||||
progressPercent: this.batchProgressPercent,
|
||||
progressStatus: this.batchProgressStatus,
|
||||
progressCurrent: this.batchProgress.current,
|
||||
progressTotal: this.batchProgress.total,
|
||||
progressFailed: this.batchProgress.failed
|
||||
}
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -1650,21 +1640,10 @@ html, body, #app, .main-container, .directory-tree, .content-card {
|
||||
.batch-progress-info {
|
||||
margin-top: 12px;
|
||||
}
|
||||
.tree-content-footer-hint {
|
||||
font-size: 12px;
|
||||
color: #909399;
|
||||
line-height: 1.4;
|
||||
}
|
||||
.dark-theme .tree-content-footer-hint {
|
||||
color: #bdc3c7;
|
||||
}
|
||||
.file-detail-empty-hint {
|
||||
margin-top: 8px;
|
||||
font-size: 13px;
|
||||
color: #909399;
|
||||
}
|
||||
.dark-theme .file-detail-empty-hint {
|
||||
color: #bdc3c7;
|
||||
.tree-batch-trigger {
|
||||
position: absolute;
|
||||
bottom: 12px;
|
||||
right: 12px;
|
||||
}
|
||||
|
||||
.stats {
|
||||
@@ -1735,7 +1714,8 @@ html, body, #app, .main-container, .directory-tree, .content-card {
|
||||
}
|
||||
.tree-content {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
padding: 16px;
|
||||
overflow-y: auto;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
@@ -2028,46 +2008,10 @@ html, body, #app, .main-container, .directory-tree, .content-card {
|
||||
min-height: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
align-items: stretch;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.tree-content-toolbar {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.tree-content-body {
|
||||
flex: 1;
|
||||
min-height: 0;
|
||||
overflow: auto;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
padding: 24px 16px 16px 16px;
|
||||
align-items: center;
|
||||
padding: 24px 16px 16px;
|
||||
}
|
||||
|
||||
.tree-content-footer {
|
||||
flex-shrink: 0;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 8px;
|
||||
flex-wrap: wrap;
|
||||
padding: 10px 12px;
|
||||
border-top: 1px solid #eaeaea;
|
||||
background: #f8f9fa;
|
||||
}
|
||||
|
||||
.tree-content-footer.is-batch {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.dark-theme .tree-content-footer {
|
||||
border-top-color: #404040;
|
||||
background: #232323;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.file-detail-panel {
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
<template>
|
||||
<div>
|
||||
<span class="tree-sidebar-count">已勾选 {{ selectedCount }} 个文件</span>
|
||||
<div class="tree-sidebar-actions">
|
||||
<el-button
|
||||
type="primary"
|
||||
size="small"
|
||||
:disabled="selectedCount === 0 || batchDownloading || treeExpanding || browserDisabled"
|
||||
:loading="batchDownloading"
|
||||
:title="browserDisabled ? '所选文件需使用下载器下载' : ''"
|
||||
@click="$emit('browser-download')"
|
||||
>
|
||||
浏览器下载
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
size="small"
|
||||
:disabled="selectedCount === 0 || batchDownloading || treeExpanding"
|
||||
:loading="batchDownloading"
|
||||
@click="$emit('send-downloader')"
|
||||
>
|
||||
发送到下载器
|
||||
</el-button>
|
||||
<el-button size="small" @click="$emit('cancel')">取消</el-button>
|
||||
</div>
|
||||
<div v-if="batchDownloading" class="batch-progress-info">
|
||||
<el-progress :percentage="progressPercent" :status="progressStatus" />
|
||||
<p>{{ progressCurrent }} / {{ progressTotal }}
|
||||
<span v-if="progressFailed > 0" style="color:#f56c6c;"> ({{ progressFailed }} 失败)</span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'TreeBatchActionBar',
|
||||
props: {
|
||||
selectedCount: { type: Number, default: 0 },
|
||||
batchDownloading: { type: Boolean, default: false },
|
||||
treeExpanding: { type: Boolean, default: false },
|
||||
browserDisabled: { type: Boolean, default: false },
|
||||
progressPercent: { type: Number, default: 0 },
|
||||
progressStatus: { type: String, default: '' },
|
||||
progressCurrent: { type: Number, default: 0 },
|
||||
progressTotal: { type: Number, default: 0 },
|
||||
progressFailed: { type: Number, default: 0 }
|
||||
},
|
||||
emits: ['browser-download', 'send-downloader', 'cancel']
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user