Skip to content

Commit

Permalink
Merge pull request #126 from wes-lin/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
wes-lin authored Mar 6, 2025
2 parents b4155d7 + 820091b commit d59fa7c
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 109 deletions.
18 changes: 11 additions & 7 deletions .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,23 @@ jobs:
node-version: 18
cache: npm

- name: 🗳️ Check if CACHE_COOKIE is true
if: vars.CACHE_COOKIE == 'true'
- name: 👾 Check if Debug is true
if: vars.debug == '1'
run: |
echo "CACHE_COOKIE=true" >> $GITHUB_ENV
echo "CURRENT_DATE=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
echo "CLOUD189_VERBOSE=1" >> $GITHUB_ENV
- name: 🗳️ Check if cacheToken is true
if: vars.cacheToken == '1'
run: |
echo "CACHE_TOKEN=1" >> $GITHUB_ENV
- name: 📹 Restore cached Cookie
id: cache-cookie-restore
if: vars.CACHE_COOKIE == 'true'
if: vars.cacheToken == '1'
uses: actions/cache@v4
with:
path: .cookie
key: ${{ env.CURRENT_DATE }}-cookie
path: .token
key: ${{ runner.os }}-cache-token

- name: 🔧 Init secrets
uses: shine1594/secrets-to-env-action@master
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ tests/**/coverage/

cheese.log

.cookie
.token

.logs
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.2",
"cloud189-sdk": "^1.0.6-alpha.4",
"dotenv": "^16.4.5",
"log4js": "^6.9.1",
"superagent": "^7.1.3"
Expand Down
17 changes: 13 additions & 4 deletions src/app.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
require("dotenv").config();
const { CloudClient } = require("cloud189-sdk");
const fs = require('fs')
const { CloudClient,FileTokenStore } = require("cloud189-sdk");
const recording = require("log4js/lib/appenders/recording");
const accounts = require("../accounts");
const families = require("../families");
const {
mask,
formatDateISO,
delay,
} = require("./utils");
const push = require("./push");
const { log4js, cleanLogs, catLogs } = require("./logger");
const execThreshold = process.env.EXEC_THRESHOLD || 1;
const cacheToken = process.env.CACHE_TOKEN === "1";
const tokenDir = ".token"

// 个人任务签到
const doUserTask = async (cloudClient, logger) => {
Expand Down Expand Up @@ -65,11 +67,15 @@ const run = async (userName, password, userSizeInfoMap, logger) => {
const before = Date.now();
try {
logger.log('开始执行');
let token = null
if(cacheToken) {
token = new FileTokenStore(`${tokenDir}/${userName}.json`)
}
const cloudClient = new CloudClient({
username: userName,
password
password,
token: token
});
await cloudClient.login()
const beforeUserSizeInfo = await cloudClient.getUserSizeInfo();
userSizeInfoMap.set(userName, {
cloudClient,
Expand Down Expand Up @@ -100,6 +106,9 @@ const run = async (userName, password, userSizeInfoMap, logger) => {

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

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==
cloud189-sdk@^1.0.6-alpha.4:
version "1.0.6-alpha.4"
resolved "https://registry.yarnpkg.com/cloud189-sdk/-/cloud189-sdk-1.0.6-alpha.4.tgz#b52f8d54ea15f6813cd03db9ea693f975e733e5a"
integrity sha512-uO3FYV4SBWcypqaXpTt6Owh/dPsUI5+ZaNWMkhrYI31Y3hwEVVF3THRNbUm1rUfeaghpngQ4+KGtqgS5IhYBuQ==
dependencies:
chalk "^4.1.2"
got "11.8.2"
node-jsencrypt "^1.0.0"
tough-cookie "^4.1.4"
tough-cookie-file-store "^2.0.3"

color-convert@^2.0.1:
version "2.0.1"
Expand Down Expand Up @@ -435,11 +432,6 @@ doctrine@^3.0.0:
dependencies:
esutils "^2.0.2"

dom-walk@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/dom-walk/-/dom-walk-0.1.2.tgz#0c548bef048f4d1f2a97249002236060daa3fd84"
integrity sha512-6QvTW9mrGeIegrFXdtQi9pk7O/nSK6lSdXW2eqUspN5LWD7UTji2Fqw5V2YLjBpHEoU9Xl/eUWNpDeZvoyOv2w==

dotenv@^16.4.5:
version "16.4.7"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-16.4.7.tgz#0e20c5b82950140aa99be360a8a5f52335f53c26"
Expand Down Expand Up @@ -800,13 +792,6 @@ get-intrinsic@^1.1.1, get-intrinsic@^1.1.3, get-intrinsic@^1.2.0, get-intrinsic@
has-proto "^1.0.1"
has-symbols "^1.0.3"

get-random-values@^1.2.0:
version "1.2.2"
resolved "https://registry.yarnpkg.com/get-random-values/-/get-random-values-1.2.2.tgz#f1d944d0025433d53a2bd9941b9e975d98a2f7ff"
integrity sha512-lMyPjQyl0cNNdDf2oR+IQ/fM3itDvpoHy45Ymo2r0L1EjazeSl13SfbKZs7KtZ/3MDCeueiaJiuOEfKqRTsSgA==
dependencies:
global "^4.4.0"

get-stream@^5.1.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/get-stream/-/get-stream-5.2.0.tgz#4966a1795ee5ace65e706c4b7beb71257d6e22d3"
Expand Down Expand Up @@ -841,14 +826,6 @@ glob@^7.1.3:
once "^1.3.0"
path-is-absolute "^1.0.0"

global@^4.4.0:
version "4.4.0"
resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406"
integrity sha512-wv/LAoHdRE3BeTGz53FAamhGlPLhlssK45usmGFThIi4XqnBmjKQ16u+RNbP7WvigRZDxUsM0J3gcQ5yicaL0w==
dependencies:
min-document "^2.19.0"
process "^0.11.10"

globals@^13.19.0:
version "13.20.0"
resolved "https://registry.yarnpkg.com/globals/-/globals-13.20.0.tgz#ea276a1e508ffd4f1612888f9d1bad1e2717bf82"
Expand Down Expand Up @@ -1239,13 +1216,6 @@ mimic-response@^3.1.0:
resolved "https://registry.yarnpkg.com/mimic-response/-/mimic-response-3.1.0.tgz#2d1d59af9c1b129815accc2c46a022a5ce1fa3c9"
integrity sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==

min-document@^2.19.0:
version "2.19.0"
resolved "https://registry.yarnpkg.com/min-document/-/min-document-2.19.0.tgz#7bd282e3f5842ed295bb748cdd9f1ffa2c824685"
integrity sha1-e9KC4/WELtKVu3SM3Z8f+iyCRoU=
dependencies:
dom-walk "^0.1.0"

minimatch@^3.0.5, minimatch@^3.1.1, minimatch@^3.1.2:
version "3.1.2"
resolved "https://registry.yarnpkg.com/minimatch/-/minimatch-3.1.2.tgz#19cd194bfd3e428f049a70817c038d89ab4be35b"
Expand Down Expand Up @@ -1273,13 +1243,6 @@ natural-compare@^1.4.0:
resolved "https://registry.yarnpkg.com/natural-compare/-/natural-compare-1.4.0.tgz#4abebfeed7541f2c27acfb29bdbbd15c8d5ba4f7"
integrity sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==

node-jsencrypt@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/node-jsencrypt/-/node-jsencrypt-1.0.0.tgz#83ffced414ecbe12fea017c6c585c9bfc49ad19b"
integrity sha1-g//O1BTsvhL+oBfGxYXJv8Sa0Zs=
dependencies:
get-random-values "^1.2.0"

normalize-url@^6.0.1:
version "6.1.0"
resolved "https://registry.yarnpkg.com/normalize-url/-/normalize-url-6.1.0.tgz#40d0885b535deffe3f3147bec877d05fe4c5668a"
Expand Down Expand Up @@ -1417,16 +1380,6 @@ prelude-ls@^1.2.1:
resolved "https://registry.yarnpkg.com/prelude-ls/-/prelude-ls-1.2.1.tgz#debc6489d7a6e6b0e7611888cec880337d316396"
integrity sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==

process@^0.11.10:
version "0.11.10"
resolved "https://registry.yarnpkg.com/process/-/process-0.11.10.tgz#7332300e840161bda3e69a1d1d91a7d4bc16f182"
integrity sha1-czIwDoQBYb2j5podHZGn1LwW8YI=

psl@^1.1.33:
version "1.9.0"
resolved "https://registry.yarnpkg.com/psl/-/psl-1.9.0.tgz#d0df2a137f00794565fcaf3b2c00cd09f8d5a5a7"
integrity sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==

pump@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/pump/-/pump-3.0.0.tgz#b4a2116815bde2f4e1ea602354e8c75565107a64"
Expand All @@ -1440,11 +1393,6 @@ punycode@^2.1.0:
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec"
integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==

punycode@^2.1.1:
version "2.3.1"
resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.3.1.tgz#027422e2faec0b25e1549c3e1bd8309b9133b6e5"
integrity sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==

qs@6.9.3:
version "6.9.3"
resolved "https://registry.yarnpkg.com/qs/-/qs-6.9.3.tgz#bfadcd296c2d549f1dffa560619132c977f5008e"
Expand All @@ -1457,11 +1405,6 @@ qs@^6.10.3:
dependencies:
side-channel "^1.0.4"

querystringify@^2.1.1:
version "2.2.0"
resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6"
integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==

queue-microtask@^1.2.2:
version "1.2.3"
resolved "https://registry.yarnpkg.com/queue-microtask/-/queue-microtask-1.2.3.tgz#4929228bbc724dfac43e0efb058caf7b6cfb6243"
Expand Down Expand Up @@ -1490,11 +1433,6 @@ regexp.prototype.flags@^1.5.0:
define-properties "^1.2.0"
functions-have-names "^1.2.3"

requires-port@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff"
integrity sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==

resolve-alpn@^1.0.0:
version "1.2.1"
resolved "https://registry.yarnpkg.com/resolve-alpn/-/resolve-alpn-1.2.1.tgz#b7adbdac3546aaaec20b45e7d8265927072726f9"
Expand Down Expand Up @@ -1696,23 +1634,6 @@ text-table@^0.2.0:
resolved "https://registry.yarnpkg.com/text-table/-/text-table-0.2.0.tgz#7f5ee823ae805207c00af2df4a84ec3fcfa570b4"
integrity sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==

tough-cookie-file-store@^2.0.3:
version "2.0.3"
resolved "https://registry.yarnpkg.com/tough-cookie-file-store/-/tough-cookie-file-store-2.0.3.tgz#788f7a6fe5cd8f61a1afb71b2f0b964ebf914b80"
integrity sha512-sMpZVcmFf6EYFHFFl+SYH4W1/OnXBYMGDsv2IlbQ2caHyFElW/UR/gpj/KYU1JwmP4dE9xqwv2+vWcmlXHojSw==
dependencies:
tough-cookie "^4.0.0"

tough-cookie@^4.0.0, tough-cookie@^4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36"
integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==
dependencies:
psl "^1.1.33"
punycode "^2.1.1"
universalify "^0.2.0"
url-parse "^1.5.3"

tsconfig-paths@^3.14.2:
version "3.14.2"
resolved "https://registry.yarnpkg.com/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz#6e32f1f79412decd261f92d633a9dc1cfa99f088"
Expand Down Expand Up @@ -1794,26 +1715,13 @@ universalify@^0.1.0:
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
integrity sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==

universalify@^0.2.0:
version "0.2.0"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0"
integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==

uri-js@^4.2.2:
version "4.4.1"
resolved "https://registry.yarnpkg.com/uri-js/-/uri-js-4.4.1.tgz#9b1a52595225859e55f669d928f88c6c57f2a77e"
integrity sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==
dependencies:
punycode "^2.1.0"

url-parse@^1.5.3:
version "1.5.10"
resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1"
integrity sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==
dependencies:
querystringify "^2.1.1"
requires-port "^1.0.0"

util-deprecate@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/util-deprecate/-/util-deprecate-1.0.2.tgz#450d4dc9fa70de732762fbd2d4a28981419a0ccf"
Expand Down

0 comments on commit d59fa7c

Please sign in to comment.