@refeain/dsh-xdpool 3.1.0 → 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/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.1.0";
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("-");
@@ -16143,6 +16143,32 @@ window.__ModuleLoader__.load({
16143
16143
  });
16144
16144
  }
16145
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
16146
16172
  //#region src/client/PoolCard.tsx
16147
16173
  const POLL_INTERVAL_MS = 3e4;
16148
16174
  function formatNumber(value) {
@@ -16169,32 +16195,14 @@ window.__ModuleLoader__.load({
16169
16195
  }
16170
16196
  const FAILURE_LINES_SHOWN = 2;
16171
16197
  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;
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`;
16187
16201
  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}`;
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)`;
16198
16206
  }
16199
16207
  function automationFailures(status) {
16200
16208
  const lines = automationJobs(status).flatMap((job) => job.failures ?? []);
@@ -20596,6 +20604,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
20596
20604
  "channelpool.autoClaimRunning": "Running…",
20597
20605
  "channelpool.autoClaimRunHint": "Run one collection pass now instead of waiting for the scheduled hour",
20598
20606
  "channelpool.autoEarned": "{credit} credits · {energy} energy · {count} task(s)",
20607
+ "channelpool.autoEarnedCredits": "{credit} credits",
20599
20608
  "channelpool.modePrefer": "Priority",
20600
20609
  "channelpool.modePreferHint": "Priority: always use the first account until it is rate-limited.",
20601
20610
  "channelpool.modeRoundRobin": "Round robin",
@@ -21361,6 +21370,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
21361
21370
  "channelpool.autoClaimRunning": "领取中…",
21362
21371
  "channelpool.autoClaimRunHint": "马上跑一轮领取,不用等到预定时间",
21363
21372
  "channelpool.autoEarned": "{credit} 积分 · {energy} 能量 · {count} 个任务",
21373
+ "channelpool.autoEarnedCredits": "{credit} 积分",
21364
21374
  "channelpool.modePrefer": "优先",
21365
21375
  "channelpool.modePreferHint": "优先:总用排在前面的账号,它限流了才换下一个。",
21366
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.1.0";
29383
+ const POOL_VERSION = "3.1.1";
29384
29384
  //#endregion
29385
29385
  //#region src/update-check.ts
29386
29386
  /**
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.1.0",
5
+ "version": "3.1.1",
6
6
  "license": "MIT",
7
7
  "author": "XDTrees",
8
8
  "homepage": "https://github.com/XDTrees/dsh-xdpool#readme",