Update thunderapi/thunderapi.ts
Browse files- thunderapi/thunderapi.ts +12 -53
thunderapi/thunderapi.ts
CHANGED
|
@@ -1446,67 +1446,26 @@ export class PikPakApi {
|
|
| 1446 |
/**
|
| 1447 |
* Restore shared files
|
| 1448 |
*/
|
| 1449 |
-
|
| 1450 |
-
|
| 1451 |
-
|
| 1452 |
-
|
| 1453 |
-
|
| 1454 |
-
|
| 1455 |
-
|
| 1456 |
-
|
| 1457 |
-
|
| 1458 |
-
|
| 1459 |
-
// const result = await this._requestPost(
|
| 1460 |
-
// `https://${PikPakApi.PIKPAK_API_HOST}/drive/v1/share/restore`,
|
| 1461 |
-
// data
|
| 1462 |
-
// );
|
| 1463 |
|
| 1464 |
-
// return result;
|
| 1465 |
-
// }
|
| 1466 |
-
// }
|
| 1467 |
-
|
| 1468 |
-
async restore(shareId, passCodeToken, fileIds) {
|
| 1469 |
-
console.log("调用restore方法,参数:", {
|
| 1470 |
-
shareId,
|
| 1471 |
-
passCodeToken: passCodeToken ? "有值" : "无值",
|
| 1472 |
-
fileIds: Array.isArray(fileIds) ? `${fileIds.length}个文件` : "无效格式"
|
| 1473 |
-
});
|
| 1474 |
-
|
| 1475 |
-
// 验证参数
|
| 1476 |
-
if (!shareId) {
|
| 1477 |
-
throw new Error("share_id is required");
|
| 1478 |
-
}
|
| 1479 |
-
|
| 1480 |
-
if (!Array.isArray(fileIds) || fileIds.length === 0) {
|
| 1481 |
-
throw new Error("file_ids must be a non-empty array");
|
| 1482 |
-
}
|
| 1483 |
-
|
| 1484 |
-
// 构造请求数据
|
| 1485 |
-
const data = {
|
| 1486 |
-
share_id: shareId,
|
| 1487 |
-
pass_code_token: passCodeToken,
|
| 1488 |
-
file_ids: fileIds
|
| 1489 |
-
};
|
| 1490 |
-
|
| 1491 |
-
console.log("restore请求体:", JSON.stringify(data));
|
| 1492 |
-
|
| 1493 |
-
const captchaResult = await this.captchaInit("GET:/drive/v1/share/restore");
|
| 1494 |
-
this.captcha_token = captchaResult.captcha_token;
|
| 1495 |
-
|
| 1496 |
-
try {
|
| 1497 |
const result = await this._requestPost(
|
| 1498 |
-
`https://${
|
| 1499 |
data
|
| 1500 |
);
|
| 1501 |
|
| 1502 |
-
console.log("restore响应:", JSON.stringify(result));
|
| 1503 |
return result;
|
| 1504 |
-
} catch (error) {
|
| 1505 |
-
console.error(`restore失败: ${error.message}`);
|
| 1506 |
-
throw error;
|
| 1507 |
}
|
| 1508 |
}
|
| 1509 |
-
|
|
|
|
| 1510 |
|
| 1511 |
// ===============================================================
|
| 1512 |
// 5. Server implementation with Oak (originally main.ts)
|
|
|
|
| 1446 |
/**
|
| 1447 |
* Restore shared files
|
| 1448 |
*/
|
| 1449 |
+
async restore(share_id: string, pass_code_token: string, file_ids: string[]): Promise<any> {
|
| 1450 |
+
const data = {
|
| 1451 |
+
share_id: share_id,
|
| 1452 |
+
pass_code_token: pass_code_token,
|
| 1453 |
+
file_ids: file_ids
|
| 1454 |
+
};
|
| 1455 |
+
|
| 1456 |
+
const captchaResult = await this.captchaInit("GET:/drive/v1/share/restore");
|
| 1457 |
+
this.captcha_token = captchaResult.captcha_token;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1458 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1459 |
const result = await this._requestPost(
|
| 1460 |
+
`https://${PikPakApi.PIKPAK_API_HOST}/drive/v1/share/restore`,
|
| 1461 |
data
|
| 1462 |
);
|
| 1463 |
|
|
|
|
| 1464 |
return result;
|
|
|
|
|
|
|
|
|
|
| 1465 |
}
|
| 1466 |
}
|
| 1467 |
+
|
| 1468 |
+
|
| 1469 |
|
| 1470 |
// ===============================================================
|
| 1471 |
// 5. Server implementation with Oak (originally main.ts)
|