@sunshaobei/dsh-codex-auth 3.0.4 → 3.0.5
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/index.js +0 -4
- package/package.json +1 -1
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
|
+
"version": "3.0.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
7
7
|
"types": "lib/index.d.ts",
|