main.dba51531.chunk.js 14 KB

12
  1. (this.webpackJsonpphoto=this.webpackJsonpphoto||[]).push([[0],{119:function(e,t,a){e.exports=a(175)},124:function(e,t,a){},175:function(e,t,a){"use strict";a.r(t);var n=a(0),r=a.n(n),l=a(8),o=a.n(l);a(124),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=a(16),c=a(10),s=a(58),u=a(4),m=a(233),d=a(19),h=a(237),p=a(238),f=a(43),g=a(225),b=a(224),E=a(96),j=a.n(E),v=a(3),y=a(247),O=a(228),C=a(239),w=a(100),k=a.n(w),S=a(101),I=a.n(S),x=a(229),N=a(240),P=a(241),B=a(53),D=a.n(B),L=a(88),A=a(89),W=a(35),F=a(106),T=a(105),z=a(90),U=a.n(z),_=a(220),G=a(92),J=a.n(G),R=a(226),V=a(231),q=a(227),H=a(93),M=a.n(H),X=a(243),Z=a(230),$=a(246),K=a(244),Q=function(e){Object(F.a)(a,e);var t=Object(T.a)(a);function a(e){var n;return Object(L.a)(this,a),(n=t.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 t=n.state.uuid,a=e.target.value,r=n.state.currentImagePath;"remove"!=e.target.value?fetch("/system/file_system/share/edit?uuid="+t+"&mode="+a,{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(W.a)(n)),n.shareImage=n.shareImage.bind(Object(W.a)(n)),n.handleDialogClose=n.handleDialogClose.bind(Object(W.a)(n)),n}return Object(A.a)(a,[{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(t){e.setState({isLoaded:!0,images:t})}),(function(t){e.setState({isLoaded:!0,error:t})}))}},{key:"setPath",value:function(){this.setState({path:"user:/Photo/"})}},{key:"render",value:function(){this.props.classes;var e=this.state,t=e.isLoaded,a=e.error;return a?r.a.createElement("div",null,"Error: ",a.message," (imageList.js)"):t?0==this.state.images.length?r.a.createElement("div",null,r.a.createElement(K.a,{severity:"info"},"Nothing here :(")):r.a.createElement("div",null,r.a.createElement(U.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(J.a,null),onClick:this.shareImage.bind(this)},"Share")]}),r.a.createElement(R.a,{style:{zIndex:99999},open:this.state.open,maxWidth:"md",fullWidth:"true",onClose:this.handleDialogClose},r.a.createElement(q.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(M.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(_.a,null))}}]),a}(r.a.Component);Q.defaultProps={images:[]};var Y=Q,ee=a(102),te=a.n(ee),ae=a(103),ne=a.n(ae),re=a(242),le=a(97),oe=a.n(le),ie=a(98),ce=a.n(ie),se=a(99),ue=a.n(se),me=a(104),de=a.n(me),he=a(178),pe=a(176),fe=a(109),ge=a(59),be=a.n(ge),Ee=a(234),je=a(235),ve=a(236),ye=a(94),Oe=a.n(ye),Ce=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 we(e){var t=Ce(),a=r.a.useState(null),l=Object(i.a)(a,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/"),j=Object(i.a)(E,2),v=j[0],y=j[1],O=function(t){y(t),console.log("1"+v),e.onChange(t)};return Object(n.useEffect)((function(){fetch("/system/ajgi/interface?script=/Photo/backend/listFolder.js",{method:"post",body:JSON.stringify({folder:v})}).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?0==f.length?r.a.createElement("div",null,r.a.createElement(K.a,{severity:"info"},"Nothing here :(")):r.a.createElement("div",{className:t.root},r.a.createElement(Ee.a,{cellHeight:180,cols:5,className:t.gridList},f.map((function(e){return r.a.createElement(je.a,{key:e.img,onClick:function(){return O(e.VPath)}},r.a.createElement("img",{src:e.img,alt:e.Foldername}),r.a.createElement(ve.a,{title:e.Foldername,actionIcon:r.a.createElement(b.a,{"aria-label":"info about ".concat(e.Foldername),onClick:function(){return O(e.VPath)},className:t.icon},r.a.createElement(Oe.a,null))}))})))):r.a.createElement("div",null,r.a.createElement(_.a,null))}var ke=a(245),Se=(a(87),a(95)),Ie=a.n(Se),xe=Object(u.a)((function(e){return{colorPrimary:{backgroundColor:e.palette.grey["light"===e.palette.type?200:700]},bar:{borderRadius:5,backgroundColor:"#1a90ff"}}}))(_.a),Ne=Object(m.a)((function(e){var t;return t={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)(t,"root",{display:"flex"}),Object(c.a)(t,"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)(t,"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)(t,"menuButton",{marginRight:36}),Object(c.a)(t,"hide",{display:"none"}),Object(c.a)(t,"drawer",{width:240,flexShrink:0,whiteSpace:"nowrap"}),Object(c.a)(t,"drawerOpen",{width:240,transition:e.transitions.create("width",{easing:e.transitions.easing.sharp,duration:e.transitions.duration.enteringScreen})}),Object(c.a)(t,"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)(t,"toolbar",Object(s.a)({display:"flex",alignItems:"center",justifyContent:"flex-end",padding:e.spacing(0,1)},e.mixins.toolbar)),Object(c.a)(t,"content",{flexGrow:1,padding:e.spacing(3)}),Object(c.a)(t,"modal",{display:"flex",alignItems:"center",justifyContent:"center"}),Object(c.a)(t,"paper",{backgroundColor:e.palette.background.paper,width:"100%",height:"100%"}),Object(c.a)(t,"fabL",{position:"absolute",bottom:"50%",left:e.spacing(2)}),Object(c.a)(t,"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"}}),t}));function Pe(e){return r.a.createElement(K.a,Object.assign({elevation:6,variant:"filled"},e))}function Be(e){var t,a,l,o=Ne(),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],L=S[1],A=r.a.useState([]),W=Object(i.a)(A,2),F=W[0],T=W[1],z=Object(d.a)(),U=r.a.useState(!1),G=Object(i.a)(U,2),J=G[0],R=G[1],V=r.a.useState(!1),q=Object(i.a)(V,2),H=q[0],M=q[1],X=function(){M(!1)},K=r.a.useState(!1),Q=Object(i.a)(K,2),ee=Q[0],ae=Q[1],le=function(e,t){"clickaway"!==t&&ae(!1)},ie=r.a.useState(!0),se=Object(i.a)(ie,2),me=se[0],ge=se[1],Ee=r.a.useState(!1),je=Object(i.a)(Ee,2),ve=je[0],ye=je[1],Oe=r.a.useState("user:/Photo/"),Ce=Object(i.a)(Oe,2),Se=Ce[0],Be=Ce[1],De=function(e){Be(e),console.log("3"+Se),ge(!0),ye(!1)},Le=r.a.useState(!1),Ae=Object(i.a)(Le,2),We=Ae[0],Fe=Ae[1],Te=function(){ge(!0),Fe(!1)},ze=function(){return r.a.createElement(Ie.a,{getUploadParams:function(e){var t=e.file,a=(e.meta,new FormData);return a.append("path",Se),a.append("file",t),{url:"/system/file_system/upload",body:a}},onChangeStatus:function(e,t){var a=e.meta;"done"===t&&console.log("".concat(a.name," uploaded!"))},onSubmit:function(e,t){t.forEach((function(e){return e.remove()}))},accept:"image/*",inputContent:function(e,t){return t.reject?"Image only":"Drag Files"},styles:{dropzoneReject:{borderColor:"red",backgroundColor:"#DAA"},dropzone:{width:"100%",height:"100%"},inputLabel:function(e,t){return t.reject?{color:"red"}:{}}}})};return Object(n.useEffect)((function(){fetch("/system/ajgi/interface?script=/Photo/backend/config.js",{method:"post",body:JSON.stringify({folder:Se})}).then((function(e){return e.json()})).then((function(e){L(!0),T(e)}),(function(e){L(!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,J))},r.a.createElement(p.a,null,r.a.createElement(b.a,(t={edge:"start",onClick:function(){R(!0)},className:Object(v.a)(o.menuButton,Object(c.a)({},o.hide,J))},Object(c.a)(t,"className",o.menuButton),Object(c.a)(t,"color","inherit"),Object(c.a)(t,"aria-label","menu"),t),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(oe.a,null),type:"button",onClick:function(){ge(!1),Fe(!0)}},"Upload"),r.a.createElement(b.a,{style:{color:"#ffffff"},"aria-label":"help",onClick:function(){ae(!0)}},r.a.createElement(ce.a,null)),r.a.createElement(b.a,{style:{color:"#ffffff"},"aria-label":"settings",onClick:function(){M(!0)}},r.a.createElement(ue.a,null)),r.a.createElement($.a,{alt:F.username,src:F.usericon}))),r.a.createElement(y.a,{variant:"permanent",className:Object(v.a)(o.drawer,(a={},Object(c.a)(a,o.drawerOpen,J),Object(c.a)(a,o.drawerClose,!J),a)),classes:{paper:Object(v.a)((l={},Object(c.a)(l,o.drawerOpen,J),Object(c.a)(l,o.drawerClose,!J),l))}},r.a.createElement("div",{className:o.toolbar},r.a.createElement(b.a,{onClick:function(){R(!1)}},"ltr"===z.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,t){return r.a.createElement(x.a,{button:!0,key:e,onClick:(a=e,function(){switch(console.log(a),a){case"Photos":ge(!0),ye(!1);break;case"Albums":ye(!0),ge(!1)}})},r.a.createElement(N.a,null,0==t?r.a.createElement(te.a,null):r.a.createElement(ne.a,null)),r.a.createElement(P.a,{primary:e}));var a}))),r.a.createElement(C.a,null),r.a.createElement(O.a,null,r.a.createElement(x.a,{button:!0,key:"Storage"},r.a.createElement(N.a,null,r.a.createElement(de.a,null)),r.a.createElement(P.a,{primary:"Storage",secondary:F.unlimited?F.quota_human+" Used":r.a.createElement(xe,{variant:"determinate",value:F.quota})})))),r.a.createElement("main",{className:o.content},r.a.createElement("div",{className:o.toolbar}),me&&r.a.createElement(Y,{path:Se}),ve&&r.a.createElement(we,{onChange:De,folderName:De})),r.a.createElement(ke.a,{open:ee,autoHideDuration:6e3,onClose:le},r.a.createElement(Pe,{onClose:le,severity:"error"},"This function has not been implemented on this platform (aCloud 0x0)")),r.a.createElement(he.a,{"aria-labelledby":"transition-modal-title","aria-describedby":"transition-modal-description",className:o.modal,open:We,onClose:Te,closeAfterTransition:!0,BackdropComponent:pe.a,BackdropProps:{timeout:500}},r.a.createElement(fe.a,{in:We},r.a.createElement("div",{className:o.paper},r.a.createElement(re.a,{container:!0,alignItems:"flex-start",justify:"flex-end",direction:"row"},r.a.createElement(b.a,{color:"primary","aria-label":"close",onClick:Te},r.a.createElement(be.a,null))),r.a.createElement(Pe,{severity:"info"},"Uploading to: ",Se),r.a.createElement(ze,null)))),r.a.createElement(he.a,{"aria-labelledby":"transition-modal-title","aria-describedby":"transition-modal-description",className:o.modal,open:H,onClose:X,closeAfterTransition:!0,BackdropComponent:pe.a,BackdropProps:{timeout:500}},r.a.createElement(fe.a,{in:H},r.a.createElement("div",{className:o.paper},r.a.createElement(re.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(be.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(D.a,null))),r.a.createElement(P.a,{primary:"Version",secondary:"v1.5.3-beta"})),r.a.createElement(x.a,{button:!0},r.a.createElement(Z.a,null,r.a.createElement($.a,null,r.a.createElement(D.a,null))),r.a.createElement(P.a,{primary:"Developer",secondary:"Alan yeung"}))))))):r.a.createElement("div",null,r.a.createElement(_.a,null))}o.a.render(r.a.createElement("div",null,r.a.createElement(Be,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)}))}},[[119,1,2]]]);
  2. //# sourceMappingURL=main.dba51531.chunk.js.map