UNPKG

decocms

Version:

Deco CMS — Self-hostable MCP Gateway for managing AI connections and tools

2 lines (1 loc) • 1.82 kB
import{a as E,u as C,j as o,N as S}from"./index-DoEtSiIe.js";import{A as y,a as R}from"./auth-entry-Bk_VrJBw.js";import{A as U}from"./auth-split-layout-zr8fqIYk.js";import{L as j}from"./legacy-admin-welcome-dialog-BYL3pyxT.js";import"./Fingerprint04-DlIWxzRc.js";import"./backoff-CrEUbyZT.js";import"./delay-CnY5UFtP.js";import"./drawer-DO0sMAej.js";import"./use-mobile-BjsAkqwr.js";const s="studio_signup_ref",r="studio_signup_src",L=720*60*60,u=128;function l(e){const t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?.[1]?decodeURIComponent(t[1]):null}function d(e,t){document.cookie=`${e}=${encodeURIComponent(t)}; path=/; max-age=${L}; samesite=lax`}function O(e){e.ref&&e.ref.length<=u&&!l(s)&&d(s,e.ref),e.src&&e.src.length<=u&&!l(r)&&d(r,e.src)}function k(e){if(!e.client_id||e.response_type!=="code")return null;const t=new URLSearchParams;return e.client_id&&t.set("client_id",e.client_id),e.redirect_uri&&t.set("redirect_uri",e.redirect_uri),e.response_type&&t.set("response_type",e.response_type),e.state&&t.set("state",e.state),e.scope&&t.set("scope",e.scope),e.code_challenge&&t.set("code_challenge",e.code_challenge),e.code_challenge_method&&t.set("code_challenge_method",e.code_challenge_method),`/api/auth/mcp/authorize?${t.toString()}`}function G(){const e=E.useSession(),t=C({from:"/login"}),{next:i="/",client_id:_,redirect_uri:h,response_type:f,state:a,scope:g,code_challenge:p,code_challenge_method:m,src:x,ref:A}=t;O({src:x,ref:A});const c=i.startsWith("/")&&!i.startsWith("//")&&!i.startsWith("/\\")?i:"/",n=k({client_id:_,redirect_uri:h,response_type:f,state:a,scope:g,code_challenge:p,code_challenge_method:m});return e.data?n?(window.location.href=n,o.jsx(y,{})):o.jsx(S,{to:c}):o.jsxs(U,{children:[o.jsx(R,{callbackUrl:c,redirectUrl:n}),o.jsx(j,{})]})}export{G as default};