dsh-desktop-statusbar 2.1.2 → 2.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/README.en.md CHANGED
@@ -1,15 +1,17 @@
1
1
  <h1 align="center">dsh-desktop-statusbar</h1>
2
2
 
3
3
  <p align="center">
4
- <a href="https://github.com/raphael-y7/dsh-desktop-statusbar/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/raphael-y7/dsh-desktop-statusbar?style=social"></a>
5
- <a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek%20Harness-0.2.0--rc.2-%234d6bfe"></a>
6
- <a href="https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar"><img alt="dshfind" src="https://img.shields.io/badge/dshfind-listed-%2300a884"></a>
7
- <a href="https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar"><img alt="1024Store" src="https://img.shields.io/badge/1024Store-listed-orange"></a>
8
- <a href="https://www.npmjs.com/package/dsh-desktop-statusbar"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-desktop-statusbar?color=red"></a>
4
+ <a href="https://github.com/raphael-y7/dsh-desktop-statusbar/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/raphael-y7/dsh-desktop-statusbar?style=flat&logo=github&color=f5f5f5"></a>
5
+ <a href="https://www.npmjs.com/package/dsh-desktop-statusbar"><img alt="npm downloads" src="https://img.shields.io/npm/dt/dsh-desktop-statusbar?style=flat&logo=npm&label=downloads&color=e74c3c"></a>
6
+ <a href="https://www.npmjs.com/package/dsh-desktop-statusbar"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-desktop-statusbar?style=flat&color=9B59B6"></a>
7
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek%20Harness-0.2.1--rc.2-%234d6bfe?style=flat"></a>
8
+ <a href="https://awesome-dsh-plugin.com/p/raphael-y7/dsh-desktop-statusbar/"><img alt="dshmarket" src="https://img.shields.io/badge/dshmarket-listed-%23e6b800?style=flat"></a>
9
+ <a href="https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar"><img alt="dshfind" src="https://img.shields.io/badge/dshfind-listed-%2300897B?style=flat"></a>
10
+ <a href="https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar"><img alt="1024Store" src="https://img.shields.io/badge/1024Store-listed-%23e67e22?style=flat"></a>
9
11
  <br>
10
- <a href="https://nodejs.org/"><img alt="node" src="https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-%238b5cf6"></a>
11
- <img alt="language" src="https://img.shields.io/github/languages/top/raphael-y7/dsh-desktop-statusbar?color=yellow">
12
- <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-%235fa04e"></a>
12
+ <a href="https://nodejs.org/"><img alt="node" src="https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-%230099cc?style=flat"></a>
13
+ <img alt="language" src="https://img.shields.io/badge/javascript-100%25-%23ec407a?style=flat">
14
+ <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-%2327ae60?style=flat"></a>
13
15
  </p>
14
16
 
15
17
  <p align="center"><a href="README.md">中文</a> | English</p>
@@ -71,7 +73,7 @@ Both ways above install from the npm registry; the package name is `dsh-desktop-
71
73
  npm view dsh-desktop-statusbar version
72
74
  ```
73
75
 
74
- Also listed on [dshfind](https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar) and [1024Store](https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar).
76
+ Also listed on [dshmarket](https://awesome-dsh-plugin.com/p/raphael-y7/dsh-desktop-statusbar/), [dshfind](https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar) and [1024Store](https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar).
75
77
 
76
78
  ## Usage
77
79
 
package/README.md CHANGED
@@ -1,15 +1,17 @@
1
1
  <h1 align="center">dsh-desktop-statusbar</h1>
2
2
 
3
3
  <p align="center">
4
- <a href="https://github.com/raphael-y7/dsh-desktop-statusbar/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/raphael-y7/dsh-desktop-statusbar?style=social"></a>
5
- <a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek%20Harness-0.2.0--rc.2-%234d6bfe"></a>
6
- <a href="https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar"><img alt="dshfind" src="https://img.shields.io/badge/dshfind-listed-%2300a884"></a>
7
- <a href="https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar"><img alt="1024Store" src="https://img.shields.io/badge/1024Store-listed-orange"></a>
8
- <a href="https://www.npmjs.com/package/dsh-desktop-statusbar"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-desktop-statusbar?color=red"></a>
4
+ <a href="https://github.com/raphael-y7/dsh-desktop-statusbar/stargazers"><img alt="GitHub stars" src="https://img.shields.io/github/stars/raphael-y7/dsh-desktop-statusbar?style=flat&logo=github&color=f5f5f5"></a>
5
+ <a href="https://www.npmjs.com/package/dsh-desktop-statusbar"><img alt="npm downloads" src="https://img.shields.io/npm/dt/dsh-desktop-statusbar?style=flat&logo=npm&label=downloads&color=e74c3c"></a>
6
+ <a href="https://www.npmjs.com/package/dsh-desktop-statusbar"><img alt="npm version" src="https://img.shields.io/npm/v/dsh-desktop-statusbar?style=flat&color=9B59B6"></a>
7
+ <a href="https://github.com/deepseek-ai/deepseek-harness"><img alt="DeepSeek Harness" src="https://img.shields.io/badge/DeepSeek%20Harness-0.2.1--rc.2-%234d6bfe?style=flat"></a>
8
+ <a href="https://awesome-dsh-plugin.com/p/raphael-y7/dsh-desktop-statusbar/"><img alt="dshmarket" src="https://img.shields.io/badge/dshmarket-listed-%23e6b800?style=flat"></a>
9
+ <a href="https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar"><img alt="dshfind" src="https://img.shields.io/badge/dshfind-listed-%2300897B?style=flat"></a>
10
+ <a href="https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar"><img alt="1024Store" src="https://img.shields.io/badge/1024Store-listed-%23e67e22?style=flat"></a>
9
11
  <br>
10
- <a href="https://nodejs.org/"><img alt="node" src="https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-%238b5cf6"></a>
11
- <img alt="language" src="https://img.shields.io/github/languages/top/raphael-y7/dsh-desktop-statusbar?color=yellow">
12
- <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-%235fa04e"></a>
12
+ <a href="https://nodejs.org/"><img alt="node" src="https://img.shields.io/badge/node-%5E22.19%20%7C%7C%20%3E%3D24-%230099cc?style=flat"></a>
13
+ <img alt="language" src="https://img.shields.io/badge/javascript-100%25-%23ec407a?style=flat">
14
+ <a href="LICENSE"><img alt="license" src="https://img.shields.io/badge/license-MIT-%2327ae60?style=flat"></a>
13
15
  </p>
14
16
 
15
17
  <p align="center">中文 | <a href="README.en.md">English</a></p>
@@ -71,7 +73,7 @@ dsh plugin --profile desktop add dsh-desktop-statusbar
71
73
  npm view dsh-desktop-statusbar version
72
74
  ```
73
75
 
74
- 本插件亦收录于 [dshfind](https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar) 与 [1024Store](https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar)。
76
+ 本插件亦收录于 [dshmarket](https://awesome-dsh-plugin.com/p/raphael-y7/dsh-desktop-statusbar/)、[dshfind](https://dshfind.com/zh/plugins/raphael-y7/dsh-desktop-statusbar) 与 [1024Store](https://deepseek1024.com/plugins/Rapheal-Y7/dsh-desktop-statusbar)。
75
77
 
76
78
  ## 使用
77
79
 
Binary file
package/docs/settings.png CHANGED
Binary file
@@ -242,7 +242,38 @@ const adapters = [
242
242
  if (Number.isFinite(total) !== true) return null;
243
243
  /* 积分不是货币:currency 留空让客户端不拼货币符号;不给 parts,
244
244
  气泡因此只显示总数、不列套餐构成。 */
245
- return { currency: '', total: formatCredits(total), parts: [], isCredits: true };
245
+ const out = { currency: '', total: formatCredits(total), parts: [], isCredits: true };
246
+ /* 套餐列表:新插件(dsh-connect-workbuddy)的 /usage 带 credits.packages,就是官方客户端
247
+ 「积分套餐」那一栏的数据。老插件 /status 只有 credits.total,**不产生 rewards** ——
248
+ 客户端据此保持现在的纯总数显示,不会因为字段缺失去猜。 */
249
+ const packages = Array.isArray(credits.packages) ? credits.packages : null;
250
+ if (packages === null) return out;
251
+ const rewards = [];
252
+ for (let i = 0; i < packages.length; i += 1) {
253
+ const one = packages[i];
254
+ if (one === null || one === undefined || typeof one !== 'object') continue;
255
+ const size = Number(one.size);
256
+ const remain = Number(one.remain);
257
+ /* size/remain 缺一个就没法算「已用/总量」:跳过这个包,
258
+ 不让一条坏数据把整条气泡弄崩(旧插件/上游漂移都可能缺字段)。 */
259
+ if (Number.isFinite(size) !== true || Number.isFinite(remain) !== true || size < 0) continue;
260
+ const name = typeof one.packageName === 'string' ? one.packageName : '';
261
+ if (name.length === 0) continue;
262
+ const monthly = one.monthly === true;
263
+ rewards.push({
264
+ name,
265
+ /* 「已用」与官方同口径:总量 - 剩余(connect 插件已按 CapacitySize/Remain 算好);
266
+ 剩余超过总量这种异常数据夹住到 0,不显示负数。 */
267
+ used: Math.max(0, size - remain),
268
+ total: size,
269
+ /* 一次性包看到期日;月度包看「下期刷新」(官方对月度包不显示「到期」,别编造到期时间) */
270
+ expireAt: monthly ? null : dateOfMs(one.expiresAtMs),
271
+ refreshAt: monthly ? dateOfMs(one.cycleRefreshMs) : null,
272
+ monthly,
273
+ });
274
+ }
275
+ out.rewards = rewards;
276
+ return out;
246
277
  }
247
278
  }
248
279
  ];
@@ -262,6 +293,23 @@ function formatCredits(value) {
262
293
  return whole.replace(/\B(?=(\d{3})+(?!\d))/g, ',') + rest;
263
294
  }
264
295
 
296
+ /**
297
+ * 毫秒时间戳 → 北京时间 'YYYY-MM-DD'(套餐气泡里的到期日/刷新日)。
298
+ *
299
+ * 为什么固定按北京时间算、不看运行环境时区:这个项目的所有「日」口径(峰谷计价、
300
+ * 签到日)都按北京时间;套餐到期时间给用户看的是**中国的日期**,跟着机器时区走
301
+ * 会在海外机器上差一天(服务端实测值如 1794056975000 = 北京时间 2026-11-07 21:09)。
302
+ * 取不到/非法值给 null —— 客户端显示「—」,绝不猜一个日期。
303
+ */
304
+ function dateOfMs(value) {
305
+ const ms = Number(value);
306
+ if (Number.isFinite(ms) !== true || ms <= 0) return null;
307
+ const bj = new Date(ms + 8 * 3600 * 1000);
308
+ const month = String(bj.getUTCMonth() + 1).padStart(2, '0');
309
+ const day = String(bj.getUTCDate()).padStart(2, '0');
310
+ return bj.getUTCFullYear() + '-' + month + '-' + day;
311
+ }
312
+
265
313
  /**
266
314
  * 会话线索 → 平台适配器。
267
315
  *