1 line
13 KiB
JavaScript
1 line
13 KiB
JavaScript
"use strict";exports.id=150,exports.ids=[150],exports.modules={7553:(e,t,r)=>{r.d(t,{Z:()=>s});let s=(0,r(8427).Z)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]])},2394:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>h});var a=r(997),i=r(3893),n=r(398),l=r(7444),c=r(9705),o=r(5743),u=r(3216),d=r(6689),m=e([i,n,l,c,o,u]);function h({title:e,ctas:t,description:r}){let{pageProps:s}=(0,d.useContext)(i.AppContext);return(0,a.jsxs)(c.Z,{className:"w-full grid-cell-content justify-between flex-nowrap items-start",children:[(0,a.jsxs)(u.Z,{className:"gap-2",children:[a.jsx(l.Z,{className:"admin-h1",children:e}),r?a.jsx(o.Z,{variant:"faded",children:r}):null,a.jsx(n.Z,{pageUrl:s.pageUrl||void 0,skipHome:!0,backButton:!0})]}),a.jsx(c.Z,{children:t})]})}[i,n,l,c,o,u]=m.then?(await m)():m,s()}catch(e){s(e)}})},8311:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>o});var a=r(997),i=r(975),n=r(990),l=r(8097),c=e([n,l]);function o({image_url:e,image_size:t=35,title:r}){let{loading:s,setLoading:c}=(0,i.Z)();return e?a.jsx(n.Z,{circle:!0,size:t,src:e,alt:r||"Avatar"}):a.jsx("div",{className:(0,l.twMerge)("bg-slate-100 dark:bg-white/10 rounded-full",""),style:{width:`${t}px`,height:`${t}px`}})}[n,l]=c.then?(await c)():c,s()}catch(e){s(e)}})},8683:(e,t,r)=>{r.d(t,{_n:()=>c,dF:()=>n.a});var s=r(5191),a=r.n(s),i=r(4605),n=r.n(i);r(6255);var l=r(1521);let c=r.n(l)();a().utils.serializeQuery,a().utils.deserializeQuery},8688:(e,t,r)=>{r.d(t,{Z:()=>u});var s=r(6315),a=r(2048),i=r.n(a),n=r(7342),l=r(6517),c=r.n(l);let{TURBOCI_DEPLOYMENT_ID_FILE:o}=(0,s.Z)();async function u({ctx:e,props:t,propsFn:r}){let{req:l,res:u}=e,d=e.query,{singleRes:m}=await (0,n.Z)({req:l}),h=function(){let{TURBOCI_CONFIG_JSON_FILE:e}=(0,s.Z)();if(!i().existsSync(e))throw Error("TurboCI config JSON file not found!");return JSON.parse(i().readFileSync(e,"utf-8"))}(),p=(0,a.readFileSync)(o,"utf-8"),x=d.service_name&&h.services.find(e=>e.service_name==d.service_name)||null,g=x?.service_name&&h.services.filter(e=>e.parent_service_name==x.service_name)||null;if(d.service_name&&!x?.service_name)return{redirect:{destination:"/admin/services",statusCode:307}};if(!m?.id)return{redirect:{destination:"/auth/login",permanent:!1}};let f=r?await r?.({user:m,query:d,props:t}):void 0;if("boolean"==typeof f&&!f)return{redirect:{destination:"/admin",permanent:!1}};if("string"==typeof f)return{redirect:{destination:f,permanent:!1}};let j=function(e,t){if(!e)return null;let r=e?.match(/_next/)?null:e?.split("?")[0].split("#")[0].split("/").filter(e=>""!==e);return"/"+r?.join("/")}(l.url,0);return{props:{...c().merge(t,f,{query:d,user:m,pageUrl:j,deployment:h,deployment_id:p,service:x,children_services:g})}}}},3960:(e,t,r)=>{r.d(t,{V:()=>s});function s({user:e}){return[{title:"Dashboard",url:"/admin",strict:!0},{title:"Services",url:"/admin/services"},e?.super_admin?{title:"Users",url:"/admin/users"}:void 0,{title:"Settings",url:"/admin/settings"}]}},7544:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>g});var a=r(997),i=r(8311),n=r(3893),l=r(417),c=r(6627),o=r(3563),u=r(8092),d=r(2984),m=r(9705),h=r(5743),p=r(6689),x=e([i,n,l,c,u,d,m,h]);function g(){let{pageProps:e}=(0,p.useContext)(n.AppContext),{user:t}=e;return a.jsx(l.Z,{target:(0,a.jsxs)(m.Z,{className:"-my-2",children:[a.jsx(i.Z,{image_url:t.image_thumbnail,title:`${t.first_name} Image`}),a.jsx(h.Z,{children:t.first_name}),a.jsx(o.Z,{name:"ChevronDown",size:17})]}),position:"bottom-right",children:a.jsx(u.Z,{className:"mt-3 min-w-[200px]",children:a.jsx(c.Z,{links:[{title:"Dashboard",url:"/admin"},{title:"Settings",url:"/admin/settings"},{component:a.jsx(d.Z,{})},{title:"Logout",url:"/auth/logout"}],className:"flex-col items-stretch w-full"})})})}[i,n,l,c,u,d,m,h]=x.then?(await x)():x,s()}catch(e){s(e)}})},2454:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>o});var a=r(997),i=r(1817),n=r(9705),l=r(7544),c=e([n,l]);function o({children:e}){return a.jsx("header",{className:"col-span-6",children:(0,a.jsxs)(n.Z,{className:"w-full grid grid-cols-6 grid-frame nested-grid-frame",children:[a.jsx(n.Z,{className:"h-full items-stretch grid-cell col-span-3 xl:col-span-1 w-full justify-between",children:a.jsx(n.Z,{className:"px-4",children:a.jsx(i.Z,{})})}),a.jsx(n.Z,{className:"grid-cell col-span-4 hidden xl:block"}),a.jsx(n.Z,{className:"grid-cell col-span-3 xl:col-span-1",children:a.jsx(n.Z,{className:"p-4 w-full justify-end",children:a.jsx(l.Z,{})})})]})})}[n,l]=c.then?(await c)():c,s()}catch(e){s(e)}})},3060:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>g});var a=r(997),i=r(6627),n=r(4519),l=r(3216),c=r(6689),o=r(3960),u=r(2454),d=r(8097),m=r(968),h=r.n(m),p=r(3893),x=e([i,n,l,u,d,p]);function g({children:e}){let{pageProps:t}=(0,c.useContext)(p.AppContext);return(0,a.jsxs)(c.Fragment,{children:[(0,a.jsxs)(h(),{children:[a.jsx("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ace.min.js"}),a.jsx("script",{src:"https://cdnjs.cloudflare.com/ajax/libs/ace/1.22.0/ext-language_tools.min.js"})]}),a.jsx(n.Z,{className:"w-screen h-screen overflow-hidden p-4 lg:p-10",id:"admin-main",children:(0,a.jsxs)("div",{className:"grid-frame grid-cols-6 w-full h-full grid-rows-[64px_47px] xl:grid-rows-[64px_auto]",children:[a.jsx(u.Z,{}),a.jsx(l.Z,{className:"grid-cell col-span-6 xl:col-span-1 gap-0",children:a.jsx(i.Z,{links:(0,o.V)({user:t.user}),className:"w-full xl:flex-col",linkProps:{className:"turboci-admin-aside-link"}})}),(0,a.jsxs)(l.Z,{className:(0,d.twMerge)("grid-cell col-span-6 xl:col-span-5 gap-0","overflow-auto pb-[200px]"),children:[e,a.jsx("div",{className:"h-[400px] w-full block",style:{height:"400px"}})]})]})})]})}[i,n,l,u,d,p]=x.then?(await x)():x,s()}catch(e){s(e)}})},4797:(e,t,r)=>{r.d(t,{ej:()=>i,kT:()=>n});var s=r(1635),a=r.n(s);function i(e,t){return e.split(";").reduce((e,t)=>{let[r,s]=t.trim().split("=").map(decodeURIComponent);return e[r]=s,e},{})[t]||null}function n(e,t){(function(e,t){let r=[];for(let e=0;e<t.length;e++){let{name:s,options:a,value:i}=t[e],n=[`${encodeURIComponent(s)}=${encodeURIComponent(i)}`];a.expires&&n.push(`Expires=${a.expires.toDate().toUTCString()}`),void 0!==a.maxAge&&n.push(`Max-Age=${a.maxAge}`),a.path&&n.push(`Path=${a.path}`),a.domain&&n.push(`Domain=${a.domain}`),a.secure&&n.push("Secure"),a.httpOnly&&n.push("HttpOnly"),r.push(n)}let s=r.map(e=>e.join("; "));e.setHeader("Set-Cookie",s)})(e,t.map(e=>({...e,value:"",options:{...e.options,expires:a()().subtract(1,"day"),maxAge:0}})))}},9757:(e,t,r)=>{r.d(t,{Z:()=>i});var s=r(2048),a=r(6315);function i(){let{TURBOCI_DEPLOYMENT_ID_FILE:e}=(0,a.Z)();if(!(0,s.existsSync)(e))throw Error(`\`${e}\` does not exist.`);let t=(0,s.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 s=r(5315),a=r.n(s);function i(){let e=a().resolve(__dirname,"../../"),t="/root/.turboci",r=a().join(t,".config"),s=a().join(r,"turboci.json"),i=a().join(t,"deployment_id"),n=a().join(t,".ssh"),l=a().join(n,"turboci");return{APP_DIR:e,TURBOCI_CONFIG_DIR:r,TURBOCI_CONFIG_JSON_FILE:s,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 s=r(4797),a=r(4882),i=r.n(a),n=r(8683),l=r(9757);async function c({req:e,bun_req:t}){try{let{auth_key_cookie_name:r,csrf_cookie_name:a}=(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,s.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,s.ej)(c,a);if(!m)return{success:!1,msg:`No ${a} 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}}}},398:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>x});var a=r(997),i=r(6689),n=r.n(i),l=r(5976),c=r(2984),o=r(9705),u=r(290),d=r(8097),m=r(7553),h=r(8006),p=e([l,c,o,d,h]);function x({excludeRegexMatch:e,linkProps:t,currentLinkProps:r,dividerProps:s,backButton:i,backButtonProps:p,pageUrl:x,currentTitle:g,skipHome:f,divider:j}){let[w,v]=n().useState(x?function({url:e,excludeRegexMatch:t,skipHome:r}){let s=e.split("/"),a=[];return r||a.push({title:"Home",path:e.match(/admin/)?"/admin":"/"}),s.forEach((e,r,s)=>{e?.match(/./)&&(t&&t.test(e)||a.push({title:(0,u.Z)(e),path:(()=>{let e="";for(let t=0;t<s.length;t++){let a=s[t];!(t>r)&&a.match(/./)&&(e+=`/${a}`)}return e})()}))}),a}({url:x,skipHome:f}):null);return w?.[1]?a.jsx("nav",{className:(0,d.twMerge)("overflow-x-auto","twui-current-breadcrumb-wrapper"),"aria-label":"Breadcrumb",children:(0,a.jsxs)(o.Z,{className:(0,d.twMerge)("gap-4 flex-nowrap whitespace-nowrap overflow-x-auto overflow-y-hidden w-full"),children:[i&&(0,a.jsxs)(n().Fragment,{children:[a.jsx(h.Z,{variant:"ghost",color:"gray",...p,className:(0,d.twMerge)("p-1 -my-2 -mx-2","twui-breadcrumbs-back-button",p?.className),onClick:e=>{window.history.back(),p?.onClick?.(e)},title:"Breadcrumbs Back Button",beforeIcon:a.jsx(m.Z,{size:20})}),j||a.jsx(c.Z,{vertical:!0,className:(0,d.twMerge)("twui-breadcrumbs-divider",s?.className)})]}),w.map((e,i,o)=>{let u=o.length-1==i;return i===w.length-1?a.jsx(l.Z,{href:e.path,...t,...u?r:{},className:(0,d.twMerge)("text-primary-text/50 dark:text-primary-dark-text/50 text-xs","max-w-[200px] text-ellipsis overflow-hidden",u?"current":"","twui-breadcrumb-link",t?.className,u&&r?.className),title:r?.title||e.title,children:g||e.title},i):(0,a.jsxs)(n().Fragment,{children:[a.jsx(l.Z,{href:e.path,...t,...u?r:{},className:(0,d.twMerge)("text-xs",u?"current":"","twui-breadcrumb-link",t?.className,u&&r?.className),children:r?.title||e.title}),j||a.jsx(c.Z,{vertical:!0,...s,className:(0,d.twMerge)("twui-breadcrumbs-divider",s?.className)})]},i)})]})}):a.jsx(n().Fragment,{})}[l,c,o,d,h]=p.then?(await p)():p,s()}catch(e){s(e)}})},2102:(e,t,r)=>{r.a(e,async(e,t)=>{try{r(997);var s=r(5976),a=r(8097),i=r(9705),n=e([s,a,i]);[s,a,i]=n.then?(await n)():n,t()}catch(e){t(e)}})},3203:(e,t,r)=>{r.a(e,async(e,t)=>{try{r(997),r(6689);var s=r(8097),a=r(9705),i=r(6788),n=e([s,a,i]);[s,a,i]=n.then?(await n)():n,t()}catch(e){t(e)}})},6788:(e,t,r)=>{r.a(e,async(e,t)=>{try{r(997),r(6689);var s=r(8097),a=r(9705),i=r(2102),n=r(417),l=r(3352),c=r(3216),o=r(8006),u=e([s,a,i,n,l,c,o]);[s,a,i,n,l,c,o]=u.then?(await u)():u,t()}catch(e){t(e)}})},6627:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>p});var a=r(997),i=r(6689),n=r.n(i),l=r(8097),c=r(5976),o=r(3203),u=r(9705),d=r(2984),m=r(8006),h=e([l,c,o,u,d,m]);function p({links:e,linkProps:t,buttonProps:r,divider:s,dividerComponent:i,linkType:o,...h}){let p=n().useRef(null);return a.jsx("div",{ref:p,...h,className:(0,l.twMerge)("flex flex-row items-center gap-1","twui-link-list",h.className),children:e.flat().filter(e=>!!e).map((h,p)=>{if(!h)return null;if(h.divider)return a.jsx(n().Fragment,{children:h.divider},p);let x=p<e.length-1&&(i||(s?a.jsx(d.Z,{}):void 0));return"button"==o||"button"==h.linkType?(0,a.jsxs)(n().Fragment,{children:[a.jsx(m.Z,{title:h.title||"Link Button",variant:"ghost",...r,...h.buttonProps,className:(0,l.twMerge)("p-2 cursor-pointer whitespace-nowrap",t?.className),onClick:e=>{h.onClick?.(e),h.buttonProps?.onClick?.(e)},children:(0,a.jsxs)(u.Z,{children:[h.icon,h.component||h.title]})}),x]},p):(0,a.jsxs)(n().Fragment,{children:[a.jsx(c.Z,{href:h.url,title:h.title,...t,...h.linkProps,className:(0,l.twMerge)("p-2 cursor-pointer whitespace-nowrap",t?.className,h.linkProps?.className),strict:h.strict,onClick:e=>{h.onClick?.(e),h.linkProps?.onClick?.(e)},children:(0,a.jsxs)(u.Z,{children:[h.iconPosition&&"before"!=h.iconPosition?null:h.icon,h.component||h.title,"after"==h.iconPosition?h.icon:null]})}),x]},p)})})}[l,c,o,u,d,m]=h.then?(await h)():h,s()}catch(e){s(e)}})},7444:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>l});var a=r(997),i=r(8097),n=e([i]);function l({...e}){return a.jsx("h1",{...e,className:(0,i.twMerge)("text-4xl md:text-5xl mb-4","twui-headings twui-heading","twui-h1",e.className),children:e.children})}i=(n.then?(await n)():n)[0],s()}catch(e){s(e)}})},990:(e,t,r)=>{r.a(e,async(e,s)=>{try{r.d(t,{Z:()=>d});var a=r(997),i=r(6517),n=r.n(i),l=r(6689),c=r.n(l),o=r(8097),u=e([o]);function d({imgErrSrc:e,imgErrComp:t,imgErrSrcDark:r,imgErrSrcLight:s,...i}){let l=i.size||i.width,u=i.size||i.height,[d,m]=c().useState(!1),h={...n().omit(i,["size","circle","bgImg","backgroundImage","fallbackImageSrc","srcLight","srcDark"]),width:l,height:u,className:(0,o.twMerge)("object-cover",i.circle&&"rounded-full",i.bgImg||i.backgroundImage?"absolute top-0 left-0 w-full h-full object-cover z-0":"","twui-img",i.className),onError:e=>{i.fallbackImageSrc&&(e.currentTarget.src=i.fallbackImageSrc),i.onError?.(e)},style:{...i.size?{width:`${i.size}px`,minWidth:`${i.size}px`,height:`${i.size}px`}:{},...i.style}};return d?t||a.jsx("img",{loading:"lazy",...h,src:e||"https://static.datasquirel.com/images/user-images/user-2/castcord-image-preset_thumbnail.jpg"}):i.srcDark&&i.srcLight?(0,a.jsxs)(c().Fragment,{children:[a.jsx("img",{loading:"lazy",...h,className:(0,o.twMerge)("hidden dark:block",h.className),src:i.srcDark,onError:e=>{m(!0),i.onError?.(e)}}),a.jsx("img",{loading:"lazy",...h,className:(0,o.twMerge)("block dark:hidden",h.className),src:i.srcLight,onError:e=>{m(!0),i.onError?.(e)}})]}):a.jsx("img",{...h,onError:e=>{m(!0),i.onError?.(e)}})}o=(u.then?(await u)():u)[0],s()}catch(e){s(e)}})},290:(e,t,r)=>{r.d(t,{Z:()=>s});function s(e){return e.replace(/_|-/g," ").split(" ").map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(" ")}}}; |