UNPKG

manifest

Version:

Self-hosted Manifest LLM router with embedded server, SQLite database, and dashboard

45 lines 1.77 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.parseOAuthTokenBlob = parseOAuthTokenBlob; exports.oauthDoneHtml = oauthDoneHtml; function parseOAuthTokenBlob(rawValue) { try { const parsed = JSON.parse(rawValue); if (typeof parsed?.t !== 'string' || typeof parsed?.r !== 'string' || typeof parsed?.e !== 'number' || (parsed.u !== undefined && typeof parsed.u !== 'string')) { return null; } return { t: parsed.t, r: parsed.r, e: parsed.e, ...(parsed.u !== undefined ? { u: parsed.u } : {}), }; } catch { return null; } } function oauthDoneHtml(success, nonce) { const message = success ? 'manifest-oauth-success' : 'manifest-oauth-error'; const text = success ? 'Login successful!' : 'Login failed. Please close this window and try again.'; const nonceAttr = nonce ? ` nonce="${nonce}"` : ''; return `<!DOCTYPE html> <html> <head><title>Manifest — OpenAI Login</title></head> <body style="font-family:system-ui;display:flex;flex-direction:column;align-items:center;justify-content:center;height:100vh;margin:0;background:#111;color:#eee;"> <p>${text}</p> <p id="hint" style="font-size:13px;color:#888;display:none;">You can close this window.</p> <script${nonceAttr}> try{var bc=new BroadcastChannel('manifest-oauth');bc.postMessage({type:'${message}'});bc.close();}catch(e){} if(window.opener){window.opener.postMessage({type:'${message}'},window.location.origin);} setTimeout(function(){window.close();document.getElementById('hint').style.display='block';},1500); </script> </body> </html>`; } //# sourceMappingURL=openai-oauth.types.js.map