PageSourceSearch

https://wodeapp.ai/assets/CallbackPage-MtRRAPy2.js

js wodeapp.ai collected 2026-09-24 14:07:36 UTC 4,173 bytes, 1 lines download raw bytes

1import{j as e,r as i}from"./react-vendor-BxoUhqX6.js";import{u as I,j as v,a as R,b as D,d as A,e as P,o as T,C as F,v as L,p as O,q as w,t as U,w as H}from"./index-CR94Sc3y.js";import{n as k}from"./creditEvents-BtyDkwyy.js";import{a as M,p as B,r as $,d as q,e as z}from"./desktopLoginHandoff-DD2GCCCT.js";import"./clsx-B-dksMZM.js";import"./i18n-vendor-Coo-X0AG.js";function y(r){M(window.location.search,window.location.hash),B(window.location.search);const s=$();if(s){window.location.replace(q(s));return}const o=z();if(o.type==="url"){window.location.href=o.href;return}r("/")}const J=()=>{const r=v();return i.useEffect(()=>{r("/login")},[r]),null},W=()=>{const r=v(),[s]=R(),{t:o}=D(),{login:f}=A(),{fetchUserInfo:j}=P(),[C,g]=i.useState(null),h=i.useRef(!1),c=s.get("auth"),d=s.get("supabaseToken");i.useEffect(()=>{if(c!=="ok")return;(async()=>{try{const t=await L();if(!t.valid||!t.user)throw new Error(o("callback.error.authFailed"));const n=await O();f(n,"cookie-auth",void 0,void 0,void 0,d||void 0),d&&w(d),k(),y(r)}catch(t){console.error("[Callback] OAuth error:",t),g(t instanceof Error?t.message:o("callback.error.loginFailed")),r("/login?error=oauth_callback_failed")}})()},[c]);const{error:N}=T(async()=>{if(c!=="ok"&&!h.current){h.current=!0;try{const a=await j();if(console.log("[Callback] Logto user info:",a),!a)throw new Error(o("callback.error.userInfoFailed"));const t={sub:a.sub,name:a.name??a.username??void 0,email:a.email??void 0,picture:a.picture??void 0,phone_number:a.phone_number??void 0},{user:n,token:l,refreshToken:S,expiresIn:_,supabaseToken:u,isNewUser:E}=await U(t);console.log("[Callback] Session created:",n.name,"token length:",l?.length),f(n,l,S,_,t,u),u&&w(u),k(),E&&sessionStorage.setItem("signup_credits_granted","1");const b=localStorage.getItem("pending_referral_code");if(b){localStorage.removeItem("pending_referral_code");try{const m=await(await fetch("/mainserver/api/referral/apply",{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...l?{Authorization:`Bearer ${l}`}:{}},body:JSON.stringify({referralCode:b})})).json();m.success?console.log("[Callback] 邀请码绑定成功:",m.data):console.log("[Callback] 邀请码绑定跳过:",m.error)}catch(x){console.warn("[Callback] 邀请码绑定失败:",x)}}if(sessionStorage.getItem("login_from")==="admin"){sessionStorage.removeItem("login_from"),window.location.href=`${H.ADMIN_URL}/callback?auth=ok`;return}y(r)}catch(a){console.error("[Callback] Error:",a),g(a instanceof Error?a.message:o("callback.error.loginFailed")),r("/login?error=callback_failed")}}}),p=C||N?.message;return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-gradient-to-br from-purple-600 via-indigo-600 to-purple-800 p-4",children:p?e.jsx("div",{className:"w-full max-w-md bg-white/95 rounded-2xl shadow-2xl p-8 animate-[fadeIn_0.3s_ease-out]",children:e.jsxs("div",{className:"text-center",children:[e.jsx(F,{className:"w-16 h-16 text-red-500 mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-bold text-gray-800 mb-2",children:o("callback.title.loginFailed")}),e.jsx("p",{className:"text-gray-500 mb-6",children:p}),e.jsx("button",{onClick:()=>r("/login"),className:"px-6 py-2 bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-colors",children:o("callback.backToLogin")})]})}):e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"w-20 h-20 mx-auto mb-6 rounded-2xl bg-white/20 flex items-center justify-center animate-pulse shadow-lg",children:e.jsx("span",{className:"text-3xl font-bold text-white",children:"W"})}),e.jsxs("div",{className:"flex items-center justify-center gap-1.5 mb-4",children:[e.jsx("span",{className:"w-2 h-2 bg-white/80 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-white/80 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-white/80 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx("p",{className:"text-white/80 text-sm font-medium",children:o("callback.processing")})]})})},ee=()=>I().authMode==="logto"?e.jsx(W,{}):e.jsx(J,{});export{ee 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.