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
10 KiB
1 lines
10 KiB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[906],{7906:function(e,n,t){t.d(n,{S:function(){return G},M:function(){return Y}});var r=t(4051),o=t.n(r),s=t(5893),c=t(5537),a=t(791),i=t(1496),l=t(7357),u=t(4799),d=t(8333),f=t(9309),h=t(5861),v=t(7294),x=t(5152),p=t(2029),m=t(7169),y=t(4825),w=t(7750),b="0xffe3",g="0xffe9",j=[{keys:"Ctrl + Alt + Delete",scans:[]},{keys:"Ctrl + Alt + F1",scans:[b,g,"0xffbe"]},{keys:"Ctrl + Alt + F2",scans:[b,g,"0xffbf"]},{keys:"Ctrl + Alt + F3",scans:[b,g,"0xffc0"]},{keys:"Ctrl + Alt + F4",scans:[b,g,"0xffc1"]},{keys:"Ctrl + Alt + F5",scans:[b,g,"0xffc2"]},{keys:"Ctrl + Alt + F6",scans:[b,g,"0xffc3"]},{keys:"Ctrl + Alt + F7",scans:[b,g,"0xffc4"]},{keys:"Ctrl + Alt + F8",scans:[b,g,"0xffc5"]},{keys:"Ctrl + Alt + F9",scans:[b,g,"0xffc6"]}],k=t(3679),C=t(8336);function B(e,n,t,r,o,s,c){try{var a=e[s](c),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}var Z=function(){var e,n=(e=o().mark((function e(n,t,r){var s,c,a;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return s=new AbortController,c=setTimeout((function(){return s.abort()}),r),e.next=4,fetch(n,{method:"PUT",headers:{"Content-Type":"application/json","Keep-Alive":"timeout=120"},signal:s.signal,body:JSON.stringify(t)});case 4:return a=e.sent,clearTimeout(c),e.abrupt("return",a);case 7:case"end":return e.stop()}}),e)})),function(){var n=this,t=arguments;return new Promise((function(r,o){var s=e.apply(n,t);function c(e){B(s,r,o,c,a,"next",e)}function a(e){B(s,r,o,c,a,"throw",e)}c(void 0)}))});return function(e,t,r){return n.apply(this,arguments)}}(),P=Z,A=t(2152),S=t(2749);function I(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}function F(e,n,t,r,o,s,c){try{var a=e[s](c),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}function E(e){return function(){var n=this,t=arguments;return new Promise((function(r,o){var s=e.apply(n,t);function c(e){F(s,r,o,c,a,"next",e)}function a(e){F(s,r,o,c,a,"throw",e)}c(void 0)}))}}function U(e,n,t){return n in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function N(e,n){return function(e){if(Array.isArray(e))return e}(e)||function(e,n){var t=null==e?null:"undefined"!==typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=t){var r,o,s=[],c=!0,a=!1;try{for(t=t.call(e);!(c=(r=t.next()).done)&&(s.push(r.value),!n||s.length!==n);c=!0);}catch(i){a=!0,o=i}finally{try{c||null==t.return||t.return()}finally{if(a)throw o}}return s}}(e,n)||D(e,n)||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.")}()}function T(e){return function(e){if(Array.isArray(e))return I(e)}(e)||function(e){if("undefined"!==typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||D(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function D(e,n){if(e){if("string"===typeof e)return I(e,n);var t=Object.prototype.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(t):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?I(e,n):void 0}}var R="FullSize",z={displayBox:"".concat(R,"-displayBox"),spinnerBox:"".concat(R,"-spinnerBox"),closeButton:"".concat(R,"-closeButton"),keyboardButton:"".concat(R,"-keyboardButton"),closeBox:"".concat(R,"-closeBox"),buttonsBox:"".concat(R,"-buttonsBox"),keysItem:"".concat(R,"-keysItem")},_=(0,i.ZP)("div")((function(){var e;return U(e={},"& .".concat(z.displayBox),{width:"75vw",height:"75vh",paddingTop:"1em",paddingBottom:0,paddingLeft:0,paddingRight:0}),U(e,"& .".concat(z.spinnerBox),{flexDirection:"column",width:"75vw",height:"75vh",alignItems:"center",justifyContent:"center"}),U(e,"& .".concat(z.closeButton),{borderRadius:8,backgroundColor:m.hM,"&:hover":{backgroundColor:m.hM}}),U(e,"& .".concat(z.keyboardButton),{borderRadius:8,backgroundColor:m.lD,"&:hover":{backgroundColor:m.lD}}),U(e,"& .".concat(z.closeBox),{paddingBottom:"1em",paddingLeft:".7em",paddingRight:0}),U(e,"& .".concat(z.buttonsBox),{paddingTop:0}),U(e,"& .".concat(z.keysItem),{backgroundColor:m.lD,paddingRight:"3em","&:hover":{backgroundColor:m.lD}}),e})),M="".concat(p.Z,"/command/vnc-pipe"),O=(0,x.default)((function(){return Promise.all([t.e(460),t.e(665)]).then(t.bind(t,4665))}),{loadableGenerated:{webpack:function(){return[4665]}},ssr:!1}),L=function(e){var n=e.onClickCloseButton,t=e.serverUUID,r=e.serverName,i=(0,v.useState)(null),x=i[0],p=i[1],b=(0,v.useRef)(),g=(0,v.useRef)(void 0),B=N((0,S.Z)(void 0),2),Z=B[0],I=B[1],F=N((0,S.Z)(!1),2),U=F[0],D=F[1],R=N((0,S.Z)(!1),2),L=R[0],G=R[1],V=(0,v.useCallback)(E(o().mark((function e(){var n;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!Z&&!U){e.next=2;break}return e.abrupt("return");case 2:return D(!0),e.prev=3,e.next=6,P(M,{serverUuid:t,open:!0},12e4);case 6:return n=e.sent,e.t0=I,e.next=10,n.json();case 10:e.t1=e.sent,(0,e.t0)(e.t1),e.next=17;break;case 14:e.prev=14,e.t2=e.catch(3),G(!0);case 17:return e.prev=17,D(!1),e.finish(17);case 20:case"end":return e.stop()}}),e,null,[[3,14,17,20]])}))),[t,G,D,I,U,Z]);(0,v.useEffect)((function(){g.current=window.location.hostname,V()}),[V]);var K=function(){var e=E(o().mark((function e(){return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,C.Z)(M,{serverUuid:t});case 2:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}();return(0,s.jsx)(k.s_,{children:(0,s.jsxs)(_,{children:[(0,s.jsx)(l.Z,{flexGrow:1,children:(0,s.jsx)(w.z,{text:"Server: ".concat(r)})}),Z?(0,s.jsxs)(l.Z,{display:"flex",className:z.displayBox,children:[(0,s.jsx)(O,{rfb:b,url:"".concat(Z.protocol,"://").concat(g.current,":").concat(Z.forwardPort),viewOnly:!1,focusOnClick:!1,clipViewport:!1,dragViewport:!1,scaleViewport:!0,resizeSession:!0,showDotCursor:!1,background:"",qualityLevel:6,compressionLevel:2,onDisconnect:function(e){e.detail.clean||(I(void 0),V())}}),(0,s.jsxs)(l.Z,{children:[(0,s.jsx)(l.Z,{className:z.closeBox,children:(0,s.jsx)(u.Z,{className:z.closeButton,style:{color:m.lD},component:"span",onClick:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var o;K(),null===n||void 0===n||(o=n).call.apply(o,[null].concat(T(t)))},children:(0,s.jsx)(c.Z,{})})}),(0,s.jsxs)(l.Z,{className:z.closeBox,children:[(0,s.jsx)(u.Z,{className:z.keyboardButton,style:{color:m.E5},component:"span",onClick:function(e){p(e.currentTarget)},children:(0,s.jsx)(a.Z,{})}),(0,s.jsx)(d.Z,{anchorEl:x,keepMounted:!0,open:Boolean(x),onClose:function(){return p(null)},children:j.map((function(e){var n=e.keys,t=e.scans;return(0,s.jsx)(f.Z,{onClick:function(){return function(e){if(b.current){if(e.length){for(var n=0;n<=e.length-1;n+=1)b.current.sendKey(e[n],1);for(var t=e.length-1;t>=0;t-=1)b.current.sendKey(e[t],0)}else b.current.sendCtrlAltDel();p(null)}}(t)},className:z.keysItem,children:(0,s.jsx)(h.Z,{variant:"subtitle1",children:n})},n)}))})]})]})]}):(0,s.jsx)(l.Z,{display:"flex",className:z.spinnerBox,children:L?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(l.Z,{style:{paddingBottom:"2em"},children:(0,s.jsx)(w.z,{text:"There was a problem connecting to the server, please try again"})}),(0,s.jsx)(y.Z,{onClick:function(){G(!1)},children:"Reconnect"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(w.z,{text:"Establishing connection with ".concat(r)}),(0,s.jsx)(w.z,{text:"This may take a few minutes"}),(0,s.jsx)(A.Z,{})]})})]})})};L.defaultProps={onClickCloseButton:void 0};var G=L,V=t(9628),K=t(2787),q=t(4690),H=t(1706);function J(e,n,t,r,o,s,c){try{var a=e[s](c),i=a.value}catch(l){return void t(l)}a.done?n(i):Promise.resolve(i).then(r,o)}var $={externalPreview:"",headerEndAdornment:null,isExternalPreviewStale:!1,isFetchPreview:!0,isShowControls:!0,isUseInnerPanel:!1,onClickConnectButton:void 0,onClickPreview:void 0,serverName:""},Q=function(e){var n=e.children;return e.isUseInnerPanel?(0,s.jsx)(k.Lg,{children:n}):(0,s.jsx)(k.s_,{children:n})},W=function(e){var n=e.children,t=e.isUseInnerPanel,r=e.text;return t?(0,s.jsxs)(k.CH,{children:[r?(0,s.jsx)(w.Ac,{text:r}):(0,s.jsx)(s.Fragment,{}),n]}):(0,s.jsxs)(k.V9,{children:[r?(0,s.jsx)(w.z,{text:r}):(0,s.jsx)(s.Fragment,{}),n]})},X=function(e){var n=e.externalPreview,t=void 0===n?$.externalPreview:n,r=e.headerEndAdornment,c=e.isExternalPreviewStale,a=void 0===c?$.isExternalPreviewStale:c,i=e.isFetchPreview,d=void 0===i?$.isFetchPreview:i,f=e.isShowControls,h=void 0===f?$.isShowControls:f,x=e.isUseInnerPanel,y=void 0===x?$.isUseInnerPanel:x,w=e.onClickPreview,b=e.serverName,g=e.serverUUID,j=e.onClickConnectButton,k=void 0===j?w:j,C=(0,v.useState)(!0),B=C[0],Z=C[1],P=(0,v.useState)(!1),S=P[0],I=P[1],F=(0,v.useState)(""),E=F[0],U=F[1],N=(0,v.useMemo)((function(){return E?(0,s.jsx)(l.Z,{alt:"",component:"img",src:"data:image/png;base64,".concat(E),sx:{height:"100%",opacity:S?"0.4":"1",padding:y?".2em":0,width:"100%"}}):(0,s.jsx)(V.Z,{sx:{height:"100%",width:"100%"}})}),[S,y,E]);return(0,v.useEffect)((function(){var e;d?(e=o().mark((function e(){var n,t,r;return o().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,fetch("".concat(p.Z,"/server/").concat(g,"?ss"),{method:"GET",headers:{"Content-Type":"application/json"}});case 3:return n=e.sent,e.next=6,n.json();case 6:t=e.sent,r=t.screenshot,U(r),I(!1),e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),I(!0);case 15:return e.prev=15,Z(!1),e.finish(15);case 18:case"end":return e.stop()}}),e,null,[[0,12,15,18]])})),function(){var n=this,t=arguments;return new Promise((function(r,o){var s=e.apply(n,t);function c(e){J(s,r,o,c,a,"next",e)}function a(e){J(s,r,o,c,a,"throw",e)}c(void 0)}))})():t&&(U(t),I(a),Z(!1))}),[t,a,d,g]),(0,s.jsxs)(Q,{isUseInnerPanel:y,children:[(0,s.jsx)(W,{isUseInnerPanel:y,text:b,children:r}),(0,s.jsxs)(q.Z,{row:!0,sx:{"& > :first-child":{flexGrow:1}},children:[(0,s.jsx)(l.Z,{children:B?(0,s.jsx)(A.Z,{mt:"1em",mb:"1em"}):(0,s.jsx)(u.Z,{component:"span",onClick:w,sx:{borderRadius:m.n_,color:m.s7,padding:0},children:N})}),h&&(0,s.jsx)(q.Z,{children:(0,s.jsx)(H.Z,{onClick:k,children:(0,s.jsx)(K.Z,{})})})]})]})};X.defaultProps=$;var Y=X}}]); |