@sunshaobei/dsh-codex-auth 3.0.4 → 3.0.6

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 CHANGED
@@ -336,14 +336,19 @@ window.__ModuleLoader__.load({
336
336
  mark();
337
337
  return () => { observer.disconnect(); marked.forEach(button => button.classList.remove("codex-auth-nav")); };
338
338
  }, "dsh-codex-auth: ChatGPT navigation icon");
339
- // ---- settings page ----
340
- ctx.slots.inject("settings.section", () => ctx.slots.register({
341
- name: "settings.section",
342
- id: "codex-subscription",
343
- order: 25,
344
- label: () => t("nav"),
345
- locale: NS
346
- }, () => React.createElement(StatusCard, { t: t, call: call })));
339
+ // ---- plugin detail page (plugins.bundle.config) ----
340
+ // 参考 dsh-context:配置命名空间由 configForms 服务托管;没有该服务时直接注册。
341
+ const registerPluginsPageCard = (env) => {
342
+ const cf = env && env.configForms;
343
+ const serve = cf && typeof cf.whileServed === "function" ? (fn) => cf.whileServed([NS], fn) : (fn) => fn();
344
+ serve(() => ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
345
+ name: "plugins.bundle.config",
346
+ key: NS,
347
+ locale: NS
348
+ }, () => React.createElement(StatusCard, { t: t, call: call }))));
349
+ };
350
+ if (typeof ctx.inject === "function") ctx.inject(["configForms"], registerPluginsPageCard);
351
+ else registerPluginsPageCard(ctx);
347
352
  // ---- expired modal ----
348
353
  ctx.slots.inject("shell.overlay", () => ctx.slots.register({
349
354
  name: "shell.overlay",
package/lib/index.js CHANGED
@@ -387,7 +387,6 @@ function registerCodexAuthRpc(ctx, credentials, phase) {
387
387
  // ---------------------------------------------------------------------------
388
388
  // silent token refresh (runs once per app start; no timers)
389
389
  // ---------------------------------------------------------------------------
390
- const REFRESH_AHEAD_MS = 60 * 60 * 1000; // only refresh when < 1 hour left
391
390
 
392
391
  async function silentRefresh(credentials) {
393
392
  try {
@@ -395,9 +394,6 @@ async function silentRefresh(credentials) {
395
394
  const payload = record && record.kind === 'grant' ? record.payload : undefined;
396
395
  if (!payload || payload.type !== 'oauth' || !payload.refresh)
397
396
  return;
398
- const msLeft = typeof payload.expires === 'number' ? payload.expires - Date.now() : 0;
399
- if (msLeft > REFRESH_AHEAD_MS)
400
- return; // still fresh; nothing to do
401
397
  const res = await fetch(TOKEN_URL, {
402
398
  method: 'POST',
403
399
  signal: AbortSignal.timeout(30000),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sunshaobei/dsh-codex-auth",
3
3
  "description": "Codex 订阅授权管理 for the dsh web surface: a dedicated settings page (authorization status, validity/expiry, one-click browser OAuth) plus an expired-credential modal when a GPT model is selected. Host half runs the full OpenAI OAuth flow (PKCE S256, localhost:1455 callback) and writes the llm-pi-ai/openai-codex grant record through ctx.credentials.",
4
- "version": "3.0.4",
4
+ "version": "3.0.6",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
7
7
  "types": "lib/index.d.ts",