1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
"use strict";(()=>{var e={};e.id=344,e.ids=[344],e.modules={6317:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.r(t),r.d(t,{config:()=>x,default:()=>d,getServerSideProps:()=>p,getStaticPaths:()=>h,getStaticProps:()=>m,reportWebVitals:()=>g,routeModule:()=>b,unstable_getServerProps:()=>j,unstable_getServerSideProps:()=>v,unstable_getStaticParams:()=>w,unstable_getStaticPaths:()=>y,unstable_getStaticProps:()=>f});var s=r(7093),i=r(5244),n=r(1323),l=r(1070),c=r(3893),o=r(8733),u=e([c,o]);[c,o]=u.then?(await u)():u;let d=(0,n.l)(o,"default"),m=(0,n.l)(o,"getStaticProps"),h=(0,n.l)(o,"getStaticPaths"),p=(0,n.l)(o,"getServerSideProps"),x=(0,n.l)(o,"config"),g=(0,n.l)(o,"reportWebVitals"),f=(0,n.l)(o,"unstable_getStaticProps"),y=(0,n.l)(o,"unstable_getStaticPaths"),w=(0,n.l)(o,"unstable_getStaticParams"),j=(0,n.l)(o,"unstable_getServerProps"),v=(0,n.l)(o,"unstable_getServerSideProps"),b=new s.PagesRouteModule({definition:{kind:i.x.PAGES,page:"/auth/login",pathname:"/auth/login",bundlePath:"",filename:""},components:{App:c.default,Document:l.default},userland:o});a()}catch(e){a(e)}})},9066:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>h});var s=r(997),i=r(861),n=r(1764),l=r(6458),c=r(6248),o=r(8006),u=r(3216),d=r(9926),m=e([i,n,l,c,o,u,d]);function h(){let{loading:e,setLoginData:t,submitLogin:r,alert:a}=(0,i.Z)();return(0,s.jsxs)(l.Z,{className:"w-full",submitHandler:()=>{r()},children:[(0,s.jsxs)(u.Z,{className:"w-full items-stretch gap-6",children:[a?.text?s.jsx(n.Z,{color:"error",variant:"outlined",className:"py-2 px-6 opacity-70",children:a.text}):null,s.jsx(c.Z,{placeholder:"Email Address or Username",title:"Email/Username",changeHandler:e=>{let r=d.default.email().safeParse(e);t(t=>({...t,email:r.success?e:void 0,username:r.success?void 0:e}))},validity:a?.field_name=="email-username"?{isValid:!1,msg:a?.text}:{isValid:!0},showLabel:!0}),s.jsx(c.Z,{placeholder:"Password",title:"Password",type:"password",onChange:e=>{t(t=>({...t,password:e.target.value}))},validity:a?.field_name=="password"?{isValid:!1,msg:a?.text}:{isValid:!0},showLabel:!0}),s.jsx(o.Z,{title:"Login",loading:e,onClick:r,children:"Login"})]})," "]})}[i,n,l,c,o,u,d]=m.then?(await m)():m,a()}catch(e){a(e)}})},8051:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>u});var s=r(997),i=r(1309),n=r(3216),l=r(9066),c=r(5743),o=e([i,n,l,c]);function u(){return(0,s.jsxs)(n.Z,{className:"w-full items-center max-w-lg gap-10",children:[(0,s.jsxs)(n.Z,{className:"gap-4",children:[s.jsx(i.Z,{children:"Login"}),s.jsx(c.Z,{children:"Welcome Back"})]}),s.jsx(l.Z,{})]})}[i,n,l,c]=o.then?(await o)():o,a()}catch(e){a(e)}})},8683:(e,t,r)=>{r.d(t,{_n:()=>c,dF:()=>n.a});var a=r(5191),s=r.n(a),i=r(4605),n=r.n(i);r(6255);var l=r(1521);let c=r.n(l)();s().utils.serializeQuery,s().utils.deserializeQuery},861:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>d});var s=r(975),i=r(6689),n=r(7639),l=r.n(n),c=r(9926),o=r(8683),u=e([c]);function d(){let[e,t]=(0,i.useState)({}),[r,a]=(0,i.useState)(),{loading:n,setLoading:u}=(0,s.Z)(),d=(0,i.useCallback)(async()=>{if(!e.email&&!e.username){a({text:"Please Enter a username or email"});return}let t=c.default.string().min(6).safeParse(e.password||"");if(!t.success){let e="Invalid Password: "+o.dF.parse(t.error.message)?.[0].message;a({text:e,field_name:"password"});return}u(!0);try{let t=await l()("/api/auth/login",{method:"POST",body:{...e}});t.success?window.location.reload():(a({text:t.msg||"Login Failed"}),u(!1))}catch(e){u(!1)}},[e]);return{loginData:e,setLoginData:t,loading:n,setLoading:u,submitLogin:d,alert:r,setAlert:a}}c=(u.then?(await u)():u)[0],a()}catch(e){a(e)}})},9177:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>x});var s=r(997),i=r(1817),n=r(1048),l=r(5808),c=r(2984),o=r(4519),u=r(9705),d=r(736),m=r(6245),h=r(3216),p=e([n,l,c,o,u,d,m,h]);function x({children:e}){return s.jsx(o.Z,{className:"w-screen h-screen overflow-hidden",children:s.jsx(d.Z,{className:"w-full h-full",children:s.jsx(l.Z,{className:"grid-frame grid-cols-1 h-full",children:(0,s.jsxs)(h.Z,{className:"w-full justify-between h-full grid-cell",children:[(0,s.jsxs)(h.Z,{className:"gap-0",children:[(0,s.jsxs)(u.Z,{children:[s.jsx(u.Z,{className:"p-6",children:s.jsx(i.Z,{})}),s.jsx(c.Z,{vertical:!0})]}),s.jsx(c.Z,{})]}),s.jsx(n.Z,{className:"p-10",children:e}),(0,s.jsxs)(h.Z,{children:[s.jsx(c.Z,{}),s.jsx(m.Z,{className:"h-20 w-full"})]})]})})})})}[n,l,c,o,u,d,m,h]=p.then?(await p)():p,a()}catch(e){a(e)}})},8733:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.r(t),r.d(t,{default:()=>d,getServerSideProps:()=>m});var s=r(997),i=r(8051),n=r(9177),l=r(7342),c=r(8804),o=r.n(c),u=e([i,n]);function d(){return s.jsx(n.Z,{children:s.jsx(i.Z,{})})}[i,n]=u.then?(await u)():u;let m=async e=>{let t=await o().select({table:"users"});if(!t.payload?.[0])return{redirect:{destination:"/auth/signup",statusCode:307}};let{singleRes:r}=await (0,l.Z)({req:e.req});return r?.logged_in_status?{redirect:{destination:"/admin",statusCode:307}}:{props:{}}};a()}catch(e){a(e)}})},4797:(e,t,r)=>{r.d(t,{ej:()=>i,kT:()=>n});var a=r(1635),s=r.n(a);function i(e,t){return e.split(";").reduce((e,t)=>{let[r,a]=t.trim().split("=").map(decodeURIComponent);return e[r]=a,e},{})[t]||null}function n(e,t){(function(e,t){let r=[];for(let e=0;e<t.length;e++){let{name:a,options:s,value:i}=t[e],n=[`${encodeURIComponent(a)}=${encodeURIComponent(i)}`];s.expires&&n.push(`Expires=${s.expires.toDate().toUTCString()}`),void 0!==s.maxAge&&n.push(`Max-Age=${s.maxAge}`),s.path&&n.push(`Path=${s.path}`),s.domain&&n.push(`Domain=${s.domain}`),s.secure&&n.push("Secure"),s.httpOnly&&n.push("HttpOnly"),r.push(n)}let a=r.map(e=>e.join("; "));e.setHeader("Set-Cookie",a)})(e,t.map(e=>({...e,value:"",options:{...e.options,expires:s()().subtract(1,"day"),maxAge:0}})))}},9757:(e,t,r)=>{r.d(t,{Z:()=>i});var a=r(2048),s=r(6315);function i(){let{TURBOCI_DEPLOYMENT_ID_FILE:e}=(0,s.Z)();if(!(0,a.existsSync)(e))throw Error(`\`${e}\` does not exist.`);let t=(0,a.readFileSync)(e,"utf-8").split("-").shift();if(!t)throw Error("Invalid deployment_id");return{auth_key_cookie_name:`turboci-admin-${t}-auth-key`,csrf_cookie_name:`turboci-admin-${t}-csrf`}}},6315:(e,t,r)=>{r.d(t,{Z:()=>i});var a=r(5315),s=r.n(a);function i(){let e=s().resolve(__dirname,"../../"),t="/root/.turboci",r=s().join(t,".config"),a=s().join(r,"turboci.json"),i=s().join(t,"deployment_id"),n=s().join(t,".ssh"),l=s().join(n,"turboci");return{APP_DIR:e,TURBOCI_CONFIG_DIR:r,TURBOCI_CONFIG_JSON_FILE:a,TURBOCI_DIR:t,TURBOCI_SSH_DIR:n,TURBOCI_SSH_KEY_FILE:l,TURBOCI_DEPLOYMENT_ID_FILE:i}}},7342:(e,t,r)=>{r.d(t,{Z:()=>c});var a=r(4797),s=r(4882),i=r.n(s),n=r(8683),l=r(9757);async function c({req:e,bun_req:t}){try{let{auth_key_cookie_name:r,csrf_cookie_name:s}=(0,l.Z)(),c=e?.headers.cookie||t?.headers.get("cookie");if(!c)return{success:!1,msg:"Couldn't grab cookie string"};let o=(0,a.ej)(c,r);if(!o)return{success:!1,msg:`No ${r} found in request object.`};let u=i()({encryptedString:o}),d=n.dF.parse(u);if(!d?.id)return{success:!1,msg:"Invalid Auth Key"};let m=(0,a.ej)(c,s);if(!m)return{success:!1,msg:`No ${s} found in request object.`};if(m!==d.csrf_k)return{success:!1,msg:"CSRF mismatch"};return{success:!0,singleRes:d}}catch(e){return{success:!1}}}},1764:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>l});var s=r(997);r(6689);var i=r(8097),n=e([i]);function l({color:e,variant:t,children:r,href:a,newTab:n,linkProps:l,...c}){let o=s.jsx("div",{...c,className:(0,i.twMerge)("text-xs px-2 py-0.5 rounded-full outline-0","text-center flex items-center justify-center","secondary"==e?"bg-secondary text-white outline-secbg-secondary":"success"==e?"bg-success outline-success text-white":"error"==e?"bg-orange-700 outline-orange-700":"gray"==e?(0,i.twMerge)("bg-slate-100 outline-slate-200 dark:bg-gray-dark dark:outline-gray-dark","text-slate-800 dark:text-white"):"bg-primary text-white outline-primbg-primary twui-tag-primary","outlined"==t?"!bg-transparent outline-1 "+("secondary"==e?"text-secondary":"success"==e?"text-success dark:text-success-dark":"error"==e?"text-orange-700":"gray"==e?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark twui-tag-primary-outlined"):"ghost"==t?"!bg-transparent outline-none border-none "+("secondary"==e?"text-secondary":"success"==e?"text-success dark:text-success-dark":"error"==e?"text-orange-700":"gray"==e?"text-slate-700 dark:text-white/80":"text-primary dark:text-primary-dark"):"","twui-tag",c.className),children:r});return a?s.jsx("a",{href:a,target:n?"_blank":void 0,...l,className:(0,i.twMerge)("hover:opacity-80",l?.className),children:o}):o}i=(n.then?(await n)():n)[0],a()}catch(e){a(e)}})},6458:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>o});var s=r(997),i=r(6517),n=r.n(i),l=r(8097),c=e([l]);function o({formRef:e,...t}){let r=n().omit(t,["submitHandler","changeHandler"]);return s.jsx("form",{...r,className:(0,l.twMerge)("flex flex-col items-stretch gap-2 w-full bg-transparent","twui-form",t.className),onSubmit:e=>{e.preventDefault();let r=e.target,a=new FormData(r),s=Object.fromEntries(a.entries());t.submitHandler?.(e,s),t.onSubmit?.(e)},onChange:e=>{e.preventDefault();let r=e.target.closest("form"),a=new FormData(r),s=Object.fromEntries(a.entries());t.changeHandler?.(e,s),t.onChange?.(e)},ref:e,children:t.children})}l=(c.then?(await c)():c)[0],a()}catch(e){a(e)}})},1048:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>l});var s=r(997),i=r(8097),n=e([i]);function l({...e}){return s.jsx("div",{...e,className:(0,i.twMerge)("flex flex-col items-center justify-center gap-4 p-2 w-full","h-full twui-center",e.className),children:e.children})}i=(n.then?(await n)():n)[0],a()}catch(e){a(e)}})},5808:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>l});var s=r(997),i=r(8097),n=e([i]);function l({...e}){return s.jsx("div",{...e,className:(0,i.twMerge)("flex w-full max-w-container gap-4 justify-between","flex-wrap flex-col xl:flex-row items-start xl:items-center","twui-container",e.className),children:e.children})}i=(n.then?(await n)():n)[0],a()}catch(e){a(e)}})},1309:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>l});var s=r(997),i=r(8097),n=e([i]);function l({...e}){return s.jsx("h2",{...e,className:(0,i.twMerge)("text-2xl md:text-3xl mb-4","twui-headings twui-heading","twui-h2",e.className),children:e.children})}i=(n.then?(await n)():n)[0],a()}catch(e){a(e)}})},736:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>l});var s=r(997),i=r(8097),n=e([i]);function l({...e}){return s.jsx("section",{...e,className:(0,i.twMerge)("flex flex-col items-center w-full","px-4 sm:px-10 py-10","twui-section",e.className),children:e.children})}i=(n.then?(await n)():n)[0],a()}catch(e){a(e)}})},6245:(e,t,r)=>{r.a(e,async(e,a)=>{try{r.d(t,{Z:()=>l});var s=r(997),i=r(8097),n=e([i]);function l({horizontal:e,...t}){return s.jsx("div",{...t,className:(0,i.twMerge)("",e?"w-10":"w-full h-10","twui-spacer",t.className),children:t.children})}i=(n.then?(await n)():n)[0],a()}catch(e){a(e)}})},5191:e=>{e.exports=require("@moduletrace/datasquirel/dist/client")},7639:e=>{e.exports=require("@moduletrace/datasquirel/dist/client/fetch")},4882:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/functions/dsql/decrypt")},4605:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/ejson")},1521:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/numberfy")},6255:e=>{e.exports=require("@moduletrace/datasquirel/dist/package-shared/utils/slugify")},8804:e=>{e.exports=require("@moduletrace/nsqlite")},1635:e=>{e.exports=require("dayjs")},6517:e=>{e.exports=require("lodash")},2423:e=>{e.exports=require("lucide-react")},2785:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},6689:e=>{e.exports=require("react")},6405:e=>{e.exports=require("react-dom")},997:e=>{e.exports=require("react/jsx-runtime")},2048:e=>{e.exports=require("fs")},5315:e=>{e.exports=require("path")},8097:e=>{e.exports=import("tailwind-merge")},9926:e=>{e.exports=import("zod")}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),a=t.X(0,[859,330,752,248],()=>r(6317));module.exports=a})(); |