stnh70 commited on
Commit
f16ec44
·
verified ·
1 Parent(s): 817c44c

Update thunderapi/thunderapi.ts

Browse files
Files changed (1) hide show
  1. thunderapi/thunderapi.ts +34 -34
thunderapi/thunderapi.ts CHANGED
@@ -1461,47 +1461,47 @@ export class PikPakApi {
1461
  // }
1462
  // }
1463
 
1464
- // async restore(shareId, passCodeToken, fileIds) {
1465
- // console.log("调用restore方法,参数:", {
1466
- // shareId,
1467
- // passCodeToken: passCodeToken ? "有值" : "无值",
1468
- // fileIds: Array.isArray(fileIds) ? `${fileIds.length}个文件` : "无效格式"
1469
- // });
1470
 
1471
- // // 验证参数
1472
- // if (!shareId) {
1473
- // throw new Error("share_id is required");
1474
- // }
1475
 
1476
- // if (!Array.isArray(fileIds) || fileIds.length === 0) {
1477
- // throw new Error("file_ids must be a non-empty array");
1478
- // }
1479
 
1480
- // // 构造请求数据
1481
- // const data = {
1482
- // share_id: shareId,
1483
- // pass_code_token: passCodeToken,
1484
- // file_ids: fileIds
1485
- // };
1486
 
1487
- // console.log("restore请求体:", JSON.stringify(data));
1488
 
1489
- // const captchaResult = await this.captchaInit("GET:/drive/v1/share/restore");
1490
- // this.captcha_token = captchaResult.captcha_token;
1491
 
1492
- // try {
1493
- // const result = await this._requestPost(
1494
- // `https://${this.PIKPAK_API_HOST}/drive/v1/share/restore`,
1495
- // data
1496
- // );
1497
 
1498
- // console.log("restore响应:", JSON.stringify(result));
1499
- // return result;
1500
- // } catch (error) {
1501
- // console.error(`restore失败: ${error.message}`);
1502
- // throw error;
1503
- // }
1504
- // }
1505
 
1506
 
1507
  // ===============================================================
 
1461
  // }
1462
  // }
1463
 
1464
+ async restore(shareId, passCodeToken, fileIds) {
1465
+ console.log("调用restore方法,参数:", {
1466
+ shareId,
1467
+ passCodeToken: passCodeToken ? "有值" : "无值",
1468
+ fileIds: Array.isArray(fileIds) ? `${fileIds.length}个文件` : "无效格式"
1469
+ });
1470
 
1471
+ // 验证参数
1472
+ if (!shareId) {
1473
+ throw new Error("share_id is required");
1474
+ }
1475
 
1476
+ if (!Array.isArray(fileIds) || fileIds.length === 0) {
1477
+ throw new Error("file_ids must be a non-empty array");
1478
+ }
1479
 
1480
+ // 构造请求数据
1481
+ const data = {
1482
+ share_id: shareId,
1483
+ pass_code_token: passCodeToken,
1484
+ file_ids: fileIds
1485
+ };
1486
 
1487
+ console.log("restore请求体:", JSON.stringify(data));
1488
 
1489
+ const captchaResult = await this.captchaInit("GET:/drive/v1/share/restore");
1490
+ this.captcha_token = captchaResult.captcha_token;
1491
 
1492
+ try {
1493
+ const result = await this._requestPost(
1494
+ `https://${this.PIKPAK_API_HOST}/drive/v1/share/restore`,
1495
+ data
1496
+ );
1497
 
1498
+ console.log("restore响应:", JSON.stringify(result));
1499
+ return result;
1500
+ } catch (error) {
1501
+ console.error(`restore失败: ${error.message}`);
1502
+ throw error;
1503
+ }
1504
+ }
1505
 
1506
 
1507
  // ===============================================================