PageSourceSearch

https://app.lewdly.ai/assets/AP_oauth_authorize-BofBT94m.js

js lewdly.ai collected 2026-10-05 12:21:32 UTC 4,375 bytes, 1 lines download raw bytes

1import{B as e}from"./ui-BIhQ6TkU.js";import{k as N,e as a}from"./router-DSedz3Dy.js";import{aL as _,W as u,t as y,N as v}from"./index-GdV_XFao.js";import"./charts-CiG4r8Bk.js";import"./lucide-Db6pIQfl.js";const C={"lewdly-mcp":`${u.name} MCP (Claude / CLI)`},k={generation:`Generate images, video, and audio (this spends your ${y})`,gallery_read:"Read your gallery and generation history"};function $(){const[n]=N(),{isAuthenticated:i,isLoading:r,user:c}=_(),[o,l]=a.useState(!1),[d,m]=a.useState(null),s=a.useMemo(()=>({client_id:n.get("client_id")||"",redirect_uri:n.get("redirect_uri")||"",code_challenge:n.get("code_challenge")||"",code_challenge_method:n.get("code_challenge_method")||"",scope:n.get("scope")||"",state:n.get("state")||""}),[n]),p=(()=>{try{const t=new URL(s.redirect_uri);return t.username||t.password?!1:t.protocol==="https:"?!0:t.protocol==="http:"&&(t.hostname==="localhost"||t.hostname==="127.0.0.1"||t.hostname==="[::1]")&&t.port!==""}catch{return!1}})(),g=!!s.client_id&&p&&!!s.code_challenge&&s.code_challenge_method==="S256";a.useEffect(()=>{if(!r&&!i){const t=encodeURIComponent(window.location.pathname+window.location.search);window.location.href=`/auth?next=${t}`}},[r,i]);const h=t=>{const j=s.redirect_uri.includes("?")?"&":"?";window.location.href=`${s.redirect_uri}${j}${t}`},b=async()=>{l(!0),m(null);try{const t=await v.mcpOauthAuthorize(s);h(`code=${encodeURIComponent(t.code)}&state=${encodeURIComponent(t.state||"")}`)}catch(t){m(t instanceof Error?t.message:"Authorization failed"),l(!1)}},f=()=>h(`error=access_denied&state=${encodeURIComponent(s.state||"")}`);if(r||!i)return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-black text-sm text-white/50",children:"Loading…"});if(!g)return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-black px-4",children:e.jsxs("div",{className:"max-w-md rounded-2xl border border-white/10 bg-white/5 p-8 text-center",children:[e.jsx("h1",{className:"text-xl font-bold text-white",children:"Invalid authorization request"}),e.jsx("p",{className:"mt-2 text-sm text-white/50",children:"This connection link is missing required parameters or uses an unsupported redirect. Start the sign-in again from the app or CLI."})]})});const w=C[s.client_id]||s.client_id,x=s.scope.split(/[ +]/).filter(Boolean);return e.jsx("div",{className:"flex min-h-screen items-center justify-center bg-black px-4",children:e.jsxs("div",{className:"w-full max-w-md rounded-2xl border border-white/10 bg-white/5 p-8",children:[e.jsxs("div",{className:"mb-6 text-center",children:[e.jsx("div",{className:"mx-auto mb-4 flex h-14 w-14 items-center justify-center rounded-2xl bg-lime-400/10 text-2xl font-black text-lime-400",children:"A"}),e.jsxs("h1",{className:"text-xl font-bold text-white",children:["Connect to ",u.name]}),e.jsxs("p",{className:"mt-1 text-sm text-white/50",children:[e.jsx("span",{className:"font-semibold text-white/80",children:w})," wants to access your account",c?.email?e.jsxs(e.Fragment,{children:[" ","as ",e.jsx("span",{className:"text-white/80",children:c.email})]}):null,"."]})]}),e.jsxs("div",{className:"space-y-2 rounded-xl border border-white/10 bg-black/30 p-4",children:[e.jsx("div",{className:"text-[11px] uppercase tracking-wide text-white/40",children:"It will be able to"}),(x.length?x:["generation"]).map(t=>e.jsxs("div",{className:"flex items-start gap-2 text-sm text-white/70",children:[e.jsx("span",{className:"mt-1.5 h-1.5 w-1.5 flex-none rounded-full bg-lime-400"}),e.jsx("span",{children:k[t]||t})]},t))]}),d&&e.jsx("p",{className:"mt-4 text-sm text-red-400",children:d}),e.jsxs("div",{className:"mt-6 flex gap-3",children:[e.jsx("button",{onClick:f,disabled:o,className:"flex-1 rounded-2xl border border-white/10 bg-white/5 px-5 py-3 text-sm font-semibold text-white/70 transition-all hover:bg-white/10 hover:text-white disabled:opacity-50",children:"Cancel"}),e.jsx("button",{onClick:b,disabled:o,className:"flex-1 rounded-2xl bg-lime-400 px-5 py-3 text-sm font-bold text-black transition-all hover:bg-lime-300 disabled:opacity-50",children:o?"Authorizing…":"Authorize"})]}),e.jsx("p",{className:"mt-4 text-center text-[11px] text-white/30",children:"Approving sends a one-time code to the app on your machine. You can revoke access by signing out everywhere from your account settings."})]})})}export{$ as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.