1 line
8.2 KiB
JavaScript
1 line
8.2 KiB
JavaScript
"use strict";(()=>{var e={};e.id=3641,e.ids=[636,3641],e.modules={30671:(e,t)=>{Object.defineProperty(t,"M",{enumerable:!0,get:function(){return function e(t,r){return r in t?t[r]:"then"in t&&"function"==typeof t.then?t.then(t=>e(t,r)):"function"==typeof t&&"default"===r?t:void 0}}})},65060:(e,t,r)=>{let i;r.r(t),r.d(t,{config:()=>j,default:()=>S,getServerSideProps:()=>M,getStaticPaths:()=>b,getStaticProps:()=>A,reportWebVitals:()=>w,routeModule:()=>G,unstable_getServerProps:()=>F,unstable_getServerSideProps:()=>V,unstable_getStaticParams:()=>C,unstable_getStaticPaths:()=>_,unstable_getStaticProps:()=>E});var s={};r.r(s),r.d(s,{default:()=>k,getServerSideProps:()=>P});var u=r(63865),a=r(9455),n=r(30671),o=r(49407),l=r(68268),p=r(8732),d=r(82015),c=r.n(d),m=r(93615),x=r.n(m),y=r(64987),h=r(32415);require("os");var g=r(63715);function q({envObject:e,envKey:t}){let[r,s]=c().useState(!1),[u,a]=c().useState(!1),[n,o]=c().useState(e[t]),[l,d]=c().useState(!1);return(0,p.jsx)(c().Fragment,{children:(0,p.jsxs)("form",{className:"grid grid-cols-2 items-center gap2 w-full hover:bg-slate-100 py-2 px-4 relative",onSubmit:e=>{e.preventDefault(),r&&(a(!0),setTimeout(()=>{a(!1)},1e3))},children:[u&&(0,p.jsx)(h.A,{width:"20px"}),(0,p.jsx)("span",{children:t}),(0,p.jsxs)("div",{children:[(0,p.jsx)("input",{type:r?"text":"password",onFocus:e=>{"password"==e.target.type&&(e.target.type="text"),d(!0),s(!0)},onBlur:e=>{window.clearTimeout(i),i=setTimeout(()=>{"text"==e.target.type&&(e.target.type="password"),d(!1),s(!1)},2e3)},value:n,onChange:e=>{o(e.target.value)}}),l?(0,p.jsx)("div",{className:"button secondary",onClick:e=>{e.preventDefault(),r&&(a(!0),(0,g.A)("/api/admin/updateEnv",{method:"post",body:{key:t,value:n}}).then(e=>{e.success?window.location.reload():window.alert(e.error)}).finally(()=>{setTimeout(()=>{a(!1)},1e3)}))},children:"Update"}):(0,p.jsx)("div",{className:"button outlined",onClick:e=>{s(!r),d(!0)},children:"Reveal"})]})]})})}function v({data:e}){let{envObject:t}=e,[r,i]=c().useState(t),s=Object.keys(r);return(0,p.jsxs)(c().Fragment,{children:[(0,p.jsxs)("div",{className:"w-full justify-between",children:[(0,p.jsx)("h2",{className:"text-2xl m-0",children:"Environment Variables"}),(0,p.jsx)("button",{onClick:e=>{let t=window.prompt("What is the new ENV name?"),r=window.prompt("ENV Value");t&&r&&i(e=>{let i={...e};return i[t]=r,i})},children:"Add Environment Variable"})]}),(0,p.jsx)("section",{className:"paper",children:s.map((e,t)=>(0,p.jsx)(q,{envObject:r,envKey:e},t))})]})}let f=r(29021);function k({user:e,data:t}){let r=(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)("title",{children:"Console | Datasquirel"}),(0,p.jsx)("meta",{name:"description",content:"Databases Console"})]});return(0,p.jsx)(y.A,{head:r,user:e,children:(0,p.jsx)(v,{data:t})})}async function P({req:e,res:t,query:r}){let i=await x()(e);if(!i?.logged_in_status)return{redirect:{destination:"/su/login",permanent:!1}};let s=f.readFileSync("./.env","utf-8").split(/\n|\r/),u={};return s.forEach(e=>{if(!e.match(/=/)||e.match(/^\#/))return;let t=e.split("=");u[t[0]]=t[1]}),{props:{user:i,data:{envObject:u}}}}let S=(0,n.M)(s,"default"),A=(0,n.M)(s,"getStaticProps"),b=(0,n.M)(s,"getStaticPaths"),M=(0,n.M)(s,"getServerSideProps"),j=(0,n.M)(s,"config"),w=(0,n.M)(s,"reportWebVitals"),E=(0,n.M)(s,"unstable_getStaticProps"),_=(0,n.M)(s,"unstable_getStaticPaths"),C=(0,n.M)(s,"unstable_getStaticParams"),F=(0,n.M)(s,"unstable_getServerProps"),V=(0,n.M)(s,"unstable_getServerSideProps"),G=new u.PagesRouteModule({definition:{kind:a.A.PAGES,page:"/su/envar",pathname:"/su/envar",bundlePath:"",filename:""},components:{App:l.default,Document:o.default},userland:s})},67105:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("CloudUpload",[["path",{d:"M4 14.899A7 7 0 1 1 15.71 8h1.79a4.5 4.5 0 0 1 2.5 8.242",key:"1pljnt"}],["path",{d:"M12 12v9",key:"192myk"}],["path",{d:"m16 16-4-4-4 4",key:"119tzi"}]])},26628:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("DatabaseBackup",[["ellipse",{cx:"12",cy:"5",rx:"9",ry:"3",key:"msslwz"}],["path",{d:"M3 12a9 3 0 0 0 5 2.69",key:"1ui2ym"}],["path",{d:"M21 9.3V5",key:"6k6cib"}],["path",{d:"M3 5v14a9 3 0 0 0 6.47 2.88",key:"i62tjy"}],["path",{d:"M12 12v4h4",key:"1bxaet"}],["path",{d:"M13 20a5 5 0 0 0 9-3 4.5 4.5 0 0 0-4.5-4.5c-1.33 0-2.54.54-3.41 1.41L12 16",key:"1f4ei9"}]])},34479:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("FileWarning",[["path",{d:"M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z",key:"1rqfz7"}],["path",{d:"M12 9v4",key:"juzpu7"}],["path",{d:"M12 17h.01",key:"p32p05"}]])},20427:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("Home",[["path",{d:"m3 9 9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z",key:"y5dka4"}],["polyline",{points:"9 22 9 12 15 12 15 22",key:"e2us08"}]])},62011:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("LockKeyhole",[["circle",{cx:"12",cy:"16",r:"1",key:"1au0dj"}],["rect",{x:"3",y:"10",width:"18",height:"12",rx:"2",key:"6s8ecr"}],["path",{d:"M7 10V7a5 5 0 0 1 10 0v3",key:"1pqi11"}]])},2459:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("Server",[["rect",{width:"20",height:"8",x:"2",y:"2",rx:"2",ry:"2",key:"ngkwjq"}],["rect",{width:"20",height:"8",x:"2",y:"14",rx:"2",ry:"2",key:"iecqi9"}],["line",{x1:"6",x2:"6.01",y1:"6",y2:"6",key:"16zg32"}],["line",{x1:"6",x2:"6.01",y1:"18",y2:"18",key:"nzw8ys"}]])},80006:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("SquareChevronRight",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"m10 8 4 4-4 4",key:"1wy4r4"}]])},25294:(e,t,r)=>{r.d(t,{A:()=>i});let i=(0,r(82544).A)("Users",[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["path",{d:"M22 21v-2a4 4 0 0 0-3-3.87",key:"kshegd"}],["path",{d:"M16 3.13a4 4 0 0 1 0 7.75",key:"1da9ce"}]])},9455:(e,t)=>{var r;Object.defineProperty(t,"A",{enumerable:!0,get:function(){return r}}),function(e){e.PAGES="PAGES",e.PAGES_API="PAGES_API",e.APP_PAGE="APP_PAGE",e.APP_ROUTE="APP_ROUTE",e.IMAGE="IMAGE"}(r||(r={}))},66099:e=>{e.exports=require("@mui/system")},37616:e=>{e.exports=require("@mui/system/DefaultPropsProvider")},24509:e=>{e.exports=require("@mui/system/InitColorSchemeScript")},84781:e=>{e.exports=require("@mui/system/colorManipulator")},18215:e=>{e.exports=require("@mui/system/createStyled")},59989:e=>{e.exports=require("@mui/system/createTheme")},16670:e=>{e.exports=require("@mui/system/styleFunctionSx")},88698:e=>{e.exports=require("@mui/system/useThemeProps")},76831:e=>{e.exports=require("@mui/utils")},28578:e=>{e.exports=require("@mui/utils/capitalize")},14036:e=>{e.exports=require("@mui/utils/composeClasses")},31112:e=>{e.exports=require("@mui/utils/createChainedFunction")},21763:e=>{e.exports=require("@mui/utils/debounce")},7546:e=>{e.exports=require("@mui/utils/deepmerge")},5928:e=>{e.exports=require("@mui/utils/deprecatedPropType")},20985:e=>{e.exports=require("@mui/utils/formatMuiErrorMessage")},61119:e=>{e.exports=require("@mui/utils/generateUtilityClass")},81699:e=>{e.exports=require("@mui/utils/generateUtilityClasses")},29823:e=>{e.exports=require("@mui/utils/isMuiElement")},55402:e=>{e.exports=require("@mui/utils/ownerDocument")},46875:e=>{e.exports=require("@mui/utils/ownerWindow")},48080:e=>{e.exports=require("@mui/utils/requirePropFactory")},39597:e=>{e.exports=require("@mui/utils/setRef")},88190:e=>{e.exports=require("@mui/utils/unsupportedProp")},83889:e=>{e.exports=require("@mui/utils/useControlled")},21956:e=>{e.exports=require("@mui/utils/useEnhancedEffect")},4926:e=>{e.exports=require("@mui/utils/useEventCallback")},7376:e=>{e.exports=require("@mui/utils/useForkRef")},63310:e=>{e.exports=require("@mui/utils/useId")},10977:e=>{e.exports=require("@mui/utils/useIsFocusVisible")},74956:e=>{e.exports=require("clsx")},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},29825:e=>{e.exports=require("prop-types")},82015:e=>{e.exports=require("react")},22326:e=>{e.exports=require("react-dom")},8732:e=>{e.exports=require("react/jsx-runtime")},79428:e=>{e.exports=require("buffer")},55511:e=>{e.exports=require("crypto")},29021:e=>{e.exports=require("fs")},81630:e=>{e.exports=require("http")},33873:e=>{e.exports=require("path")}};var t=require("../../webpack-runtime.js");t.C(e);var r=e=>t(t.s=e),i=t.X(0,[9764,883,8268,615],()=>r(65060));module.exports=i})(); |