Skip to content

Commit

Permalink
Merge pull request #122 from wes-lin/develop
Browse files Browse the repository at this point in the history
更新sdk
  • Loading branch information
wes-lin authored Mar 5, 2025
2 parents 0d26b19 + 190cc34 commit f9b5ec9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 30 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"author": "",
"license": "ISC",
"dependencies": {
"cloud189-sdk": "^1.0.6-alpha.1",
"cloud189-sdk": "^1.0.6-alpha.2",
"dotenv": "^16.4.5",
"log4js": "^6.9.1",
"superagent": "^7.1.3"
Expand Down
18 changes: 2 additions & 16 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
require("dotenv").config();
const fs = require("fs");
const { CookieJar } = require("tough-cookie");
const { CloudClient } = require("cloud189-sdk");
const { FileCookieStore } = require('tough-cookie-file-store')
const recording = require("log4js/lib/appenders/recording");
const accounts = require("../accounts");
const families = require("../families");
Expand All @@ -14,8 +11,6 @@ const {
const push = require("./push");
const { log4js, cleanLogs, catLogs } = require("./logger");
const execThreshold = process.env.EXEC_THRESHOLD || 1;
// 缓存cookie
const cacheCookie = !process.env.GITHUB_ACTIONS && process.env.CACHE_COOKIE === "true";

// 个人任务签到
const doUserTask = async (cloudClient, logger) => {
Expand Down Expand Up @@ -65,22 +60,16 @@ const doFamilyTask = async (cloudClient, logger) => {
}
};

const cookieDir = `.cookie/${formatDateISO(new Date())}`;

const run = async (userName, password, userSizeInfoMap, logger) => {
if (userName && password) {
const before = Date.now();
try {
logger.log('开始执行');
let cookieJar = null;
if (cacheCookie) {
cookieJar = new CookieJar(new FileCookieStore(`${cookieDir}/${userName}.json`))
}
const cloudClient = new CloudClient({
username: userName,
password,
cookie: cookieJar
password
});
await cloudClient.login()
const beforeUserSizeInfo = await cloudClient.getUserSizeInfo();
userSizeInfoMap.set(userName, {
cloudClient,
Expand Down Expand Up @@ -111,9 +100,6 @@ const run = async (userName, password, userSizeInfoMap, logger) => {

// 开始执行程序
async function main() {
if (cacheCookie && !fs.existsSync(cookieDir)) {
fs.mkdirSync(cookieDir, { recursive: true });
}
// 用于统计实际容量变化
const userSizeInfoMap = new Map();
for (let index = 0; index < accounts.length; index++) {
Expand Down
18 changes: 5 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -305,13 +305,12 @@ clone-response@^1.0.2:
dependencies:
mimic-response "^1.0.0"

cloud189-sdk@^1.0.6-alpha.1:
version "1.0.6-alpha.1"
resolved "https://registry.yarnpkg.com/cloud189-sdk/-/cloud189-sdk-1.0.6-alpha.1.tgz#d3b5981ac30160deee52c327d3854824e4fd8845"
integrity sha512-RJ//4S0vS0FXxlxJDXMJ0OGoQDw6z6GLrRMuwb1AZolFfgCBlI7pzDPsLkecbP4kh196QhOMRIDj7UxOLKPW2w==
cloud189-sdk@^1.0.6-alpha.2:
version "1.0.6-alpha.2"
resolved "https://registry.yarnpkg.com/cloud189-sdk/-/cloud189-sdk-1.0.6-alpha.2.tgz#a6bb9a1bd66459ef06c8aa1eb20277ad944ead5d"
integrity sha512-2lxGJ05FLdSdOz3BXzgLEyFjZpn8/l8QMiGHq1q/+CWRLMg1cABjFciPGg0XzY3SLg4j0wYaGdtvmNyt/GRRFw==
dependencies:
chalk "^4.1.2"
debug "^4.4.0"
got "11.8.2"
node-jsencrypt "^1.0.0"
tough-cookie "^4.1.4"
Expand Down Expand Up @@ -384,13 +383,6 @@ debug@^4.1.1, debug@^4.3.2, debug@^4.3.4:
dependencies:
ms "2.1.2"

debug@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.4.0.tgz#2b3f2aea2ffeb776477460267377dc8710faba8a"
integrity sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==
dependencies:
ms "^2.1.3"

decompress-response@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/decompress-response/-/decompress-response-6.0.0.tgz#ca387612ddb7e104bd16d85aab00d5ecf09c66fc"
Expand Down Expand Up @@ -1271,7 +1263,7 @@ ms@2.1.2:
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009"
integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==

ms@^2.1.1, ms@^2.1.3:
ms@^2.1.1:
version "2.1.3"
resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.3.tgz#574c8138ce1d2b5861f0b44579dbadd60c6615b2"
integrity sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==
Expand Down

0 comments on commit f9b5ec9

Please sign in to comment.