PageSourceSearch

https://modrinth.com/_nuxt/D5ZRY7Xc.js

js modrinth.com collected 2026-09-24 09:07:29 UTC 14,002 bytes, 1 lines download raw bytes

1import{d as ue,aB as $,w as Me,aC as K,u as de,a as v,b as c,k as e,j as u,v as g,n as k,m as B,p as P,F as ae,y as Ie,aD as Ce,z as oe,aE as ne,Q as w,aF as fe,aG as ge,P as _e,_ as z,H as se,aH as Ae,l as L,aI as Le,aJ as ie,aK as Se,U as he,o as h,q as A,aL as re,J as Fe,aM as Pe,aN as Ue,aO as Te,aP as Re,aQ as Ee,aR as Ve,aS as qe,aT as Oe,R as Ne,V as De,aU as $e,aV as Ge,aW as We,aX as Be,e as J,aY as Ke,aZ as Qe,c as le,a_ as je,a$ as He,b0 as ce,b1 as G,b2 as Ye,b3 as W,b4 as ze,b5 as Je,b6 as X,b7 as Xe,b8 as Ze,b9 as Z,ba as ee}from"./DvgxvNL0.js";import{_ as et}from"./Cc0a7gKB.js";import{_ as tt,g as at}from"./CfbUwt1w.js";import{A as ot}from"./B0nhbelq.js";import{u as nt}from"./Bvy7JVk9.js";import"./DG1csYqL.js";import"./C0jx6QEY.js";import"./BYO7PYqm.js";const st={key:0},it=["src","title"],rt={class:"universal-card mx-auto flex w-full max-w-[27rem] flex-col gap-6 border border-solid border-surface-5 !p-6 text-center"},lt={class:"flex flex-col gap-2"},ct={class:"m-0 text-2xl font-semibold text-contrast"},ut={class:"m-0 text-left text-primary"},dt={class:"flex flex-col gap-2"},ft={key:1,class:"universal-card mx-auto flex w-full max-w-[27rem] flex-col gap-6 border border-solid border-surface-5 !p-6"},gt=["aria-busy"],ht={class:"flex w-full flex-col gap-1.5"},wt={for:"two-factor-code"},mt={id:"two-factor-label",class:"label__title"},pt={id:"two-factor-description",class:"label__description"},bt={key:1,class:"flex flex-col gap-5"},vt={key:0,class:"flex w-full flex-col gap-4"},yt={class:"text-center text-2xl font-semibold text-contrast"},kt={class:"text-center text-2xl font-semibold text-contrast"},xt={class:"grid grid-cols-1 gap-2.5 sm:grid-cols-2"},Mt={key:0,class:"oauth-provider-last-sign-in-badge"},It={class:"ml-1"},Ct={key:0,class:"oauth-provider-last-sign-in-badge"},_t={class:"mx-auto flex w-full flex-col gap-2.5"},At={for:"email",hidden:""},Lt={for:"password",hidden:""},St={class:"flex flex-wrap items-center justify-center gap-2.5 !text-base"},Ft=ue({__name:"SignIn",props:ne({subtleLauncherRedirectUri:{default:""},flow:{default:""},redirectTarget:{default:""},routeQuery:{default:()=>({})},globals:{default:null},onPasswordSignIn:{type:Function,default:()=>{}},onTwoFactorSignIn:{type:Function,default:()=>{}},twoFactorPending:{type:Boolean,default:!1},twoFactorError:{type:Boolean,default:!1},onPasskeySignIn:{type:Function,default:()=>{}},onSetCaptchaRef:{type:Function,default:void 0},accounts:{default:()=>[]}},{email:{default:""},emailModifiers:{},password:{default:""},passwordModifiers:{},token:{default:""},tokenModifiers:{},twoFactorCode:{default:""},twoFactorCodeModifiers:{}}),emits:ne(["select"],["update:email","update:password","update:token","update:twoFactorCode"]),setup(o,{emit:m}
1){const y=[{id:"discord",name:"Discord",icon:Ue},{id:"github",name:"GitHub",icon:Te},{id:"microsoft",name:"Microsoft",icon:Re},{id:"google",name:"Google",icon:Ee},{id:"steam",name:"Steam",icon:Ve},{id:"gitlab",name:"GitLab",icon:qe}],M=w(!1),U=m,b=$(o,"email"),S=$(o,"password"),I=$(o,"token"),C=$(o,"twoFactorCode"),T=w();Me(()=>o.twoFactorPending,async x=>{!x&&o.twoFactorError&&(await Ne(),T.value?.focus())});const p=K(fe,null,void 0,{initOnMounted:!0}),d=K(ge,null,void 0,{initOnMounted:!0}),_=x=>{d.value=x};async function Q(){await fetch(o.subtleLauncherRedirectUri,{mode:"no-cors"}).catch(()=>{})}const{formatMessage:s}=de(),i=he({twoFactorIncorrect:{id:"auth.two-factor.incorrect-code",defaultMessage:"The two-factor code is incorrect. Try again or use a backup code."},launcherCallbackTitle:{id:"auth.sign-in.launcher.callback.title",defaultMessage:"Modrinth App sign-in callback"},openingLauncherTitle:{id:"auth.sign-in.launcher.opening.title",defaultMessage:"Opening Modrinth App..."},openingLauncherDescription:{id:"auth.sign-in.launcher.opening.description",defaultMessage:"If the app doesn’t open, use the button below to finish signing in."},forgotPasswordLabel:{id:"auth.sign-in.forgot-password",defaultMessage:"Forgot password"},noAccountLabel:{id:"auth.sign-in.no-account",defaultMessage:"Don't have an account?"},createAccountLabel:{id:"auth.sign-in.create-account",defaultMessage:"Sign up"},signInWithLabel:{id:"auth.sign-in.sign-in-with",defaultMessage:"Sign into Modrinth"},chooseAccountLabel:{id:"auth.sign-in.choose-account",defaultMessage:"Choose an account to use in Modrinth App"},addAccountLabel:{id:"auth.sign-in.add-account",defaultMessage:"Add account"},twoFactorCodeLabel:{id:"auth.sign-in.2fa.label",defaultMessage:"Two-factor authentication"},twoFactorCodeLabelDescription:{id:"auth.sign-in.2fa.description",defaultMessage:"Enter the 6-digit code from your authenticator app, or one of your backup codes."},continueWithProvider:{id:"auth.continue-with-provider",defaultMessage:"Continue with {provider}"},continueWithEmail:{id:"auth.sign-in.continue-with-email",defaultMessage:"Continue with Email"},lastSignInLabel:{id:"auth.sign-in.last-sign-in",defaultMessage:"Last used"},continueWithPasskey:{id:"auth.sign-in.continue-with-passkey",defaultMessage:"Continue with passkey"},launcherSignInCompleteTitle:{id:"auth.sign-in.launcher.complete.title",defaultMessage:"You’re signed in"},launcherSignInCompleteDescription:{id:"auth.sign-in.launcher.complete.description",defaultMessage:"We’re returning you to the Modrinth App. If nothing happens, use the button below."},returnToLauncherButton:{id:"auth.sign-in.launcher.complete.return-button",defaultMessage:"Open Modrinth App"},goToWebsiteButton:{id:"auth.sign-in.launcher.complete.go-to-website",defaultMessage:"Go to Modrinth.com"}});return(x,r)=>{const R=_e;return o.subtleLauncherRedirectUri?(h(),v("div",st,[c("iframe",{src:o.subtleLauncherRedirectUri,class:"hidden",title:e(s)(e(i).launcherCallbackTitle)},null,8,it),c("div",rt,[c("div",lt,[c("h1",ct,u(e(s)(e(i).openingLauncherTitle)),1),c("p",ut,u(e(s)(e(i).openingLauncherDescription)),1)]),c("div",dt,[g(e(z),{type:"colored",color:"brand",class:"!w-full !justify-center",onClick:Q},{default:k(()=>[A(u(e(s)(e(i).returnToLauncherButton))+" ",1),g(e(re))]),_:1}),g(e(se),{to:"/",class:"!w-full !justify-center"},{default:k(()=>[A(u(e(s)(e(i).goToWebsiteButton)),1)]),_:1})])])])):(h(),v("div",ft,[o.flow&&!o.subtleLauncherRedirectUri?(h(),v("div",{key:0,class:"flex flex-col gap-4","aria-busy":o.twoFactorPending},[c("div",ht,[c("label",wt,[c("span",mt,u(e(s)(e(i).twoFactorCodeLabel)),1),c("span",pt,u(e(s)(e(i).twoFactorCodeLabelDescription)),1)]),g(tt,{id:"two-factor-code",ref_key:"twoFactorInput",ref:T,modelValue:C.value,"onUpdate:modelValue":r[0]||(r[0]=n=>C.value=n),class:"mx-auto mt-3","allow-backup-code":"",autofocus:"",readonly:o.twoFactorPending,error:o.twoFactorError,"aria-labelledby":"two-factor-label","aria-describedby":o.twoFactorError?"two-factor-description two-factor-error":"two-factor-description",onComplete:o.onTwoFactorSign
1In},null,8,["modelValue","readonly","error","aria-describedby","onComplete"])]),o.twoFactorError?(h(),B(e(ot),{key:0,id:"two-factor-error",type:"critical",role:"alert"},{default:k(()=>[A(u(e(s)(e(i).twoFactorIncorrect)),1)]),_:1})):P("",!0)],8,gt)):(h(),v("div",bt,[o.accounts.length&&!M.value?(h(),v("div",vt,[c("div",yt,u(e(s)(e(i).chooseAccountLabel)),1),g(e(Ae),{accounts:o.accounts,"add-account-label":e(s)(e(i).addAccountLabel),onSelect:r[1]||(r[1]=n=>U("select",n)),onAdd:r[2]||(r[2]=n=>M.value=!0)},null,8,["accounts","add-account-label"])])):(h(),v(ae,{key:1},[c("div",kt,u(e(s)(e(i).signInWithLabel)),1),c("section",xt,[(h(),v(ae,null,Ie(y,n=>g(e(se),{key:n.id,class:oe(["relative w-full !justify-center overflow-visible",{"!border !border-[var(--color-green)]":e(p)===n.id}]),href:e(Pe)(n.id,o.redirectTarget),"aria-label":e(s)(e(i).continueWithProvider,{provider:n.name}),onClick:F=>_(n.id)},{default:k(()=>[(h(),B(Fe(n.icon))),c("span",null,u(n.name),1),e(p)===n.id?(h(),v("span",Mt,u(e(s)(e(i).lastSignInLabel)),1)):P("",!0)]),_:2},1032,["class","href","aria-label","onClick"])),64)),g(e(z),{class:oe(["relative !w-full !justify-center overflow-visible sm:col-span-2",{"!border !border-[var(--color-green)]":e(p)==="passkey"}]),role:"button",tabindex:"0",onClick:o.onPasskeySignIn,onKeydown:Ce(o.onPasskeySignIn,["enter"])},{default:k(()=>[g(e(Oe)),c("span",It,u(e(s)(e(i).continueWithPasskey)),1),e(p)==="passkey"?(h(),v("span",Ct,u(e(s)(e(i).lastSignInLabel)),1)):P("",!0)]),_:1},8,["class","onClick","onKeydown"])]),r[8]||(r[8]=c("div",{class:"h-px w-full bg-surface-5"},null,-1)),c("section",_t,[c("label",At,u(e(s)(e(L).emailUsernameLabel)),1),g(e(ie),{id:"email",modelValue:b.value,"onUpdate:modelValue":r[3]||(r[3]=n=>b.value=n),icon:e(Le),type:"text",inputmode:"email",autocomplete:"username",placeholder:e(s)(e(L).emailUsernameLabel),"wrapper-class":"w-full"},null,8,["modelValue","icon","placeholder"]),c("label",Lt,u(e(s)(e(L).passwordLabel)),1),g(e(ie),{id:"password",modelValue:S.value,"onUpdate:modelValue":r[4]||(r[4]=n=>S.value=n),icon:e(Se),type:"password",autocomplete:"current-password",placeholder:e(s)(e(L).passwordLabel),"wrapper-class":"w-full"},null,8,["modelValue","icon","placeholder"]),o.globals?.captcha_enabled&&b.value&&S.value?(h(),B(et,{key:0,ref:o.onSetCaptchaRef,modelValue:I.value,"onUpdate:modelValue":r[5]||(r[5]=n=>I.value=n)},null,8,["modelValue"])):P("",!0),g(e(z),{type:"colored",color:"brand",class:"!w-full",disabled:o.globals?.captcha_enabled?!I.value:!1,onClick:r[6]||(r[6]=n=>o.onPasswordSignIn())},{default:k(()=>[A(u(e(s)(e(i).continueWithEmail))+" ",1),g(e(re))]),_:1},8,["disabled"]),c("div",St,[g(R,{class:"text-link",to:{path:"/auth/reset-password",query:o.routeQuery}},{default:k(()=>[A(u(e(s)(e(i).forgotPasswordLabel)),1)]),_:1},8,["to"]),r[7]||(r[7]=c("div",{class:"h-1.5 w-1.5 rounded-full bg-surface-5"},null,-1)),g(R,{class:"inline text-link",to:{path:"/auth/sign-up",query:o.routeQuery}},{default:k(()=>[A(u(e(s)(e(i).createAccountLabel)),1)]),_:1},8,["to"])])])],64))]))]))}}}),Pt=De(Ft,[["__scopeId","data-v-04d2c151"]]),Dt=ue({__name:"sign-in",async setup(o){let m,y;const M=t=>{const a=Array.isArray(t)?t[0]:t;return typeof a=="string"?a:""},U=t=>{const a=t;return typeof a?.data?.description=="string"?a.data.description:t instanceof Error?t.message:String(t)},b=$e(),S=Ge(),{addNotification:I}=We(),{formatMessage:C}=de(),T=he({signInTitle:{id:"auth.sign-in.title",defaultMessage:"Sign In"}});Be({title(){return`${C(T.signInTitle)} - Modrinth`}});const p=([m,y]=J(()=>X()),m=await m,y(),m),d=ze(),_=K(ge,null,void 0,{initOnMounted:!0}),Q=K(fe,null,void 0,{initOnMounted:!0});d.query.state!==void 0&&([m,y]=J(()=>G({path:"/auth/create/oauth",query:d.query},{replace:!0})),await m,y());const s=M(d.query.redirect),i=w();d.query.code&&([m,y]=J(()=>D()),await m,y());const x=d.query[Ke]!==void 0,r=d.query.launcher!==void 0,R=Qe(),n=w(!r),F=le(()=>{const t=p.value.user,a=p.value.token,l=R.value.map(f=>t&&a&&f.id===t.id?{...f,username:t.username,avatarUrl:t.avatar_url??f.avatarUrl,token:a,role:t.role}:f);return t&&a&&!l.some(f=>f.id===t.id)&&l.push({id:t.id,username:t.username,avatarUrl:t.avatar_url??null,token:a,role:t.role}),l}),we=le(()=>{if(!r)return[];const t=x?1:2;return F.value.length>=t?F.value:[]});je(async()=>
1{if(r){if(He(),i.value){n.value=!0;return}if(p.value.user&&!x&&F.value.length===1&&d.query.code===void 0){await j(p.value.token),i.value&&(n.value=!0);return}n.value=!0}});function me(t){return`${Je(d)}/?code=${t}`}async function j(t){ce();const a=me(t);if(a.startsWith("https://launcher-files.modrinth.com/")){await G(a,{external:!0});return}i.value=a}function pe(t){const a=F.value.find(l=>l.id===t.id);a&&j(a.token)}const te=w(null),be=t=>{te.value=t??null},{data:ve}=Ye({queryKey:["auth-globals"],queryFn:async()=>{try{return await b.labrinth.globals_internal.get()}catch(t){return console.error("Error fetching globals:",t),{captcha_enabled:!0,tax_compliance_thresholds:{}}}}}),E=w(""),V=w(""),q=w(""),H=w(M(d.query.flow));async function ye(){_.value=null,Q.value=null,Z();try{const t=await b.labrinth.auth_v2.login({username:E.value,password:V.value,challenge:q.value});t.flow?H.value=t.flow:await D(t.session,"password")}catch(t){I({title:C(L.errorNotificationTitle),text:U(t),type:"error"}),te.value?.reset?.()}ee()}const O=w(""),N=w(!1),Y=w(!1);async function ke(t){if(!N.value){N.value=!0,Y.value=!1,Z();try{const a=await b.labrinth.auth_v2.login2FA({flow:H.value,code:t});await D(a.session,"password")}catch{O.value="",Y.value=!0}finally{N.value=!1,ee()}}}async function xe(){Z();try{const t=await b.labrinth.auth_v2.authenticatePasskeyStart(),a=await at(t.options.publicKey),l=await b.labrinth.auth_v2.authenticatePasskeyFinish({flow:t.flow,credential:a});_.value="passkey",await D(l.session,"passkey")}catch(t){I({title:C(L.errorNotificationTitle),text:U(t),type:"error"})}ee()}async function D(t,a){if(d.query.launcher){const f=t??p.value.token;f&&await j(f);return}t&&(await X(t),await nt(),S.clear());const l=await X();if(l.value.user&&l.value.token){const f=a??(Xe(_.value)?_.value:void 0);Ze(l.value.user,l.value.token,f?{authMethod:f}:void 0)}if(ce(),d.query.redirect){const f=decodeURIComponent(M(d.query.redirect));await G(f,{replace:!0})}else l.value.user&&await G(`/user/${l.value.user.username}`)}return(t,a)=>e(n)||e(i)?(h(),B(Pt,{key:0,email:e(E),"onUpdate:email":a[0]||(a[0]=l=>W(E)?E.value=l:null),password:e(V),"onUpdate:password":a[1]||(a[1]=l=>W(V)?V.value=l:null),token:e(q),"onUpdate:token":a[2]||(a[2]=l=>W(q)?q.value=l:null),"two-factor-code":e(O),"onUpdate:twoFactorCode":a[3]||(a[3]=l=>W(O)?O.value=l:null),"subtle-launcher-redirect-uri":e(i),flow:e(H),"redirect-target":e(s),"route-query":e(d).query,globals:e(ve),accounts:e(we),"on-password-sign-in":ye,"on-two-factor-sign-in":ke,"two-factor-pending":e(N),"two-factor-error":e(Y),"on-passkey-sign-in":xe,"on-set-captcha-ref":be,onSelect:pe},null,8,["email","password","token","two-factor-code","subtle-launcher-redirect-uri","flow","redirect-target","route-query","globals","accounts","two-factor-pending","two-factor-error"])):P("",!0)}});export{Dt 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.