@goodandready/dsh-subscriptions 0.6.7 → 0.6.9
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.md +18 -0
- package/README.ru.md +18 -0
- package/README.zh.md +18 -0
- package/lib/accounts.js +0 -17
- package/lib/client.js +502 -284
- package/lib/http.js +7 -0
- package/lib/relative-time.js +11 -3
- package/lib/routes/status.js +22 -14
- package/lib/routes.js +9 -2
- package/lib/updater.js +260 -0
- package/lib/usage.js +11 -11
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -252,6 +252,24 @@ Supports Anthropic's adaptive thinking (`thinking: { type: "adaptive" }`) and re
|
|
|
252
252
|
|
|
253
253
|
---
|
|
254
254
|
|
|
255
|
+
## 🌐 Full Bilingual Localization (EN / ZH) & Account Health (Added in v0.6.8)
|
|
256
|
+
|
|
257
|
+
- **Strict Localization Standards**: Built-in UI dictionary is now 100% bilingual with complete English (`en`) and Simplified Chinese (`zh`) translation dictionaries and instruction guides.
|
|
258
|
+
- **Decoupled Translations**: Russian and other localized translations are provided at runtime via standalone dictionary packages (such as `dsh-russian-lang`), leaving the core plugin codebase lean and zero-hardcoded.
|
|
259
|
+
- **Per-Account Health & Latency Probe**: The slot check button now records live upstream round-trip latency (`latencyMs`) for each individual subscription account slot.
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
## 🚀 One-Click Plugin Updater & Stability Hardening (Added in v0.6.9)
|
|
264
|
+
|
|
265
|
+
- **Host One-Click Updater**: Automatic in-place updater mounted at `/dsh-subscriptions/update`, checking the npm registry for newer releases and executing single-flight installation via the host DSH CLI (`dsh plugin add --config.minimumReleaseAge=0`).
|
|
266
|
+
- **Security & Origin Protection**: Updater endpoints enforce strict loopback address checks (supporting IPv4 `127.0.0.1`, IPv6 `::1`, `localhost`), `x-dsh-plugin-update` header verification, and same-origin validation to prevent unauthorized updates.
|
|
267
|
+
- **Header Badge & UI Action**: The settings header bar displays current plugin version, an update warning badge when a new release is detected, and an instant "Update" button with live restart countdown.
|
|
268
|
+
- **Network Timeout Hardening**: Quota balance and smoke test probes now enforce guaranteed 15-second abort timeouts (`AbortSignal.timeout(15_000)`), preventing hanging sockets during vendor outages.
|
|
269
|
+
- **Parameter Normalization & Deduplication**: Unified support for `provider || vendor` and `index || accountIndex` aliases in check endpoints, and deduplicated threshold notification loops.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
255
273
|
## 🌐 Localization
|
|
256
274
|
|
|
257
275
|
The plugin source language is English only. Russian and other translations are provided at runtime by separate language plugins (for example the russification plugin), which translate the registered locale keys - the package itself ships no bundled translations (Changed in 0.6.1).
|
package/README.ru.md
CHANGED
|
@@ -225,6 +225,24 @@ dsh-subscriptions:
|
|
|
225
225
|
|
|
226
226
|
---
|
|
227
227
|
|
|
228
|
+
## 🌐 Двуязычная локализация (EN / ZH) и проверка здоровья аккаунтов (Добавлено в v0.6.8)
|
|
229
|
+
|
|
230
|
+
- **Стандарты локализации**: Встроенный интерфейс стал на 100% двуязычным — предоставлены полные словари и инструкции на английском (`en`) и упрощенном китайском (`zh`) языках.
|
|
231
|
+
- **Внешняя русификация**: Русские строки полностью отделены от исходного кода плагина и подключаются динамически через официальный плагин русификации (`dsh-russian-lang`).
|
|
232
|
+
- **Индивидуальная проверка аккаунта**: Кнопка проверки в карточке слота измеряет фактическую задержку (`latencyMs`) и статус здоровья выбранного аккаунта.
|
|
233
|
+
|
|
234
|
+
---
|
|
235
|
+
|
|
236
|
+
## 🚀 Обновление в один клик и повышение стабильности (Добавлено в v0.6.9)
|
|
237
|
+
|
|
238
|
+
- **Встроенный апдейтер в один клик**: Фоновая проверка новых версий в npm registry и обновление на месте по маршруту `/dsh-subscriptions/update` через хостовый CLI DSH (`dsh plugin add --config.minimumReleaseAge=0`).
|
|
239
|
+
- **Безопасность и защита эндпоинта**: Строгая верификация loopback-адресов (поддержка IPv4 `127.0.0.1`, IPv6 `::1`, `localhost`), валидация заголовка `x-dsh-plugin-update` и защита от CSRF/cross-origin запросов.
|
|
240
|
+
- **Индикатор в шапке и кнопка обновления**: В строке состояния панели отображается текущая версия, бейдж наличия обновления и кнопка быстрого обновления («Update → vX.Y.Z») с уведомлением о перезапуске службы.
|
|
241
|
+
- **Сетевые таймауты и устойчивость**: Ограничение времени ожидания запросов баланса и smoke-тестов до 15 секунд (`AbortSignal.timeout(15_000)`), предотвращающее зависание сокетов при недоступности внешних API.
|
|
242
|
+
- **Нормализация параметров и дедупликация**: Поддержка алиасов параметров `provider || vendor` и `index || accountIndex` в статусных маршрутах, а также устранение дублирующего цикла нотификаций в `lib/accounts.js`.
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
228
246
|
## 🌐 Локализация
|
|
229
247
|
|
|
230
248
|
Исходный язык плагина - только английский. Русский и другие переводы во время работы предоставляют отдельные языковые плагины (например, плагин русификации), переводящие зарегистрированные ключи локали, - сам пакет не содержит встроенных переводов (Changed in 0.6.1).
|
package/README.zh.md
CHANGED
|
@@ -147,6 +147,24 @@ dsh plugin --profile web add @goodandready/dsh-subscriptions
|
|
|
147
147
|
|
|
148
148
|
---
|
|
149
149
|
|
|
150
|
+
## 🌐 完整双语支持 (EN / ZH) 与单账户健康探活 (v0.6.8 新增)
|
|
151
|
+
|
|
152
|
+
- **原生双语支持**: 内置 UI 字典全面提供英语 (`en`) 与简体中文 (`zh`) 翻译,所有服务商获取令牌指引均具备中英双语版。
|
|
153
|
+
- **解耦外部翻译**: 俄语等其他语种由独立语言包插件(如 `dsh-russian-lang`)在运行时翻译,插件源码保持纯净零硬编码。
|
|
154
|
+
- **单账户实时探活与延迟测量**: 槽位中的“检测”按钮实时测量对应订阅账户的双向响应延迟 (`latencyMs`) 与健康状态。
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## 🚀 一键插件自更新与稳定性强化 (v0.6.9 新增)
|
|
159
|
+
|
|
160
|
+
- **宿主端一键更新**: 挂载于 `/dsh-subscriptions/update` 的就地更新机制,自动对比 npm registry 最新版本并通过宿主 DSH CLI 执行单飞安装 (`dsh plugin add --config.minimumReleaseAge=0`)。
|
|
161
|
+
- **安全与来源防护**: 更新接口严格校验环回地址(支持 IPv4 `127.0.0.1`、IPv6 `::1`、`localhost`)、`x-dsh-plugin-update` 请求头及同源策略,阻断未授权跨站调用。
|
|
162
|
+
- **状态栏徽章与更新按钮**: 设置面板顶部状态栏显示当前插件版本,有新版本时提示告警徽章并提供一键更新按钮与重启提示。
|
|
163
|
+
- **网络超时熔断**: 配额检测与冒烟测试增加 15 秒超时信号保护 (`AbortSignal.timeout(15_000)`),防止外部服务商接口故障导致请求挂起。
|
|
164
|
+
- **参数容错与逻辑去重**: 状态接口兼容 `provider || vendor` 与 `index || accountIndex` 参数别名,并消除 `lib/accounts.js` 中的重复配额通知循环。
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
150
168
|
## 🌐 本地化
|
|
151
169
|
|
|
152
170
|
插件源语言仅为英语。俄语及其他翻译由独立的语言插件(如俄化插件)在运行时对注册的本地化键进行翻译,包本身不内置翻译(Changed in 0.6.1)。
|
package/lib/accounts.js
CHANGED
|
@@ -268,23 +268,6 @@ export function createAccountStore({ credentials, getConfig, fetchImpl, fetchFor
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
// Notification thresholds: 70/90/100% — fire once per window until reset.
|
|
272
|
-
if (Array.isArray(snap.windows)) {
|
|
273
|
-
for (const win of snap.windows) {
|
|
274
|
-
if (!win || !Number.isFinite(Number(win.usedPercent))) continue
|
|
275
|
-
const pct = Number(win.usedPercent)
|
|
276
|
-
const key = slot.ref + ':' + win.id
|
|
277
|
-
const prev = notifyThresholds.get(key) || 0
|
|
278
|
-
const THRESHOLDS = [70, 90, 100]
|
|
279
|
-
for (const th of THRESHOLDS) {
|
|
280
|
-
if (pct >= th && prev < th) {
|
|
281
|
-
notifyThresholds.set(key, th)
|
|
282
|
-
try { onLimitNotice && onLimitNotice(slot.provider, slot.ref, win, th) } catch {}
|
|
283
|
-
break
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
271
|
const list = Array.isArray(snap.windows) ? snap.windows : null
|
|
289
272
|
if (list) {
|
|
290
273
|
windows.set(slot.ref, list)
|