dsh-wtq-pool 1.0.5 → 1.1.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/CHANGELOG.md +34 -98
- package/README.en.md +25 -26
- package/README.md +26 -27
- package/lib/client.js +39 -6
- package/lib/index.js +1327 -225
- package/package.json +2 -2
- package/renderer/index.html +14 -10
- package/renderer/panel.css +16 -5
- package/renderer/panel.js +166 -82
package/renderer/panel.js
CHANGED
|
@@ -50,10 +50,13 @@ var EN = {
|
|
|
50
50
|
"region.parkedShort": "disabled",
|
|
51
51
|
"region.global": "Global",
|
|
52
52
|
"region.cnShort": "CN",
|
|
53
|
-
"region.globalShort": "Global",
|
|
54
53
|
"pool.summary": "{count} account(s) · {cooling} cooling",
|
|
55
54
|
"pool.healthy": "Rate limits automatically switch to another available account.",
|
|
56
55
|
"pool.allCooling": "Every account is rate-limited right now; requests pause until a cooldown lifts.",
|
|
56
|
+
"pool.refused": "{count} need a new sign-in",
|
|
57
|
+
"pool.allRefused": "Every account's sign-in was refused by the upstream; add one with Add account and the pool starts working again.",
|
|
58
|
+
"pool.restricted": "{count} restricted by the upstream",
|
|
59
|
+
"pool.allRestricted": "Every account was restricted by the upstream; appeal the restriction in the WorkBuddy console, or add another account.",
|
|
57
60
|
"pool.checkinAll": "Check in every account",
|
|
58
61
|
"pool.checkinAllHint": "Collect every account's daily check-in. The streak bonus is collected with it.",
|
|
59
62
|
"pool.checkinAllBusy": "Checking in…",
|
|
@@ -106,6 +109,7 @@ var EN = {
|
|
|
106
109
|
"qoder.fallback": "preferred port {port} is taken; this session serves a spare port, which the provider row follows",
|
|
107
110
|
"badge.next": "next up",
|
|
108
111
|
"badge.cooling": "cooling",
|
|
112
|
+
"badge.revoked": "re-login needed",
|
|
109
113
|
"badge.healthy": "healthy",
|
|
110
114
|
"acct.token": "token {time}",
|
|
111
115
|
"acct.tokenExpiring": "token expires in {min} min",
|
|
@@ -114,13 +118,18 @@ var EN = {
|
|
|
114
118
|
"time.days": "{count} d",
|
|
115
119
|
"acct.noExpiry": "no token expiry reported",
|
|
116
120
|
"acct.coolUntil": "cooling until {time}",
|
|
121
|
+
"acct.holdUntil": "held until {time}",
|
|
122
|
+
"acct.restrictedUntil": "restricted by the upstream until {time}",
|
|
123
|
+
"acct.restrictedHint": "The upstream restricted this account (11140: unusual activity). The pool leaves it out of rotation six hours at a time and retries afterwards; appeal it in the WorkBuddy console.",
|
|
124
|
+
"badge.restricted": "restricted",
|
|
125
|
+
"acct.signInRefused": "The upstream no longer accepts this account's sign-in, and its refresh token is spent. Add the account again from the panel: that sign-in is the plugin's own copy.",
|
|
117
126
|
"acct.hits": "{hits} rate-limit hit(s)",
|
|
118
127
|
"acct.choose": "Use credits from",
|
|
119
128
|
"acct.automatic": "Automatic (follow account usage)",
|
|
120
129
|
"acct.choiceHint": "The picked account goes first; a rate limit switches account until the cooldown lifts. Automatic follows the usage mode.",
|
|
121
130
|
"acct.unavailable": "Selected account unavailable (automatic fallback)",
|
|
122
131
|
"acct.expired": "sign-in expired",
|
|
123
|
-
"acct.archivedHint": "
|
|
132
|
+
"acct.archivedHint": "No desktop sign-in file holds this account any more: the token the pool kept is what serves it, until that token expires. Signing the account in again in WorkBuddy renews it.",
|
|
124
133
|
"acct.choiceCredits": "{label} · {credits} credits",
|
|
125
134
|
"badge.preferred": "selected",
|
|
126
135
|
"acct.on": "Enabled",
|
|
@@ -128,17 +137,16 @@ var EN = {
|
|
|
128
137
|
"acct.switchOn": "Use this account again",
|
|
129
138
|
"acct.inPool": "In the rotation",
|
|
130
139
|
"acct.switchOff": "Keep this account out of the pool for now",
|
|
131
|
-
"acct.offHint": "Switched off: requests never use this account until you switch it back on.",
|
|
132
140
|
"acct.remove": "Remove",
|
|
133
141
|
"acct.removeHint": "Takes the account out of the pool. Restore it under “Removed accounts”.",
|
|
134
142
|
"acct.delete": "Delete",
|
|
135
|
-
"acct.deleteHint": "
|
|
136
|
-
"acct.deleteConfirm": "Delete {name}?
|
|
143
|
+
"acct.deleteHint": "Takes the account out of the pool and deletes the plugin's saved sign-in and archive; signing the account in again restores it.",
|
|
144
|
+
"acct.deleteConfirm": "Delete {name}? It leaves the pool and deletes the plugin's saved sign-in and archive; a rescan will not bring it back. Signing the account in again restores it.",
|
|
137
145
|
"acct.deleteConfirmAgain": "Press delete again to confirm",
|
|
138
146
|
"acct.stateError": "Could not change this account: {message}",
|
|
139
147
|
"pool.switchedOff": "{count} switched off",
|
|
140
148
|
"removed.title": "Removed accounts",
|
|
141
|
-
"removed.hint": "
|
|
149
|
+
"removed.hint": "Out of the pool; restore one here and it rejoins rotation.",
|
|
142
150
|
"removed.restore": "Restore",
|
|
143
151
|
"acct.modelCool": "{model} cooling until {time}",
|
|
144
152
|
"credits.title": "Credits",
|
|
@@ -243,16 +251,16 @@ var EN = {
|
|
|
243
251
|
"keepAlive.runNow": "Refresh now",
|
|
244
252
|
"keepAlive.running": "Refreshing…",
|
|
245
253
|
"keepAlive.label": "Token keep-alive",
|
|
246
|
-
"keepAlive.hint": "Renews sign-in tokens
|
|
254
|
+
"keepAlive.hint": "Renews sign-in tokens on demand: plugin-owned copies refresh once six hours old or close to expiry, and the result is written back into the file the plugin owns, so a refused sign-in shows up the same day. The desktop app renews the sign-in it is using.",
|
|
247
255
|
"growth.title": "Growth centre",
|
|
248
256
|
"growth.ready": "WorkBuddy",
|
|
249
257
|
"growth.running": "Running…",
|
|
250
258
|
"growth.read": "Read state",
|
|
251
259
|
"growth.reading": "Reading…",
|
|
252
|
-
"growth.readHint": "Reads what
|
|
260
|
+
"growth.readHint": "Reads the current tiers and what is due; Run now claims them.",
|
|
253
261
|
"growth.run": "Run now",
|
|
254
|
-
"growth.runHint": "Runs the growth
|
|
255
|
-
"growth.hint": "Four steps: the make-up card, the gift and compensation, the activity report, and the streak tiers with their draws. A run consumes the make-up card and the draws; the rest
|
|
262
|
+
"growth.runHint": "Runs the growth stage of the scheduled check-in on its own, and reports each step.",
|
|
263
|
+
"growth.hint": "Four steps: the make-up card, the gift and compensation, the activity report, and the streak tiers with their draws. A run consumes the make-up card and the draws; the rest can run again without paying twice.",
|
|
256
264
|
"growth.stateNone": "No state read yet",
|
|
257
265
|
"growth.stateStale": "The last run made this stale; read the state again",
|
|
258
266
|
"growth.stateSummary": "{accounts} account(s) · {tiers} tier(s) to redeem · {cards} make-up card(s) · {chances} draw(s)",
|
|
@@ -267,7 +275,7 @@ var EN = {
|
|
|
267
275
|
"growth.tierLocked": "locked",
|
|
268
276
|
"growth.rowNothing": "Nothing to collect here",
|
|
269
277
|
"growth.rowFailed": "This account could not be read",
|
|
270
|
-
"growth.onlyWorkbuddy": "The growth centre
|
|
278
|
+
"growth.onlyWorkbuddy": "The growth centre applies to WorkBuddy accounts.",
|
|
271
279
|
"growth.runNone": "Nothing to collect on this pass",
|
|
272
280
|
"growth.runLine": "{when}: make-up {makeup} · gift +{gift} · compensation +{compensation} · activity {activity} · tiers {streak} · draws {lottery} · +{credit} credits",
|
|
273
281
|
"growth.runFailed": "{when}: {failed} step(s) failed",
|
|
@@ -299,6 +307,7 @@ var EN = {
|
|
|
299
307
|
"foot.license": "License",
|
|
300
308
|
"err.bridge": "The panel bridge is unavailable.",
|
|
301
309
|
"err.busy": "The panel is busy with another action; try again in a moment.",
|
|
310
|
+
"err.stale": "The plugin was reloading; the list below is the last document before the reload. Refresh again.",
|
|
302
311
|
"tag.free": "free",
|
|
303
312
|
"tag.rate": "x{rate}",
|
|
304
313
|
"tag.promoNight": "free until {hour}",
|
|
@@ -336,10 +345,13 @@ var ZH = {
|
|
|
336
345
|
"region.parkedShort": "已停用",
|
|
337
346
|
"region.global": "国际版",
|
|
338
347
|
"region.cnShort": "国内版",
|
|
339
|
-
"region.globalShort": "国际版",
|
|
340
348
|
"pool.summary": "{count} 个账号 · {cooling} 个冷却中",
|
|
341
349
|
"pool.healthy": "限流时会自动切换到其他可用账号。",
|
|
342
350
|
"pool.allCooling": "所有账号当前都被限流,请求会等到有账号冷却结束。",
|
|
351
|
+
"pool.refused": "{count} 个需重新登录",
|
|
352
|
+
"pool.allRefused": "所有账号的登录都已被上游拒绝,用「添加账号」重新登录一个,号池就能继续用。",
|
|
353
|
+
"pool.restricted": "{count} 个被上游限制",
|
|
354
|
+
"pool.allRestricted": "所有账号都被上游限制了;请到 WorkBuddy 官方后台申诉,或换一个账号。",
|
|
343
355
|
"pool.checkinAll": "全部签到",
|
|
344
356
|
"pool.checkinAllHint": "一次领完所有账号今天的签到,连登奖励也随这一轮领取。",
|
|
345
357
|
"pool.checkinAllBusy": "签到中…",
|
|
@@ -350,7 +362,7 @@ var ZH = {
|
|
|
350
362
|
"pool.emptyHint": "请在该版本的 WorkBuddy 桌面 App 里登录,再点「重新检测账号」。",
|
|
351
363
|
"pool.sourceOff": "WorkBuddy 来源已在插件设置里关闭。",
|
|
352
364
|
"login.add": "添加账号",
|
|
353
|
-
"login.addHint": "在浏览器里登录 WorkBuddy
|
|
365
|
+
"login.addHint": "在浏览器里登录 WorkBuddy,完成后该账号即加入账号池。",
|
|
354
366
|
"login.openAgain": "再打开一次链接",
|
|
355
367
|
"login.waiting": "在浏览器里完成登录即可,面板会自己把这个账号收进来。",
|
|
356
368
|
"login.timeout": "登录没有完成。重新开始一次拿新链接。",
|
|
@@ -392,6 +404,7 @@ var ZH = {
|
|
|
392
404
|
"badge.next": "下一个",
|
|
393
405
|
"source.claimableAt": "{time} 后可签到",
|
|
394
406
|
"badge.cooling": "冷却中",
|
|
407
|
+
"badge.revoked": "需重新登录",
|
|
395
408
|
"badge.healthy": "可用",
|
|
396
409
|
"acct.token": "令牌 {time}",
|
|
397
410
|
"acct.tokenExpiring": "令牌将在 {min} 分钟后过期",
|
|
@@ -400,13 +413,18 @@ var ZH = {
|
|
|
400
413
|
"time.days": "{count} 天",
|
|
401
414
|
"acct.noExpiry": "令牌没有报告有效期",
|
|
402
415
|
"acct.coolUntil": "冷却至 {time}",
|
|
416
|
+
"acct.holdUntil": "暂停至 {time}",
|
|
417
|
+
"acct.restrictedUntil": "被上游限制,直至 {time}",
|
|
418
|
+
"acct.restrictedHint": "上游限制了这个账号(11140:账号存在异常行为)。号池每六小时重试一次;请到 WorkBuddy 官方后台提交申诉。",
|
|
419
|
+
"badge.restricted": "已限制",
|
|
420
|
+
"acct.signInRefused": "该账号的登录已被上游拒绝,刷新令牌同样失效。在面板上「添加账号」重新登录一次:这份登录由插件自己保管。",
|
|
403
421
|
"acct.hits": "已触发 {hits} 次限流",
|
|
404
422
|
"acct.choose": "使用哪个账号的额度",
|
|
405
423
|
"acct.automatic": "自动选择(按使用方式)",
|
|
406
424
|
"acct.choiceHint": "优先用所选账号,限流时临时换号;自动选择则按使用方式分配。",
|
|
407
425
|
"acct.unavailable": "所选账号暂不可用(自动换号)",
|
|
408
426
|
"acct.expired": "登录已过期",
|
|
409
|
-
"acct.archivedHint": "
|
|
427
|
+
"acct.archivedHint": "桌面端已经没有文件持有这个账号:面板上的这份令牌就是它在用的,到期为止。在 WorkBuddy 里重新登录该账号可续期。",
|
|
410
428
|
"acct.choiceCredits": "{label} · {credits} 积分",
|
|
411
429
|
"badge.preferred": "已选",
|
|
412
430
|
"acct.on": "启用中",
|
|
@@ -414,17 +432,16 @@ var ZH = {
|
|
|
414
432
|
"acct.switchOn": "重新使用该账号",
|
|
415
433
|
"acct.inPool": "参与轮换",
|
|
416
434
|
"acct.switchOff": "暂时不使用该账号",
|
|
417
|
-
"acct.offHint": "已停用:在重新启用之前,请求不会使用该账号。",
|
|
418
435
|
"acct.remove": "移除",
|
|
419
436
|
"acct.removeHint": "把账号移出账号池;可在「已移除的账号」里恢复。",
|
|
420
437
|
"acct.delete": "删除",
|
|
421
|
-
"acct.deleteHint": "
|
|
422
|
-
"acct.deleteConfirm": "要删除 {name}
|
|
438
|
+
"acct.deleteHint": "移出账号池,并删除插件保存的登录与留档;重新登录该账号即可恢复。",
|
|
439
|
+
"acct.deleteConfirm": "要删除 {name} 吗?它会退出账号池,插件保存的登录与留档一并删除;重新扫描不会再带回,重新登录该账号即可恢复。",
|
|
423
440
|
"acct.deleteConfirmAgain": "再按一次确认删除",
|
|
424
441
|
"acct.stateError": "账号设置失败:{message}",
|
|
425
442
|
"pool.switchedOff": "{count} 个已停用",
|
|
426
443
|
"removed.title": "已移除的账号",
|
|
427
|
-
"removed.hint": "
|
|
444
|
+
"removed.hint": "已退出账号池;在此恢复后重新参与分发。",
|
|
428
445
|
"removed.restore": "恢复",
|
|
429
446
|
"acct.modelCool": "{model} 冷却至 {time}",
|
|
430
447
|
"credits.title": "积分",
|
|
@@ -514,7 +531,7 @@ var ZH = {
|
|
|
514
531
|
"rewrite.on": "已开启",
|
|
515
532
|
"rewrite.off": "已关闭",
|
|
516
533
|
"rewrite.label": "改写发往国内版的提示词里的客户端名称",
|
|
517
|
-
"rewrite.hint": "WorkBuddy
|
|
534
|
+
"rewrite.hint": "WorkBuddy 国内版会拒绝提示词里把客户端名称写成 DeepSeek Harness 的对话请求(渠道校验 11128)。开启后,提示词里这个名称的每一处都改为 DeepSeek;关闭后恢复原名。",
|
|
518
535
|
"rewrite.show": "改写名称",
|
|
519
536
|
"rewrite.hide": "恢复原名",
|
|
520
537
|
"growth.title": "成长中心",
|
|
@@ -522,12 +539,12 @@ var ZH = {
|
|
|
522
539
|
"growth.running": "运行中…",
|
|
523
540
|
"growth.read": "读取状态",
|
|
524
541
|
"growth.reading": "读取中…",
|
|
525
|
-
"growth.readHint": "
|
|
542
|
+
"growth.readHint": "读取当前档位与可领取项;领取动作在「立即执行」。",
|
|
526
543
|
"growth.run": "立即执行",
|
|
527
|
-
"growth.runHint": "
|
|
528
|
-
"growth.hint": "
|
|
544
|
+
"growth.runHint": "单独执行定时签到里的成长环节,并按步骤报告结果。",
|
|
545
|
+
"growth.hint": "四项:补签卡、礼包与补偿、活跃上报、连登档位与抽奖。补签卡与抽奖次数在执行后扣减,其余分项可重复执行,只到账一次。",
|
|
529
546
|
"growth.stateNone": "还没有读过状态",
|
|
530
|
-
"growth.stateStale": "
|
|
547
|
+
"growth.stateStale": "执行后读数已过期,请重新读取",
|
|
531
548
|
"growth.stateSummary": "{accounts} 个账号 · 可兑换 {tiers} 档 · 补签卡 {cards} 张 · 抽奖 {chances} 次",
|
|
532
549
|
"growth.groupCount": "{count} 个账号",
|
|
533
550
|
"growth.stateFailed": "{failed} 个账号读不出来",
|
|
@@ -540,8 +557,8 @@ var ZH = {
|
|
|
540
557
|
"growth.tierLocked": "未解锁",
|
|
541
558
|
"growth.rowNothing": "这里没有可领的",
|
|
542
559
|
"growth.rowFailed": "这个账号读不出来",
|
|
543
|
-
"growth.onlyWorkbuddy": "
|
|
544
|
-
"growth.runNone": "
|
|
560
|
+
"growth.onlyWorkbuddy": "成长中心对 WorkBuddy 账号生效。",
|
|
561
|
+
"growth.runNone": "本次没有可领取的项",
|
|
545
562
|
"growth.runLine": "{when}:补签 {makeup} · 礼包 +{gift} · 补偿 +{compensation} · 活跃上报 {activity} · 档位 {streak} · 抽奖 {lottery} · 共 +{credit} 积分",
|
|
546
563
|
"growth.runFailed": "{when}:{failed} 个步骤失败",
|
|
547
564
|
"growth.busy": "签到正在跑,等它跑完",
|
|
@@ -561,13 +578,13 @@ var ZH = {
|
|
|
561
578
|
"auto.rowTrae": "Trae",
|
|
562
579
|
"auto.rowCounts": "{label}:领取 {claimed} · 跳过 {skipped} · 失败 {failed}",
|
|
563
580
|
"auto.rowGrowth": "连登:{streak} 档 · +{credit} 积分 · 失败 {failed}",
|
|
564
|
-
"auto.rowKeepAlive": "令牌保活 {when}:刷新 {refreshed} 个 ·
|
|
581
|
+
"auto.rowKeepAlive": "令牌保活 {when}:刷新 {refreshed} 个 · 已是最新 {fresh} 个 · 失败 {failed} 个 · 无刷新令牌 {noToken} 个",
|
|
565
582
|
"auto.rowTravelCounts": "{label}:派出 {departed} · 领奖 {claimed} · 领养 {adopted}",
|
|
566
583
|
"auto.hint": "时间到后一次性领取三家(WorkBuddy / Trae / Qoder)的签到奖励、WorkBuddy 国内账号的连登奖励,并顺带完成猫猫旅行;今天已领过的时段跳过。当天错过的时段在下次启动时补领。",
|
|
567
584
|
"keepAlive.runNow": "立即刷新",
|
|
568
585
|
"keepAlive.running": "刷新中…",
|
|
569
586
|
"keepAlive.label": "登录令牌保活",
|
|
570
|
-
"keepAlive.hint": "
|
|
587
|
+
"keepAlive.hint": "按需续期登录令牌:插件自管的副本满 6 小时或临近到期即刷新,结果写回插件自己的登录文件,登录被上游拒绝时当天即可发现。桌面端正在使用的登录由桌面端续期。",
|
|
571
588
|
"auto.badHours": "时间请填 0–23 的整数小时,例如 9 或 9,21。",
|
|
572
589
|
"check.title": "连接检查",
|
|
573
590
|
"check.empty": "运行检查可以看到对话能否连上 WorkBuddy、Trae 或 Qoder。",
|
|
@@ -582,6 +599,7 @@ var ZH = {
|
|
|
582
599
|
"foot.license": "许可",
|
|
583
600
|
"err.bridge": "面板桥不可用。",
|
|
584
601
|
"err.busy": "面板正在处理其他操作,请稍候再试。",
|
|
602
|
+
"err.stale": "插件刚刚重载,当前列表还是重载前的状态,请再刷新一次。",
|
|
585
603
|
"tag.free": "免费",
|
|
586
604
|
"tag.rate": "x{rate}",
|
|
587
605
|
"tag.promoNight": "夜间免费 · 到 {hour}",
|
|
@@ -838,7 +856,7 @@ var reserveDrafts = {};
|
|
|
838
856
|
// ----------------------------------------------------------------- render
|
|
839
857
|
|
|
840
858
|
function regionLabel(region, short) {
|
|
841
|
-
if (region === "global") return t(
|
|
859
|
+
if (region === "global") return t("region.global");
|
|
842
860
|
return t(short ? "region.cnShort" : "region.cn");
|
|
843
861
|
}
|
|
844
862
|
|
|
@@ -846,6 +864,18 @@ function accountsOf(region) {
|
|
|
846
864
|
return (state && state.accounts ? state.accounts : []).filter(function (a) { return a.region === region; });
|
|
847
865
|
}
|
|
848
866
|
|
|
867
|
+
/**
|
|
868
|
+
* A rate limit, as opposed to a hold the pool decided on its own.
|
|
869
|
+
*
|
|
870
|
+
* `cooling` is set for all three states, so a summary that counts it directly
|
|
871
|
+
* tells the user to wait out a window that does not exist: a refused sign-in
|
|
872
|
+
* needs a fresh login and a vendor restriction needs an appeal. Three summary
|
|
873
|
+
* lines counted it directly and each read "cooling" over a parked account.
|
|
874
|
+
*/
|
|
875
|
+
function isCooling(account) {
|
|
876
|
+
return account.cooling === true && account.hold !== "session" && account.hold !== "restricted";
|
|
877
|
+
}
|
|
878
|
+
|
|
849
879
|
|
|
850
880
|
|
|
851
881
|
function modelsOf(region) {
|
|
@@ -854,8 +884,18 @@ function modelsOf(region) {
|
|
|
854
884
|
|
|
855
885
|
function renderHeader() {
|
|
856
886
|
var accounts = state ? state.accounts || [] : [];
|
|
857
|
-
|
|
858
|
-
|
|
887
|
+
// A held sign-in is not a rate limit: counting it as cooling understated how
|
|
888
|
+
// many accounts the pool had actually lost, and the summary read "0 cooling"
|
|
889
|
+
// over a pool where half the rows could not answer.
|
|
890
|
+
// Three states, three counts: a refused sign-in, a vendor restriction and a
|
|
891
|
+
// rate limit all read as `cooling` upstream, and lumping them together told
|
|
892
|
+
// the user to wait out a window that does not exist.
|
|
893
|
+
var cooling = accounts.filter(isCooling).length;
|
|
894
|
+
var refused = accounts.filter(function (a) { return a.hold === "session"; }).length;
|
|
895
|
+
var restricted = accounts.filter(function (a) { return a.hold === "restricted"; }).length;
|
|
896
|
+
// A pool whose every account is refused has nobody to serve a turn, so the
|
|
897
|
+
// dot must not read healthy just because a refused sign-in is not cooling.
|
|
898
|
+
var healthy = accounts.length > 0 && cooling + refused + restricted < accounts.length;
|
|
859
899
|
var refreshing = state !== null && state.refreshing === true;
|
|
860
900
|
var dot = $("healthDot");
|
|
861
901
|
dot.className = "dot " + (state === null ? "idle" : (healthy ? "ok" : "idle")) + (refreshing ? " busy" : "");
|
|
@@ -866,7 +906,9 @@ function renderHeader() {
|
|
|
866
906
|
$("barTitle").textContent = "WTQ Pool";
|
|
867
907
|
var sub = state === null
|
|
868
908
|
? t("state.loading")
|
|
869
|
-
: t("pool.summary", { count: accounts.length, cooling: cooling })
|
|
909
|
+
: t("pool.summary", { count: accounts.length, cooling: cooling })
|
|
910
|
+
+ (refused > 0 ? " · " + t("pool.refused", { count: refused }) : "")
|
|
911
|
+
+ (restricted > 0 ? " · " + t("pool.restricted", { count: restricted }) : "");
|
|
870
912
|
// The first paint comes from cache while detection runs behind it, so say so
|
|
871
913
|
// instead of leaving the user to wonder why the numbers are not final yet.
|
|
872
914
|
if (state && state.refreshing === true) sub = sub + " · " + t("state.refreshing");
|
|
@@ -1129,7 +1171,7 @@ function renderWorkbuddyHead() {
|
|
|
1129
1171
|
clear(host);
|
|
1130
1172
|
if (state === null) return;
|
|
1131
1173
|
var accounts = state.accounts || [];
|
|
1132
|
-
var cooling = accounts.filter(
|
|
1174
|
+
var cooling = accounts.filter(isCooling).length;
|
|
1133
1175
|
var off = accounts.filter(function (account) { return account.disabled === true; }).length;
|
|
1134
1176
|
host.appendChild(el("strong", null, t("workbuddy.title")));
|
|
1135
1177
|
host.appendChild(el("span", "muted", t("pool.summary", { count: accounts.length, cooling: cooling })));
|
|
@@ -1171,18 +1213,24 @@ function renderPoolStrip() {
|
|
|
1171
1213
|
var strip = $("poolStrip");
|
|
1172
1214
|
clear(strip);
|
|
1173
1215
|
var accounts = accountsOf(activeRegion);
|
|
1174
|
-
var
|
|
1216
|
+
var refused = accounts.filter(function (a) { return a.hold === "session"; }).length;
|
|
1217
|
+
var restricted = accounts.filter(function (a) { return a.hold === "restricted"; }).length;
|
|
1175
1218
|
var off = accounts.filter(function (a) { return a.disabled === true; }).length;
|
|
1176
|
-
// Only the accounts that can serve
|
|
1177
|
-
//
|
|
1178
|
-
//
|
|
1179
|
-
//
|
|
1180
|
-
//
|
|
1181
|
-
|
|
1219
|
+
// Only the accounts that can serve a turn right now are counted. A
|
|
1220
|
+
// switched-off account is not rate-limited, and a refused sign-in is parked,
|
|
1221
|
+
// so counting either would read "every account is rate-limited" over a row
|
|
1222
|
+
// that also said "1 switched off". A pool whose serving accounts are all
|
|
1223
|
+
// cooling really does pause, and one with nothing switched on says so on the
|
|
1224
|
+
// line below rather than here.
|
|
1225
|
+
var usable = accounts.filter(function (a) { return a.disabled !== true && !a.cooling; }).length;
|
|
1182
1226
|
var noteText = accounts.length === 0
|
|
1183
1227
|
? ""
|
|
1184
|
-
:
|
|
1228
|
+
: usable <= 0
|
|
1229
|
+
? (restricted > 0 && refused === 0 ? t("pool.allRestricted") : refused > 0 ? t("pool.allRefused") : t("pool.allCooling"))
|
|
1230
|
+
: t("pool.healthy");
|
|
1185
1231
|
if (noteText) strip.appendChild(el("span", "muted", noteText));
|
|
1232
|
+
if (refused > 0) strip.appendChild(el("span", "finding-fail", t("pool.refused", { count: refused })));
|
|
1233
|
+
if (restricted > 0) strip.appendChild(el("span", "finding-fail", t("pool.restricted", { count: restricted })));
|
|
1186
1234
|
if (off > 0) strip.appendChild(el("span", "muted", t("pool.switchedOff", { count: off })));
|
|
1187
1235
|
}
|
|
1188
1236
|
|
|
@@ -1725,16 +1773,19 @@ function renderAutoCheckin() {
|
|
|
1725
1773
|
run.disabled = busy !== null;
|
|
1726
1774
|
|
|
1727
1775
|
// The keep-alive row: one button, run by hand. It is a static node, so the
|
|
1728
|
-
// handler lives in `bind`.
|
|
1776
|
+
// handler lives in `bind`. Its own card, its own log: it renews tokens rather
|
|
1777
|
+
// than collecting rewards and has no hour to set, so it shares nothing with
|
|
1778
|
+
// the schedule beside the accounts both walk. The head carries no second
|
|
1779
|
+
// reading of the last run - the row below already says when, and two labels
|
|
1780
|
+
// for one fact is how one of them ends up stale.
|
|
1729
1781
|
var keepAliveRun = $("tokenKeepAliveRun");
|
|
1730
1782
|
keepAliveRun.textContent = busy === "keepAlive" ? t("keepAlive.running") : t("keepAlive.runNow");
|
|
1731
1783
|
keepAliveRun.disabled = busy !== null;
|
|
1732
|
-
$("
|
|
1784
|
+
$("keepAliveTitle").textContent = t("keepAlive.label");
|
|
1733
1785
|
$("keepAliveHint").textContent = t("keepAlive.hint");
|
|
1734
1786
|
$("autoHint").textContent = t("auto.hint");
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
paintAutoNote($("autoNote"), { last: auto.last, keepAlive: state && state.keepAlive });
|
|
1787
|
+
paintAutoNote($("autoNote"), { last: auto.last });
|
|
1788
|
+
paintKeepAliveNote($("keepAliveNote"), state && state.keepAlive);
|
|
1738
1789
|
}
|
|
1739
1790
|
|
|
1740
1791
|
/**
|
|
@@ -1794,38 +1845,14 @@ function renderRewriteClientName() {
|
|
|
1794
1845
|
*/
|
|
1795
1846
|
function autoNoteRows(auto) {
|
|
1796
1847
|
var last = auto.last;
|
|
1797
|
-
|
|
1798
|
-
// reports on its own line and says when it last ran - on every path, including
|
|
1799
|
-
// the ones that have nothing to say about a check-in pass. Its record is the
|
|
1800
|
-
// only proof the button did anything, and a restart clears the pass log without
|
|
1801
|
-
// touching it.
|
|
1802
|
-
var keepAliveRow = null;
|
|
1803
|
-
if (auto.keepAlive) {
|
|
1804
|
-
keepAliveRow = {
|
|
1805
|
-
text: t("auto.rowKeepAlive", {
|
|
1806
|
-
when: formatStamp(auto.keepAlive.at),
|
|
1807
|
-
refreshed: Number(auto.keepAlive.refreshed) || 0,
|
|
1808
|
-
fresh: Number(auto.keepAlive.fresh) || 0,
|
|
1809
|
-
failed: Number(auto.keepAlive.failed) || 0,
|
|
1810
|
-
noToken: Number(auto.keepAlive.noToken) || 0,
|
|
1811
|
-
}),
|
|
1812
|
-
tone: Number(auto.keepAlive.failed) > 0 || Number(auto.keepAlive.noToken) > 0 ? "fail"
|
|
1813
|
-
: Number(auto.keepAlive.refreshed) > 0 ? "ok" : "",
|
|
1814
|
-
};
|
|
1815
|
-
}
|
|
1816
|
-
// What the pass log has to say, with the keep-alive line kept on the end.
|
|
1817
|
-
var finish = function (rows) {
|
|
1818
|
-
if (keepAliveRow !== null) rows.push(keepAliveRow);
|
|
1819
|
-
return rows;
|
|
1820
|
-
};
|
|
1821
|
-
if (!last) return finish([{ text: t("auto.neverRun"), tone: "" }]);
|
|
1848
|
+
if (!last) return [{ text: t("auto.neverRun"), tone: "" }];
|
|
1822
1849
|
// Opening stub: sources have not answered yet. A finished "0 accounts" row
|
|
1823
1850
|
// here is what "run now" painted and then never replaced.
|
|
1824
1851
|
if (last.pending === true && last.travel == null && last.qoder == null && last.trae == null) {
|
|
1825
|
-
return
|
|
1852
|
+
return [{ text: t("auto.running"), tone: "" }];
|
|
1826
1853
|
}
|
|
1827
1854
|
var slot = String(last.slot).replace("T", " ");
|
|
1828
|
-
if (last.error) return
|
|
1855
|
+
if (last.error) return [{ text: t("auto.lastFailedAt", { slot: slot, message: last.error }), tone: "fail" }];
|
|
1829
1856
|
var rows = [];
|
|
1830
1857
|
if (last.pending === true) rows.push({ text: t("auto.running"), tone: "" });
|
|
1831
1858
|
// The head count is every source's claimed accounts, matching the rows
|
|
@@ -1883,7 +1910,50 @@ function autoNoteRows(auto) {
|
|
|
1883
1910
|
}
|
|
1884
1911
|
push(t("auto.rowQoder"), last.qoder);
|
|
1885
1912
|
push(t("auto.rowTrae"), last.trae);
|
|
1886
|
-
return
|
|
1913
|
+
return rows;
|
|
1914
|
+
}
|
|
1915
|
+
|
|
1916
|
+
/**
|
|
1917
|
+
* The keep-alive's own line: what its last run did, and when.
|
|
1918
|
+
*
|
|
1919
|
+
* A duty of its own rather than a stage of the check-in pass, so it reports on
|
|
1920
|
+
* its own card and says when it last ran - on every path, including the ones
|
|
1921
|
+
* that have nothing to say about a check-in pass. Its record is the only proof
|
|
1922
|
+
* the button did anything, and a restart clears the pass log without touching
|
|
1923
|
+
* it.
|
|
1924
|
+
*/
|
|
1925
|
+
function keepAliveNoteRow(keepAlive) {
|
|
1926
|
+
if (!keepAlive) return null;
|
|
1927
|
+
return {
|
|
1928
|
+
text: t("auto.rowKeepAlive", {
|
|
1929
|
+
when: formatStamp(keepAlive.at),
|
|
1930
|
+
refreshed: Number(keepAlive.refreshed) || 0,
|
|
1931
|
+
fresh: Number(keepAlive.fresh) || 0,
|
|
1932
|
+
failed: Number(keepAlive.failed) || 0,
|
|
1933
|
+
noToken: Number(keepAlive.noToken) || 0,
|
|
1934
|
+
}),
|
|
1935
|
+
tone: Number(keepAlive.failed) > 0 || Number(keepAlive.noToken) > 0 ? "fail"
|
|
1936
|
+
: Number(keepAlive.refreshed) > 0 ? "ok" : "",
|
|
1937
|
+
};
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
/** Paint the keep-alive log as rows, so the caller does not build markup inline. */
|
|
1941
|
+
function paintKeepAliveNote(host, keepAlive) {
|
|
1942
|
+
var atBottom = host.scrollTop + host.clientHeight >= host.scrollHeight - 4;
|
|
1943
|
+
var rowCount = host.childElementCount;
|
|
1944
|
+
clear(host);
|
|
1945
|
+
var row = keepAliveNoteRow(keepAlive);
|
|
1946
|
+
// No run yet leaves the box out of the card rather than drawing an empty
|
|
1947
|
+
// frame: the card head already says it has not run, and an empty bordered box
|
|
1948
|
+
// reads as a log that failed to load.
|
|
1949
|
+
host.hidden = row === null;
|
|
1950
|
+
if (row !== null) {
|
|
1951
|
+
var line = el("div", "log-line" + (row.tone ? " " + row.tone : ""));
|
|
1952
|
+
line.appendChild(el("span", "log-dot"));
|
|
1953
|
+
line.appendChild(el("span", "log-text", row.text));
|
|
1954
|
+
host.appendChild(line);
|
|
1955
|
+
}
|
|
1956
|
+
if (host.childElementCount !== rowCount || atBottom) host.scrollTop = host.scrollHeight;
|
|
1887
1957
|
}
|
|
1888
1958
|
|
|
1889
1959
|
/** Paint the check-in log as rows, so the caller does not build markup inline. */
|
|
@@ -2179,7 +2249,7 @@ function runGrowth() {
|
|
|
2179
2249
|
});
|
|
2180
2250
|
}).catch(function (error) {
|
|
2181
2251
|
var message = String(error && error.message ? error.message : error);
|
|
2182
|
-
note(/BUSY
|
|
2252
|
+
note(/BUSY|already running/i.test(message) ? t("growth.busy") : message);
|
|
2183
2253
|
});
|
|
2184
2254
|
}
|
|
2185
2255
|
function renderAccounts() {
|
|
@@ -2297,6 +2367,11 @@ function renderRemoved(host) {
|
|
|
2297
2367
|
|
|
2298
2368
|
function accountCard(account) {
|
|
2299
2369
|
var off = account.disabled === true;
|
|
2370
|
+
// The upstream refused this sign-in and a forced refresh could not save it.
|
|
2371
|
+
// The row says so in its own words: the account is not waiting out a window,
|
|
2372
|
+
// and only a new sign-in brings it back.
|
|
2373
|
+
var refused = account.hold === "session";
|
|
2374
|
+
var restricted = account.hold === "restricted";
|
|
2300
2375
|
|
|
2301
2376
|
// Listed but out of rotation: the app overwrote this account's sign-in with
|
|
2302
2377
|
// the next one, so the card stays readable but says why it is not picked.
|
|
@@ -2312,8 +2387,8 @@ function accountCard(account) {
|
|
|
2312
2387
|
if (account.preferred) head.appendChild(el("span", "badge next", t("badge.preferred")));
|
|
2313
2388
|
// An archived account keeps serving, so its badge reports the same health as
|
|
2314
2389
|
// any other; the note below the head says where its sign-in now comes from.
|
|
2315
|
-
head.appendChild(el("span", "badge " + (off ? "off" : account.cooling ? "cool" : "ok"),
|
|
2316
|
-
off ? t("acct.off") : account.cooling ? t("badge.cooling") : t("badge.healthy")));
|
|
2390
|
+
head.appendChild(el("span", "badge " + (off ? "off" : refused ? "dead" : restricted || account.cooling ? "cool" : "ok"),
|
|
2391
|
+
off ? t("acct.off") : refused ? t("badge.revoked") : restricted ? t("badge.restricted") : account.cooling ? t("badge.cooling") : t("badge.healthy")));
|
|
2317
2392
|
|
|
2318
2393
|
// "Not right now" and "not mine any more" are different decisions, so they
|
|
2319
2394
|
// stay separate controls: a switch the user flips, and a plain remove button.
|
|
@@ -2415,15 +2490,18 @@ function accountCard(account) {
|
|
|
2415
2490
|
card.appendChild(head);
|
|
2416
2491
|
|
|
2417
2492
|
if (archived) card.appendChild(el("div", "hint muted", t("acct.archivedHint")));
|
|
2418
|
-
if (
|
|
2493
|
+
if (refused) card.appendChild(el("div", "hint finding-fail", t("acct.signInRefused")));
|
|
2494
|
+
if (restricted) card.appendChild(el("div", "hint finding-fail", t("acct.restrictedHint")));
|
|
2419
2495
|
|
|
2420
2496
|
var meta = el("div", "model-meta");
|
|
2421
2497
|
// Not beside a badge that already says the token is expired.
|
|
2422
2498
|
if (account.expired !== true) meta.appendChild(tokenChip(account.expiresAt));
|
|
2423
2499
|
if (account.cooling && account.cooldownUntil) {
|
|
2424
|
-
|
|
2500
|
+
// A hold is not a rate limit: it names the moment the pool stops waiting,
|
|
2501
|
+
// not a window the upstream set.
|
|
2502
|
+
meta.appendChild(el("span", "finding-fail", t(refused ? "acct.holdUntil" : restricted ? "acct.restrictedUntil" : "acct.coolUntil", { time: formatStamp(account.cooldownUntil) })));
|
|
2425
2503
|
}
|
|
2426
|
-
if (num(account.rateLimitHits, 0) > 0) {
|
|
2504
|
+
if (num(account.rateLimitHits, 0) > 0 && !refused && !restricted) {
|
|
2427
2505
|
meta.appendChild(el("span", null, t("acct.hits", { hits: account.rateLimitHits })));
|
|
2428
2506
|
}
|
|
2429
2507
|
card.appendChild(meta);
|
|
@@ -2436,6 +2514,9 @@ function accountCard(account) {
|
|
|
2436
2514
|
// account's billing data yet, so say so instead of showing nothing.
|
|
2437
2515
|
if (account.probePending === true) {
|
|
2438
2516
|
card.appendChild(el("div", "hint muted", t("probe.pending")));
|
|
2517
|
+
} else if (refused) {
|
|
2518
|
+
// No read was spent on this account, so there is no credits figure and no
|
|
2519
|
+
// upstream error to show: the hold above is the whole story.
|
|
2439
2520
|
} else if (account.creditsError) {
|
|
2440
2521
|
card.appendChild(el("div", "hint finding-fail", t("credits.unavailable") + ": " + account.creditsError));
|
|
2441
2522
|
} else if (account.credits) {
|
|
@@ -2636,7 +2717,9 @@ function checkinBlock(account) {
|
|
|
2636
2717
|
var wrap = el("div", "checkin");
|
|
2637
2718
|
wrap.appendChild(el("span", "card-title", t("checkin.title")));
|
|
2638
2719
|
|
|
2639
|
-
|
|
2720
|
+
// A held sign-in is not read at all, so an error here would be the previous
|
|
2721
|
+
// read's; the account card already carries the hold and its remedy.
|
|
2722
|
+
if (account.checkinError && account.hold !== "session") {
|
|
2640
2723
|
wrap.appendChild(el("span", "hint finding-fail", account.checkinError));
|
|
2641
2724
|
return wrap;
|
|
2642
2725
|
}
|
|
@@ -3961,7 +4044,8 @@ function runBusy(id, work) {
|
|
|
3961
4044
|
return work().then(function (result) {
|
|
3962
4045
|
busy = null;
|
|
3963
4046
|
if (result && result.accounts) adopt(result);
|
|
3964
|
-
note(
|
|
4047
|
+
if (result && result.stale === true) note(t("err.stale"), "warn");
|
|
4048
|
+
else note(null);
|
|
3965
4049
|
render();
|
|
3966
4050
|
pollCheckinLog(0);
|
|
3967
4051
|
return result;
|
|
@@ -4133,7 +4217,7 @@ function rescan() {
|
|
|
4133
4217
|
return runBusy("rescan", function () { return invoke("xd.rescan"); })
|
|
4134
4218
|
.then(function (next) { announce(t("pool.summary", {
|
|
4135
4219
|
count: (next.accounts || []).length,
|
|
4136
|
-
cooling: (next.accounts || []).filter(
|
|
4220
|
+
cooling: (next.accounts || []).filter(isCooling).length,
|
|
4137
4221
|
})); })
|
|
4138
4222
|
.catch(function () {});
|
|
4139
4223
|
}
|