filecat
Version:
FileCat Server Manager
2 lines • 5.82 kB
JavaScript
/*! For license information please see 402.b269a6a99df5cd6841a9.js.LICENSE.txt */
;(self.webpackChunkfilecat=self.webpackChunkfilecat||[]).push([[402],{3402(t,n,e){e.r(n),e.d(n,{default:()=>m});var r=e(6540),o=e(7856),i=e(4238),u=e(4944),c=e(7444),a=e(6417),f=e(4405),l=e(505);function s(){var t,n,e="function"==typeof Symbol?Symbol:{},r=e.iterator||"@@iterator",o=e.toStringTag||"@@toStringTag";function i(e,r,o,i){var a=r&&r.prototype instanceof c?r:c,f=Object.create(a.prototype);return h(f,"_invoke",function(e,r,o){var i,c,a,f=0,l=o||[],s=!1,h={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(n,e){return i=n,c=0,a=t,h.n=e,u}};function d(e,r){for(c=e,a=r,n=0;!s&&f&&!o&&n<l.length;n++){var o,i=l[n],d=h.p,p=i[2];e>3?(o=p===r)&&(a=i[(c=i[4])?5:(c=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=e<2&&d<i[1])?(c=0,h.v=r,h.n=i[1]):d<p&&(o=e<3||i[0]>r||r>p)&&(i[4]=e,i[5]=r,h.n=p,c=0))}if(o||e>1)return u;throw s=!0,r}return function(o,l,p){if(f>1)throw TypeError("Generator is already running");for(s&&1===l&&d(l,p),c=l,a=p;(n=c<2?t:a)||!s;){i||(c?c<3?(c>1&&(h.n=-1),d(c,a)):h.n=a:h.v=a);try{if(f=2,i){if(c||(o="next"),n=i[o]){if(!(n=n.call(i,a)))throw TypeError("iterator result is not an object");if(!n.done)return n;a=n.value,c<2&&(c=0)}else 1===c&&(n=i.return)&&n.call(i),c<2&&(a=TypeError("The iterator does not provide a '"+o+"' method"),c=1);i=t}else if((n=(s=h.n<0)?a:e.call(r,h))!==u)break}catch(n){i=t,c=1,a=n}finally{f=1}}return{value:n,done:s}}}(e,o,i),!0),f}var u={};function c(){}function a(){}function f(){}n=Object.getPrototypeOf;var l=[][r]?n(n([][r]())):(h(n={},r,function(){return this}),n),d=f.prototype=c.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,f):(t.__proto__=f,h(t,o,"GeneratorFunction")),t.prototype=Object.create(d),t}return a.prototype=f,h(d,"constructor",f),h(f,"constructor",a),a.displayName="GeneratorFunction",h(f,o,"GeneratorFunction"),h(d),h(d,o,"Generator"),h(d,r,function(){return this}),h(d,"toString",function(){return"[object Generator]"}),(s=function(){return{w:i,m:p}})()}function h(t,n,e,r){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}h=function(t,n,e,r){function i(n,e){h(t,n,function(t){return this._invoke(n,e,t)})}n?o?o(t,n,{value:e,enumerable:!r,configurable:!r,writable:!r}):t[n]=e:(i("next",0),i("throw",1),i("return",2))},h(t,n,e,r)}function d(t,n,e,r,o,i,u){try{var c=t[i](u),a=c.value}catch(t){return void e(t)}c.done?n(a):Promise.resolve(a).then(r,o)}function p(t){return function(){var n=this,e=arguments;return new Promise(function(r,o){var i=t.apply(n,e);function u(t){d(i,r,o,u,c,"next",t)}function c(t){d(i,r,o,u,c,"throw",t)}u(void 0)})}}function y(t,n){return function(t){if(Array.isArray(t))return t}(t)||function(t,n){var e=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=e){var r,o,i,u,c=[],a=!0,f=!1;try{if(i=(e=e.call(t)).next,0===n){if(Object(e)!==e)return;a=!1}else for(;!(a=(r=i.call(e)).done)&&(c.push(r.value),c.length!==n);a=!0);}catch(t){f=!0,o=t}finally{try{if(!a&&null!=e.return&&(u=e.return(),Object(u)!==u))return}finally{if(f)throw o}}return c}}(t,n)||function(t,n){if(t){if("string"==typeof t)return w(t,n);var e={}.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?w(t,n):void 0}}(t,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 w(t,n){(null==n||n>t.length)&&(n=t.length);for(var e=0,r=Array(n);e<n;e++)r[e]=t[e];return r}var v=r.lazy(function(){return e.e(614).then(e.bind(e,5614))});function m(t){var n=y((0,r.useState)(null),2),e=n[0],h=n[1],d=y((0,c.L4)(a.A.fileShellShow),2),w=d[0],m=(d[1],y((0,c.L4)(a.A.file_shell_hidden),2)),b=m[0],g=(m[1],y((0,r.useState)(!1),2)),_=(g[0],g[1]),S=y((0,c.L4)(a.A.user_base_info),2),F=S[0],k=(S[1],"dark"===F.user_data.theme?"#FFFFFF":"#000000"),j=function(){var t=p(s().m(function t(){var n,e,r;return s().w(function(t){for(;;)switch(t.n){case 0:n=new o.Terminal({fontFamily:"Monaco, Menlo, Consolas, 'Courier New', monospace",theme:{background:"#FFFFFF",foreground:k,cursor:k,selectionBackground:"#a6d2ff"},cursorBlink:!0,cursorStyle:"bar",scrollback:1e3,scrollSensitivity:1,tabStopWidth:4}),r=function(t){n.write(t)},e=function(t){n.clear(),n.write(t),e=r},u.ws.addMsg(i.HK.shell_getting,function(t){e(t.context)}),u.ws.addMsg(i.HK.shell_copy,function(t){t.context&&(0,l.l)(t.context),n.focus()}),n.onData(function(){var t=p(s().m(function t(n){var e;return s().w(function(t){for(;;)switch(t.n){case 0:return(e=new i.hf(i.HK.shell_send)).context=n,t.n=1,u.ws.send(e);case 1:return t.a(2)}},t)}));return function(n){return t.apply(this,arguments)}}()),h(n);case 1:return t.a(2)}},t)}));return function(){return t.apply(this,arguments)}}(),O=function(){p(s().m(function t(){return s().w(function(t){for(;;)switch(t.n){case 0:e&&(e.dispose(),h(null)),u.ws.isAilive()&&u.ws.setPromise(function(){var t=p(s().m(function t(n){return s().w(function(t){for(;;)switch(t.n){case 0:return t.n=1,u.ws.unConnect();case 1:n();case 2:return t.a(2)}},t)}));return function(n){return t.apply(this,arguments)}}());case 1:return t.a(2)}},t)}))()};(0,r.useEffect)(function(){return function(){O()}},[]),(0,r.useEffect)(function(){w.show?e?w.cmd&&u.ws.sendData(i.HK.shell_send,w.cmd):(j(),_(!0)):O()},[w]);return r.createElement(v,{show:w.show,file_shell_hidden:b,terminal:e,init:function(t,n){e.writeln("[38;2;29;153;243mopen shell...[0m ");var r=new i.hf(i.HK.shell_open),o=new f.n;o.init_path=w.path,o.rows=t,o.cols=n,o.http_token=localStorage.getItem("token"),r.context=o,u.ws.send(r),w.cmd&&u.ws.sendData(i.HK.shell_send,w.cmd)}})}}}]);