Skip to content

Commit e7e4001

Browse files
author
Taois
committed
feat: 优化一点webdav日志问题
1 parent 3e841f6 commit e7e4001

File tree

4 files changed

+23
-7
lines changed

4 files changed

+23
-7
lines changed

.env.development

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,5 @@ CLIPBOARD_MAX_READ_SIZE=
5353
# 默认API超时时间
5454
API_TIMEOUT=20
5555
# action接口专用超时时间
56-
API_ACTION_TIMEOUT=60
56+
API_ACTION_TIMEOUT=60
57+
WEBDAV_DEBUG=0

json/webdav.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
[
2+
{
3+
"name": "Zn存档服",
4+
"baseURL": "https://pan.8897122.xyz/dav",
5+
"username": "webdavtv",
6+
"password": "webdavtv",
7+
"rejectUnauthorized": false,
8+
"showAll": false,
9+
"timeout": 30000
10+
},
211
{
312
"name": "本地webdav",
413
"id": "local",

spider/js/hdmoli[盘].js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ var rule = {
2626
class_url: '1&2&41',
2727
lazy: async function () {
2828
let {input, pdfa, pdfh, pd} = this
29+
if (input.startsWith('push://')) {
30+
return {
31+
parse: 0,
32+
url: input
33+
}
34+
}
2935
const html = JSON.parse((await req(input)).content.match(/r player_.*?=(.*?)</)[1]);
3036
let url = html.url;
3137
if (html.encrypt == "1") {

utils/webdav.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ export class WebDAVClient {
148148
});
149149

150150
// 添加调试信息
151-
if (process.env.NODE_ENV === 'development' || process.env.WEBDAV_DEBUG) {
151+
if (Number(process.env.WEBDAV_DEBUG)) {
152152
console.log('WebDAV PROPFIND response for', remotePath, ':', response.data);
153153
}
154154

@@ -429,7 +429,7 @@ export class WebDAVClient {
429429
}
430430

431431
// 添加调试信息
432-
if (process.env.NODE_ENV === 'development' || process.env.WEBDAV_DEBUG) {
432+
if (Number(process.env.WEBDAV_DEBUG)) {
433433
console.log('WebDAV COPY operation:');
434434
console.log(' Source:', normalizedSource);
435435
console.log(' Destination URL:', destinationUrl);
@@ -517,7 +517,7 @@ export class WebDAVClient {
517517
const basePath = baseUrl.pathname;
518518

519519
// 添加调试信息
520-
if (process.env.NODE_ENV === 'development' || process.env.WEBDAV_DEBUG) {
520+
if (Number(process.env.WEBDAV_DEBUG)) {
521521
console.log('_normalizeResponsePath debug:');
522522
console.log(' Response path:', responsePath);
523523
console.log(' Base path:', basePath);
@@ -537,15 +537,15 @@ export class WebDAVClient {
537537
normalizedPath = '';
538538
}
539539

540-
if (process.env.NODE_ENV === 'development' || process.env.WEBDAV_DEBUG) {
540+
if (Number(process.env.WEBDAV_DEBUG)) {
541541
console.log(' Normalized path:', normalizedPath);
542542
}
543543

544544
return normalizedPath;
545545
}
546546

547547
// 如果不以基础路径开头,直接返回原路径
548-
if (process.env.NODE_ENV === 'development' || process.env.WEBDAV_DEBUG) {
548+
if (Number(process.env.WEBDAV_DEBUG)) {
549549
console.log(' No normalization needed, returning:', responsePath);
550550
}
551551

@@ -571,7 +571,7 @@ export class WebDAVClient {
571571
const absoluteUrl = new URL(cleanPath, baseURL).href;
572572

573573
// 添加调试信息
574-
if (process.env.NODE_ENV === 'development' || process.env.WEBDAV_DEBUG) {
574+
if (Number(process.env.WEBDAV_DEBUG)) {
575575
console.log('_getAbsoluteUrl debug:');
576576
console.log(' Input remotePath:', remotePath);
577577
console.log(' Normalized path:', normalizedPath);

0 commit comments

Comments
 (0)