This commit is contained in:
Benjamin Toby
2024-12-15 12:27:16 +01:00
parent d9d32a4643
commit bc037e839f
314 changed files with 10191 additions and 408 deletions
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
"use strict";(()=>{var e={};e.id=9326,e.ids=[9326],e.modules={53088:(e,t,s)=>{s.r(t),s.d(t,{config:()=>W,default:()=>R,getServerSideProps:()=>I,getStaticPaths:()=>H,getStaticProps:()=>k,reportWebVitals:()=>B,routeModule:()=>X,unstable_getServerProps:()=>U,unstable_getServerSideProps:()=>G,unstable_getStaticParams:()=>Q,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>$});var r={};s.r(r),s.d(r,{MediaContext:()=>T,default:()=>D,getServerSideProps:()=>V});var a=s(63865),i=s(9455),n=s(30671),d=s(49407),o=s(89600),l=s(8732),u=s(82015),c=s.n(u),p=s(95222),x=s(20048),m=s.n(x),g=s(58548),S=s(55158),j=s(24671),h=s(82747),f=s(62506);function b(e){let{media:t,setTargetMedia:s,user:r,folders:a,staticHost:i}=c().useContext(T);return(0,l.jsxs)(c().Fragment,{children:[(0,l.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,l.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,l.jsx)("h1",{className:"text-3xl m-0",children:"Media"}),(0,l.jsxs)(f.A,{children:[(0,l.jsxs)("button",{className:"flex items-center gap-2",onClick:e=>{(0,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Media"})]}),(0,l.jsxs)("button",{className:"flex items-center gap-2 outlined gray",onClick:e=>{(0,S.PB)("add-folder-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Folder"})]})]})]}),(0,l.jsx)(g.A,{user:r})]}),r?.verification_status?.toString().match(/1/)?(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(h.A,{media:t,setTargetMedia:s,folders:a,staticHost:i,user:r}),t&&t[0]&&(0,l.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,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{className:"",children:"Add Media"})]})]}):(0,l.jsx)(j.A,{})]})}var P=s(83531),M=s(81156),v=s(98009),A=s(30180),_=s(31700),N=s(99486),w=s(32415),y=s(67216),q=s.n(y),F=s(33873),C=s.n(F),E=s(65693);let L=s(29021),T=c().createContext({});function D({user:e,media:t,folders:s,staticHost:r}){let a=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[i,n]=c().useState(null),[d,o]=c().useState(null),[u,x]=c().useState(null),[m,g]=c().useState(!1),[S,j]=c().useState(null);return(0,l.jsx)(p.A,{head:a,user:e,children:(0,l.jsxs)(T.Provider,{value:{user:e,media:t,targetMedia:S,setTargetMedia:j,folders:s,staticHost:r},children:[m&&(0,l.jsx)(w.A,{screen:!0,title:"Processing Files ..."}),(0,l.jsx)(b,{}),(0,l.jsx)(P.A,{setNewMedia:n,setLoading:g}),(0,l.jsx)(_.A,{setNewFile:o,setLoading:g}),(0,l.jsx)(E.A,{setNewVideo:x,setLoading:g}),(0,l.jsx)(M.A,{newMedia:i,setNewMedia:n,newFile:d,setNewFile:o,newVideo:u,setNewVideo:x}),(0,l.jsx)(v.A,{targetMedia:S,setTargetMedia:j,staticHost:r,media:t}),(0,l.jsx)(A.A,{}),(0,l.jsx)(N.A,{user:e})]})})}async function V({req:e,res:t,query:s}){let r=await m()(e,t);if(!r?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let a=await q()(`SELECT * FROM user_media WHERE user_id='${r.id}' AND folder IS NULL`),i=process.env.DSQL_STATIC_SERVER_DIR;if(!i)return console.log("Static File ENV not Found!"),{redirect:{destination:"/admin",permanent:!1}};let n=C().join(i,`images/user-images/user-${r.id}/`);return L.existsSync(n)?{props:{user:r,media:a,folders:L.readdirSync(n).filter(e=>!e.match(/\..{3,4}$/)),staticHost:process.env.DSQL_STATIC_HOST||""}}:{redirect:{destination:"/admin",permanent:!1}}}let R=(0,n.M)(r,"default"),k=(0,n.M)(r,"getStaticProps"),H=(0,n.M)(r,"getStaticPaths"),I=(0,n.M)(r,"getServerSideProps"),W=(0,n.M)(r,"config"),B=(0,n.M)(r,"reportWebVitals"),$=(0,n.M)(r,"unstable_getStaticProps"),O=(0,n.M)(r,"unstable_getStaticPaths"),Q=(0,n.M)(r,"unstable_getStaticParams"),U=(0,n.M)(r,"unstable_getServerProps"),G=(0,n.M)(r,"unstable_getServerSideProps"),X=new a.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/admin/[user_id]/media",pathname:"/admin/[user_id]/media",bundlePath:"",filename:""},components:{App:o.default,Document:d.default},userland:r})},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},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 t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[883,9821,9600,7070,7640],()=>s(53088));module.exports=r})();
"use strict";(()=>{var e={};e.id=9326,e.ids=[9326],e.modules={53088:(e,t,s)=>{s.r(t),s.d(t,{config:()=>W,default:()=>R,getServerSideProps:()=>I,getStaticPaths:()=>H,getStaticProps:()=>k,reportWebVitals:()=>B,routeModule:()=>X,unstable_getServerProps:()=>U,unstable_getServerSideProps:()=>G,unstable_getStaticParams:()=>Q,unstable_getStaticPaths:()=>O,unstable_getStaticProps:()=>$});var r={};s.r(r),s.d(r,{MediaContext:()=>T,default:()=>D,getServerSideProps:()=>V});var a=s(63865),i=s(9455),n=s(30671),d=s(49407),o=s(89600),l=s(8732),u=s(82015),c=s.n(u),p=s(95222),x=s(20048),m=s.n(x),g=s(58548),S=s(55158),j=s(24671),h=s(82747),f=s(62506);function b(e){let{media:t,setTargetMedia:s,user:r,folders:a,staticHost:i}=c().useContext(T);return(0,l.jsxs)(c().Fragment,{children:[(0,l.jsxs)("div",{className:"flex-col items-start gap-0 w-full",children:[(0,l.jsxs)("div",{className:"w-full justify-between flex-wrap",children:[(0,l.jsx)("h1",{className:"text-3xl m-0",children:"Media"}),(0,l.jsxs)(f.A,{children:[(0,l.jsxs)("button",{className:"flex items-center gap-2",onClick:e=>{(0,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Media"})]}),(0,l.jsxs)("button",{className:"flex items-center gap-2 outlined gray",onClick:e=>{(0,S.PB)("add-folder-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{children:"Add Folder"})]})]})]}),(0,l.jsx)(g.A,{user:r})]}),r?.verification_status?.toString().match(/1/)?(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(h.A,{media:t,setTargetMedia:s,folders:a,staticHost:i,user:r}),t&&t[0]&&(0,l.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,S.PB)("choose-media-type-popoup")},children:[(0,l.jsx)("span",{className:"symbol",children:"+"}),(0,l.jsx)("span",{className:"",children:"Add Media"})]})]}):(0,l.jsx)(j.A,{})]})}var P=s(83531),M=s(81156),v=s(98009),A=s(30180),_=s(31700),N=s(99486),w=s(32415),y=s(67216),q=s.n(y),F=s(33873),C=s.n(F),E=s(65693);let L=s(29021),T=c().createContext({});function D({user:e,media:t,folders:s,staticHost:r}){let a=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("title",{children:"User Dashboard | Datasquirel"}),(0,l.jsx)("meta",{name:"description",content:"Welcome to your data app"})]}),[i,n]=c().useState(null),[d,o]=c().useState(null),[u,x]=c().useState(null),[m,g]=c().useState(!1),[S,j]=c().useState(null);return(0,l.jsxs)(c().Fragment,{children:[(0,l.jsx)(p.A,{head:a,user:e,children:(0,l.jsxs)(T.Provider,{value:{user:e,media:t,targetMedia:S,setTargetMedia:j,folders:s,staticHost:r},children:[m&&(0,l.jsx)(w.A,{screen:!0,title:"Processing Files ..."}),(0,l.jsx)(b,{}),(0,l.jsx)(P.A,{setNewMedia:n,setLoading:g}),(0,l.jsx)(_.A,{setNewFile:o,setLoading:g}),(0,l.jsx)(E.A,{setNewVideo:x,setLoading:g})]})}),(0,l.jsx)(M.A,{newMedia:i,setNewMedia:n,newFile:d,setNewFile:o,newVideo:u,setNewVideo:x}),(0,l.jsx)(v.A,{targetMedia:S,setTargetMedia:j,staticHost:r,media:t}),(0,l.jsx)(A.A,{}),(0,l.jsx)(N.A,{user:e})]})}async function V({req:e,res:t,query:s}){let r=await m()(e,t);if(!r?.logged_in_status)return{redirect:{destination:"/login",permanent:!1}};let a=await q()(`SELECT * FROM user_media WHERE user_id='${r.id}' AND folder IS NULL`),i=process.env.DSQL_STATIC_SERVER_DIR;if(!i)return console.log("Static File ENV not Found!"),{redirect:{destination:"/admin",permanent:!1}};let n=C().join(i,`images/user-images/user-${r.id}/`);return L.existsSync(n)?{props:{user:r,media:a,folders:L.readdirSync(n).filter(e=>!e.match(/\..{3,4}$/)),staticHost:process.env.DSQL_STATIC_HOST||""}}:{redirect:{destination:"/admin",permanent:!1}}}let R=(0,n.M)(r,"default"),k=(0,n.M)(r,"getStaticProps"),H=(0,n.M)(r,"getStaticPaths"),I=(0,n.M)(r,"getServerSideProps"),W=(0,n.M)(r,"config"),B=(0,n.M)(r,"reportWebVitals"),$=(0,n.M)(r,"unstable_getStaticProps"),O=(0,n.M)(r,"unstable_getStaticPaths"),Q=(0,n.M)(r,"unstable_getStaticParams"),U=(0,n.M)(r,"unstable_getServerProps"),G=(0,n.M)(r,"unstable_getServerSideProps"),X=new a.PagesRouteModule({definition:{kind:i.A.PAGES,page:"/admin/[user_id]/media",pathname:"/admin/[user_id]/media",bundlePath:"",filename:""},components:{App:o.default,Document:d.default},userland:r})},40361:e=>{e.exports=require("next/dist/compiled/next-server/pages.runtime.prod.js")},27912:e=>{e.exports=require("next/head")},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 t=require("../../../webpack-runtime.js");t.C(e);var s=e=>t(t.s=e),r=t.X(0,[883,9821,9600,7070,7640],()=>s(53088));module.exports=r})();
File diff suppressed because one or more lines are too long