dsh-checkin-all 0.0.0-stage → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +326 -2
- package/bin/dsh-checkin-all.js +183 -0
- package/docs/VPS.md +175 -0
- package/lib/checkin-secrets.js +159 -0
- package/lib/credentials.js +439 -0
- package/lib/paths.js +115 -0
- package/lib/providers/astudio.js +326 -0
- package/lib/providers/base.js +54 -0
- package/lib/providers/browser-cookies.js +192 -0
- package/lib/providers/doubao.js +208 -0
- package/lib/providers/dumate.js +347 -0
- package/lib/providers/index.js +36 -0
- package/lib/providers/lingxi.js +315 -0
- package/lib/providers/minimax.js +159 -0
- package/lib/providers/qoder.js +193 -0
- package/lib/providers/trae.js +269 -0
- package/lib/runner.js +138 -0
- package/lib/scheduler.js +147 -0
- package/lib/server.js +209 -0
- package/lib/signin.js +142 -0
- package/lib/store.js +244 -0
- package/package.json +83 -3
- package/plugin/client.js +309 -0
- package/plugin/cordis.patch.yml +12 -0
- package/plugin/index.js +259 -0
- package/plugin/tools.js +218 -0
- package/scripts/deploy-vps.sh +171 -0
- package/scripts/sync-to-vps.sh +93 -0
- package/web/panel.css +265 -0
- package/web/panel.html +60 -0
- package/web/panel.js +479 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AIcivilization
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,327 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-checkin-all
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
每天自动给 **MiniMax Code**、**WPS 灵犀**、**百度 DuMate(搭子)**、**AStudio(星火)**、**Qoder**、**Trae** 和 **豆包** 签到领积分。装进 [DeepSeek Harness](https://github.com/deepseek-ai/dsh)(dsh)之后,
|
|
4
|
+
它会用本机 App 已经存好的登录凭据,每天到点调一次官方签到接口,签完记账,面板挂在对话页右侧栏,
|
|
5
|
+
**顶部按服务切换卡片**。
|
|
6
|
+
|
|
7
|
+
> 你不用记着签,也不用把账号密码交给任何东西——凭据本来就是 App 自己存的
|
|
8
|
+
> (MiniMax Code 在 `~/.minimax/auth/`,WPS 灵犀和 DuMate 在各自的 Cookies 里)。
|
|
9
|
+
|
|
10
|
+
> **为什么要自动签**:灵犀的连续签到断一天就归零(回退到第 1 天)。手动记着签太容易忘,
|
|
11
|
+
> 这个插件就是替你记住的那一下。
|
|
12
|
+
|
|
13
|
+
## 支持的服务
|
|
14
|
+
|
|
15
|
+
| 服务 | 凭据来源 | 签到单位 | 「今天」按哪算 |
|
|
16
|
+
| --- | --- | --- | --- |
|
|
17
|
+
| MiniMax Code | `~/.minimax/auth/`(OAuth) | 分 | 本机时区 |
|
|
18
|
+
| WPS 灵犀 | 灵犀自己的 Cookies(`wps_sid`) | 智点 | **北京时间** |
|
|
19
|
+
| 百度 DuMate | `qianfan-desktop-app/auth.json`(加密 cookie) | 积分 | **北京时间** |
|
|
20
|
+
| AStudio | `~/.acode/acode/userdata/astron-session.json` | 积分 | **北京时间** |
|
|
21
|
+
| Qoder | 个人访问令牌(PAT,面板里填) | 积分 | **北京时间** |
|
|
22
|
+
| Trae | 本机 Trae App/CLI 登录(自动读) | 积分 | **北京时间** |
|
|
23
|
+
| 豆包 | 登录 Cookie(面板里填,或从本机浏览器读) | 额度 | **北京时间** |
|
|
24
|
+
|
|
25
|
+
签到窗口不一样:灵犀、搭子、AStudio、Qoder、Trae、豆包 按北京时间算日期,美西晚上 8 点之后就已经是北京的第二天了。
|
|
26
|
+
插件按各自的规则判断「今天」,互不干扰。
|
|
27
|
+
|
|
28
|
+
## 它做什么
|
|
29
|
+
|
|
30
|
+
- **每个服务每天到点自动签到**:默认 09:00,可给每个服务单独设时间
|
|
31
|
+
- **顶部索引**:每个服务一张卡,显示登录状态、今天签没签、连续天数,点一下切到详情
|
|
32
|
+
- **补签**:电脑睡过了、DSH 半夜才启动,醒来照样补上(可关)
|
|
33
|
+
- **不重复签**:今天已经签过(哪怕你是在 App 里点的)就不动
|
|
34
|
+
- **自动续期**:access token 快过期时用 refresh token 换新的并**写回 App 的位置**,App 那边不受影响
|
|
35
|
+
- **记账**:每个服务分开记连续天数、累计积分、最近 14 天每天的结果
|
|
36
|
+
- **面板**:对话页右侧栏,顶部索引卡 + 每个服务的一周签到表 + 设置;DSH 设置里也有一块
|
|
37
|
+
- **对话里能用**:说「帮我签到」「MiniMax 积分还有多少」「以后每天 8 点签」就行
|
|
38
|
+
- **登录兜底**:凭据失效时给一个设备码,在浏览器里确认一次(和 App 里登录是同一条 OAuth 链路)
|
|
39
|
+
|
|
40
|
+
## 安装
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# 从 npm(推荐)
|
|
44
|
+
dsh plugin --profile desktop add dsh-checkin-all
|
|
45
|
+
|
|
46
|
+
# 或者从仓库
|
|
47
|
+
git clone https://github.com/AIcivilization/dsh-checkin-all.git
|
|
48
|
+
dsh plugin --profile desktop add /path/to/dsh-checkin-all
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
完全退出 DSH(macOS 按 Cmd+Q,不是关窗口)再重新打开。
|
|
52
|
+
|
|
53
|
+
装好后打开对话页右侧栏,引导页里点「自动签到」;或者「设置 → 自动签到」。
|
|
54
|
+
|
|
55
|
+
## 命令行
|
|
56
|
+
|
|
57
|
+
不开 DSH 也能用:
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
node bin/dsh-checkin-all.js status # 每个服务:登录状态 + 本周签到表 + 连续天数
|
|
61
|
+
node bin/dsh-checkin-all.js checkin # 全部签到(--dry 只看不领)
|
|
62
|
+
node bin/dsh-checkin-all.js checkin lingxi # 只签灵犀(或 minimax / dumate / astudio / qoder / trae / doubao)
|
|
63
|
+
node bin/dsh-checkin-all.js login # 设备码登录 MiniMax Code
|
|
64
|
+
node bin/dsh-checkin-all.js time 08:30 # 改自动签到时间
|
|
65
|
+
node bin/dsh-checkin-all.js on | off # 开 / 关自动签到
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### 不依赖 DSH 常驻:挂到系统 crontab
|
|
69
|
+
|
|
70
|
+
```cron
|
|
71
|
+
0 9 * * * /usr/local/bin/node /Users/wf/dsh/dsh-checkin-all/bin/dsh-checkin-all.js cron >> ~/.dsh/dsh-checkin-all/cron.log 2>&1
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
`cron` 是静默模式:今天签过了就什么都不做,只在真签的时候输出一行。
|
|
75
|
+
|
|
76
|
+
## 在对话里
|
|
77
|
+
|
|
78
|
+
| 你说 | 会发生什么 |
|
|
79
|
+
| --- | --- |
|
|
80
|
+
| 帮我签到 / 领一下积分 | 调 `minimax_checkin`,三个服务都签(也可只签一个) |
|
|
81
|
+
| 灵犀连续多少天了 / 签到情况 | 调 `minimax_checkin_status`,给每个服务的一周表、连续天数 |
|
|
82
|
+
| 以后每天 8 点自动签 | 调 `minimax_checkin_config`,改时间(可只改一个服务) |
|
|
83
|
+
| MiniMax 登录失效了 | 调 `minimax_login`,给设备码和网址 |
|
|
84
|
+
|
|
85
|
+
命令:`/checkin 状态|签到 [服务]|时间 09:00|开启|关闭|登录`(`/minimax` 是别名)
|
|
86
|
+
|
|
87
|
+
服务名:`minimax`(MiniMax Code)/ `lingxi`(WPS 灵犀)/ `dumate`(百度 DuMate)/ `astudio`(AStudio)/ `qoder`(Qoder)/ `trae`(Trae)/ `doubao`(豆包)
|
|
88
|
+
|
|
89
|
+
## 配置
|
|
90
|
+
|
|
91
|
+
面板里改,或者 profile 的 `cordis.patch.yml` 里给 `id: dsh-checkin-all` 加 `config`:
|
|
92
|
+
|
|
93
|
+
```yaml
|
|
94
|
+
- id: dsh-checkin-all
|
|
95
|
+
config:
|
|
96
|
+
enabled: true # 是否自动签到
|
|
97
|
+
time: '09:00' # 每天几点签
|
|
98
|
+
timeZone: '' # 时区覆盖,空 = 跟随本机(只影响 MiniMax;灵犀固定按北京时间)
|
|
99
|
+
catchUp: true # 过了时间才开机是否补签
|
|
100
|
+
notify: true # 签完是否提示
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
面板里可以给每个服务单独设开关和时间(存在 `config.json` 的 `providers` 字段里)。
|
|
104
|
+
|
|
105
|
+
插件自己的数据(设置、签到历史)在 `~/.dsh/dsh-checkin-all/`:
|
|
106
|
+
|
|
107
|
+
- `config.json` — 设置(全局 + 每个服务的 `providers` 覆盖)
|
|
108
|
+
- `state.json` — 按服务分开记:最近一次结果、连续天数、累计积分、每天一条记录(保留 400 天)
|
|
109
|
+
```
|
|
110
|
+
{ "version": 2, "providers": { "minimax": {...}, "lingxi": {...} } }
|
|
111
|
+
```
|
|
112
|
+
老版本的单服务 `state.json` 会自动迁移成 `providers.minimax`,历史不丢。
|
|
113
|
+
|
|
114
|
+
## 接口与凭据
|
|
115
|
+
|
|
116
|
+
### MiniMax Code
|
|
117
|
+
|
|
118
|
+
MiniMax Code 桌面端自己用的就是这两个接口,插件原样调用(`lib/signin.js`):
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
GET https://agent.minimax.io/minimax-cloud/api/v1/signin/status?timezone_id=<IANA>
|
|
122
|
+
POST https://agent.minimax.io/minimax-cloud/api/v1/signin/claim?timezone_id=<IANA>
|
|
123
|
+
Authorization: Bearer <access token>
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
`agent.minimax.io` / `agent.minimax.cn` 按 region 分(`en` / `cn`)。**必须带 `timezone_id`**,
|
|
127
|
+
不带会报 `invalid timezone_id`——这是「按谁的一天算」的关键。
|
|
128
|
+
|
|
129
|
+
凭据(`lib/credentials.js`):
|
|
130
|
+
|
|
131
|
+
```
|
|
132
|
+
~/.minimax/auth/<buildEnv>/<region>/mcode-public/auth.json # { schemaVersion, records: { "<service>\0<account>": {...} } }
|
|
133
|
+
~/.minimax/auth/<buildEnv>/<region>/mcode-public/auth-state.json # generation / expiresAtMs 必须和凭据对得上
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
- `service` = `com.minimax.mcode.oauth.<buildEnv>.<region>`
|
|
137
|
+
- `account` = `base64url(sha256("<authHome>\0mcode-public"))`
|
|
138
|
+
- 文件 `0600`、目录 `0700`(App 会检查,太宽直接拒绝读)
|
|
139
|
+
- 写回在 `auth.lock` 的锁里做,和 App 自己的 `proper-lockfile` 兼容
|
|
140
|
+
- refresh token 是一次性的:换一次旧的就作废,所以必须写回
|
|
141
|
+
|
|
142
|
+
### WPS 灵犀
|
|
143
|
+
|
|
144
|
+
```
|
|
145
|
+
GET https://lingxi.wps.cn/api/public/v1/tasks # 任务列表
|
|
146
|
+
POST https://lingxi.wps.cn/api/public/v1/tasks/daily_check_in/claim # 签到
|
|
147
|
+
Cookie: wps_sid=<...>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
签到数据在 `tasks[].task_key === "daily_check_in"` 那条里:
|
|
151
|
+
|
|
152
|
+
```
|
|
153
|
+
extra.check_in_days 七天签到表 [{day, date, reward, status}]
|
|
154
|
+
extra.consecutive_days 连续签到天数(断一天就回 1)
|
|
155
|
+
extra.today_day 今天是第几天
|
|
156
|
+
data.total_claimed_credits 账户累计智点
|
|
157
|
+
status: claimed / available / locked
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
凭据(`lib/providers/lingxi.js`):读灵犀自己的 `Cookies`(SQLite,用 `node:sqlite` 只读打开),
|
|
161
|
+
取 `wps_sid`。位置:`~/Library/Application Support/WPS 灵犀/Cookies`。
|
|
162
|
+
|
|
163
|
+
**日期按北京时间算**——服务器返回的 `date` 是北京日期。本机在美西时,晚上 8 点之后就已经是北京的第二天,
|
|
164
|
+
所以灵犀的签到窗口和 MiniMax 完全不同,代码里两个 provider 分开判断。
|
|
165
|
+
|
|
166
|
+
### 百度 DuMate(搭子)
|
|
167
|
+
|
|
168
|
+
```
|
|
169
|
+
GET https://console.bce.baidu.com/api/dumate/points/loginBonusInfo 签到状态
|
|
170
|
+
POST https://console.bce.baidu.com/api/dumate/points/loginBonus 领今天的分
|
|
171
|
+
GET https://console.bce.baidu.com/api/dumate/points/quota_overview 积分总览
|
|
172
|
+
Cookie: <解密出来的 cookie>; csrftoken: <bce-user-info 的值>
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
`loginBonusInfo` 返回:
|
|
176
|
+
|
|
177
|
+
```json
|
|
178
|
+
{"totalTimes":2,"totalPoints":1000,"hasIssued":true,"signInDays":["2026-11-01","2026-11-02"]}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**坑:必须带 `csrftoken` 头**(值来自 `bce-user-info` cookie,去掉引号)。
|
|
182
|
+
少了它服务端一律回 `{"success":false,"message":{"global":"登录凭证已过期,请重新登录"}}`——
|
|
183
|
+
这句话是误导的,cookie 其实好好的。注意不是 `X-Bce-Csrf-Token`,就叫 `csrftoken`。
|
|
184
|
+
|
|
185
|
+
凭据(`lib/providers/dumate.js`):DuMate 把 cookie 加密存在
|
|
186
|
+
`~/Library/Application Support/qianfan-desktop-app/auth.json` 的 `cookies` 字段:
|
|
187
|
+
|
|
188
|
+
```
|
|
189
|
+
base64( iv(12) || authTag(16) || ciphertext ) AES-256-GCM
|
|
190
|
+
密钥:同目录 .cookie-key 的 32 字节
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
插件用 `node:crypto` 解密(不需要额外的原生模块)。
|
|
194
|
+
|
|
195
|
+
### AStudio(星火)
|
|
196
|
+
|
|
197
|
+
AStudio 的「签到」= **每日登录积分**:每天首次连上时自动到账,桌面端用「每日积分」弹窗提示。
|
|
198
|
+
插件复刻同一套调用(`lib/providers/astudio.js`):
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
GET points/balance 积分余额(通用 + 星火)
|
|
202
|
+
GET points/summary 积分摘要
|
|
203
|
+
GET membership/me 当前套餐
|
|
204
|
+
GET membership/plan-config 每日登录积分配置(按套餐给 dailyLoginPoints)
|
|
205
|
+
GET client-popups/pending 待展示/待领取弹窗(每日积分在这里)
|
|
206
|
+
POST client-popups/complete 领取(body: { popupId, instanceKey })
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
- 上游:`https://agent.xfyun.cn/xingchen-studio/`
|
|
210
|
+
- 认证:`Cookie` + 身份头 `clientType` / `studioVersion`
|
|
211
|
+
- `clientType` 按平台自动上报:Windows `21`、macOS/Linux `22`
|
|
212
|
+
- `studioVersion` 默认 `3.5.5`,可用环境变量 `ASTUDIO_VERSION` 覆盖
|
|
213
|
+
- 「今天」按**北京时间**算
|
|
214
|
+
|
|
215
|
+
凭据(`lib/providers/astudio.js`)读 AStudio 的登录态文件 `astron-session.json`:
|
|
216
|
+
|
|
217
|
+
```
|
|
218
|
+
# macOS / Linux
|
|
219
|
+
~/.acode/acode/userdata/astron-session.json
|
|
220
|
+
# Windows
|
|
221
|
+
%USERPROFILE%\.acode\acode\userdata\astron-session.json
|
|
222
|
+
# { accountId, uid, token, ssoSessionId, mobile, ... }
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
凭据目录可用 `ASTUDIO_DATA_DIR` 环境变量覆盖(VPS 部署时指到同步目录)。
|
|
226
|
+
|
|
227
|
+
拼出的 Cookie(和桌面端 `buildAstronCookieHeader` 一致):
|
|
228
|
+
|
|
229
|
+
```
|
|
230
|
+
ssoSessionId=<ssoSessionId>; sso_sessionid=<ssoSessionId>; account_id=<accountId>; token=<token>
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Qoder
|
|
234
|
+
|
|
235
|
+
Qoder 的「签到」= **每日领取 CLAIM_BENEFIT 赠送积分**,与 Qoder 桌面端「用量面板」的领取链路一致
|
|
236
|
+
(`lib/providers/qoder.js`):
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
POST {openApi}/api/v1/jobToken/exchange PAT 换短期 jobToken
|
|
240
|
+
GET {openApi}/sash/api/v1/me/campaigns 找当天的 CLAIM_BENEFIT 活动
|
|
241
|
+
POST {openApi}/sash/api/v1/me/campaigns/{id}/claim 幂等领取(重复返回 replayed)
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
- 国内版 `https://openapi.qoder.com.cn`,国际版 `https://openapi.qoder.sh`
|
|
245
|
+
- 凭据:**个人访问令牌(PAT)**,在面板里填,存 `~/.dsh/dsh-checkin-all/secrets.json`(0600)
|
|
246
|
+
- 「今天」按**北京时间**算
|
|
247
|
+
|
|
248
|
+
### Trae
|
|
249
|
+
|
|
250
|
+
Trae(国内版 / SOLO)的每日签到,读本机 Trae 桌面 App 或 CLI 的登录(`lib/providers/trae.js`):
|
|
251
|
+
|
|
252
|
+
```
|
|
253
|
+
POST https://api.trae.cn/trae/api/v2/ug/checkin_credits/status 今天签没签
|
|
254
|
+
POST https://api.trae.cn/trae/api/v2/ug/checkin_credits/claim 签到
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
- 凭据:本机 Trae 的登录(桌面 App 的 `storage.json` 加密信封,或 `~/.trae-cn/trae-jwt-token` / `~/.trae/trae-jwt-token`),只读不落盘
|
|
258
|
+
- 桌面 App 位置:`{TRAE SOLO CN | Trae CN | Trae | TRAE SOLO}/User/globalStorage/storage.json`
|
|
259
|
+
- 「今天」按**北京时间**算
|
|
260
|
+
|
|
261
|
+
### 豆包
|
|
262
|
+
|
|
263
|
+
豆包的「天天领额度」每日签到(`lib/providers/doubao.js` + `browser-cookies.js`):
|
|
264
|
+
|
|
265
|
+
```
|
|
266
|
+
POST https://www.doubao.com/alice/ug/campaign/v3/detail/ 任务面板
|
|
267
|
+
POST https://www.doubao.com/alice/ug/campaign/landing/checkin 领取(幂等,重复返回 idempotent:true)
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
- 凭据:豆包登录 Cookie(`doubao.com`),在面板里手动粘贴,或从本机豆包电脑版/Chrome/Edge/Brave 自动读
|
|
271
|
+
- 只支持个人账号:飞书企业账号没有签到任务
|
|
272
|
+
- 「今天」按**北京时间**算
|
|
273
|
+
|
|
274
|
+
## 隐私
|
|
275
|
+
|
|
276
|
+
- 不保存账号密码,只用 App 已经存好的 OAuth 凭据
|
|
277
|
+
- 除了 MiniMax 自己的签到接口和 OAuth 接口,不往任何地方发请求
|
|
278
|
+
- 签到历史只写在本机 `~/.dsh/dsh-checkin-all/`
|
|
279
|
+
|
|
280
|
+
## 部署到 VPS(无图形界面)
|
|
281
|
+
|
|
282
|
+
可以。三个服务都支持,详细步骤见 **[docs/VPS.md](docs/VPS.md)**。
|
|
283
|
+
|
|
284
|
+
三步:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
# 1) 传代码
|
|
288
|
+
rsync -av ~/dsh/dsh-checkin-all/ vps:/opt/dsh-checkin-all/
|
|
289
|
+
|
|
290
|
+
# 2) 传凭据(在本机跑)
|
|
291
|
+
bash ~/dsh/dsh-checkin-all/scripts/sync-to-vps.sh vps
|
|
292
|
+
|
|
293
|
+
# 3) 装(在 VPS 上)
|
|
294
|
+
ssh vps 'bash /opt/dsh-checkin-all/scripts/deploy-vps.sh /opt/dsh-checkin-all'
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
要点(细节见 docs/VPS.md):
|
|
298
|
+
|
|
299
|
+
- **时区**:VPS 多是 UTC,灵犀和搭子按北京时间算日期 → 签到时间设 **01:00**
|
|
300
|
+
- **MiniMax 的 refresh token 一次性**:VPS 默认只读(`DSH_CHECKIN_ALL_READONLY=1`),
|
|
301
|
+
本机要定时 `sync-to-vps.sh` 同步;或者干脆只让 VPS 跑、本机关掉
|
|
302
|
+
- **灵犀和搭子不受限制**:cookie 多处使用不会互相失效
|
|
303
|
+
|
|
304
|
+
### 环境变量
|
|
305
|
+
|
|
306
|
+
| 变量 | 作用 |
|
|
307
|
+
| --- | --- |
|
|
308
|
+
| `MINIMAX_DATA_DIR` | MiniMax 数据根目录(默认 `~/.minimax`) |
|
|
309
|
+
| `LINGXI_DATA_DIR` | 灵犀数据目录(默认 macOS 的 `~/Library/Application Support/WPS 灵犀`) |
|
|
310
|
+
| `DUMATE_DATA_DIR` | DuMate 数据目录(默认 `~/Library/Application Support/qianfan-desktop-app`) |
|
|
311
|
+
| `ASTUDIO_DATA_DIR` | AStudio 用户数据目录(默认 `~/.acode/acode/userdata`) |
|
|
312
|
+
| `ASTUDIO_VERSION` | AStudio 版本号(默认 `3.5.5`,用于上游 `studioVersion` 头) |
|
|
313
|
+
| `DSH_CHECKIN_ALL_READONLY` | `1` = 不刷新 refresh token |
|
|
314
|
+
| `DSH_CHECKIN_ALL_HOME` | 插件自己的状态目录(默认 `~/.dsh/dsh-checkin-all`) |
|
|
315
|
+
|
|
316
|
+
> 凭据文件的记录 key 里嵌了 **authHome 的绝对路径**,换目录后算出来的 key 对不上。
|
|
317
|
+
> 插件会自动按 service 前缀兜底找(`lib/credentials.js` 的 `pickRecord`),所以拷过去能用。
|
|
318
|
+
|
|
319
|
+
## 开发
|
|
320
|
+
|
|
321
|
+
```bash
|
|
322
|
+
node --test "test/*.test.js"
|
|
323
|
+
```
|
|
324
|
+
|
|
325
|
+
## License
|
|
326
|
+
|
|
327
|
+
MIT
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// bin/dsh-checkin-all.js — 不开 DSH 也能用:查状态、签到、登录、改时间
|
|
3
|
+
//
|
|
4
|
+
// dsh-checkin-all status 所有服务:登录状态 + 本周签到表 + 连续天数
|
|
5
|
+
// dsh-checkin-all checkin [服务] 立刻签到(--dry 只看不领);不指定服务就全签
|
|
6
|
+
// dsh-checkin-all login 设备码登录 MiniMax Code
|
|
7
|
+
// dsh-checkin-all time 08:30 改自动签到时间
|
|
8
|
+
// dsh-checkin-all on | off 开 / 关自动签到
|
|
9
|
+
// dsh-checkin-all cron 给系统 crontab 用的静默签到
|
|
10
|
+
//
|
|
11
|
+
// 服务名:minimax(MiniMax Code)/ lingxi(WPS 灵犀)/ dumate(百度 DuMate)/ astudio(AStudio)/ qoder(Qoder)/ trae(Trae)/ doubao(豆包)
|
|
12
|
+
//
|
|
13
|
+
// 系统 crontab 里可以这样挂(不想依赖 DSH 常驻时):
|
|
14
|
+
// 0 9 * * * /path/to/dsh-checkin-all cron >> ~/.dsh/dsh-checkin-all/cron.log 2>&1
|
|
15
|
+
|
|
16
|
+
import { Runner } from '../lib/runner.js'
|
|
17
|
+
import { loadConfig, loadState, saveConfig, providerConfig } from '../lib/store.js'
|
|
18
|
+
|
|
19
|
+
const argv = process.argv.slice(2)
|
|
20
|
+
const command = (argv[0] || 'status').toLowerCase()
|
|
21
|
+
const flags = new Set(argv.slice(1).filter(a => a.startsWith('-')))
|
|
22
|
+
const rest = argv.slice(1).filter(a => !a.startsWith('-'))
|
|
23
|
+
|
|
24
|
+
const log = (message) => console.log(message)
|
|
25
|
+
const runner = new Runner({ log })
|
|
26
|
+
|
|
27
|
+
const STATUS_TAG = { 1: '未到', 2: '可领', 3: '已领', 4: '未开放' }
|
|
28
|
+
|
|
29
|
+
function printPanel(panel, unit) {
|
|
30
|
+
if (!panel || !panel.days.length) return console.log(' 签到表读不出来')
|
|
31
|
+
// 「每日登录积分」型服务(AStudio):只显示今天一天,不显示「本周 7 天」
|
|
32
|
+
if (panel.style === 'daily') {
|
|
33
|
+
const day = panel.days[0]
|
|
34
|
+
const done = day.status === 3
|
|
35
|
+
console.log(` 今天 +${String(day.points).padStart(5)}${done ? ' 已到账' : ' 可领取'} ← 今天`)
|
|
36
|
+
if (panel.accountCredits) console.log(` 账户累计 ${panel.accountCredits} ${unit}`)
|
|
37
|
+
return
|
|
38
|
+
}
|
|
39
|
+
for (const day of panel.days) {
|
|
40
|
+
const mark = day.isToday ? ' ← 今天' : ''
|
|
41
|
+
const bonus = day.bonusPoints ? ` +${day.bonusPoints}奖励` : ''
|
|
42
|
+
console.log(` 第 ${day.dayNo} 天 ${String(day.points).padStart(5)}${bonus.padEnd(9)} ${STATUS_TAG[day.status] || day.status}${mark}`)
|
|
43
|
+
}
|
|
44
|
+
if (panel.consecutiveDays !== undefined) console.log(` 连续 ${panel.consecutiveDays} 天`)
|
|
45
|
+
console.log(` 本周已领 ${panel.claimedDays} 天,共 ${panel.totalPoints} ${unit}`)
|
|
46
|
+
if (panel.accountCredits) console.log(` 账户累计 ${panel.accountCredits} ${unit}`)
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** 按名字找服务 */
|
|
50
|
+
function findProvider(text) {
|
|
51
|
+
const metas = runner.meta()
|
|
52
|
+
if (!text) return null
|
|
53
|
+
const t = String(text).toLowerCase()
|
|
54
|
+
return metas.find(m => m.id === t || m.short === text || m.name.toLowerCase() === t
|
|
55
|
+
|| m.name.toLowerCase().includes(t) || m.short.includes(text)) || null
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
async function main() {
|
|
59
|
+
const metas = runner.meta()
|
|
60
|
+
|
|
61
|
+
if (command === 'status') {
|
|
62
|
+
const cfg = await loadConfig()
|
|
63
|
+
const state = await loadState()
|
|
64
|
+
for (const meta of metas) {
|
|
65
|
+
const own = providerConfig(cfg, meta.id)
|
|
66
|
+
const account = await runner.account(meta.id).catch(e => ({ loggedIn: false, detail: e.message }))
|
|
67
|
+
const ps = (state.providers && state.providers[meta.id]) || {}
|
|
68
|
+
console.log(`── ${meta.name} ──`)
|
|
69
|
+
console.log(account.loggedIn
|
|
70
|
+
? `登录:已登录(${account.detail || ''})`
|
|
71
|
+
: `登录:未登录${account.detail ? `(${account.detail})` : ''}`)
|
|
72
|
+
console.log(`自动签到:${own.enabled ? `每天 ${own.time}` : '已关闭'}${meta.timeZoneMode === 'fixed' ? `(按 ${meta.timeZone} 算日期)` : ''}`)
|
|
73
|
+
console.log(`连续 ${ps.streak || 0} 天`)
|
|
74
|
+
if (ps.lastAttempt) console.log(`最近一次:${ps.lastAttempt.message}`)
|
|
75
|
+
if (account.loggedIn) {
|
|
76
|
+
try {
|
|
77
|
+
const panel = await runner.panel(meta.id)
|
|
78
|
+
printPanel(panel, meta.unit)
|
|
79
|
+
} catch (error) {
|
|
80
|
+
console.log(` 读签到表失败:${error.message}`)
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
console.log('')
|
|
84
|
+
}
|
|
85
|
+
return
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (command === 'checkin' || command === 'sign' || command === '签到') {
|
|
89
|
+
const target = findProvider(rest[0])
|
|
90
|
+
const dryRun = flags.has('--dry') || flags.has('-d')
|
|
91
|
+
if (target) {
|
|
92
|
+
const result = await runner.run(target.id, { trigger: 'manual', dryRun })
|
|
93
|
+
console.log(`${target.short}:${result.message}`)
|
|
94
|
+
if (result.panel) printPanel(result.panel, target.unit)
|
|
95
|
+
process.exitCode = result.ok ? 0 : 1
|
|
96
|
+
return
|
|
97
|
+
}
|
|
98
|
+
const results = await runner.runAll({ trigger: 'manual', dryRun })
|
|
99
|
+
for (const r of results) {
|
|
100
|
+
const meta = metas.find(m => m.id === r.provider) || { short: r.provider, unit: '分' }
|
|
101
|
+
console.log(`${meta.short}:${r.message}`)
|
|
102
|
+
if (r.panel) printPanel(r.panel, meta.unit)
|
|
103
|
+
}
|
|
104
|
+
process.exitCode = results.every(r => r.ok) ? 0 : 1
|
|
105
|
+
return
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
if (command === 'login' || command === '登录') {
|
|
109
|
+
const info = await runner.loginStart('minimax')
|
|
110
|
+
console.log(`在浏览器打开:${info.verificationUri}`)
|
|
111
|
+
console.log(`设备码:${info.userCode}`)
|
|
112
|
+
console.log(`(或直接打开 ${info.verificationUriComplete})`)
|
|
113
|
+
console.log(`等待确认…(${Math.round(info.expiresInSec / 60)} 分钟内有效)`)
|
|
114
|
+
const result = await runner.loginWait('minimax', { timeoutMs: info.expiresInSec * 1000 })
|
|
115
|
+
console.log(`登录成功,凭据已写回 MiniMax Code(${result.expiresAt} 过期)`)
|
|
116
|
+
return
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (command === 'time' || command === '时间') {
|
|
120
|
+
const value = rest[0]
|
|
121
|
+
if (!/^([01]?\d|2[0-3]):[0-5]\d$/.test(String(value || ''))) {
|
|
122
|
+
console.error('用法:dsh-checkin-all time 08:30')
|
|
123
|
+
process.exitCode = 2
|
|
124
|
+
return
|
|
125
|
+
}
|
|
126
|
+
const [hour, minute] = String(value).split(':')
|
|
127
|
+
const time = `${hour.padStart(2, '0')}:${minute}`
|
|
128
|
+
await saveConfig({ time, providers: null })
|
|
129
|
+
console.log(`全部服务自动签到时间改为每天 ${time}`)
|
|
130
|
+
return
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
if (command === 'on' || command === 'off') {
|
|
134
|
+
await saveConfig({ enabled: command === 'on', providers: null })
|
|
135
|
+
console.log(`全部服务自动签到已${command === 'on' ? '开启' : '关闭'}`)
|
|
136
|
+
return
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (command === 'cron') {
|
|
140
|
+
const cfg = await loadConfig()
|
|
141
|
+
if (!cfg.enabled) return
|
|
142
|
+
const results = await runner.runAll({ trigger: 'auto' })
|
|
143
|
+
for (const r of results) {
|
|
144
|
+
const meta = metas.find(m => m.id === r.provider) || { short: r.provider }
|
|
145
|
+
console.log(`${new Date().toISOString()} ${meta.short} ${r.outcome} ${r.message}`)
|
|
146
|
+
}
|
|
147
|
+
process.exitCode = results.every(r => r.ok) ? 0 : 1
|
|
148
|
+
return
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
console.log(`用法:
|
|
152
|
+
dsh-checkin-all status 所有服务:登录状态 + 本周签到表
|
|
153
|
+
dsh-checkin-all checkin [服务] 立刻签到(--dry 只看不领)
|
|
154
|
+
dsh-checkin-all login 设备码登录 MiniMax Code
|
|
155
|
+
dsh-checkin-all time 08:30 改自动签到时间
|
|
156
|
+
dsh-checkin-all on | off 开 / 关自动签到
|
|
157
|
+
dsh-checkin-all cron 给系统 crontab 用的静默签到
|
|
158
|
+
|
|
159
|
+
服务名:${metas.map(m => `${m.id}(${m.name})`).join(' / ')}`)
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
main().catch((error) => {
|
|
163
|
+
console.error(`出错:${error.message}`)
|
|
164
|
+
if (error.code === 'AUTH_REQUIRED' || error.code === 'AUTH_INVALID_GRANT' || error.code === 'AUTH_NO_REFRESH_TOKEN') {
|
|
165
|
+
console.error('MiniMax 登录状态没了,跑一次:dsh-checkin-all login')
|
|
166
|
+
}
|
|
167
|
+
if (error.code === 'LINGXI_NOT_LOGGED_IN' || error.code === 'LINGXI_NO_COOKIE_DB') {
|
|
168
|
+
console.error('灵犀没登录:打开 WPS 灵犀 App 登录一次')
|
|
169
|
+
}
|
|
170
|
+
if (error.code === 'ASTUDIO_NOT_LOGGED_IN' || error.code === 'ASTUDIO_SESSION_EXPIRED') {
|
|
171
|
+
console.error('AStudio 没登录或登录失效:打开 AStudio App 登录一次')
|
|
172
|
+
}
|
|
173
|
+
if (error.code === 'QODER_NOT_CONFIGURED' || error.code === 'QODER_AUTH') {
|
|
174
|
+
console.error('Qoder 没配置:在面板里添加个人访问令牌(PAT)')
|
|
175
|
+
}
|
|
176
|
+
if (error.code === 'TRAE_NOT_LOGGED_IN') {
|
|
177
|
+
console.error('Trae 没登录:打开 Trae App 登录一次(要在装了 Trae 的电脑上签)')
|
|
178
|
+
}
|
|
179
|
+
if (error.code === 'DOUBAO_NOT_CONFIGURED') {
|
|
180
|
+
console.error('豆包没配置:在面板里添加 Cookie(手动粘贴或从浏览器读)')
|
|
181
|
+
}
|
|
182
|
+
process.exitCode = 1
|
|
183
|
+
})
|