@refeain/dsh-xdpool 3.0.9 → 3.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/lib/bin.js CHANGED
@@ -11649,7 +11649,10 @@ var WorkBuddyScheduler = class {
11649
11649
  const restored = options.loadEarnings?.();
11650
11650
  const today = dayKey(this.now());
11651
11651
  if (restored !== void 0 && restored.date === today) {
11652
- for (const [id, entry] of Object.entries(restored.accounts)) this.earnings.set(id, entry);
11652
+ for (const [id, entry] of Object.entries(restored.accounts)) {
11653
+ if (entry.date !== today) continue;
11654
+ this.earnings.set(id, entry);
11655
+ }
11653
11656
  this.earningsDate = today;
11654
11657
  }
11655
11658
  this.enabled = options.enabled ?? false;
@@ -11693,7 +11696,10 @@ var WorkBuddyScheduler = class {
11693
11696
  applyEarningsLedger(ledger) {
11694
11697
  const today = dayKey(this.now());
11695
11698
  if (ledger.date !== today) return;
11696
- for (const [id, entry] of Object.entries(ledger.accounts)) this.earnings.set(id, entry);
11699
+ for (const [id, entry] of Object.entries(ledger.accounts)) {
11700
+ if (entry.date !== today) continue;
11701
+ this.earnings.set(id, entry);
11702
+ }
11697
11703
  this.earningsDate = today;
11698
11704
  }
11699
11705
  applyConfig(options) {
package/lib/client.js CHANGED
@@ -269,7 +269,7 @@ window.__ModuleLoader__.load({
269
269
  const POOL_NAV_ICON_MASK_URL = `data:image/svg+xml;utf8,${encodeURIComponent(POOL_NAV_ICON_SVG)}`;
270
270
  //#endregion
271
271
  //#region src/version.ts
272
- const POOL_VERSION = "3.0.9";
272
+ const POOL_VERSION = "3.1.0";
273
273
  function compareVersions(left, right) {
274
274
  const parse = (value) => {
275
275
  const [core, ...rest] = value.trim().replace(/^v/u, "").split("-");
@@ -10314,7 +10314,7 @@ window.__ModuleLoader__.load({
10314
10314
  return "签到失败";
10315
10315
  }
10316
10316
  }
10317
- function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, autoClaimReport, autoClaimFailing, banner, regionCards }) {
10317
+ function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, autoClaimReport, autoClaimFailing, autoClaimEarned, banner, regionCards }) {
10318
10318
  const [ownActive, setOwnActive] = (0, react.useState)("");
10319
10319
  const [loginState, setLoginState] = (0, react.useState)(void 0);
10320
10320
  const loginAbort = (0, react.useRef)(void 0);
@@ -11645,6 +11645,10 @@ window.__ModuleLoader__.load({
11645
11645
  className: "sum-sub",
11646
11646
  ...autoClaimFailing === true ? { "data-tone": "err" } : {},
11647
11647
  children: autoClaimReport
11648
+ }),
11649
+ autoClaimEarned === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
11650
+ className: "sum-sub",
11651
+ children: autoClaimEarned
11648
11652
  })
11649
11653
  ]
11650
11654
  })]
@@ -16164,6 +16168,34 @@ window.__ModuleLoader__.load({
16164
16168
  return AUTOMATION_JOBS.map((kind) => jobs[kind]);
16165
16169
  }
16166
16170
  const FAILURE_LINES_SHOWN = 2;
16171
+ function automationEarnedToday(status, t) {
16172
+ const today = status?.automation?.earningsToday;
16173
+ if (today === void 0) return void 0;
16174
+ let credit = 0;
16175
+ let energy = 0;
16176
+ let claimed = 0;
16177
+ let sawToday = false;
16178
+ for (const entry of Object.values(today)) {
16179
+ if (entry.date !== dayKeyOfToday()) continue;
16180
+ sawToday = true;
16181
+ credit += entry.credit + entry.checkinCredit + entry.bonusCredit + entry.travelCredit + entry.compensationCredit;
16182
+ energy += entry.energy;
16183
+ claimed += entry.claimed;
16184
+ }
16185
+ if (!sawToday) return void 0;
16186
+ if (credit === 0 && energy === 0 && claimed === 0) return void 0;
16187
+ return t?.("channelpool.autoEarned", {
16188
+ credit,
16189
+ energy,
16190
+ count: claimed
16191
+ }) ?? `${String(credit)} credits · ${String(energy)} energy · ${String(claimed)} task(s)`;
16192
+ }
16193
+ function dayKeyOfToday() {
16194
+ const now = new Date();
16195
+ const month = String(now.getMonth() + 1).padStart(2, "0");
16196
+ const day = String(now.getDate()).padStart(2, "0");
16197
+ return `${String(now.getFullYear())}-${month}-${day}`;
16198
+ }
16167
16199
  function automationFailures(status) {
16168
16200
  const lines = automationJobs(status).flatMap((job) => job.failures ?? []);
16169
16201
  if (lines.length === 0) return void 0;
@@ -16630,6 +16662,7 @@ window.__ModuleLoader__.load({
16630
16662
  },
16631
16663
  autoClaimReport: automationFailures(statusOf("cn")),
16632
16664
  autoClaimFailing: automationJobs(statusOf("cn")).some((job) => job.failed > 0),
16665
+ autoClaimEarned: automationEarnedToday(statusOf("cn"), t),
16633
16666
  banner: flash === void 0 && error === void 0 ? void 0 : (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [flash === void 0 ? null : (0, react_jsx_runtime.jsx)("p", {
16634
16667
  className: "note",
16635
16668
  children: flash
@@ -20562,6 +20595,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20562
20595
  "channelpool.autoClaimRun": "Run now",
20563
20596
  "channelpool.autoClaimRunning": "Running…",
20564
20597
  "channelpool.autoClaimRunHint": "Run one collection pass now instead of waiting for the scheduled hour",
20598
+ "channelpool.autoEarned": "{credit} credits · {energy} energy · {count} task(s)",
20565
20599
  "channelpool.modePrefer": "Priority",
20566
20600
  "channelpool.modePreferHint": "Priority: always use the first account until it is rate-limited.",
20567
20601
  "channelpool.modeRoundRobin": "Round robin",
@@ -21326,6 +21360,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
21326
21360
  "channelpool.autoClaimRun": "立即执行",
21327
21361
  "channelpool.autoClaimRunning": "领取中…",
21328
21362
  "channelpool.autoClaimRunHint": "马上跑一轮领取,不用等到预定时间",
21363
+ "channelpool.autoEarned": "{credit} 积分 · {energy} 能量 · {count} 个任务",
21329
21364
  "channelpool.modePrefer": "优先",
21330
21365
  "channelpool.modePreferHint": "优先:总用排在前面的账号,它限流了才换下一个。",
21331
21366
  "channelpool.modeRoundRobin": "轮换",
package/lib/index.js CHANGED
@@ -29380,7 +29380,7 @@ function parseBody(body) {
29380
29380
  *
29381
29381
  * @module dsh-xdpool/version
29382
29382
  */
29383
- const POOL_VERSION = "3.0.9";
29383
+ const POOL_VERSION = "3.1.0";
29384
29384
  //#endregion
29385
29385
  //#region src/update-check.ts
29386
29386
  /**
@@ -30422,7 +30422,10 @@ var WorkBuddyScheduler = class {
30422
30422
  const restored = options.loadEarnings?.();
30423
30423
  const today = dayKey(this.now());
30424
30424
  if (restored !== void 0 && restored.date === today) {
30425
- for (const [id, entry] of Object.entries(restored.accounts)) this.earnings.set(id, entry);
30425
+ for (const [id, entry] of Object.entries(restored.accounts)) {
30426
+ if (entry.date !== today) continue;
30427
+ this.earnings.set(id, entry);
30428
+ }
30426
30429
  this.earningsDate = today;
30427
30430
  }
30428
30431
  this.enabled = options.enabled ?? false;
@@ -30466,7 +30469,10 @@ var WorkBuddyScheduler = class {
30466
30469
  applyEarningsLedger(ledger) {
30467
30470
  const today = dayKey(this.now());
30468
30471
  if (ledger.date !== today) return;
30469
- for (const [id, entry] of Object.entries(ledger.accounts)) this.earnings.set(id, entry);
30472
+ for (const [id, entry] of Object.entries(ledger.accounts)) {
30473
+ if (entry.date !== today) continue;
30474
+ this.earnings.set(id, entry);
30475
+ }
30470
30476
  this.earningsDate = today;
30471
30477
  }
30472
30478
  applyConfig(options) {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@refeain/dsh-xdpool",
3
3
  "displayName": "DSH XD Pool",
4
4
  "description": "One DSH model pool for every free quota you have: merge all locally signed-in WorkBuddy accounts with auto-failover, sign in to 22 vendors by QR/web, aggregate 77 external vendors' keys, plus a usage dashboard, model routing, a local OpenAI-compatible gateway and a points-automation suite.",
5
- "version": "3.0.9",
5
+ "version": "3.1.0",
6
6
  "license": "MIT",
7
7
  "author": "XDTrees",
8
8
  "homepage": "https://github.com/XDTrees/dsh-xdpool#readme",