You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 lines
7.6 KiB
1 lines
7.6 KiB
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[753],{8954:function(n,e,t){(window.__NEXT_P=window.__NEXT_P||[]).push(["/server",function(){return t(1142)}])},5521:function(n,e,t){"use strict";t.d(e,{Z:function(){return L}});var r=t(5893),i=t(1113),o=t(1496),c=t(2293),a=t(7357),l=t(2992),s=t(4799),u=t(7294),f=t(7169),d=t(4433),p=t(9029),h=t(7533),g=t(8462),m=t(7212),v=t(8619),x=[{text:"Anvil",image:"/pngs/anvil_icon_on.png",uri:"/manage-element"},{text:"Files",image:"/pngs/files_on.png",uri:"/file-manager"},{text:"Configure",image:"/pngs/configure_icon_on.png",uri:"/config"},{text:"Help",image:"/pngs/help_icon_on.png",uri:"https://alteeve.com/w/Support"}],j={width:"40em",height:"40em"},w=t(4390),b=t(582),y=t(4690),Z=t(1770),S=t(7750),k=t(1081);function _(n,e){(null==e||e>n.length)&&(e=n.length);for(var t=0,r=new Array(e);t<e;t++)r[t]=n[t];return r}function C(n,e){return function(n){if(Array.isArray(n))return n}(n)||function(n,e){var t=null==n?null:"undefined"!==typeof Symbol&&n[Symbol.iterator]||n["@@iterator"];if(null!=t){var r,i,o=[],c=!0,a=!1;try{for(t=t.call(n);!(c=(r=t.next()).done)&&(o.push(r.value),!e||o.length!==e);c=!0);}catch(l){a=!0,i=l}finally{try{c||null==t.return||t.return()}finally{if(a)throw i}}return o}}(n,e)||function(n,e){if(!n)return;if("string"===typeof n)return _(n,e);var t=Object.prototype.toString.call(n).slice(8,-1);"Object"===t&&n.constructor&&(t=n.constructor.name);if("Map"===t||"Set"===t)return Array.from(t);if("Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return _(n,e)}(n,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var O=function(){var n=(0,k.Z)(),e=(0,u.useState)({}),t=e[0],r=e[1],i=(0,u.useCallback)((function(n){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"suiapi.";return t["".concat(e).concat(n)]}),[t]),o=(0,u.useCallback)((function(){return i("user")}),[i]);return(0,u.useEffect)((function(){if(n){var e=document.cookie.split(/\s*;\s*/);r(e.reduce((function(n,e){var t,r=C(e.split("=",2),2),i=r[0],o=r[1],c=decodeURIComponent(o);if(c.startsWith("j:"))try{t=JSON.parse(c.substring(2))}catch(a){t=o}else t=o;return n[i]=t,n}),{}))}}),[n]),{cookieJar:t,getCookie:i,getSessionUser:o}};function P(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}function N(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{},r=Object.keys(t);"function"===typeof Object.getOwnPropertySymbols&&(r=r.concat(Object.getOwnPropertySymbols(t).filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})))),r.forEach((function(e){P(n,e,t[e])}))}return n}var A="AnvilDrawer",B={actionIcon:"".concat(A,"-actionIcon"),list:"".concat(A,"-list")},E=(0,o.ZP)(h.ZP)((function(){var n;return P(n={},"& .".concat(B.list),{width:"200px"}),P(n,"& .".concat(B.actionIcon),{fontSize:"2.3em",color:f.of}),n})),I=function(n){var e=n.open,t=n.setOpen,i=(0,O().getSessionUser)();return(0,r.jsx)(E,{BackdropProps:{invisible:!0},anchor:"left",open:e,onClose:function(){return t(!e)},children:(0,r.jsx)("div",{role:"presentation",children:(0,r.jsxs)(g.Z,{className:B.list,children:[(0,r.jsx)(m.ZP,{children:(0,r.jsx)(S.Ac,{children:i?(0,r.jsxs)(r.Fragment,{children:["Welcome, ",i.name]}):"Unregistered"})}),(0,r.jsx)(b.Z,{}),(0,r.jsx)(v.Z,{component:"a",href:"/index.html",children:(0,r.jsxs)(y.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(d.Z,{className:B.actionIcon}),(0,r.jsx)(S.Ac,{children:"Dashboard"})]})}),x.map((function(n){return(0,r.jsx)(v.Z,{component:"a",href:n.uri,children:(0,r.jsxs)(y.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)("img",N({alt:n.text,src:n.image},j)),(0,r.jsx)(S.Ac,{children:n.text})]})},"anvil-drawer-".concat(n.image))})),(0,r.jsx)(v.Z,{onClick:function(){w.Z.put("/auth/logout").then((function(){window.location.replace("/login")})).catch((function(n){(0,Z.Z)(n)}))},children:(0,r.jsxs)(y.Z,{fullWidth:!0,row:!0,spacing:"2em",children:[(0,r.jsx)(p.Z,{className:B.actionIcon}),(0,r.jsx)(S.Ac,{children:"Logout"})]})})]})})})},U=t(3377),R=t(2444);function D(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}var T="Header",W={input:"".concat(T,"-input"),barElement:"".concat(T,"-barElement"),iconBox:"".concat(T,"-iconBox"),searchBar:"".concat(T,"-searchBar"),icons:"".concat(T,"-icons")},F=(0,o.ZP)(c.Z)((function(n){var e,t=n.theme;return D(e={paddingTop:t.spacing(.5),paddingBottom:t.spacing(.5),paddingLeft:t.spacing(3),paddingRight:t.spacing(3),borderBottom:"solid 1px",borderBottomColor:f.hM,position:"static"},"& .".concat(W.input),{height:"2.8em",width:"30vw",backgroundColor:t.palette.secondary.main,borderRadius:f.n_}),D(e,"& .".concat(W.barElement),{padding:0}),D(e,"& .".concat(W.iconBox),D({},t.breakpoints.down("sm"),{display:"none"})),D(e,"& .".concat(W.searchBar),D({},t.breakpoints.down("sm"),{flexGrow:1,paddingLeft:"15vw"})),D(e,"& .".concat(W.icons),{paddingLeft:".1em",paddingRight:".1em"}),e})),L=function(){var n=(0,u.useRef)({}),e=(0,u.useRef)({}),t=(0,u.useState)(!1),o=t[0],c=t[1];return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(F,{children:(0,r.jsxs)(a.Z,{display:"flex",justifyContent:"space-between",flexDirection:"row",children:[(0,r.jsx)(y.Z,{row:!0,children:(0,r.jsx)(l.Z,{onClick:function(){return c(!o)},children:(0,r.jsx)("img",{alt:"",src:"/pngs/logo.png",width:"160",height:"40"})})}),(0,r.jsx)(y.Z,{className:W.iconBox,row:!0,spacing:0,children:(0,r.jsx)(a.Z,{children:(0,r.jsx)(s.Z,{onClick:function(n){var t,r,i=n.currentTarget;null===(t=e.current.setAnchor)||void 0===t||t.call(null,i),null===(r=e.current.setOpen)||void 0===r||r.call(null,!0)},sx:{color:f.of,padding:"0 .1rem"},children:(0,r.jsx)(U.Z,{icon:i.Z,ref:n})})})})]})}),(0,r.jsx)(I,{open:o,setOpen:c}),(0,r.jsx)(R.Z,{onFetchSuccessAppend:function(e){var t;null===(t=n.current.indicate)||void 0===t||t.call(null,Object.keys(e).length>0)},ref:e})]})}},1081:function(n,e,t){"use strict";var r=t(7294);e.Z=function(){var n=(0,r.useRef)(!0);return n.current?(n.current=!1,!0):n.current}},8336:function(n,e){"use strict";e.Z=function(n,e){return fetch(n,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}},1142:function(n,e,t){"use strict";t.r(e);var r=t(5893),i=t(7294),o=t(1163),c=t(9008),a=t(7357),l=t(1496),s=t(7906),u=t(5521);function f(n,e,t){return e in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t,n}var d="Server",p={preview:"".concat(d,"-preview"),fullView:"".concat(d,"-fullView")},h=(0,l.ZP)("div")((function(n){var e,t=n.theme;return f(e={},"& .".concat(p.preview),f({width:"25%",height:"100%"},t.breakpoints.down("md"),{width:"100%"})),f(e,"& .".concat(p.fullView),{display:"flex",flexDirection:"row",width:"100%",justifyContent:"center"}),e}));e.default=function(){var n=(0,i.useState)(!0),e=n[0],t=n[1],l=(0,o.useRouter)().query,f=l.server_name,d=l.uuid,g=l.vnc,m=((null===g||void 0===g?void 0:g.toString())||"").length>0,v=(null===d||void 0===d?void 0:d.toString())||"",x=(null===f||void 0===f?void 0:f.toString())||"";return(0,i.useEffect)((function(){m&&t(!1)}),[m]),(0,r.jsxs)(h,{children:[(0,r.jsx)(c.default,{children:(0,r.jsx)("title",{children:x})}),(0,r.jsx)(u.Z,{}),e?(0,r.jsx)(a.Z,{className:p.preview,children:(0,r.jsx)(s.M,{onClickPreview:function(){t(!1)},serverName:x,serverUUID:v})}):(0,r.jsx)(a.Z,{className:p.fullView,children:(0,r.jsx)(s.S,{onClickCloseButton:function(){t(!0)},serverUUID:v,serverName:x})})]})}}},function(n){n.O(0,[382,894,227,746,906,774,888,179],(function(){return e=8954,n(n.s=e);var e}));var e=n.O();_N_E=e}]); |