@goodandready/dsh-subscriptions 0.6.10 → 0.6.11
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 +8 -0
- package/README.ru.md +8 -0
- package/README.zh.md +8 -0
- package/lib/client.js +7 -1
- package/lib/config-schema.js +2 -0
- package/lib/oauth.js +3 -0
- package/lib/routes/oauth.js +14 -1
- package/lib/vendors/antigravity.js +3 -0
- package/lib/vendors/glm.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -272,6 +272,14 @@ Supports Anthropic's adaptive thinking (`thinking: { type: "adaptive" }`) and re
|
|
|
272
272
|
|
|
273
273
|
---
|
|
274
274
|
|
|
275
|
+
## 🔒 OAuth Client Validation & Route Updates (Added in v0.6.11)
|
|
276
|
+
|
|
277
|
+
- **OAuth Client ID Guard (GitHub #2)**: uildAuthorizeUrl and ntigravity.authorizeUrl now strictly require a non-empty clientId. If unconfigured, the endpoint returns an explicit HTTP 400 (missing_client_id) and the UI prompts the user to configure ntigravityClientId in plugin settings or use "From CLI" instead of directing the browser to a failing Google OAuth page.
|
|
278
|
+
- **Config Schema Secret Key**: Added ntigravityClientSecret to the plugin configuration schema, allowing convenient entry of private client secrets alongside ntigravityClientId with automatic masking in public endpoints.
|
|
279
|
+
- **Zhipu GLM Console Route Migration (GitHub #3)**: Updated the Zhipu GLM authorization and API key center link to the active console route (https://bigmodel.cn/usercenter/proj-mgmt/apikeys), eliminating 404 navigation errors caused by vendor console restructuring.
|
|
280
|
+
|
|
281
|
+
---
|
|
282
|
+
|
|
275
283
|
## 🛡️ Reliability & Quality Hardening (Added in v0.6.10)
|
|
276
284
|
|
|
277
285
|
- **Structured Error Handling**: Eliminated all empty catch blocks across the plugin runtime via safe `bestEffort` helper logging debug diagnostics.
|
package/README.ru.md
CHANGED
|
@@ -245,6 +245,14 @@ dsh-subscriptions:
|
|
|
245
245
|
|
|
246
246
|
---
|
|
247
247
|
|
|
248
|
+
## 🔒 Защита OAuth Client ID и обновление ссылок (Добавлено в v0.6.11)
|
|
249
|
+
|
|
250
|
+
- **Защита OAuth Client ID (GitHub #2)**: uildAuthorizeUrl и ntigravity.authorizeUrl теперь строго требуют непустой clientId. Если параметр не задан, сервер возвращает явный код ошибки HTTP 400 (missing_client_id), а интерфейс выводит подсказку с предложением указать ntigravityClientId в настройках или нажать «📥 Из CLI», предотвращая отправку битых запросов в Google OAuth.
|
|
251
|
+
- **Секретный ключ в схеме настроек**: В схему Config добавлено поле ntigravityClientSecret для удобного ввода Client Secret рядом с ntigravityClientId с автоматическим маскированием в публичном API.
|
|
252
|
+
- **Актуализация маршрута Zhipu GLM (GitHub #3)**: Ссылка на консоль API-ключей Zhipu GLM обновлена на актуальный адрес (https://bigmodel.cn/usercenter/proj-mgmt/apikeys), устраняя ошибку 404 («页面跑丢啦!!»), вызванную миграцией маршрутов вендора.
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
248
256
|
## 🛡️ Надежность и стандарты качества (Добавлено в v0.6.10)
|
|
249
257
|
|
|
250
258
|
- **Структурированная обработка ошибок**: Устранены все пустые блоки catch в рантайме плагина с переходом на безопасный хелпер `bestEffort` с диагностическим логированием.
|
package/README.zh.md
CHANGED
|
@@ -167,6 +167,14 @@ dsh plugin --profile web add @goodandready/dsh-subscriptions
|
|
|
167
167
|
|
|
168
168
|
---
|
|
169
169
|
|
|
170
|
+
## 🔒 OAuth Client ID 校验保护与控制台地址更新 (v0.6.11 新增)
|
|
171
|
+
|
|
172
|
+
- **Google OAuth Client ID 校验保护 (GitHub #2)**:uildAuthorizeUrl 和 ntigravity.authorizeUrl 严格要求非空 clientId。未配置时服务端返回明确的 HTTP 400 (missing_client_id),前端界面提示用户在插件设置中填写 ntigravityClientId 或使用“📥 从 CLI 导入”,避免浏览器跳转至 Google OAuth 400 报错页面。
|
|
173
|
+
- **配置架构新增密钥项**:在插件 Config 架构中新增 ntigravityClientSecret,方便用户在设置中配置客户端密钥,并在公共接口中自动脱敏脱密。
|
|
174
|
+
- **智谱 GLM 控制台地址迁移 (GitHub #3)**:将智谱 GLM 授权与 API Key 获取链接更新为最新控制台有效路由 (https://bigmodel.cn/usercenter/proj-mgmt/apikeys),彻底解决因服务商控制台路由调整导致的 404 错误。
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
170
178
|
## 🛡️ 稳定性与代码质量强化 (v0.6.10 新增)
|
|
171
179
|
|
|
172
180
|
- **结构化异常降级**: 全面移除运行时空 catch 块,统一采用带诊断日志的 `bestEffort` 安全兜底机制。
|
package/lib/client.js
CHANGED
|
@@ -292,7 +292,7 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
292
292
|
"3. 粘贴到输入框中并点击 \"保存令牌\"。",
|
|
293
293
|
"4. 若已安装 ZCode CLI (~/.zcode),点击 \"📥 从 CLI 导入\" 即可自动导入。",
|
|
294
294
|
],
|
|
295
|
-
link: "https://
|
|
295
|
+
link: "https://bigmodel.cn/usercenter/proj-mgmt/apikeys",
|
|
296
296
|
},
|
|
297
297
|
grok: {
|
|
298
298
|
title: "xAI Grok",
|
|
@@ -434,6 +434,7 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
434
434
|
"fcMinutes": "m",
|
|
435
435
|
"reconnect": "Reconnect",
|
|
436
436
|
"connect": "Connect",
|
|
437
|
+
"missingClientIdAntigravity": "Google OAuth requires a custom Client ID. Please configure antigravityClientId in plugin settings below, or click '📥 From CLI' to import active credentials.",
|
|
437
438
|
"disconnect": "Disconnect",
|
|
438
439
|
"removeSlot": "Remove slot",
|
|
439
440
|
"pastePlaceholder": "Paste redirected URL or code",
|
|
@@ -603,6 +604,7 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
603
604
|
"fcMinutes": "分",
|
|
604
605
|
"reconnect": "重新连接",
|
|
605
606
|
"connect": "连接",
|
|
607
|
+
"missingClientIdAntigravity": "Google OAuth 需要自定义 Client ID。请在下方设置中配置 antigravityClientId,或点击‘📥 从 CLI 导入’直接导入本地会话。",
|
|
606
608
|
"disconnect": "断开连接",
|
|
607
609
|
"removeSlot": "移除槽位",
|
|
608
610
|
"pastePlaceholder": "粘贴重定向 URL 或授权代码",
|
|
@@ -985,6 +987,10 @@ const cssId = 'dsh-subscriptions/settings.module.css'
|
|
|
985
987
|
|
|
986
988
|
const connect = async (provider, index) => {
|
|
987
989
|
setErr('')
|
|
990
|
+
if (provider === 'antigravity' && (!draft || !draft.antigravityClientId || !String(draft.antigravityClientId).trim())) {
|
|
991
|
+
setErr(t('missingClientIdAntigravity'))
|
|
992
|
+
return
|
|
993
|
+
}
|
|
988
994
|
const res = await fetch('/dsh-subscriptions/oauth/start?provider=' + encodeURIComponent(provider) + '&index=' + encodeURIComponent(index), { cache: 'no-store' })
|
|
989
995
|
const data = await res.json().catch(() => ({}))
|
|
990
996
|
if (!res.ok) throw new Error((data.error && data.error.message) || ('HTTP ' + res.status))
|
package/lib/config-schema.js
CHANGED
|
@@ -64,6 +64,8 @@ export const Config = z.object({
|
|
|
64
64
|
grokClientVersion: z.string().default('')
|
|
65
65
|
.description('Grok CLI identity version header. Empty uses the built-in default.'),
|
|
66
66
|
antigravityClientId: z.string().default(''),
|
|
67
|
+
antigravityClientSecret: z.string().default('')
|
|
68
|
+
.description('Google Cloud OAuth Client Secret for Antigravity.'),
|
|
67
69
|
antigravityRedirectUri: z.string().default(''),
|
|
68
70
|
customVendors: z.array(z.any()).default([])
|
|
69
71
|
.description('Declarative OpenAI-Responses-compatible providers. See README.'),
|
package/lib/oauth.js
CHANGED
|
@@ -7,6 +7,9 @@ export function buildAuthorizeUrl({
|
|
|
7
7
|
extra,
|
|
8
8
|
scope,
|
|
9
9
|
}) {
|
|
10
|
+
if (!clientId || typeof clientId !== 'string' || !clientId.trim()) {
|
|
11
|
+
throw new Error('Missing required parameter: clientId')
|
|
12
|
+
}
|
|
10
13
|
const url = new URL(authUrl)
|
|
11
14
|
url.searchParams.set('response_type', 'code')
|
|
12
15
|
url.searchParams.set('client_id', clientId)
|
package/lib/routes/oauth.js
CHANGED
|
@@ -51,7 +51,20 @@ export function registerOauthRoutes(ctx, state) {
|
|
|
51
51
|
createdAt: Date.now(),
|
|
52
52
|
})
|
|
53
53
|
const cfg = { ...vendorConfig(provider, live()), redirectUri }
|
|
54
|
-
|
|
54
|
+
let url
|
|
55
|
+
try {
|
|
56
|
+
url = getVendor(provider).authorizeUrl(cfg, pkce)
|
|
57
|
+
} catch (err) {
|
|
58
|
+
pending.delete(pkce.state)
|
|
59
|
+
writeJson(res, 400, {
|
|
60
|
+
ok: false,
|
|
61
|
+
error: {
|
|
62
|
+
code: 'missing_client_id',
|
|
63
|
+
message: err.message || 'OAuth authorization configuration error',
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
return
|
|
67
|
+
}
|
|
55
68
|
// #89: if redirect_uri is loopback - start a temporary catch server.
|
|
56
69
|
let autoCatch = false
|
|
57
70
|
if (live().autoLoopback) {
|
|
@@ -52,6 +52,9 @@ export function defaults() {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
export function authorizeUrl(cfg, pkce) {
|
|
55
|
+
if (!cfg || !cfg.clientId || !String(cfg.clientId).trim()) {
|
|
56
|
+
throw new Error('Google OAuth requires a custom Client ID. Please configure antigravityClientId in plugin settings or use "From CLI" to import active credentials.')
|
|
57
|
+
}
|
|
55
58
|
return buildAuthorizeUrl({
|
|
56
59
|
authUrl: AUTH,
|
|
57
60
|
clientId: cfg.clientId,
|
package/lib/vendors/glm.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-subscriptions",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.11",
|
|
4
4
|
"description": "Use ChatGPT Codex, Claude, Grok, Antigravity, Kimi, GLM, Cursor, Kiro, Copilot, Qwen, ERNIE, Spark, JetBrains, Perplexity, Replit, and Cody subscriptions as DeepSeek Harness LLM providers via OAuth.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|