fix: 优化签到工作流与稳健性(免装 gh / cookie 合并 / 二维码依赖解析 / README 说明) - #28
Open
xfxx2022 wants to merge 8 commits into
Open
Conversation
- 删除 scheduled 触发的随机延迟步骤(原 DELAY=$((RANDOM%121)) 平均空耗 60 分钟/次) - 签到改为北京时间 08:00 准时执行,单次由 ~60+ 分钟降至约 5 分钟 - timeout-minutes 由 150 下调至 30,防止异常卡死持续占用额度
- 签到.yml cron '0 0 * * *'(北京08:00)→ '10 17 * * *'(北京01:10) - 背景:PR#23 将触发时间改为 08:00 意图做随机执行,但其随机延迟/超时部分已被 c2c3e69 回退为固定 08:00 整点;且当初未同步 README 造成文档矛盾 - 脚本与用户在 APP 手动领取共用当日青春版VIP名额(先到先得,main.js 已处理 130012/30002),凌晨跑可抢在手动操作前领取,避免空跑失败 - README 第57行现仍为 01:10,本次修正后 cron 与文档一致,无需改动 README 文字
- 签到.yml:删除 apt 安装 gh 段(ubuntu-latest 已预装),新增 actions:write 权限供 gh 写回刷新 token
- README:补充凌晨签到的意图说明(抢在手动领取前,避免青春版 VIP 名额冲突)
- api/server.js:cookie 合并前先规整为对象(字符串→cookieToJson / 对象原样 / 其余空),且不 mutate req.cookies
- qrcodeLogin.js:优先 require('qrcode'),失败再回退 api/node_modules 路径
Bumps the npm_and_yarn group with 6 updates in the /api directory: | Package | From | To | | --- | --- | --- | | [axios](https://github.com/axios/axios) | `1.15.2` | `1.18.0` | | [body-parser](https://github.com/expressjs/body-parser) | `1.20.4` | `1.20.6` | | [brace-expansion](https://github.com/juliangruber/brace-expansion) | `1.1.12` | `1.1.18` | | [form-data](https://github.com/form-data/form-data) | `4.0.5` | `4.0.6` | | [minimatch](https://github.com/isaacs/minimatch) | `3.1.2` | `3.1.5` | | [qs](https://github.com/ljharb/qs) | `6.14.2` | `6.15.3` | Updates `axios` from 1.15.2 to 1.18.0 - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/v1.x/CHANGELOG.md) - [Commits](axios/axios@v1.15.2...v1.18.0) Updates `body-parser` from 1.20.4 to 1.20.6 - [Release notes](https://github.com/expressjs/body-parser/releases) - [Changelog](https://github.com/expressjs/body-parser/blob/master/HISTORY.md) - [Commits](expressjs/body-parser@1.20.4...1.20.6) Updates `brace-expansion` from 1.1.12 to 1.1.18 - [Release notes](https://github.com/juliangruber/brace-expansion/releases) - [Commits](juliangruber/brace-expansion@v1.1.12...v1.1.18) Updates `form-data` from 4.0.5 to 4.0.6 - [Changelog](https://github.com/form-data/form-data/blob/master/CHANGELOG.md) - [Commits](form-data/form-data@v4.0.5...v4.0.6) Updates `minimatch` from 3.1.2 to 3.1.5 - [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md) - [Commits](isaacs/minimatch@v3.1.2...v3.1.5) Updates `qs` from 6.14.2 to 6.15.3 - [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md) - [Commits](ljharb/qs@v6.14.2...v6.15.3) --- updated-dependencies: - dependency-name: axios dependency-version: 1.18.0 dependency-type: direct:production dependency-group: npm_and_yarn - dependency-name: body-parser dependency-version: 1.20.6 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: brace-expansion dependency-version: 1.1.18 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: form-data dependency-version: 4.0.6 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: minimatch dependency-version: 3.1.5 dependency-type: indirect dependency-group: npm_and_yarn - dependency-name: qs dependency-version: 6.15.3 dependency-type: indirect dependency-group: npm_and_yarn ... Signed-off-by: dependabot[bot] <support@github.com>
…race-expansion,minimatch) Bump the npm_and_yarn group across 1 directory with 6 updates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
改动清单(4 文件,+20/−13)
② 签到.yml 免装 gh、省 Actions 分钟
apt install gh整段(GitHub 托管的ubuntu-latest已预装 gh,该段在标准 runner 上本就几乎不执行,删掉彻底避免任何安装/网络开销)。permissions增加actions: write:githubSecrets.js用gh secret set写回刷新后的 token,属于 actions 权限域,必需。githubSecrets.js:仍用gh写 Secret。说明:GitHub Secrets API 要求用仓库公钥做 sealed-box 加密,curl无法自加密;若改用 REST 需引入tweetnacl重写加密逻辑,会让"周日刷新 token 写回 Secret"这一关键路径增加失败风险——故选择"删安装段 + 保留 gh"的最稳方案,零新依赖、零加密风险。③ README 意图说明
④ server.js cookie 合并稳健性
Object.assign(req.cookies, cookie)在query.cookie为字符串/数组时,会把字符串当类数组注入0,1,2…字符索引键,污染传给酷狗的 cookie。字符串 → cookieToJson、对象 → 原样、数组/其它 → 空对象;并用Object.assign({}, req.cookies, cookieSource)不再 mutate 原req.cookies。?cookie=,属额外防御层,行为等价。⑤ qrcodeLogin.js 二维码依赖解析
require('./api/node_modules/qrcode')→ 改为优先require('qrcode'),失败再回退./api/node_modules/qrcode。验证
node --check:api/server.js、qrcodeLogin.js全过。git diff --stat:仅 4 个文件、+20/−13,无任何额外变更。兼容性 / 风险标注
actions: write权限:写 Secret 的最小必要权限,非越权。