dsh-sub2api 0.2.2 → 0.2.3
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/CHANGELOG.md +8 -0
- package/lib/client.js +2 -3
- package/lib/constants.js +2 -2
- package/lib/index.js +17 -0
- package/lib/routes.js +3 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.3
|
|
4
|
+
|
|
5
|
+
- Show the running build's version in the panel's 诊断 card. A fix that shipped
|
|
6
|
+
minutes ago and an install that never updated look identical in a screenshot;
|
|
7
|
+
now the version says which one it is.
|
|
8
|
+
- The 诊断 card and the diagnostic detail quote balances in ¥ like the rest of
|
|
9
|
+
the panel.
|
|
10
|
+
|
|
3
11
|
## 0.2.2
|
|
4
12
|
|
|
5
13
|
- Quote quota in yuan, which is what the site actually sells. The panel labelled
|
package/lib/client.js
CHANGED
|
@@ -828,10 +828,9 @@ window.__ModuleLoader__.load({
|
|
|
828
828
|
|
|
829
829
|
return h(Card, {
|
|
830
830
|
title: "诊断",
|
|
831
|
+
meta: state.version ? "v" + state.version : null,
|
|
831
832
|
aside: result
|
|
832
|
-
? h("span", {
|
|
833
|
-
style: { ...T.meta, marginLeft: "auto", color: result.ok ? C.ok : C.warn },
|
|
834
|
-
}, result.summary)
|
|
833
|
+
? h("span", { style: { ...T.meta, color: result.ok ? C.ok : C.warn } }, result.summary)
|
|
835
834
|
: null,
|
|
836
835
|
},
|
|
837
836
|
h("div", { style: T.row },
|
package/lib/constants.js
CHANGED
|
@@ -48,8 +48,8 @@ export const KEY_PAGE_SIZE = 100;
|
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Currency of every amount this plugin shows. Sub2API quotes quota in yuan and
|
|
51
|
-
* treats one quota unit as one yuan ("1 额度 = 1 元"), so
|
|
52
|
-
*
|
|
51
|
+
* treats one quota unit as one yuan ("1 额度 = 1 元"), so the panel never uses a
|
|
52
|
+
* foreign-currency figure.
|
|
53
53
|
*/
|
|
54
54
|
export const CURRENCY_SYMBOL = "¥";
|
|
55
55
|
|
package/lib/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
import { PROVIDER, PLUGIN_NAME, SETTINGS_NS } from "./constants.js";
|
|
13
|
+
import { readFileSync } from "node:fs";
|
|
13
14
|
import { resolveConfig } from "./config.js";
|
|
14
15
|
import { Sub2ApiAdapter } from "./adapter.js";
|
|
15
16
|
import { makeRoutes } from "./routes.js";
|
|
@@ -27,6 +28,21 @@ export const name = PLUGIN_NAME;
|
|
|
27
28
|
/** Services required before anything can mount. */
|
|
28
29
|
export const inject = ["llm"];
|
|
29
30
|
|
|
31
|
+
/**
|
|
32
|
+
* The running build's version, read from the package next to the module.
|
|
33
|
+
*
|
|
34
|
+
* The panel shows it, because "which version am I looking at" is otherwise
|
|
35
|
+
* unanswerable from a screenshot — and a fix that shipped ten minutes ago is
|
|
36
|
+
* indistinguishable from one that never arrived.
|
|
37
|
+
*/
|
|
38
|
+
export const VERSION = (() => {
|
|
39
|
+
try {
|
|
40
|
+
return JSON.parse(readFileSync(new URL("../package.json", import.meta.url), "utf8")).version;
|
|
41
|
+
} catch {
|
|
42
|
+
return "unknown";
|
|
43
|
+
}
|
|
44
|
+
})();
|
|
45
|
+
|
|
30
46
|
/** Order of the announcement section within the tool-guidance band. */
|
|
31
47
|
const SECTION_ORDER = 172;
|
|
32
48
|
|
|
@@ -159,6 +175,7 @@ export function apply(ctx, rawConfig = {}) {
|
|
|
159
175
|
...deps,
|
|
160
176
|
cfg,
|
|
161
177
|
panel,
|
|
178
|
+
version: VERSION,
|
|
162
179
|
announceCatalog,
|
|
163
180
|
hostname: () => "dsh",
|
|
164
181
|
refreshCatalog: async (key) => {
|
package/lib/routes.js
CHANGED
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
* @returns {Array<{kind: "exact", path: string, handler: Function}>}
|
|
38
38
|
*/
|
|
39
39
|
export function makeRoutes(deps) {
|
|
40
|
-
const { api, session, catalog, cfg, logger, panel, announceCatalog } = deps;
|
|
40
|
+
const { api, session, catalog, cfg, logger, panel, announceCatalog, version } = deps;
|
|
41
41
|
|
|
42
42
|
/** Orders created by this process, keyed by the pay centre's order number. */
|
|
43
43
|
const orders = new Map();
|
|
@@ -62,6 +62,7 @@ export function makeRoutes(deps) {
|
|
|
62
62
|
panel: panel.snapshot(),
|
|
63
63
|
rechargeMultiplier: cfg().rechargeMultiplier,
|
|
64
64
|
currency: "CNY",
|
|
65
|
+
version: version ?? "unknown",
|
|
65
66
|
showSidebarQuota: cfg().showSidebarQuota,
|
|
66
67
|
};
|
|
67
68
|
|
|
@@ -289,7 +290,7 @@ export function makeRoutes(deps) {
|
|
|
289
290
|
"profile",
|
|
290
291
|
"账号资料",
|
|
291
292
|
profile !== undefined,
|
|
292
|
-
profile === undefined ? "读取失败" : `余额
|
|
293
|
+
profile === undefined ? "读取失败" : `余额 ¥${Number.isFinite(balance) ? balance.toFixed(2) : "?"}`,
|
|
293
294
|
);
|
|
294
295
|
add(
|
|
295
296
|
"balance",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-sub2api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Sub2API provider for DeepSeek Harness: zero-friction signup, auto-provisioned API key, upstream model sync, balance and recharge",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "GPL-3.0-only",
|