@refeain/dsh-xdpool 3.1.0 → 3.2.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/client.js +289 -239
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -116,136 +116,6 @@ window.__ModuleLoader__.load({
|
|
|
116
116
|
//#endregion
|
|
117
117
|
//#region src/client/avatar.ts
|
|
118
118
|
const POOL_CARD_AVATAR = "data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAAQDAwQDAwQEAwQFBAQFBgoHBgYGBg0JCggKDw0QEA8NDw4RExgUERIXEg4PFRwVFxkZGxsbEBQdHx0aHxgaGxr/2wBDAQQFBQYFBgwHBwwaEQ8RGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhoaGhr/wAARCACAAIADASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uP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6GrEVwMqRjrxUcsgKk9F7E1UCOBjzXx9eaJEDEb2J2njJ60EMrXV0BwB1rO6mprly0nzLtx0FQ0FpWCtDRtGudcvUtrNev33b7qD1NZ9ejfDDT/ADZJ5jJksdqpngf7R96Bnq/wu00+G0FpE7TW6yZLtwd5xu4HavpvwvrsjKkCMFOBjdXzr4VkNje/ZpkUsTu3lsd+v8q9i0d3jmiNvKuwkZye9Te4juPHUhm8J6mkoIk8gsDnOCvI/lVr4a+IFutLs5CeSgVhmom2anp8ltdsGSRChOR3H/1682+F+qPZ+dYSPh7eVosZ7q2D/KuOuup1UHuj2f4i6JF4o8N6jptygkhvLZ4WB9GUivzCude8R6cJ9Fn1i4S2sXe22RvjIVsY3DnHHrX6hx3w1CzaJpArMpUNnpnjNflXrdnPpWs6np96Ct1a3UsMobqGVyD/ACqcPrJplYh2s0VbgCQl4vvKMDHYjtShxOik8kiqkshjl3Rn7w5HaliuVACsu0e3Negcdkwkja2O+JsrViOdnjVgx3d+aaJVOMEGoARFJlHAB6igltFovLj79QF8ACRufU01rkYOOarFi3Uk0xctx0r72z6cCmUUUjQ//9k=";
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region src/client/account-card.tsx
|
|
121
|
-
const CREDITS = new Intl.NumberFormat();
|
|
122
|
-
function formatExpiry(value) {
|
|
123
|
-
if (value === void 0) return void 0;
|
|
124
|
-
const at = Date.parse(value);
|
|
125
|
-
if (!Number.isFinite(at)) return void 0;
|
|
126
|
-
return new Intl.DateTimeFormat(void 0, {
|
|
127
|
-
month: "2-digit",
|
|
128
|
-
day: "2-digit",
|
|
129
|
-
hour: "2-digit",
|
|
130
|
-
minute: "2-digit",
|
|
131
|
-
hour12: false
|
|
132
|
-
}).format(new Date(at));
|
|
133
|
-
}
|
|
134
|
-
function AccountCard({ account, serving = false, busy = false, claiming = false, t, onClaim, onToggle, onPrefer, onIgnore }) {
|
|
135
|
-
const total = account.credits?.total;
|
|
136
|
-
const expiry = formatExpiry(account.expiresAt);
|
|
137
|
-
const checkin = account.checkin;
|
|
138
|
-
const claimed = checkin?.todayCheckedIn === true;
|
|
139
|
-
return (0, react_jsx_runtime.jsxs)("article", {
|
|
140
|
-
className: "xdp-acct",
|
|
141
|
-
"data-serving": serving ? "true" : void 0,
|
|
142
|
-
children: [
|
|
143
|
-
(0, react_jsx_runtime.jsx)("header", {
|
|
144
|
-
className: "xdp-acct-head",
|
|
145
|
-
children: (0, react_jsx_runtime.jsx)("span", {
|
|
146
|
-
className: "xdp-acct-name",
|
|
147
|
-
title: account.nickname ?? account.label,
|
|
148
|
-
children: account.nickname ?? account.label
|
|
149
|
-
})
|
|
150
|
-
}),
|
|
151
|
-
!serving && !account.disabled && !account.cooling ? null : (0, react_jsx_runtime.jsxs)("div", {
|
|
152
|
-
className: "xdp-acct-badges",
|
|
153
|
-
children: [
|
|
154
|
-
serving ? (0, react_jsx_runtime.jsx)("span", {
|
|
155
|
-
className: "xdp-acct-badge",
|
|
156
|
-
children: t?.("row.currentAccount") ?? "当前使用"
|
|
157
|
-
}) : null,
|
|
158
|
-
account.disabled ? (0, react_jsx_runtime.jsx)("span", {
|
|
159
|
-
className: "xdp-acct-badge is-off",
|
|
160
|
-
children: "已停用"
|
|
161
|
-
}) : null,
|
|
162
|
-
account.cooling ? (0, react_jsx_runtime.jsx)("span", {
|
|
163
|
-
className: "xdp-acct-badge is-warn",
|
|
164
|
-
children: "冷却中"
|
|
165
|
-
}) : null
|
|
166
|
-
]
|
|
167
|
-
}),
|
|
168
|
-
(0, react_jsx_runtime.jsxs)("p", {
|
|
169
|
-
className: "xdp-acct-meta",
|
|
170
|
-
children: [expiry === void 0 ? "令牌有效期未知" : `令牌到期 ${expiry}`, account.lastUsedAt === void 0 ? "" : ` · 上次使用 ${formatExpiry(account.lastUsedAt) ?? ""}`]
|
|
171
|
-
}),
|
|
172
|
-
(0, react_jsx_runtime.jsxs)("div", {
|
|
173
|
-
className: "xdp-acct-credits",
|
|
174
|
-
children: [
|
|
175
|
-
(0, react_jsx_runtime.jsx)("strong", { children: total === void 0 ? "—" : CREDITS.format(total) }),
|
|
176
|
-
(0, react_jsx_runtime.jsx)("span", { children: t?.("row.creditsTotal") ?? "积分" }),
|
|
177
|
-
checkinError(account)
|
|
178
|
-
]
|
|
179
|
-
}),
|
|
180
|
-
(0, react_jsx_runtime.jsxs)("footer", {
|
|
181
|
-
className: "xdp-acct-actions",
|
|
182
|
-
children: [
|
|
183
|
-
(0, react_jsx_runtime.jsx)("button", {
|
|
184
|
-
type: "button",
|
|
185
|
-
className: account.preferred ? "tiny is-on" : "tiny",
|
|
186
|
-
"aria-pressed": account.preferred,
|
|
187
|
-
disabled: busy,
|
|
188
|
-
title: account.preferred ? t?.("row.accountPreferClearHint") ?? "取消优先,交回按使用方式选号" : t?.("row.accountPreferHint") ?? "让它排在前面,仍然健康时才用",
|
|
189
|
-
onClick: () => {
|
|
190
|
-
onPrefer(account.preferred ? null : account.id);
|
|
191
|
-
},
|
|
192
|
-
children: account.preferred ? t?.("row.accountPreferOn") ?? "优先" : t?.("row.accountPrefer") ?? "优先"
|
|
193
|
-
}),
|
|
194
|
-
(0, react_jsx_runtime.jsx)("button", {
|
|
195
|
-
type: "button",
|
|
196
|
-
className: "tiny",
|
|
197
|
-
disabled: busy,
|
|
198
|
-
onClick: () => {
|
|
199
|
-
onToggle(!account.disabled);
|
|
200
|
-
},
|
|
201
|
-
children: account.disabled ? "启用" : "停用"
|
|
202
|
-
}),
|
|
203
|
-
checkin === void 0 ? null : (0, react_jsx_runtime.jsx)("button", {
|
|
204
|
-
type: "button",
|
|
205
|
-
className: "tiny",
|
|
206
|
-
disabled: claiming || claimed || checkin.active !== true,
|
|
207
|
-
title: checkin.active === true ? void 0 : "这个账号当前没有签到活动",
|
|
208
|
-
onClick: onClaim,
|
|
209
|
-
children: claimed ? t?.("row.checkinClaimed") ?? "今日已签" : claiming ? t?.("row.checkinClaiming") ?? "签到中…" : t?.("row.checkinClaim") ?? "签到"
|
|
210
|
-
}),
|
|
211
|
-
(0, react_jsx_runtime.jsx)("button", {
|
|
212
|
-
type: "button",
|
|
213
|
-
className: "tiny",
|
|
214
|
-
disabled: busy,
|
|
215
|
-
title: "把这个账号从池子里永久移除(可在「已忽略」里恢复)",
|
|
216
|
-
onClick: onIgnore,
|
|
217
|
-
children: "移出池子"
|
|
218
|
-
})
|
|
219
|
-
]
|
|
220
|
-
})
|
|
221
|
-
]
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
function checkinError(account) {
|
|
225
|
-
if (account.checkinError === void 0) return null;
|
|
226
|
-
return (0, react_jsx_runtime.jsx)("span", {
|
|
227
|
-
className: "xdp-acct-warn",
|
|
228
|
-
title: account.checkinError,
|
|
229
|
-
children: "签到不可用"
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
const ACCOUNT_CARD_CSS = `
|
|
233
|
-
.xdp-accts{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s3)}
|
|
234
|
-
.xdp-acct{display:flex;flex-direction:column;gap:var(--s2);min-width:0;padding:var(--s3);border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface)}
|
|
235
|
-
.xdp-acct[data-serving="true"]{border-color:var(--accent-line)}
|
|
236
|
-
.xdp-acct .xdp-acct-head{display:block;min-width:0}
|
|
237
|
-
.xdp-acct .xdp-acct-name{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-sm);font-weight:600;color:var(--text)}
|
|
238
|
-
.xdp-acct .xdp-acct-badges{display:flex;flex-wrap:wrap;gap:var(--s1)}
|
|
239
|
-
.xdp-acct .xdp-acct-badge{flex:0 0 auto;padding:0 6px;border:1px solid var(--accent-line);border-radius:var(--r-pill);background:var(--accent-dim);color:var(--accent);font-size:var(--fs-xs);line-height:16px;white-space:nowrap}
|
|
240
|
-
.xdp-acct-badge.is-off{border-color:var(--line-2);background:transparent;color:var(--faint)}
|
|
241
|
-
.xdp-acct-badge.is-warn{border-color:color-mix(in oklch, var(--warn) 40%, transparent);background:color-mix(in oklch, var(--warn) 10%, transparent);color:var(--warn)}
|
|
242
|
-
.xdp-acct-meta{margin:0;font-size:var(--fs-xs);line-height:1.5;color:var(--faint);font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
243
|
-
.xdp-acct-credits{display:flex;align-items:baseline;gap:var(--s2);min-width:0;flex-wrap:wrap}
|
|
244
|
-
.xdp-acct-credits strong{font-size:var(--fs-lg);font-weight:600;color:var(--text);font-variant-numeric:tabular-nums}
|
|
245
|
-
.xdp-acct-credits > span{font-size:var(--fs-xs);color:var(--faint)}
|
|
246
|
-
.xdp-acct-warn{font-size:var(--fs-xs);color:var(--warn)}
|
|
247
|
-
.xdp-acct-actions{display:flex;flex-wrap:wrap;gap:var(--s1);padding-top:2px}
|
|
248
|
-
`;
|
|
249
119
|
//#endregion
|
|
250
120
|
//#region src/client/nav-icon.ts
|
|
251
121
|
const POOL_NAV_ICON_PATHS = [{
|
|
@@ -269,7 +139,7 @@ window.__ModuleLoader__.load({
|
|
|
269
139
|
const POOL_NAV_ICON_MASK_URL = `data:image/svg+xml;utf8,${encodeURIComponent(POOL_NAV_ICON_SVG)}`;
|
|
270
140
|
//#endregion
|
|
271
141
|
//#region src/version.ts
|
|
272
|
-
const POOL_VERSION = "3.
|
|
142
|
+
const POOL_VERSION = "3.2.0";
|
|
273
143
|
function compareVersions(left, right) {
|
|
274
144
|
const parse = (value) => {
|
|
275
145
|
const [core, ...rest] = value.trim().replace(/^v/u, "").split("-");
|
|
@@ -10314,7 +10184,7 @@ window.__ModuleLoader__.load({
|
|
|
10314
10184
|
return "签到失败";
|
|
10315
10185
|
}
|
|
10316
10186
|
}
|
|
10317
|
-
function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, autoClaimReport, autoClaimFailing, autoClaimEarned, banner,
|
|
10187
|
+
function ChannelPoolSection({ t, active, onAddAccount, autoClaim, autoClaimBusy, onAutoClaim, autoClaimRunning, onAutoClaimRun, autoClaimReport, autoClaimFailing, autoClaimEarned, banner, poolLanes }) {
|
|
10318
10188
|
const [ownActive, setOwnActive] = (0, react.useState)("");
|
|
10319
10189
|
const [loginState, setLoginState] = (0, react.useState)(void 0);
|
|
10320
10190
|
const loginAbort = (0, react.useRef)(void 0);
|
|
@@ -11083,22 +10953,27 @@ window.__ModuleLoader__.load({
|
|
|
11083
10953
|
}
|
|
11084
10954
|
};
|
|
11085
10955
|
if (entries.length === 0 && error === void 0) {
|
|
11086
|
-
if (!
|
|
11087
|
-
|
|
11088
|
-
|
|
11089
|
-
|
|
11090
|
-
|
|
11091
|
-
|
|
11092
|
-
|
|
11093
|
-
|
|
11094
|
-
|
|
11095
|
-
|
|
11096
|
-
});
|
|
11097
|
-
}
|
|
10956
|
+
if (!loading) return (0, react_jsx_runtime.jsx)(react_jsx_runtime.Fragment, {});
|
|
10957
|
+
return (0, react_jsx_runtime.jsx)("section", {
|
|
10958
|
+
className: "dsm-xdpool-cpool",
|
|
10959
|
+
"aria-label": t?.("channelpool.title") ?? "Channels",
|
|
10960
|
+
children: (0, react_jsx_runtime.jsx)("p", {
|
|
10961
|
+
className: "note",
|
|
10962
|
+
role: "status",
|
|
10963
|
+
children: t?.("channelpool.loading") ?? "Reading scan channels…"
|
|
10964
|
+
})
|
|
10965
|
+
});
|
|
11098
10966
|
}
|
|
11099
10967
|
const chosenEntry = entries.find((entry) => entry.channel.id === chosen) ?? entries[0];
|
|
11100
|
-
const
|
|
11101
|
-
const
|
|
10968
|
+
const laneOf = (channelId) => poolLanes?.[channelId];
|
|
10969
|
+
const rowAccountCount = (entry) => laneOf(entry.channel.id)?.accounts.length ?? entry.accounts.length;
|
|
10970
|
+
const rowEnabledCount = (entry) => {
|
|
10971
|
+
const lane = laneOf(entry.channel.id);
|
|
10972
|
+
if (lane !== void 0) return lane.accounts.filter((account) => account.disabled !== true).length;
|
|
10973
|
+
return entry.accounts.filter((account) => account.enabled !== false).length;
|
|
10974
|
+
};
|
|
10975
|
+
const totalAccounts = entries.reduce((sum, entry) => sum + rowAccountCount(entry), 0);
|
|
10976
|
+
const liveAccounts = entries.reduce((sum, entry) => sum + rowEnabledCount(entry), 0);
|
|
11102
10977
|
const totalCredits = entries.reduce((sum, entry) => {
|
|
11103
10978
|
const credits = entry.channel.credits;
|
|
11104
10979
|
if (credits === void 0 || credits.unit !== void 0 || credits.quota === true) return sum;
|
|
@@ -11106,8 +10981,8 @@ window.__ModuleLoader__.load({
|
|
|
11106
10981
|
return value === void 0 ? sum : sum + value;
|
|
11107
10982
|
}, 0);
|
|
11108
10983
|
const anyCredits = entries.some((entry) => entry.channel.credits !== void 0 && entry.channel.credits.unit === void 0 && entry.channel.credits.quota !== true && balancesTotal(entry.balances) !== void 0);
|
|
11109
|
-
const bound = entries.filter((entry) => entry
|
|
11110
|
-
const unbound = entries.filter((entry) => entry
|
|
10984
|
+
const bound = entries.filter((entry) => rowAccountCount(entry) > 0);
|
|
10985
|
+
const unbound = entries.filter((entry) => rowAccountCount(entry) === 0);
|
|
11111
10986
|
const channelRow = (entry, isBound) => {
|
|
11112
10987
|
const icon = channelIcon(entry.channel.id);
|
|
11113
10988
|
const isOn = chosenEntry !== void 0 && entry.channel.id === chosenEntry.channel.id;
|
|
@@ -11139,7 +11014,7 @@ window.__ModuleLoader__.load({
|
|
|
11139
11014
|
}),
|
|
11140
11015
|
isBound ? (0, react_jsx_runtime.jsx)("span", {
|
|
11141
11016
|
className: "ch-n num",
|
|
11142
|
-
children: String(entry
|
|
11017
|
+
children: String(rowAccountCount(entry))
|
|
11143
11018
|
}) : null
|
|
11144
11019
|
]
|
|
11145
11020
|
}, entry.channel.id);
|
|
@@ -11226,23 +11101,19 @@ window.__ModuleLoader__.load({
|
|
|
11226
11101
|
children: (0, react_jsx_runtime.jsxs)("div", {
|
|
11227
11102
|
className: "mbody",
|
|
11228
11103
|
style: { paddingTop: "var(--s5)" },
|
|
11229
|
-
children: [
|
|
11230
|
-
|
|
11231
|
-
|
|
11232
|
-
|
|
11233
|
-
className: "
|
|
11234
|
-
|
|
11235
|
-
|
|
11236
|
-
|
|
11237
|
-
|
|
11238
|
-
|
|
11239
|
-
|
|
11240
|
-
|
|
11241
|
-
|
|
11242
|
-
children: t?.("channelpool.retry") ?? "重试"
|
|
11243
|
-
})]
|
|
11244
|
-
})
|
|
11245
|
-
]
|
|
11104
|
+
children: [banner, error === void 0 ? null : (0, react_jsx_runtime.jsxs)("p", {
|
|
11105
|
+
className: "hint",
|
|
11106
|
+
children: [t?.("channelpool.loadError", { message: error }) ?? `Could not load channels: ${error}`, (0, react_jsx_runtime.jsx)("button", {
|
|
11107
|
+
type: "button",
|
|
11108
|
+
className: "tiny",
|
|
11109
|
+
style: { marginLeft: "auto" },
|
|
11110
|
+
onClick: () => {
|
|
11111
|
+
setEnabled(new Map());
|
|
11112
|
+
load();
|
|
11113
|
+
},
|
|
11114
|
+
children: t?.("channelpool.retry") ?? "重试"
|
|
11115
|
+
})]
|
|
11116
|
+
})]
|
|
11246
11117
|
})
|
|
11247
11118
|
})] });
|
|
11248
11119
|
const { channel, accounts, models, facts, balances, statuses, status } = chosenEntry;
|
|
@@ -11255,8 +11126,18 @@ window.__ModuleLoader__.load({
|
|
|
11255
11126
|
const statusOf = (accountId) => statuses.find((row) => row.accountId === accountId);
|
|
11256
11127
|
const balanceOf = (accountId) => balances.find((row) => row.accountId === accountId);
|
|
11257
11128
|
const enabledAccounts = accounts.filter((account) => account.enabled !== false);
|
|
11258
|
-
const
|
|
11259
|
-
const
|
|
11129
|
+
const lane = laneOf(channel.id);
|
|
11130
|
+
const poolExpiry = (iso) => {
|
|
11131
|
+
if (iso === void 0) return void 0;
|
|
11132
|
+
const at = Date.parse(iso);
|
|
11133
|
+
return Number.isFinite(at) ? expiryText(at, t) : void 0;
|
|
11134
|
+
};
|
|
11135
|
+
const laneEnabled = lane === void 0 ? void 0 : lane.accounts.filter((account) => account.disabled !== true);
|
|
11136
|
+
const shownAccounts = lane?.accounts.length ?? accounts.length;
|
|
11137
|
+
const shownEnabled = laneEnabled?.length ?? enabledAccounts.length;
|
|
11138
|
+
const checkedInToday = laneEnabled === void 0 ? enabledAccounts.filter((account) => statusOf(account.id)?.todayCheckedIn === true).length : laneEnabled.filter((account) => account.checkin?.todayCheckedIn === true).length;
|
|
11139
|
+
const allClaimedToday = shownEnabled > 0 && checkedInToday === shownEnabled;
|
|
11140
|
+
const claimedToday = checkedInToday;
|
|
11260
11141
|
const canClaim = channel.credits?.claim === true || OWN_CHECKIN_CHANNELS[channel.id] !== void 0;
|
|
11261
11142
|
const query = queryFor(channel.id);
|
|
11262
11143
|
const visibleModels = modelsMatching(chosenEntry, query);
|
|
@@ -11320,7 +11201,7 @@ window.__ModuleLoader__.load({
|
|
|
11320
11201
|
className: "mhead-org",
|
|
11321
11202
|
children: channel.domain === void 0 || channel.domain === "" ? channel.org : `${channel.org} · ${channel.domain}`
|
|
11322
11203
|
}),
|
|
11323
|
-
|
|
11204
|
+
shownAccounts > 0 ? (0, react_jsx_runtime.jsx)("span", {
|
|
11324
11205
|
className: "pill",
|
|
11325
11206
|
"data-tone": "ok",
|
|
11326
11207
|
children: t?.("channelpool.stateReady") ?? "已连接"
|
|
@@ -11349,7 +11230,6 @@ window.__ModuleLoader__.load({
|
|
|
11349
11230
|
className: "mbody",
|
|
11350
11231
|
children: [
|
|
11351
11232
|
banner,
|
|
11352
|
-
regionCards,
|
|
11353
11233
|
loginState !== void 0 && loginState.channelId === channel.id && (loginState.phase === "paste" ? (0, react_jsx_runtime.jsxs)("div", {
|
|
11354
11234
|
className: "banner",
|
|
11355
11235
|
children: [
|
|
@@ -11546,7 +11426,7 @@ window.__ModuleLoader__.load({
|
|
|
11546
11426
|
children: t?.("channelpool.statAccounts") ?? "账号"
|
|
11547
11427
|
}), (0, react_jsx_runtime.jsx)("span", {
|
|
11548
11428
|
className: "kpi-v num",
|
|
11549
|
-
children: String(
|
|
11429
|
+
children: String(shownEnabled)
|
|
11550
11430
|
})]
|
|
11551
11431
|
}),
|
|
11552
11432
|
(0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -11600,7 +11480,7 @@ window.__ModuleLoader__.load({
|
|
|
11600
11480
|
}),
|
|
11601
11481
|
(0, react_jsx_runtime.jsx)("span", {
|
|
11602
11482
|
className: "policy-hint",
|
|
11603
|
-
children:
|
|
11483
|
+
children: shownAccounts <= 1 ? "这个渠道只有一个账号,使用方式不影响选号。" : modeHint(t, mode)
|
|
11604
11484
|
})
|
|
11605
11485
|
]
|
|
11606
11486
|
}), !showAutomation ? null : (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -11624,7 +11504,7 @@ window.__ModuleLoader__.load({
|
|
|
11624
11504
|
onAutoClaim?.(autoClaim !== true);
|
|
11625
11505
|
}
|
|
11626
11506
|
}),
|
|
11627
|
-
(0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(
|
|
11507
|
+
(0, react_jsx_runtime.jsx)("span", { children: `${t?.("channelpool.claimedToday") ?? "今日已领"} ${String(claimedToday)}/${String(shownEnabled)}` }),
|
|
11628
11508
|
(0, react_jsx_runtime.jsx)("button", {
|
|
11629
11509
|
type: "button",
|
|
11630
11510
|
className: "tiny",
|
|
@@ -11803,7 +11683,7 @@ window.__ModuleLoader__.load({
|
|
|
11803
11683
|
}),
|
|
11804
11684
|
(0, react_jsx_runtime.jsx)("span", {
|
|
11805
11685
|
className: "sec-n num",
|
|
11806
|
-
children: String(
|
|
11686
|
+
children: String(shownAccounts)
|
|
11807
11687
|
}),
|
|
11808
11688
|
(0, react_jsx_runtime.jsxs)("span", {
|
|
11809
11689
|
className: "sec-actions",
|
|
@@ -11845,7 +11725,162 @@ window.__ModuleLoader__.load({
|
|
|
11845
11725
|
role: "status",
|
|
11846
11726
|
children: chosenEntry.balanceError
|
|
11847
11727
|
}),
|
|
11848
|
-
|
|
11728
|
+
lane === void 0 ? null : (0, react_jsx_runtime.jsx)("div", {
|
|
11729
|
+
className: "accts",
|
|
11730
|
+
children: lane.accounts.map((account) => {
|
|
11731
|
+
const credits = account.credits;
|
|
11732
|
+
const checkin = account.checkin;
|
|
11733
|
+
const claimed = checkin?.todayCheckedIn === true;
|
|
11734
|
+
const claiming = lane.claimingId === account.id;
|
|
11735
|
+
const busy = lane.busyId === account.id;
|
|
11736
|
+
const soon = poolExpiry(account.expiresAt);
|
|
11737
|
+
const packages = credits?.packages ?? [];
|
|
11738
|
+
return (0, react_jsx_runtime.jsxs)("article", {
|
|
11739
|
+
className: "acct",
|
|
11740
|
+
"data-off": account.disabled,
|
|
11741
|
+
children: [
|
|
11742
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
11743
|
+
className: "acct-head",
|
|
11744
|
+
children: [
|
|
11745
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
11746
|
+
className: "acct-dot",
|
|
11747
|
+
"aria-hidden": "true",
|
|
11748
|
+
style: account.disabled ? { background: "var(--line-3)" } : void 0
|
|
11749
|
+
}),
|
|
11750
|
+
(0, react_jsx_runtime.jsx)("span", {
|
|
11751
|
+
className: "acct-name",
|
|
11752
|
+
title: account.nickname === void 0 ? account.label : `${account.label}(${account.nickname})`,
|
|
11753
|
+
children: account.label
|
|
11754
|
+
}),
|
|
11755
|
+
lane.activeAccountId === account.id ? (0, react_jsx_runtime.jsx)("span", {
|
|
11756
|
+
className: "pill",
|
|
11757
|
+
"data-tone": "ok",
|
|
11758
|
+
children: t?.("row.currentAccount") ?? "当前使用"
|
|
11759
|
+
}) : null,
|
|
11760
|
+
account.disabled ? (0, react_jsx_runtime.jsx)("span", {
|
|
11761
|
+
className: "pill",
|
|
11762
|
+
children: "已停用"
|
|
11763
|
+
}) : null,
|
|
11764
|
+
account.cooling ? (0, react_jsx_runtime.jsx)("span", {
|
|
11765
|
+
className: "pill",
|
|
11766
|
+
"data-tone": "warn",
|
|
11767
|
+
children: "冷却中"
|
|
11768
|
+
}) : null,
|
|
11769
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
11770
|
+
type: "button",
|
|
11771
|
+
role: "switch",
|
|
11772
|
+
className: "sw",
|
|
11773
|
+
"aria-checked": !account.disabled,
|
|
11774
|
+
"aria-label": account.label,
|
|
11775
|
+
disabled: busy,
|
|
11776
|
+
onClick: () => {
|
|
11777
|
+
lane.onToggle(account.id, !account.disabled);
|
|
11778
|
+
}
|
|
11779
|
+
})
|
|
11780
|
+
]
|
|
11781
|
+
}),
|
|
11782
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
11783
|
+
className: "acct-total",
|
|
11784
|
+
style: account.creditsError !== void 0 ? {
|
|
11785
|
+
flexWrap: "wrap",
|
|
11786
|
+
alignItems: "flex-start"
|
|
11787
|
+
} : void 0,
|
|
11788
|
+
children: [account.creditsError !== void 0 ? (0, react_jsx_runtime.jsx)("span", {
|
|
11789
|
+
className: "acct-k",
|
|
11790
|
+
"data-tone": "err",
|
|
11791
|
+
title: account.creditsError,
|
|
11792
|
+
style: {
|
|
11793
|
+
display: "-webkit-box",
|
|
11794
|
+
WebkitLineClamp: 2,
|
|
11795
|
+
WebkitBoxOrient: "vertical",
|
|
11796
|
+
overflow: "hidden",
|
|
11797
|
+
color: "var(--warn)",
|
|
11798
|
+
lineHeight: 1.5,
|
|
11799
|
+
minWidth: 0,
|
|
11800
|
+
flex: "1 1 auto"
|
|
11801
|
+
},
|
|
11802
|
+
children: "积分读取失败"
|
|
11803
|
+
}) : credits?.total !== void 0 ? (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [(0, react_jsx_runtime.jsx)("span", {
|
|
11804
|
+
className: "acct-total-v num",
|
|
11805
|
+
children: amount(credits.total)
|
|
11806
|
+
}), (0, react_jsx_runtime.jsx)("span", {
|
|
11807
|
+
className: "acct-total-u",
|
|
11808
|
+
children: unit
|
|
11809
|
+
})] }) : (0, react_jsx_runtime.jsx)("span", {
|
|
11810
|
+
className: "acct-total-v",
|
|
11811
|
+
children: "…"
|
|
11812
|
+
}), soon === void 0 ? null : (0, react_jsx_runtime.jsx)("span", {
|
|
11813
|
+
className: "acct-soon",
|
|
11814
|
+
children: soon
|
|
11815
|
+
})]
|
|
11816
|
+
}),
|
|
11817
|
+
(0, react_jsx_runtime.jsxs)("details", {
|
|
11818
|
+
className: "acct-detail",
|
|
11819
|
+
children: [
|
|
11820
|
+
(0, react_jsx_runtime.jsx)("summary", { children: t?.("channelpool.accountDetail") ?? "积分明细" }),
|
|
11821
|
+
(0, react_jsx_runtime.jsxs)("dl", {
|
|
11822
|
+
className: "facts",
|
|
11823
|
+
children: [
|
|
11824
|
+
packages.length === 0 ? null : packages.map((pkg, index) => (0, react_jsx_runtime.jsxs)("div", {
|
|
11825
|
+
className: "fact",
|
|
11826
|
+
children: [(0, react_jsx_runtime.jsx)("dt", { children: pkg.packageName }), (0, react_jsx_runtime.jsx)("dd", { children: pkg.size === void 0 ? pkg.remain === void 0 ? "—" : amount(pkg.remain) : `${amount(pkg.remain ?? 0)} / ${amount(pkg.size)}` })]
|
|
11827
|
+
}, `${pkg.packageName}-${String(index)}`)),
|
|
11828
|
+
checkin === void 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
|
|
11829
|
+
className: "fact",
|
|
11830
|
+
children: [(0, react_jsx_runtime.jsx)("dt", { children: t?.("channelpool.todayClaimed") ?? "今日签到" }), claimed ? (0, react_jsx_runtime.jsxs)("dd", {
|
|
11831
|
+
style: { color: "var(--accent)" },
|
|
11832
|
+
children: ["已领", typeof checkin?.todayCredit === "number" ? ` +${amount(checkin.todayCredit)}` : ""]
|
|
11833
|
+
}) : (0, react_jsx_runtime.jsx)("dd", { children: t?.("channelpool.notClaimed") ?? "未领" })]
|
|
11834
|
+
}),
|
|
11835
|
+
checkin === void 0 || checkin.streakDays <= 0 ? null : (0, react_jsx_runtime.jsxs)("div", {
|
|
11836
|
+
className: "fact",
|
|
11837
|
+
children: [(0, react_jsx_runtime.jsx)("dt", { children: "连续签到" }), (0, react_jsx_runtime.jsx)("dd", { children: `${String(checkin.streakDays)} 天` })]
|
|
11838
|
+
})
|
|
11839
|
+
]
|
|
11840
|
+
}),
|
|
11841
|
+
(0, react_jsx_runtime.jsxs)("div", {
|
|
11842
|
+
className: "acct-more",
|
|
11843
|
+
children: [
|
|
11844
|
+
checkin === void 0 ? null : (0, react_jsx_runtime.jsx)("button", {
|
|
11845
|
+
type: "button",
|
|
11846
|
+
className: "tiny",
|
|
11847
|
+
disabled: busy || claiming || claimed || checkin.active !== true,
|
|
11848
|
+
title: checkin.active === true ? void 0 : "这个账号当前没有签到活动",
|
|
11849
|
+
onClick: () => {
|
|
11850
|
+
lane.onClaim(account.id);
|
|
11851
|
+
},
|
|
11852
|
+
children: claimed ? t?.("channelpool.claimClaimed") ?? "今日已领取" : claiming ? t?.("channelpool.claiming") ?? "领取中…" : "签到"
|
|
11853
|
+
}),
|
|
11854
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
11855
|
+
type: "button",
|
|
11856
|
+
className: "tiny",
|
|
11857
|
+
disabled: busy || account.preferred,
|
|
11858
|
+
title: t?.("channelpool.preferHint") ?? "优先用这个账号接下一次请求",
|
|
11859
|
+
onClick: () => {
|
|
11860
|
+
lane.onPrefer(account.preferred ? null : account.id);
|
|
11861
|
+
},
|
|
11862
|
+
children: account.preferred ? t?.("channelpool.preferred") ?? "首选" : t?.("channelpool.prefer") ?? "设为首选"
|
|
11863
|
+
}),
|
|
11864
|
+
(0, react_jsx_runtime.jsx)("button", {
|
|
11865
|
+
type: "button",
|
|
11866
|
+
className: "tiny",
|
|
11867
|
+
disabled: busy,
|
|
11868
|
+
style: { color: "var(--danger)" },
|
|
11869
|
+
title: "把这个账号从池子里永久移除(可在「已忽略」里恢复)",
|
|
11870
|
+
onClick: () => {
|
|
11871
|
+
lane.onIgnore(account.id);
|
|
11872
|
+
},
|
|
11873
|
+
children: "移出池子"
|
|
11874
|
+
})
|
|
11875
|
+
]
|
|
11876
|
+
})
|
|
11877
|
+
]
|
|
11878
|
+
})
|
|
11879
|
+
]
|
|
11880
|
+
}, account.id);
|
|
11881
|
+
})
|
|
11882
|
+
}),
|
|
11883
|
+
lane !== void 0 ? null : accounts.length === 0 ? (0, react_jsx_runtime.jsx)("p", {
|
|
11849
11884
|
className: "hint",
|
|
11850
11885
|
children: t?.("channelpool.accountsEmpty") ?? "这个渠道还没有登录的账号。"
|
|
11851
11886
|
}) : (0, react_jsx_runtime.jsx)("div", {
|
|
@@ -16143,6 +16178,32 @@ window.__ModuleLoader__.load({
|
|
|
16143
16178
|
});
|
|
16144
16179
|
}
|
|
16145
16180
|
//#endregion
|
|
16181
|
+
//#region src/client/earned-today.ts
|
|
16182
|
+
function dayKeyOf(date) {
|
|
16183
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
16184
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
16185
|
+
return `${String(date.getFullYear())}-${month}-${day}`;
|
|
16186
|
+
}
|
|
16187
|
+
function earnedToday(status, today) {
|
|
16188
|
+
const totals = {
|
|
16189
|
+
credit: 0,
|
|
16190
|
+
energy: 0,
|
|
16191
|
+
claimed: 0
|
|
16192
|
+
};
|
|
16193
|
+
if (status === void 0) return totals;
|
|
16194
|
+
for (const account of status.accounts) totals.credit += account.checkin?.todayCredit ?? 0;
|
|
16195
|
+
for (const entry of Object.values(status.automation?.earningsToday ?? {})) {
|
|
16196
|
+
if (entry.date !== today) continue;
|
|
16197
|
+
totals.credit += entry.credit + entry.bonusCredit + entry.travelCredit + entry.compensationCredit;
|
|
16198
|
+
totals.energy += entry.energy;
|
|
16199
|
+
totals.claimed += entry.claimed;
|
|
16200
|
+
}
|
|
16201
|
+
return totals;
|
|
16202
|
+
}
|
|
16203
|
+
function earnedNothing(totals) {
|
|
16204
|
+
return totals.credit === 0 && totals.energy === 0 && totals.claimed === 0;
|
|
16205
|
+
}
|
|
16206
|
+
//#endregion
|
|
16146
16207
|
//#region src/client/PoolCard.tsx
|
|
16147
16208
|
const POLL_INTERVAL_MS = 3e4;
|
|
16148
16209
|
function formatNumber(value) {
|
|
@@ -16169,32 +16230,14 @@ window.__ModuleLoader__.load({
|
|
|
16169
16230
|
}
|
|
16170
16231
|
const FAILURE_LINES_SHOWN = 2;
|
|
16171
16232
|
function automationEarnedToday(status, t) {
|
|
16172
|
-
const
|
|
16173
|
-
if (
|
|
16174
|
-
|
|
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;
|
|
16233
|
+
const totals = earnedToday(status, dayKeyOf(new Date()));
|
|
16234
|
+
if (earnedNothing(totals)) return void 0;
|
|
16235
|
+
if (totals.energy === 0 && totals.claimed === 0) return t?.("channelpool.autoEarnedCredits", { credit: totals.credit }) ?? `${String(totals.credit)} credits`;
|
|
16187
16236
|
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}`;
|
|
16237
|
+
credit: totals.credit,
|
|
16238
|
+
energy: totals.energy,
|
|
16239
|
+
count: totals.claimed
|
|
16240
|
+
}) ?? `${String(totals.credit)} credits · ${String(totals.energy)} energy · ${String(totals.claimed)} task(s)`;
|
|
16198
16241
|
}
|
|
16199
16242
|
function automationFailures(status) {
|
|
16200
16243
|
const lines = automationJobs(status).flatMap((job) => job.failures ?? []);
|
|
@@ -16251,7 +16294,6 @@ window.__ModuleLoader__.load({
|
|
|
16251
16294
|
label: t?.("shell.tabBackup") ?? "Backup"
|
|
16252
16295
|
}
|
|
16253
16296
|
];
|
|
16254
|
-
const [selectedChannel, setSelectedChannel] = (0, react.useState)("");
|
|
16255
16297
|
const [page, setPage] = (0, react.useState)(() => initialShellTab(rememberedShellTab(), shellTabs) ?? "pool");
|
|
16256
16298
|
const [busyRegion, setBusyRegion] = (0, react.useState)(void 0);
|
|
16257
16299
|
const [catalogBusyRegion, setCatalogBusyRegion] = (0, react.useState)(void 0);
|
|
@@ -16570,7 +16612,31 @@ window.__ModuleLoader__.load({
|
|
|
16570
16612
|
};
|
|
16571
16613
|
t?.("row.title");
|
|
16572
16614
|
t?.("row.desc");
|
|
16573
|
-
const
|
|
16615
|
+
const laneFor = (region) => {
|
|
16616
|
+
const here = statusOf(region);
|
|
16617
|
+
return {
|
|
16618
|
+
accounts: here?.accounts ?? [],
|
|
16619
|
+
activeAccountId: here?.activeAccountId,
|
|
16620
|
+
claimingId: checkinBusyId,
|
|
16621
|
+
busyId: accountBusyId,
|
|
16622
|
+
onClaim: (accountId) => {
|
|
16623
|
+
claimCheckin(region, accountId);
|
|
16624
|
+
},
|
|
16625
|
+
onToggle: (accountId, disabled) => {
|
|
16626
|
+
toggleAccountDisabled(region, accountId, disabled);
|
|
16627
|
+
},
|
|
16628
|
+
onPrefer: (accountId) => {
|
|
16629
|
+
setPreferredAccount(region, accountId);
|
|
16630
|
+
},
|
|
16631
|
+
onIgnore: (accountId) => {
|
|
16632
|
+
setAccountIgnored(region, accountId, true);
|
|
16633
|
+
}
|
|
16634
|
+
};
|
|
16635
|
+
};
|
|
16636
|
+
const poolLanes = {
|
|
16637
|
+
[REGION_CHANNEL_BY_REGION.cn]: laneFor("cn"),
|
|
16638
|
+
[REGION_CHANNEL_BY_REGION.global]: laneFor("global")
|
|
16639
|
+
};
|
|
16574
16640
|
return (0, react_jsx_runtime.jsx)(PoolShell, {
|
|
16575
16641
|
t,
|
|
16576
16642
|
version: POOL_VERSION,
|
|
@@ -16611,43 +16677,7 @@ window.__ModuleLoader__.load({
|
|
|
16611
16677
|
style: { display: "contents" },
|
|
16612
16678
|
children: (0, react_jsx_runtime.jsx)(ChannelPoolSection, {
|
|
16613
16679
|
t,
|
|
16614
|
-
|
|
16615
|
-
const here = statusOf(region);
|
|
16616
|
-
const rows = here?.accounts ?? [];
|
|
16617
|
-
if (rows.length === 0) return null;
|
|
16618
|
-
return (0, react_jsx_runtime.jsxs)("section", {
|
|
16619
|
-
className: "sec",
|
|
16620
|
-
children: [(0, react_jsx_runtime.jsx)("div", {
|
|
16621
|
-
className: "sec-head",
|
|
16622
|
-
children: (0, react_jsx_runtime.jsxs)("span", {
|
|
16623
|
-
className: "sec-title",
|
|
16624
|
-
children: [region === "cn" ? t?.("row.tabCn") ?? "CN" : t?.("row.tabGlobal") ?? "Global", ` · ${String(rows.length)}`]
|
|
16625
|
-
})
|
|
16626
|
-
}), (0, react_jsx_runtime.jsx)("div", {
|
|
16627
|
-
className: "accts",
|
|
16628
|
-
children: rows.map((account) => (0, react_jsx_runtime.jsx)(AccountCard, {
|
|
16629
|
-
account,
|
|
16630
|
-
t,
|
|
16631
|
-
serving: here?.activeAccountId === account.id,
|
|
16632
|
-
...checkinBusyId === account.id ? { claiming: true } : {},
|
|
16633
|
-
...accountBusyId === account.id ? { busy: true } : {},
|
|
16634
|
-
onClaim: () => {
|
|
16635
|
-
claimCheckin(region, account.id);
|
|
16636
|
-
},
|
|
16637
|
-
onToggle: (disabled) => {
|
|
16638
|
-
toggleAccountDisabled(region, account.id, disabled);
|
|
16639
|
-
},
|
|
16640
|
-
onPrefer: (id) => {
|
|
16641
|
-
setPreferredAccount(region, id);
|
|
16642
|
-
},
|
|
16643
|
-
onIgnore: () => {
|
|
16644
|
-
setAccountIgnored(region, account.id, true);
|
|
16645
|
-
}
|
|
16646
|
-
}, account.id))
|
|
16647
|
-
})]
|
|
16648
|
-
}, region);
|
|
16649
|
-
}) : void 0,
|
|
16650
|
-
active: selectedChannel,
|
|
16680
|
+
poolLanes,
|
|
16651
16681
|
onAddAccount: () => {
|
|
16652
16682
|
setPage("channels");
|
|
16653
16683
|
},
|
|
@@ -19902,6 +19932,24 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
|
|
|
19902
19932
|
.app[data-theme="light"] .col:hover .col-bar {
|
|
19903
19933
|
background: oklch(64% .13 152);
|
|
19904
19934
|
}
|
|
19935
|
+
`;
|
|
19936
|
+
new Intl.NumberFormat();
|
|
19937
|
+
const ACCOUNT_CARD_CSS = `
|
|
19938
|
+
.xdp-accts{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:var(--s3)}
|
|
19939
|
+
.xdp-acct{display:flex;flex-direction:column;gap:var(--s2);min-width:0;padding:var(--s3);border:1px solid var(--line);border-radius:var(--r-lg);background:var(--surface)}
|
|
19940
|
+
.xdp-acct[data-serving="true"]{border-color:var(--accent-line)}
|
|
19941
|
+
.xdp-acct .xdp-acct-head{display:block;min-width:0}
|
|
19942
|
+
.xdp-acct .xdp-acct-name{display:block;max-width:100%;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;font-size:var(--fs-sm);font-weight:600;color:var(--text)}
|
|
19943
|
+
.xdp-acct .xdp-acct-badges{display:flex;flex-wrap:wrap;gap:var(--s1)}
|
|
19944
|
+
.xdp-acct .xdp-acct-badge{flex:0 0 auto;padding:0 6px;border:1px solid var(--accent-line);border-radius:var(--r-pill);background:var(--accent-dim);color:var(--accent);font-size:var(--fs-xs);line-height:16px;white-space:nowrap}
|
|
19945
|
+
.xdp-acct-badge.is-off{border-color:var(--line-2);background:transparent;color:var(--faint)}
|
|
19946
|
+
.xdp-acct-badge.is-warn{border-color:color-mix(in oklch, var(--warn) 40%, transparent);background:color-mix(in oklch, var(--warn) 10%, transparent);color:var(--warn)}
|
|
19947
|
+
.xdp-acct-meta{margin:0;font-size:var(--fs-xs);line-height:1.5;color:var(--faint);font-variant-numeric:tabular-nums;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
|
19948
|
+
.xdp-acct-credits{display:flex;align-items:baseline;gap:var(--s2);min-width:0;flex-wrap:wrap}
|
|
19949
|
+
.xdp-acct-credits strong{font-size:var(--fs-lg);font-weight:600;color:var(--text);font-variant-numeric:tabular-nums}
|
|
19950
|
+
.xdp-acct-credits > span{font-size:var(--fs-xs);color:var(--faint)}
|
|
19951
|
+
.xdp-acct-warn{font-size:var(--fs-xs);color:var(--warn)}
|
|
19952
|
+
.xdp-acct-actions{display:flex;flex-wrap:wrap;gap:var(--s1);padding-top:2px}
|
|
19905
19953
|
`;
|
|
19906
19954
|
//#endregion
|
|
19907
19955
|
//#region src/client/design-style.ts
|
|
@@ -20596,6 +20644,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
|
|
|
20596
20644
|
"channelpool.autoClaimRunning": "Running…",
|
|
20597
20645
|
"channelpool.autoClaimRunHint": "Run one collection pass now instead of waiting for the scheduled hour",
|
|
20598
20646
|
"channelpool.autoEarned": "{credit} credits · {energy} energy · {count} task(s)",
|
|
20647
|
+
"channelpool.autoEarnedCredits": "{credit} credits",
|
|
20599
20648
|
"channelpool.modePrefer": "Priority",
|
|
20600
20649
|
"channelpool.modePreferHint": "Priority: always use the first account until it is rate-limited.",
|
|
20601
20650
|
"channelpool.modeRoundRobin": "Round robin",
|
|
@@ -21361,6 +21410,7 @@ label.sw:has(input:disabled) { opacity: .5; cursor: not-allowed }
|
|
|
21361
21410
|
"channelpool.autoClaimRunning": "领取中…",
|
|
21362
21411
|
"channelpool.autoClaimRunHint": "马上跑一轮领取,不用等到预定时间",
|
|
21363
21412
|
"channelpool.autoEarned": "{credit} 积分 · {energy} 能量 · {count} 个任务",
|
|
21413
|
+
"channelpool.autoEarnedCredits": "{credit} 积分",
|
|
21364
21414
|
"channelpool.modePrefer": "优先",
|
|
21365
21415
|
"channelpool.modePreferHint": "优先:总用排在前面的账号,它限流了才换下一个。",
|
|
21366
21416
|
"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.
|
|
29383
|
+
const POOL_VERSION = "3.2.0";
|
|
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.
|
|
5
|
+
"version": "3.2.0",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "XDTrees",
|
|
8
8
|
"homepage": "https://github.com/XDTrees/dsh-xdpool#readme",
|