@refeain/dsh-xdpool 3.0.9 → 3.1.1

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.1";
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
  })]
@@ -16139,6 +16143,32 @@ window.__ModuleLoader__.load({
16139
16143
  });
16140
16144
  }
16141
16145
  //#endregion
16146
+ //#region src/client/earned-today.ts
16147
+ function dayKeyOf(date) {
16148
+ const month = String(date.getMonth() + 1).padStart(2, "0");
16149
+ const day = String(date.getDate()).padStart(2, "0");
16150
+ return `${String(date.getFullYear())}-${month}-${day}`;
16151
+ }
16152
+ function earnedToday(status, today) {
16153
+ const totals = {
16154
+ credit: 0,
16155
+ energy: 0,
16156
+ claimed: 0
16157
+ };
16158
+ if (status === void 0) return totals;
16159
+ for (const account of status.accounts) totals.credit += account.checkin?.todayCredit ?? 0;
16160
+ for (const entry of Object.values(status.automation?.earningsToday ?? {})) {
16161
+ if (entry.date !== today) continue;
16162
+ totals.credit += entry.credit + entry.bonusCredit + entry.travelCredit + entry.compensationCredit;
16163
+ totals.energy += entry.energy;
16164
+ totals.claimed += entry.claimed;
16165
+ }
16166
+ return totals;
16167
+ }
16168
+ function earnedNothing(totals) {
16169
+ return totals.credit === 0 && totals.energy === 0 && totals.claimed === 0;
16170
+ }
16171
+ //#endregion
16142
16172
  //#region src/client/PoolCard.tsx
16143
16173
  const POLL_INTERVAL_MS = 3e4;
16144
16174
  function formatNumber(value) {
@@ -16164,6 +16194,16 @@ window.__ModuleLoader__.load({
16164
16194
  return AUTOMATION_JOBS.map((kind) => jobs[kind]);
16165
16195
  }
16166
16196
  const FAILURE_LINES_SHOWN = 2;
16197
+ function automationEarnedToday(status, t) {
16198
+ const totals = earnedToday(status, dayKeyOf(new Date()));
16199
+ if (earnedNothing(totals)) return void 0;
16200
+ if (totals.energy === 0 && totals.claimed === 0) return t?.("channelpool.autoEarnedCredits", { credit: totals.credit }) ?? `${String(totals.credit)} credits`;
16201
+ return t?.("channelpool.autoEarned", {
16202
+ credit: totals.credit,
16203
+ energy: totals.energy,
16204
+ count: totals.claimed
16205
+ }) ?? `${String(totals.credit)} credits · ${String(totals.energy)} energy · ${String(totals.claimed)} task(s)`;
16206
+ }
16167
16207
  function automationFailures(status) {
16168
16208
  const lines = automationJobs(status).flatMap((job) => job.failures ?? []);
16169
16209
  if (lines.length === 0) return void 0;
@@ -16630,6 +16670,7 @@ window.__ModuleLoader__.load({
16630
16670
  },
16631
16671
  autoClaimReport: automationFailures(statusOf("cn")),
16632
16672
  autoClaimFailing: automationJobs(statusOf("cn")).some((job) => job.failed > 0),
16673
+ autoClaimEarned: automationEarnedToday(statusOf("cn"), t),
16633
16674
  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
16675
  className: "note",
16635
16676
  children: flash
@@ -20562,6 +20603,8 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20562
20603
  "channelpool.autoClaimRun": "Run now",
20563
20604
  "channelpool.autoClaimRunning": "Running…",
20564
20605
  "channelpool.autoClaimRunHint": "Run one collection pass now instead of waiting for the scheduled hour",
20606
+ "channelpool.autoEarned": "{credit} credits · {energy} energy · {count} task(s)",
20607
+ "channelpool.autoEarnedCredits": "{credit} credits",
20565
20608
  "channelpool.modePrefer": "Priority",
20566
20609
  "channelpool.modePreferHint": "Priority: always use the first account until it is rate-limited.",
20567
20610
  "channelpool.modeRoundRobin": "Round robin",
@@ -21326,6 +21369,8 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
21326
21369
  "channelpool.autoClaimRun": "立即执行",
21327
21370
  "channelpool.autoClaimRunning": "领取中…",
21328
21371
  "channelpool.autoClaimRunHint": "马上跑一轮领取,不用等到预定时间",
21372
+ "channelpool.autoEarned": "{credit} 积分 · {energy} 能量 · {count} 个任务",
21373
+ "channelpool.autoEarnedCredits": "{credit} 积分",
21329
21374
  "channelpool.modePrefer": "优先",
21330
21375
  "channelpool.modePreferHint": "优先:总用排在前面的账号,它限流了才换下一个。",
21331
21376
  "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.1";
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.1",
6
6
  "license": "MIT",
7
7
  "author": "XDTrees",
8
8
  "homepage": "https://github.com/XDTrees/dsh-xdpool#readme",