UNPKG

cloudcmd

Version:

File manager for the web with console and editor

2 lines 3.03 kB
!function(e){function t(t){for(var n,i,l=t[0],c=t[1],s=t[2],d=0,f=[];d<l.length;d++)i=l[d],Object.prototype.hasOwnProperty.call(r,i)&&r[i]&&f.push(r[i][0]),r[i]=0;for(n in c)Object.prototype.hasOwnProperty.call(c,n)&&(e[n]=c[n]);for(u&&u(t);f.length;)f.shift()();return a.push.apply(a,s||[]),o()}function o(){for(var e,t=0;t<a.length;t++){for(var o=a[t],n=!0,l=1;l<o.length;l++){var c=o[l];0!==r[c]&&(n=!1)}n&&(a.splice(t--,1),e=i(i.s=o[0]))}return e}var n={},r={11:0},a=[];function i(t){if(n[t])return n[t].exports;var o=n[t]={i:t,l:!1,exports:{}};return e[t].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=n,i.d=function(e,t,o){i.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.t=function(e,t){if(1&t&&(e=i(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(i.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)i.d(o,n,function(t){return e[t]}.bind(null,n));return o},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],c=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var u=c;a.push([112,0]),o()}({112:function(e,t,o){"use strict";CloudCmd.Konsole=t;const n=o(5),r=o(0),a=o(3),i=o(4).js,l=o(2),c=o(1),{Dialog:s,CurrentInfo:u}=DOM;let d;const{config:f}=CloudCmd,p=r((e,t)=>e("cd "+(t.replace(/\/$/,"")||"/")));let h,C;e.exports.init=async()=>{f("console")&&(c.show.load("top"),await CloudCmd.View(),await P(),await b())},e.exports.hide=()=>{CloudCmd.View.hide()},e.exports.clear=()=>{d.clear()};const m=()=>CloudCmd.prefix+"/console";async function w(e){u.dirPath!==e&&await CloudCmd.changeDir(e)}const y=()=>{if(f("syncConsolePath"))return u.dirPath},b=async()=>{const e={cwd:y(),env:{ACTIVE_DIR:DOM.getCurrentDirPath.bind(DOM),PASSIVE_DIR:DOM.getNotCurrentDirPath.bind(DOM),CURRENT_NAME:DOM.getCurrentName.bind(DOM),CURRENT_PATH:()=>u.path},prefix:m(),prefixSocket:CloudCmd.prefixSocket+"/console",socketPath:CloudCmd.prefix};h=l("div",{className:"console"}),d=await Console(h,e),d.on("connect",n.with(g,d)),d.on("path",f.if("syncConsolePath",w)),CloudCmd.on("active-dir",f.if("syncConsolePath",p(d.handler))),d.addShortCuts({P:()=>{const e=d.getPromptText(),t=DOM.getCurrentDirPath();d.setPromptText(e+t)}})};function g(e){e.emit("auth",f("username"),f("password")),e.on("reject",()=>{s.alert("Wrong credentials!")})}e.exports.show=e=>{C&&f("console")&&CloudCmd.View.show(h,{afterShow:()=>{d.focus(),n(e)}})};const P=async()=>{Util.time("Konsole load");const e=m()+"/console.js",[t]=await a(i,e);if(C=!0,Util.timeEnd("Konsole load"),t)return s.alert(t.message,{cancel:!1})}}}); //# sourceMappingURL=konsole.js.map