main.e7237072.chunk.js 13 KB

12
  1. (this.webpackJsonpphoto=this.webpackJsonpphoto||[]).push([[0],{116:function(e,a,t){e.exports=t(172)},121:function(e,a,t){},172:function(e,a,t){"use strict";t.r(a);var n=t(0),r=t.n(n),l=t(8),o=t.n(l);t(121),Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/));var i=t(17),c=t(10),s=t(58),u=t(4),m=t(230),d=t(19),h=t(235),p=t(236),f=t(43),g=t(222),b=t(234),E=t(92),j=t.n(E),v=t(3),y=t(245),O=t(225),C=t(237),w=t(96),k=t.n(w),S=t(97),I=t.n(S),x=t(226),P=t(238),N=t(239),B=t(53),L=t.n(B),D=t(85),W=t(86),A=t(35),T=t(103),F=t(102),G=t(87),_=t.n(G),z=t(218),J=t(89),R=t.n(J),U=t(223),V=t(228),H=t(224),M=t(90),q=t.n(M),X=t(241),Z=t(227),$=t(244),K=function(e){Object(T.a)(t,e);var a=Object(F.a)(t);function t(e){var n;return Object(D.a)(this,t),(n=a.call(this,e)).shareImage=function(){var e=n.state.images[n.state.currentImage].vsrc;n.setState({open:!0,currentImagePath:e}),fetch("/system/file_system/share/new?path="+e,{}).then((function(e){return e.json()})).then((function(e){n.setState({uuid:e.UUID,mode:e.Permission}),console.log(n.state.uuid)}),(function(e){n.setState({ShareError:e})}))},n.handleChange=function(e){n.setState({mode:e.target.value});var a=n.state.uuid,t=e.target.value,r=n.state.currentImagePath;"remove"!=e.target.value?fetch("/system/file_system/share/edit?uuid="+a+"&mode="+t,{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(e){return e})):fetch("/system/file_system/share/delete?path="+r,{method:"GET",headers:{"Content-Type":"application/json"}}).then((function(e){return e.json()})).then((function(e){return e}))},n.state={images:[],currentImage:0,currentImagePath:"",error:null,isLoaded:!1,open:!1,uuid:"not_found",mode:"nil",permission:"anyone",ShareError:null},n.onCurrentImageChange=n.onCurrentImageChange.bind(Object(A.a)(n)),n.shareImage=n.shareImage.bind(Object(A.a)(n)),n.handleDialogClose=n.handleDialogClose.bind(Object(A.a)(n)),n}return Object(W.a)(t,[{key:"onCurrentImageChange",value:function(e){this.setState({currentImage:e})}},{key:"handleDialogClose",value:function(){this.setState({open:!1})}},{key:"componentDidMount",value:function(){var e=this;fetch("/system/ajgi/interface?script=/Photo/backend/listFile.js",{method:"post",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify({folder:this.props.path})}).then((function(e){return e.json()})).then((function(a){e.setState({isLoaded:!0,images:a})}),(function(a){e.setState({isLoaded:!0,error:a})}))}},{key:"setPath",value:function(){this.setState({path:"user:/Photo/Photo/uploads/"})}},{key:"render",value:function(){this.props.classes;var e=this.state,a=e.isLoaded,t=e.error;return t?r.a.createElement("div",null,"Error: ",t.message," (imageList.js)"):a?r.a.createElement("div",null,r.a.createElement(_.a,{images:this.state.images,enableLightbox:!0,enableImageSelection:!1,currentImageWillChange:this.onCurrentImageChange,customControls:[r.a.createElement(g.a,{variant:"contained",size:"large",style:{margin:4},startIcon:r.a.createElement(R.a,null),onClick:this.shareImage.bind(this)},"Share")]}),r.a.createElement(U.a,{style:{zIndex:99999},open:this.state.open,maxWidth:"md",fullWidth:"true",onClose:this.handleDialogClose},r.a.createElement(H.a,null,r.a.createElement(O.a,null,r.a.createElement(x.a,null,r.a.createElement(Z.a,null,r.a.createElement($.a,null,r.a.createElement(q.a,null))),"Get link"))),r.a.createElement(V.a,null,r.a.createElement(X.a,{label:"Shared link",defaultValue:"https://arozos.com/share/not_found",InputProps:{readOnly:!0},variant:"filled",fullWidth:"true",value:window.location.origin+"/share?id="+this.state.uuid}),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(X.a,{select:!0,label:"Share option",value:this.state.mode,onChange:this.handleChange,SelectProps:{native:!0},variant:"outlined",fullWidth:"true"},[{label:"Anyone with the link",value:"anyone"},{label:"Anyone signed in",value:"signedin"},{label:"Users in the same group",value:"samegroup"},{label:"Not public",value:"remove"}].map((function(e){return r.a.createElement("option",{key:e.value,value:e.value},e.label)}))),r.a.createElement("br",null),r.a.createElement("br",null),r.a.createElement(g.a,{variant:"contained",color:"primary",onClick:this.handleDialogClose},"Done")))):r.a.createElement("div",null,r.a.createElement(z.a,null))}}]),t}(r.a.Component);K.defaultProps={images:[]};var Q=K,Y=t(98),ee=t.n(Y),ae=t(99),te=t.n(ae),ne=t(240),re=t(93),le=t.n(re),oe=t(94),ie=t.n(oe),ce=t(95),se=t.n(ce),ue=t(100),me=t.n(ue),de=t(175),he=t(173),pe=t(106),fe=t(101),ge=t.n(fe),be=t(231),Ee=t(232),je=t(233),ve=t(91),ye=t.n(ve),Oe=Object(m.a)((function(e){return{root:{display:"flex",flexWrap:"wrap",justifyContent:"space-around",overflow:"hidden"},gridList:{width:"100%",height:"100%"},icon:{color:"rgba(255, 255, 255, 0.54)"}}}));function Ce(e){var a=Oe(),t=r.a.useState(null),l=Object(i.a)(t,2),o=l[0],c=l[1],s=r.a.useState(!1),u=Object(i.a)(s,2),m=u[0],d=u[1],h=r.a.useState([]),p=Object(i.a)(h,2),f=p[0],g=p[1],E=r.a.useState("user:/Photo/Photo/uploads/"),j=Object(i.a)(E,2),v=j[0],y=j[1],O=function(a){y(a),console.log("1"+v),e.onChange(a)};return Object(n.useEffect)((function(){fetch("/backend_test/listFolder",{}).then((function(e){return e.json()})).then((function(e){d(!0),g(e)}),(function(e){d(!0),c(e)}))}),[]),o?r.a.createElement("div",null,"Error: ",o.message," (FolderList.js)"):m?r.a.createElement("div",{className:a.root},r.a.createElement(be.a,{cellHeight:180,cols:5,className:a.gridList},f.map((function(e){return r.a.createElement(Ee.a,{key:e.img,onClick:function(){return O(e.VPath)}},r.a.createElement("img",{src:e.img,alt:e.Foldername}),r.a.createElement(je.a,{title:e.Foldername,actionIcon:r.a.createElement(b.a,{"aria-label":"info about ".concat(e.Foldername),onClick:function(){return O(e.VPath)},className:a.icon},r.a.createElement(ye.a,null))}))})))):r.a.createElement("div",null,r.a.createElement(z.a,null))}var we=t(243),ke=t(242),Se=Object(u.a)((function(e){return{colorPrimary:{backgroundColor:e.palette.grey["light"===e.palette.type?200:700]},bar:{borderRadius:5,backgroundColor:"#1a90ff"}}}))(z.a),Ie=Object(m.a)((function(e){var a;return a={root:{flexGrow:1},menuButton:{marginRight:e.spacing(2)},title:{flexGrow:1},toolbar:Object(s.a)({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)},Object(c.a)(a,"root",{display:"flex"}),Object(c.a)(a,"appBar",{zIndex:e.zIndex.drawer+1,transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen})}),Object(c.a)(a,"appBarShift",{marginLeft:240,width:"calc(100% - ".concat(240,"px)"),transition:e.transitions.create(["width","margin"],{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}),Object(c.a)(a,"menuButton",{marginRight:36}),Object(c.a)(a,"hide",{display:"none"}),Object(c.a)(a,"drawer",{width:240,flexShrink:0,whiteSpace:"nowrap"}),Object(c.a)(a,"drawerOpen",{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}),Object(c.a)(a,"drawerClose",Object(c.a)({transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.leavingScreen}),overflowX:"hidden",width:e.spacing(7)+1},e.breakpoints.up("sm"),{width:e.spacing(9)+1})),Object(c.a)(a,"toolbar",Object(s.a)({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),Object(c.a)(a,"content",{flexGrow:1,padding:e.spacing(3)}),Object(c.a)(a,"modal",{display:"flex",alignItems:"center",justifyContent:"center"}),Object(c.a)(a,"paper",{backgroundColor:e.palette.background.paper,width:"100%",height:"100%"}),Object(c.a)(a,"fabL",{position:"absolute",bottom:"50%",left:e.spacing(2)}),Object(c.a)(a,"fabR",{position:"absolute",bottom:"50%",right:"calc(".concat(e.spacing(2),"px + ( 100vw / 4 ))"),Mcontainer:{display:"flex",flexWrap:"wrap",position:"absolute",top:0,left:0,height:"100%",width:"100%",alignItems:"center"}}),a}));function xe(e){return r.a.createElement(ke.a,Object.assign({elevation:6,variant:"filled"},e))}function Pe(e){var a,t,l,o=Ie(),s=r.a.useState(null),u=Object(i.a)(s,2),m=u[0],E=u[1],w=r.a.useState(!1),S=Object(i.a)(w,2),B=S[0],D=S[1],W=r.a.useState([]),A=Object(i.a)(W,2),T=A[0],F=A[1],G=Object(d.a)(),_=r.a.useState(!1),J=Object(i.a)(_,2),R=J[0],U=J[1],V=r.a.useState(!1),H=Object(i.a)(V,2),M=H[0],q=H[1],X=function(){q(!1)},K=r.a.useState(!1),Y=Object(i.a)(K,2),ae=Y[0],re=Y[1],oe=function(){re(!0)},ce=function(e,a){"clickaway"!==a&&re(!1)},ue=r.a.useState(!0),fe=Object(i.a)(ue,2),be=fe[0],Ee=fe[1],je=r.a.useState(!1),ve=Object(i.a)(je,2),ye=ve[0],Oe=ve[1],ke=r.a.useState("user:/Photo/Photo/uploads/"),Pe=Object(i.a)(ke,2),Ne=Pe[0],Be=Pe[1],Le=function(e){Be(e),console.log("3"+Ne),Ee(!0),Oe(!1)};return Object(n.useEffect)((function(){fetch("/system/ajgi/interface?script=/Photo/backend/config.js",{method:"post",body:JSON.stringify({folder:Ne})}).then((function(e){return e.json()})).then((function(e){D(!0),F(e)}),(function(e){D(!0),E(e)}))}),[]),m?r.a.createElement("div",null,"Error: ",m.message," (Config.js)"):B?r.a.createElement("div",{className:o.root},r.a.createElement(h.a,{position:"fixed",style:{background:"#2196f3"},className:Object(v.a)(o.appBar,Object(c.a)({},o.appBarShift,R))},r.a.createElement(p.a,null,r.a.createElement(b.a,(a={edge:"start",onClick:function(){U(!0)},className:Object(v.a)(o.menuButton,Object(c.a)({},o.hide,R))},Object(c.a)(a,"className",o.menuButton),Object(c.a)(a,"color","inherit"),Object(c.a)(a,"aria-label","menu"),a),r.a.createElement(j.a,null)),r.a.createElement(f.a,{variant:"h6",className:o.title},"ArOZ Photo"),r.a.createElement(g.a,{variant:"contained",startIcon:r.a.createElement(le.a,null),type:"button",onClick:oe},"Upload"),r.a.createElement(b.a,{style:{color:"#ffffff"},"aria-label":"help",onClick:oe},r.a.createElement(ie.a,null)),r.a.createElement(b.a,{style:{color:"#ffffff"},"aria-label":"settings",onClick:function(){q(!0)}},r.a.createElement(se.a,null)),r.a.createElement($.a,{alt:T.username,src:T.usericon}))),r.a.createElement(y.a,{variant:"permanent",className:Object(v.a)(o.drawer,(t={},Object(c.a)(t,o.drawerOpen,R),Object(c.a)(t,o.drawerClose,!R),t)),classes:{paper:Object(v.a)((l={},Object(c.a)(l,o.drawerOpen,R),Object(c.a)(l,o.drawerClose,!R),l))}},r.a.createElement("div",{className:o.toolbar},r.a.createElement(b.a,{onClick:function(){U(!1)}},"ltr"===G.direction?r.a.createElement(k.a,null):r.a.createElement(I.a,null))),r.a.createElement(C.a,null),r.a.createElement(O.a,null,["Photos","Albums"].map((function(e,a){return r.a.createElement(x.a,{button:!0,key:e,onClick:(t=e,function(){switch(console.log(t),t){case"Photos":Ee(!0),Oe(!1);break;case"Albums":Oe(!0),Ee(!1)}})},r.a.createElement(P.a,null,0==a?r.a.createElement(ee.a,null):r.a.createElement(te.a,null)),r.a.createElement(N.a,{primary:e}));var t}))),r.a.createElement(C.a,null),r.a.createElement(O.a,null,r.a.createElement(x.a,{button:!0,key:"Storage"},r.a.createElement(P.a,null,r.a.createElement(me.a,null)),r.a.createElement(N.a,{primary:"Storage",secondary:r.a.createElement(Se,{variant:"determinate",value:T.quota})})))),r.a.createElement("main",{className:o.content},r.a.createElement("div",{className:o.toolbar}),be&&r.a.createElement(Q,{path:Ne}),ye&&r.a.createElement(Ce,{onChange:Le,folderName:Le})),r.a.createElement(we.a,{open:ae,autoHideDuration:6e3,onClose:ce},r.a.createElement(xe,{onClose:ce,severity:"error"},"This function has not been implemented on this platform (aCloud 0x0)")),r.a.createElement(de.a,{"aria-labelledby":"transition-modal-title","aria-describedby":"transition-modal-description",className:o.modal,open:M,onClose:X,closeAfterTransition:!0,BackdropComponent:he.a,BackdropProps:{timeout:500}},r.a.createElement(pe.a,{in:M},r.a.createElement("div",{className:o.paper},r.a.createElement(ne.a,{container:!0,alignItems:"flex-start",justify:"flex-end",direction:"row"},r.a.createElement(b.a,{color:"primary","aria-label":"close",onClick:X},r.a.createElement(ge.a,null))),r.a.createElement(O.a,null,r.a.createElement(x.a,{button:!0},r.a.createElement(Z.a,null,r.a.createElement($.a,null,r.a.createElement(L.a,null))),r.a.createElement(N.a,{primary:"Version",secondary:"v1.0.0-alpha"})),r.a.createElement(x.a,{button:!0},r.a.createElement(Z.a,null,r.a.createElement($.a,null,r.a.createElement(L.a,null))),r.a.createElement(N.a,{primary:"Developer",secondary:"Alanyeung.co"}))))))):r.a.createElement("div",null,r.a.createElement(z.a,null))}o.a.render(r.a.createElement("div",null,r.a.createElement(Pe,null),r.a.createElement("preview",null)),document.getElementById("root")),"serviceWorker"in navigator&&navigator.serviceWorker.ready.then((function(e){e.unregister()})).catch((function(e){console.error(e.message)}))}},[[116,1,2]]]);
  2. //# sourceMappingURL=main.e7237072.chunk.js.map