dsql-admin/dsql-app/.local_dist/server/pages/admin/[user_id]/media.js
Benjamin Toby 7a06e83a46 Updates
2024-12-08 20:56:57 +01:00

1 line
6.6 KiB
JavaScript

"use strict";(()=>{var e={};e.id=9326,e.ids=[636,9326],e.modules={53088:(e,r,t)=>{t.r(r),t.d(r,{config:()=>W,default:()=>V,getServerSideProps:()=>H,getStaticPaths:()=>I,getStaticProps:()=>k,reportWebVitals:()=>U,routeModule:()=>G,unstable_getServerProps:()=>Q,unstable_getServerSideProps:()=>z,unstable_getStaticParams:()=>O,unstable_getStaticPaths:()=>$,unstable_getStaticProps:()=>B});var s={};t.r(s),t.d(s,{MediaContext:()=>D,default:()=>L,getServerSideProps:()=>R});var i=t(63865),u=t(9455),a=t(30671),o=t(49407),l=t(68268),n=t(8732),d=t(82015),p=t.n(d),c=t(95222),m=t(20048),x=t.n(m),g=t(58548),q=t(55158),S=t(24671),h=t(2628),f=t(62506);function j(e){let{media:r,setTargetMedia:t,user:s,folders:i,staticHost:u}=p().useContext(D);return(0,n.jsxs)(p().Fragment,{children:[(0,n.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,n.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,n.jsx)("h1",{className:"text-3xl m-0",children:"Media"}),(0,n.jsxs)(f.A,{children:[(0,n.jsxs)("button",{className:"flex items-center gap-2",onClick:e=>{(0,q.PB)("choose-media-type-popoup")},children:[(0,n.jsx)("span",{className:"symbol",children:"+"}),(0,n.jsx)("span",{children:"Add Media"})]}),(0,n.jsxs)("button",{className:"flex items-center gap-2 outlined gray",onClick:e=>{(0,q.PB)("add-folder-popoup")},children:[(0,n.jsx)("span",{className:"symbol",children:"+"}),(0,n.jsx)("span",{children:"Add Folder"})]})]})]}),(0,n.jsx)(g.A,{user:s})]}),s?.verification_status?.toString().match(/1/)?(0,n.jsxs)(p().Fragment,{children:[(0,n.jsx)(h.A,{media:r,setTargetMedia:t,folders:i,staticHost:u,user:s}),r&&r[0]&&(0,n.jsxs)("a",{className:"border-dotted border-slate-400 border-2 px-4 py-3 w-full rounded flex items-center hover:border-primary/50 gap-2 cursor-pointer justify-center",onClick:e=>{(0,q.PB)("choose-media-type-popoup")},children:[(0,n.jsx)("span",{className:"symbol",children:"+"}),(0,n.jsx)("span",{className:"",children:"Add Media"})]})]}):(0,n.jsx)(S.A,{})]})}var y=t(83531),P=t(90194),b=t(70161),M=t(30180),v=t(31700),A=t(73413),_=t(32415),w=t(67216),N=t.n(w),C=t(33873),F=t.n(C),E=t(65693);let T=t(29021),D=p().createContext({});function L({user:e,media:r,folders:t,staticHost:s}){let i=(0,n.jsxs)(n.Fragment,{children:[(0,n.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,n.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[u,a]=p().useState(null),[o,l]=p().useState(null),[d,m]=p().useState(null),[x,g]=p().useState(!1),[q,S]=p().useState(null);return(0,n.jsx)(c.A,{head:i,user:e,children:(0,n.jsxs)(D.Provider,{value:{user:e,media:r,targetMedia:q,setTargetMedia:S,folders:t,staticHost:s},children:[x&&(0,n.jsx)(_.A,{screen:!0,title:"Processing Files ..."}),(0,n.jsx)(j,{}),(0,n.jsx)(y.A,{setNewMedia:a,setLoading:g}),(0,n.jsx)(v.A,{setNewFile:l,setLoading:g}),(0,n.jsx)(E.A,{setNewVideo:m,setLoading:g}),(0,n.jsx)(P.A,{newMedia:u,setNewMedia:a,newFile:o,setNewFile:l,newVideo:d,setNewVideo:m}),(0,n.jsx)(b.A,{targetMedia:q,setTargetMedia:S,staticHost:s,media:r}),(0,n.jsx)(M.A,{}),(0,n.jsx)(A.A,{user:e})]})})}async function R({req:e,res:r,query:t}){let s=await x()(e,r);if(!s?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let i=await N()(`SELECT * FROM user_media WHERE user_id='${s.id}' AND folder IS NULL`),u=process.env.DSQL_STATIC_SERVER_DIR;if(!u)return console.log("Static File ENV not Found!"),{redirect:{destination:"/admin",permanent:!1}};let a=F().join(u,`images/user-images/user-${s.id}/`);return T.existsSync(a)?{props:{user:s,media:i,folders:T.readdirSync(a).filter(e=>!e.match(/\..{3,4}$/)),staticHost:process.env.DSQL_STATIC_HOST||""}}:{redirect:{destination:"/admin",permanent:!1}}}let V=(0,a.M)(s,"default"),k=(0,a.M)(s,"getStaticProps"),I=(0,a.M)(s,"getStaticPaths"),H=(0,a.M)(s,"getServerSideProps"),W=(0,a.M)(s,"config"),U=(0,a.M)(s,"reportWebVitals"),B=(0,a.M)(s,"unstable_getStaticProps"),$=(0,a.M)(s,"unstable_getStaticPaths"),O=(0,a.M)(s,"unstable_getStaticParams"),Q=(0,a.M)(s,"unstable_getServerProps"),z=(0,a.M)(s,"unstable_getServerSideProps"),G=new i.PagesRouteModule({definition:{kind:u.A.PAGES,page:"/admin/[user_id]/media",pathname:"/admin/[user_id]/media",bundlePath:"",filename:""},components:{App:l.default,Document:o.default},userland:s})},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")},9973:e=>{e.exports=require("serverless-mysql")},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 r=require("../../../webpack-runtime.js");r.C(e);var t=e=>r(r.s=e),s=r.X(0,[9764,883,3468,8268,7070,7665],()=>t(53088));module.exports=s})();