dsh-deepseek-web-login 0.5.2 → 0.5.3
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/CHANGELOG.md +20 -0
- package/lib/index.js +20 -4
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
本项目遵循大致语义化版本;日期为本地时间。
|
|
4
4
|
|
|
5
|
+
## 0.5.3 — 2026-09-27
|
|
6
|
+
|
|
7
|
+
> 修掉一个"重启后前 3 分钟里限流不换号"的窗口 —— 0.5.2 的漏洞。
|
|
8
|
+
|
|
9
|
+
### 修复
|
|
10
|
+
|
|
11
|
+
- **限流换号的冷却用错了基准**:0.5.2 里冷却要求「距上次换号 ≥ 3 分钟」,而"上次换号"
|
|
12
|
+
实际上取的是**插件启动时刻**(它同时还要给"按时间轮换"当计时起点)。两件事的语义不同 ——
|
|
13
|
+
一个是"从启动算起过了多久",一个是"上次真的换过号是什么时候" —— 在"启动后还没换过号"
|
|
14
|
+
这段区间里,它们给出**相反**的答案。
|
|
15
|
+
后果:**每次重启之后的 3 分钟内撞上限流,都不会换号**。而那恰好是最容易撞上的窗口
|
|
16
|
+
(重启往往就是为了接着跑任务)。
|
|
17
|
+
现在冷却改用独立的"上次真的换过号"时刻(只在换号成功与手动切号时推进):
|
|
18
|
+
**本次启动还没换过号 ⇒ 不套冷却**,限流立刻可换。
|
|
19
|
+
|
|
20
|
+
### 说明
|
|
21
|
+
|
|
22
|
+
- 只影响"限流换号"这条路径的时间判定;按时间轮换、封禁换号、退避分流都不变。
|
|
23
|
+
- ⚠️ **升级后需要重启 DSH 才生效**(`link:` 安装方式不热重载)。
|
|
24
|
+
|
|
5
25
|
## 0.5.2 — 2026-09-27
|
|
6
26
|
|
|
7
27
|
> 限流时也能自动换号接下去,不用再手动重发。
|
package/lib/index.js
CHANGED
|
@@ -6363,7 +6363,7 @@ function decideAutoSwitch(params) {
|
|
|
6363
6363
|
const currentUnusable = current !== void 0 && !isUsable(current, now);
|
|
6364
6364
|
const throttleSwitch = isThrottleSwitchAllowed({
|
|
6365
6365
|
throttledAt: currentId === void 0 ? void 0 : params.throttledAt?.get(currentId),
|
|
6366
|
-
lastSwitchAt,
|
|
6366
|
+
lastSwitchAt: params.lastSwitchedAt ?? 0,
|
|
6367
6367
|
now,
|
|
6368
6368
|
...params.throttleWindowMs === void 0 ? {} : { windowMs: params.throttleWindowMs },
|
|
6369
6369
|
...params.throttleCooldownMs === void 0 ? {} : { cooldownMs: params.throttleCooldownMs }
|
|
@@ -8648,7 +8648,7 @@ async function checkForUpdate(current, fetchImpl) {
|
|
|
8648
8648
|
* 兜底常量与 package.json 的一致性由 `tests/check-smoke.mjs` 守着,不会漂。
|
|
8649
8649
|
*/
|
|
8650
8650
|
/** 与 package.json 保持一致的兜底版本(由测试保证不会漂)。 */
|
|
8651
|
-
const FALLBACK_VERSION = "0.5.
|
|
8651
|
+
const FALLBACK_VERSION = "0.5.3";
|
|
8652
8652
|
let cached;
|
|
8653
8653
|
/** 本插件版本(如 `0.1.26`)。 */
|
|
8654
8654
|
function pluginVersion() {
|
|
@@ -9199,6 +9199,19 @@ function apply(ctx, config = {}) {
|
|
|
9199
9199
|
logger.info?.(`deepseek-web: 传输层=${transportState.effective}` + (transportState.degraded ? "(配置要求 Chromium,但本环境没有 electron.net.fetch,已降级为 Node)" : ""));
|
|
9200
9200
|
let lastAutoSwitchAt = Date.now();
|
|
9201
9201
|
/**
|
|
9202
|
+
* 上一次**真正换过号**的时刻(自动或手动),0 = 本次启动还没换过。
|
|
9203
|
+
*
|
|
9204
|
+
* 🔴 为什么不能用上面那个 `lastAutoSwitchAt` 代替:它在启动时被初始化成"启动时刻"
|
|
9205
|
+
* (`isSwitchDue` 要的是"从启动算起过了多久")。而限流换号有自己的**冷却**(距上次换号
|
|
9206
|
+
* 至少 3 分钟),若拿"启动时刻"当"上次换号",就会**每次重启后都开出一段"限流也不换号"
|
|
9207
|
+
* 的窗口** —— 实测 2026-09-27:插件 10:56:30 启动、10:57:54 撞限流,距启动只有 73 秒
|
|
9208
|
+
* ⇒ 被自己的冷却挡掉,用户看到的是"依旧没有自动切换账号"。
|
|
9209
|
+
* 用它之后语义才对:**没换过号 ⇒ 不套冷却**(限流是明确的坏状态,值得立刻换走)。
|
|
9210
|
+
*
|
|
9211
|
+
* 只在**换号成功**(含手动切号)时更新;探活失败、换号抛错都不算换过号。
|
|
9212
|
+
*/
|
|
9213
|
+
let lastSwitchedAt = 0;
|
|
9214
|
+
/**
|
|
9202
9215
|
* 最近一次**自动**换号的记录(只给界面显示用,不落盘)。
|
|
9203
9216
|
*
|
|
9204
9217
|
* 只记自动换号:手动切号是用户自己的操作,界面不需要"提示"他刚做过什么。
|
|
@@ -9230,7 +9243,8 @@ function apply(ctx, config = {}) {
|
|
|
9230
9243
|
now: Date.now(),
|
|
9231
9244
|
accounts,
|
|
9232
9245
|
currentId: activeAccountId(),
|
|
9233
|
-
throttledAt: throttleAt
|
|
9246
|
+
throttledAt: throttleAt,
|
|
9247
|
+
lastSwitchedAt
|
|
9234
9248
|
});
|
|
9235
9249
|
if (decision.action !== "switch") return;
|
|
9236
9250
|
autoSwitching = true;
|
|
@@ -9250,6 +9264,7 @@ function apply(ctx, config = {}) {
|
|
|
9250
9264
|
const fromId = activeAccountId();
|
|
9251
9265
|
if (!setActiveAccount(decision.nextId)) return;
|
|
9252
9266
|
lastAutoSwitchAt = Date.now();
|
|
9267
|
+
lastSwitchedAt = Date.now();
|
|
9253
9268
|
const fromRecord = fromId ? readAccount(fromId) : void 0;
|
|
9254
9269
|
lastAutoSwitch = {
|
|
9255
9270
|
at: lastAutoSwitchAt,
|
|
@@ -9281,7 +9296,7 @@ function apply(ctx, config = {}) {
|
|
|
9281
9296
|
const now = Date.now();
|
|
9282
9297
|
if (kind === "throttled" && !isThrottleSwitchAllowed({
|
|
9283
9298
|
throttledAt: now,
|
|
9284
|
-
lastSwitchAt:
|
|
9299
|
+
lastSwitchAt: lastSwitchedAt,
|
|
9285
9300
|
now
|
|
9286
9301
|
})) return false;
|
|
9287
9302
|
const fresh = freshThrottledIds(throttleAt, now);
|
|
@@ -9720,6 +9735,7 @@ function apply(ctx, config = {}) {
|
|
|
9720
9735
|
}
|
|
9721
9736
|
logger.info?.(`deepseek-web: 当前账号已切换为 ${id}`);
|
|
9722
9737
|
lastAutoSwitchAt = Date.now();
|
|
9738
|
+
lastSwitchedAt = Date.now();
|
|
9723
9739
|
sendJson(res, 200, {
|
|
9724
9740
|
ok: true,
|
|
9725
9741
|
activeId: id
|