@sunshaobei/dsh-codex-auth 3.0.5 → 3.0.7
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 +24 -8
- package/package.json +1 -1
package/lib/client.js
CHANGED
|
@@ -336,14 +336,30 @@ 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
|
-
// ----
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
339
|
+
// ---- plugin detail page (plugins.bundle.config, same as dsh-context) ----
|
|
340
|
+
const settingsStore = (() => {
|
|
341
|
+
let form; let state = {}; const listeners = new Set();
|
|
342
|
+
const notify = () => listeners.forEach((fn) => fn());
|
|
343
|
+
return {
|
|
344
|
+
get state() { return state; },
|
|
345
|
+
subscribe(fn) { listeners.add(fn); return () => listeners.delete(fn); },
|
|
346
|
+
attach(f) { form = f; try { state = { ...state, ...(f && f.get ? f.get() : {}) }; } catch {} notify(); let un; try { un = f.subscribe(() => { try { state = { ...state, ...(f.get ? f.get() : {}) }; } catch {} notify(); }); } catch {} return () => { if (un) un(); if (form === f) form = undefined; }; },
|
|
347
|
+
set(k, v) { state = { ...state, [k]: v }; notify(); if (form && typeof form.set === "function") form.set(k, v).catch(() => {}); },
|
|
348
|
+
};
|
|
349
|
+
})();
|
|
350
|
+
const registerPluginsPageCard = (env) => {
|
|
351
|
+
const cf = env && env.configForms;
|
|
352
|
+
if (!cf || typeof cf.get !== "function" || typeof cf.whileServed !== "function") return;
|
|
353
|
+
ctx.effect(() => settingsStore.attach(cf.get(NS)), "dsh-codex-auth: config forms");
|
|
354
|
+
ctx.effect(() => cf.whileServed([NS], () => ctx.slots.inject("plugins.bundle.config", () => ctx.slots.register({
|
|
355
|
+
name: "plugins.bundle.config",
|
|
356
|
+
key: NS,
|
|
357
|
+
locale: NS,
|
|
358
|
+
inject: () => ({ hooks: { codexAuth: settingsStore }, set: (k, v) => settingsStore.set(k, v) })
|
|
359
|
+
}, () => React.createElement(StatusCard, { t: t, call: call })))), "dsh-codex-auth: plugins-page card");
|
|
360
|
+
};
|
|
361
|
+
if (typeof ctx.inject === "function") ctx.inject(["configForms"], registerPluginsPageCard);
|
|
362
|
+
else registerPluginsPageCard(ctx);
|
|
347
363
|
// ---- expired modal ----
|
|
348
364
|
ctx.slots.inject("shell.overlay", () => ctx.slots.register({
|
|
349
365
|
name: "shell.overlay",
|
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
|
+
"version": "3.0.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|