cloudcmd 18.5.1 → 18.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +12 -0
- package/HELP.md +2 -1
- package/README.md +1 -1
- package/bin/release.mjs +2 -1
- package/common/cloudfunc.js +35 -36
- package/dist/cloudcmd.common.js +2 -2
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/cloudcmd.js +1 -1
- package/dist/cloudcmd.js.map +1 -1
- package/dist/modules/menu.js.map +1 -1
- package/dist/modules/operation.js +1 -1
- package/dist/modules/operation.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist-dev/cloudcmd.common.js +3 -3
- package/dist-dev/cloudcmd.js +1 -1
- package/dist-dev/modules/menu.js +1 -1
- package/dist-dev/modules/operation.js +1 -1
- package/dist-dev/sw.js +1 -1
- package/package.json +9 -8
- package/server/repl.js +18 -18
- package/server/show-config.js +3 -3
- package/server/user-menu.mjs +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file://cloudcmd/modules/operation.js"],"names":["modules","webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","14","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","106","currify","wraptile","promisify","exec","load","tryToCatch","encode","removeExtension","setListeners","getNextCurrentName","CloudCmd","config","Dialog","Images","DOM","authCheck","spawn","ok","accept","alertDialog","alert","on","emit","Operation","Loaded","copyFn","moveFn","deleteFn","extractFn","packZipFn","packTarFn","Info","CurrentInfo","showLoad","show","processFiles","async","options","selFiles","files","panel","shouldAsk","from","to","names","dirPath","getNotCurrentDirPath","getSelectedFiles","getFilenames","panelPassive","getCurrentName","sameName","getCurrentByName","noFilesCheck","type","isCopy","option","title","operation","cancel","newTo","msg","prompt","map","ask","go","str","Storage","remove","isOnePanel","refresh","noCurrent","confirm","then","getActiveFiles","is","Boolean","noFiles","init","callback","series","loadSocket","prefix","prefixSocket","file","error","js","message","loadAll","socketPrefix","fn","operator","fileop","onConnect","initOperations","hide","listen","noContinue","tar","zip","replace","copy","move","extract","setOperations","deleteSilent","path","removedNames","currentName","nextCurrentName","includes","setCurrentByName","twopack","op","fileFrom","activeFiles","Error","checkEmpty","getPacker","dir","getPackerExt","View","delete","pack","msgAsk","current","getCurrentFile","isDir","isCurrentIsDir","getType","107","getExt","ext","test","getExtension","108","forEachKey","format","emitter","done","lastError","onAbort","abort","removeListener","progress","catch","listeners","setProgress","end","continue","110","111","not","array","notOneOf","a","b","filter","indexOf","nextNames"],"mappings":"CAAS,SAAUA,GAET,SAASC,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDH,EAAQG,GAAYG,EAAYH,IAKlC,IAFGc,GAAqBA,EAAoBf,GAEtCO,EAASC,QACdD,EAASS,OAATT,GAOD,OAHAU,EAAgBH,KAAKI,MAAMD,EAAiBZ,GAAkB,IAGvDc,IAER,SAASA,IAER,IADA,IAAIC,EACId,EAAI,EAAGA,EAAIW,EAAgBT,OAAQF,IAAK,CAG/C,IAFA,IAAIe,EAAiBJ,EAAgBX,GACjCgB,GAAY,EACRC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AMxJ,EAAQ,CAACyJ,EAAO1K,KAAW0K,EAAM3C,SAAS/H,IAChD2K,EAAW1J,EAAQ,CAAC2J,EAAGC,IAAMD,EAAEE,OAAOL,EAAII,KAChD3L,EAAOD,QAAU,CAAC4I,EAAahE,EAAO+D,KACpC,MAAMnK,EAAIoG,EAAMkH,QAAQlD,GAClBmD,EAAYL,EAAS9G,EAAO+D,IAC5BjK,OACJA,GACEqN,EACJ,OAAIA,EAAUvN,GAAWuN,EAAUvN,GAC5BuN,EAAUrN,EAAS","file":"./modules/operation.js","sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["file://cloudcmd/modules/operation.js"],"names":["modules","webpackJsonpCallback","data","moduleId","chunkId","chunkIds","moreModules","executeModules","i","resolves","length","Object","prototype","hasOwnProperty","call","installedChunks","push","parentJsonpFunction","shift","deferredModules","apply","checkDeferredModules","result","deferredModule","fulfilled","j","depId","splice","__webpack_require__","s","installedModules","14","exports","module","l","m","c","d","name","getter","o","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","p","jsonpArray","window","oldJsonpFunction","slice","106","currify","wraptile","promisify","exec","load","tryToCatch","encode","removeExtension","setListeners","getNextCurrentName","CloudCmd","config","Dialog","Images","DOM","authCheck","spawn","ok","accept","alertDialog","alert","on","emit","Operation","Loaded","copyFn","moveFn","deleteFn","extractFn","packZipFn","packTarFn","Info","CurrentInfo","showLoad","show","processFiles","async","options","selFiles","files","panel","shouldAsk","from","to","names","dirPath","getNotCurrentDirPath","getSelectedFiles","getFilenames","panelPassive","getCurrentName","sameName","getCurrentByName","noFilesCheck","type","isCopy","option","title","operation","cancel","newTo","msg","prompt","map","ask","go","str","Storage","remove","isOnePanel","refresh","noCurrent","confirm","then","getActiveFiles","is","Boolean","noFiles","init","callback","series","loadSocket","prefix","prefixSocket","file","error","js","message","loadAll","socketPrefix","fn","operator","fileop","onConnect","initOperations","hide","listen","noContinue","tar","zip","replace","copy","move","extract","setOperations","deleteSilent","path","removedNames","currentName","nextCurrentName","includes","setCurrentByName","twopack","op","fileFrom","activeFiles","Error","checkEmpty","getPacker","dir","getPackerExt","View","delete","pack","msgAsk","current","getCurrentFile","isDir","isCurrentIsDir","getType","107","getExt","ext","test","getExtension","108","forEachKey","format","emitter","done","lastError","onAbort","abort","removeListener","progress","catch","listeners","setProgress","end","continue","110","111","not","array","notOneOf","a","b","filter","indexOf","nextNames"],"mappings":"CAAS,SAAUA,GAET,SAASC,EAAqBC,GAQ7B,IAPA,IAMIC,EAAUC,EANVC,EAAWH,EAAK,GAChBI,EAAcJ,EAAK,GACnBK,EAAiBL,EAAK,GAIHM,EAAI,EAAGC,EAAW,GACpCD,EAAIH,EAASK,OAAQF,IACzBJ,EAAUC,EAASG,GAChBG,OAAOC,UAAUC,eAAeC,KAAKC,EAAiBX,IAAYW,EAAgBX,IACpFK,EAASO,KAAKD,EAAgBX,GAAS,IAExCW,EAAgBX,GAAW,EAE5B,IAAID,KAAYG,EACZK,OAAOC,UAAUC,eAAeC,KAAKR,EAAaH,KACpDH,EAAQG,GAAYG,EAAYH,IAKlC,IAFGc,GAAqBA,EAAoBf,GAEtCO,EAASC,QACdD,EAASS,OAATT,GAOD,OAHAU,EAAgBH,KAAKI,MAAMD,EAAiBZ,GAAkB,IAGvDc,IAER,SAASA,IAER,IADA,IAAIC,EACId,EAAI,EAAGA,EAAIW,EAAgBT,OAAQF,IAAK,CAG/C,IAFA,IAAIe,EAAiBJ,EAAgBX,GACjCgB,GAAY,EACRC,EAAI,EAAGA,EAAIF,EAAeb,OAAQe,IAAK,CAC9C,IAAIC,EAAQH,EAAeE,GACG,IAA3BV,EAAgBW,KAAcF,GAAY,GAE3CA,IACFL,EAAgBQ,OAAOnB,IAAK,GAC5Bc,EAASM,EAAoBA,EAAoBC,EAAIN,EAAe,KAItE,OAAOD,EAIR,IAAIQ,EAAmB,GAKnBf,EAAkB,CACrBgB,GAAI,GAGDZ,EAAkB,GAGtB,SAASS,EAAoBzB,G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Root":""}
|
package/dist/sw.js
CHANGED
|
@@ -7,5 +7,5 @@ var serviceWorkerOption = {
|
|
|
7
7
|
]
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";const r=n(1),o=n(2),i=n(3),u="development"===r.env.NODE_ENV,c=i((t,e)=>e.waitUntil(t())),s=i((t,e)=>{const{request:n}=e,{url:r}=n,o=a(r);r.endsWith("/")||/\^\/fs/.test(o)||"GET"===n.method&&(t=>"basic"===t.type)(n)&&(o.startsWith("/api")||/^socket.io/.test(o)||e.respondWith(t(e)))}),a=t=>new URL(t).pathname,f="cloudcmd:
|
|
10
|
+
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/dist/",n(n.s=0)}([function(t,e,n){"use strict";const r=n(1),o=n(2),i=n(3),u="development"===r.env.NODE_ENV,c=i((t,e)=>e.waitUntil(t())),s=i((t,e)=>{const{request:n}=e,{url:r}=n,o=a(r);r.endsWith("/")||/\^\/fs/.test(o)||"GET"===n.method&&(t=>"basic"===t.type)(n)&&(o.startsWith("/api")||/^socket.io/.test(o)||e.respondWith(t(e)))}),a=t=>new URL(t).pathname,f="cloudcmd: Thu Apr 10 2025 17:24:05 GMT+0300 (Eastern European Summer Time)",l=(t,e)=>"/"!==t?e:(t=>new Request(t,{credentials:"same-origin"}))("/");self.addEventListener("install",c((async function(){console.info("cloudcmd: sw: install: "+f),await self.skipWaiting()}))),self.addEventListener("fetch",s((async function(t){const{request:e}=t,{url:n}=e,r=a(n),i=l(r,t.request),c=await caches.open(f),s=await c.match(e);if(!u&&s)return s;const[d,h]=await o(fetch,i,{credentials:"same-origin"});return d?new Response(d.message):(await async function(t,e){return(await caches.open(f)).put(t,e)}(e,h.clone()),h)}))),self.addEventListener("activate",c((async function(){console.info("cloudcmd: sw: activate: "+f),await self.clients.claim();const t=await caches.keys(),e=caches.delete.bind(caches);await Promise.all(t.map(e))})))},function(t,e){var n,r,o=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function u(){throw new Error("clearTimeout has not been defined")}function c(t){if(n===setTimeout)return setTimeout(t,0);if((n===i||!n)&&setTimeout)return n=setTimeout,setTimeout(t,0);try{return n(t,0)}catch(e){try{return n.call(null,t,0)}catch(e){return n.call(this,t,0)}}}!function(){try{n="function"==typeof setTimeout?setTimeout:i}catch(t){n=i}try{r="function"==typeof clearTimeout?clearTimeout:u}catch(t){r=u}}();var s,a=[],f=!1,l=-1;function d(){f&&s&&(f=!1,s.length?a=s.concat(a):l=-1,a.length&&h())}function h(){if(!f){var t=c(d);f=!0;for(var e=a.length;e;){for(s=a,a=[];++l<e;)s&&s[l].run();l=-1,e=a.length}s=null,f=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===u||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function m(){}o.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];a.push(new p(t,e)),1!==a.length||f||c(h)},p.prototype.run=function(){this.fun.apply(null,this.array)},o.title="browser",o.browser=!0,o.env={},o.argv=[],o.version="",o.versions={},o.on=m,o.addListener=m,o.once=m,o.off=m,o.removeListener=m,o.removeAllListeners=m,o.emit=m,o.prependListener=m,o.prependOnceListener=m,o.listeners=function(t){return[]},o.binding=function(t){throw new Error("process.binding is not supported")},o.cwd=function(){return"/"},o.chdir=function(t){throw new Error("process.chdir is not supported")},o.umask=function(){return 0}},function(t,e,n){"use strict";t.exports=async(t,...e)=>{!function(t){if("function"!=typeof t)throw Error("fn should be a function!")}(t);try{return[null,await t(...e)]}catch(t){return[t]}}},function(t,e,n){"use strict";const r=(t,...e)=>{if(function(t){if("function"!=typeof t)throw Error("fn should be function!")}(t),e.length>=t.length)return t(...e);const n=(...n)=>r(t,...e,...n),o=t.length-e.length-1;return(t=>[function(e){return t(...arguments)},function(e,n){return t(...arguments)},function(e,n,r){return t(...arguments)},function(e,n,r,o){return t(...arguments)},function(e,n,r,o,i){return t(...arguments)}])(n)[o]||n};t.exports=r}]);
|
|
11
11
|
//# sourceMappingURL=sw.js.map
|
package/dist/sw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["file://cloudcmd/webpack/bootstrap","file://cloudcmd/client/sw/sw.js","file://cloudcmd/node_modules/process/browser.js","file://cloudcmd/node_modules/try-to-catch/lib/try-to-catch.js","file://cloudcmd/node_modules/currify/lib/currify.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","process","require","tryToCatch","currify","isDev","env","NODE_ENV","wait","f","e","waitUntil","respondWith","request","url","pathname","getPathName","endsWith","test","method","a","type","isBasic","startsWith","URL","NAME","getRequest","Request","credentials","createRequest","self","addEventListener","async","console","info","skipWaiting","event","newRequest","cache","caches","open","response","match","resp","fetch","Response","message","put","addToCache","clone","clients","claim","keys","deleteCache","delete","Promise","all","map","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","Error","defaultClearTimeout","runTimeout","fun","setTimeout","this","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","length","concat","drainQueue","timeout","len","run","marker","runClearTimeout","Item","array","noop","nextTick","args","Array","arguments","push","apply","title","browser","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","fn","check","again","args2","count","b"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,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MAU/B,SAAeyB,GACX,GAAkB,mBAAPA,EACP,MAAMjD,MAAM,4BAXhBkD,CAAMD,GAEN,IACI,MAAO,CAAC,WAAYA,KAAMzB,IAC5B,MAAM3E,GACJ,MAAO,CAACA,M,6BCNhB,MASMN,EAAU,CAAC0G,KAAOzB,KAGpB,GAeJ,SAAeyB,GACX,GAAkB,mBAAPA,EACP,MAAMjD,MAAM,0BAnBhBkD,CAAMD,GAEFzB,EAAKZ,QAAUqC,EAAGrC,OAClB,OAAOqC,KAAMzB,GAEjB,MAAM2B,EAAQ,IAAIC,IACP7G,EAAQ0G,KAAWzB,KAAS4B,GAGjCC,EAAQJ,EAAGrC,OAASY,EAAKZ,OAAS,EAGxC,MAtBM,CAACqC,GAAO,CAEd,SAAU1F,GAAI,OAAO0F,KAAMvB,YAC3B,SAAUnE,EAAG+F,GAAI,OAAOL,KAAMvB,YAC9B,SAAUnE,EAAG+F,EAAG7I,GAAI,OAAOwI,KAAMvB,YACjC,SAAUnE,EAAG+F,EAAG7I,EAAGC,GAAI,OAAOuI,KAAMvB,YACpC,SAAUnE,EAAG+F,EAAG7I,EAAGC,EAAGmC,GAAI,OAAOoG,KAAMvB,aAc1B9E,CAAEuG,GAAOE,IAEPF,GAGnBhJ,EAAOD,QAAUqC","file":"sw.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","'use strict';\n\nconst process = require('node:process');\nconst codegen = require('codegen.macro');\nconst tryToCatch = require('try-to-catch');\nconst currify = require('currify');\n\nconst isDev = process.env.NODE_ENV === 'development';\n\nconst isGet = (a) => a.method === 'GET';\nconst isBasic = (a) => a.type === 'basic';\n\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {request} = e;\n const {url} = request;\n const pathname = getPathName(url);\n \n if (url.endsWith('/') || /\\^\\/fs/.test(pathname))\n return;\n \n if (!isGet(request))\n return;\n \n if (!isBasic(request))\n return;\n \n if (pathname.startsWith('/api'))\n return;\n \n if (/^socket.io/.test(pathname))\n return;\n \n e.respondWith(f(e));\n});\n\nconst getPathName = (url) => new URL(url).pathname;\n\nconst date = codegen`module.exports = '\"' + Date() + '\"'`;\nconst NAME = `cloudcmd: ${date}`;\n\nconst createRequest = (a) => new Request(a, {\n credentials: 'same-origin',\n});\n\nconst getRequest = (a, request) => {\n if (a !== '/')\n return request;\n \n return createRequest('/');\n};\n\nself.addEventListener('install', wait(onInstall));\nself.addEventListener('fetch', respondWith(onFetch));\nself.addEventListener('activate', wait(onActivate));\n\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n \n await self.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n \n await Promise.all(keys.map(deleteCache));\n}\n\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n \n await self.skipWaiting();\n}\n\nasync function onFetch(event) {\n const {request} = event;\n const {url} = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n \n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n \n if (!isDev && response)\n return response;\n \n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin',\n });\n \n if (e)\n return new Response(e.message);\n \n await addToCache(request, resp.clone());\n \n return resp;\n}\n\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","'use strict';\n\nmodule.exports = async (fn, ...args) => {\n check(fn);\n \n try {\n return [null, await fn(...args)];\n } catch(e) {\n return [e];\n }\n};\n\nfunction check(fn) {\n if (typeof fn !== 'function')\n throw Error('fn should be a function!');\n}\n\n","'use strict';\n\nconst f = (fn) => [\n /*eslint no-unused-vars: 0*/\n function (a) {return fn(...arguments);},\n function (a, b) {return fn(...arguments);},\n function (a, b, c) {return fn(...arguments);},\n function (a, b, c, d) {return fn(...arguments);},\n function (a, b, c, d, e) {return fn(...arguments);},\n];\n\nconst currify = (fn, ...args) => {\n check(fn);\n \n if (args.length >= fn.length)\n return fn(...args);\n \n const again = (...args2) => {\n return currify(fn, ...[...args, ...args2]);\n };\n \n const count = fn.length - args.length - 1;\n const func = f(again)[count];\n \n return func || again;\n};\n\nmodule.exports = currify;\n\nfunction check(fn) {\n if (typeof fn !== 'function')\n throw Error('fn should be function!');\n}\n\n"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"sources":["file://cloudcmd/webpack/bootstrap","file://cloudcmd/client/sw/sw.js","file://cloudcmd/node_modules/process/browser.js","file://cloudcmd/node_modules/try-to-catch/lib/try-to-catch.js","file://cloudcmd/node_modules/currify/lib/currify.js"],"names":["installedModules","__webpack_require__","moduleId","exports","module","i","l","modules","call","m","c","d","name","getter","o","Object","defineProperty","enumerable","get","r","Symbol","toStringTag","value","t","mode","__esModule","ns","create","key","bind","n","object","property","prototype","hasOwnProperty","p","s","process","require","tryToCatch","currify","isDev","env","NODE_ENV","wait","f","e","waitUntil","respondWith","request","url","pathname","getPathName","endsWith","test","method","a","type","isBasic","startsWith","URL","NAME","getRequest","Request","credentials","createRequest","self","addEventListener","async","console","info","skipWaiting","event","newRequest","cache","caches","open","response","match","resp","fetch","Response","message","put","addToCache","clone","clients","claim","keys","deleteCache","delete","Promise","all","map","cachedSetTimeout","cachedClearTimeout","defaultSetTimout","Error","defaultClearTimeout","runTimeout","fun","setTimeout","this","clearTimeout","currentQueue","queue","draining","queueIndex","cleanUpNextTick","length","concat","drainQueue","timeout","len","run","marker","runClearTimeout","Item","array","noop","nextTick","args","Array","arguments","push","apply","title","browser","argv","version","versions","on","addListener","once","off","removeListener","removeAllListeners","emit","prependListener","prependOnceListener","listeners","binding","cwd","chdir","dir","umask","fn","check","again","args2","count","b"],"mappings":"aACE,IAAIA,EAAmB,GAGvB,SAASC,EAAoBC,GAG5B,GAAGF,EAAiBE,GACnB,OAAOF,EAAiBE,GAAUC,QAGnC,IAAIC,EAASJ,EAAiBE,GAAY,CACzCG,EAAGH,EACHI,GAAG,EACHH,QAAS,IAUV,OANAI,EAAQL,GAAUM,KAAKJ,EAAOD,QAASC,EAAQA,EAAOD,QAASF,GAG/DG,EAAOE,GAAI,EAGJF,EAAOD,QAKfF,EAAoBQ,EAAIF,EAGxBN,EAAoBS,EAAIV,EAGxBC,EAAoBU,EAAI,SAASR,EAASS,EAAMC,GAC3CZ,EAAoBa,EAAEX,EAASS,IAClCG,OAAOC,eAAeb,EAASS,EAAM,CAAEK,YAAY,EAAMC,IAAKL,KAKhEZ,EAAoBkB,EAAI,SAAShB,GACX,oBAAXiB,QAA0BA,OAAOC,aAC1CN,OAAOC,eAAeb,EAASiB,OAAOC,YAAa,CAAEC,MAAO,WAE7DP,OAAOC,eAAeb,EAAS,aAAc,CAAEmB,OAAO,KAQvDrB,EAAoBsB,EAAI,SAASD,EAAOE,GAEvC,GADU,EAAPA,IAAUF,EAAQrB,EAAoBqB,IAC/B,EAAPE,EAAU,OAAOF,EACpB,GAAW,EAAPE,GAA8B,iBAAVF,GAAsBA,GAASA,EAAMG,WAAY,OAAOH,EAChF,IAAII,EAAKX,OAAOY,OAAO,MAGvB,GAFA1B,EAAoBkB,EAAEO,GACtBX,OAAOC,eAAeU,EAAI,UAAW,CAAET,YAAY,EAAMK,MAAOA,IACtD,EAAPE,GAA4B,iBAATF,E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AAOuI,KAAMvB,YACpC,SAAUnE,EAAG+F,EAAG7I,EAAGC,EAAGmC,GAAI,OAAOoG,KAAMvB,aAc1B9E,CAAEuG,GAAOE,IAEPF,GAGnBhJ,EAAOD,QAAUqC","file":"sw.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/dist/\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 0);\n","'use strict';\n\nconst process = require('node:process');\nconst codegen = require('codegen.macro');\nconst tryToCatch = require('try-to-catch');\nconst currify = require('currify');\n\nconst isDev = process.env.NODE_ENV === 'development';\n\nconst isGet = (a) => a.method === 'GET';\nconst isBasic = (a) => a.type === 'basic';\n\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {request} = e;\n const {url} = request;\n const pathname = getPathName(url);\n \n if (url.endsWith('/') || /\\^\\/fs/.test(pathname))\n return;\n \n if (!isGet(request))\n return;\n \n if (!isBasic(request))\n return;\n \n if (pathname.startsWith('/api'))\n return;\n \n if (/^socket.io/.test(pathname))\n return;\n \n e.respondWith(f(e));\n});\n\nconst getPathName = (url) => new URL(url).pathname;\n\nconst date = codegen`module.exports = '\"' + Date() + '\"'`;\nconst NAME = `cloudcmd: ${date}`;\n\nconst createRequest = (a) => new Request(a, {\n credentials: 'same-origin',\n});\n\nconst getRequest = (a, request) => {\n if (a !== '/')\n return request;\n \n return createRequest('/');\n};\n\nself.addEventListener('install', wait(onInstall));\nself.addEventListener('fetch', respondWith(onFetch));\nself.addEventListener('activate', wait(onActivate));\n\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n \n await self.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n \n await Promise.all(keys.map(deleteCache));\n}\n\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n \n await self.skipWaiting();\n}\n\nasync function onFetch(event) {\n const {request} = event;\n const {url} = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n \n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n \n if (!isDev && response)\n return response;\n \n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin',\n });\n \n if (e)\n return new Response(e.message);\n \n await addToCache(request, resp.clone());\n \n return resp;\n}\n\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","'use strict';\n\nmodule.exports = async (fn, ...args) => {\n check(fn);\n \n try {\n return [null, await fn(...args)];\n } catch(e) {\n return [e];\n }\n};\n\nfunction check(fn) {\n if (typeof fn !== 'function')\n throw Error('fn should be a function!');\n}\n\n","'use strict';\n\nconst f = (fn) => [\n /*eslint no-unused-vars: 0*/\n function (a) {return fn(...arguments);},\n function (a, b) {return fn(...arguments);},\n function (a, b, c) {return fn(...arguments);},\n function (a, b, c, d) {return fn(...arguments);},\n function (a, b, c, d, e) {return fn(...arguments);},\n];\n\nconst currify = (fn, ...args) => {\n check(fn);\n \n if (args.length >= fn.length)\n return fn(...args);\n \n const again = (...args2) => {\n return currify(fn, ...[...args, ...args2]);\n };\n \n const count = fn.length - args.length - 1;\n const func = f(again)[count];\n \n return func || again;\n};\n\nmodule.exports = currify;\n\nfunction check(fn) {\n if (typeof fn !== 'function')\n throw Error('fn should be function!');\n}\n\n"],"sourceRoot":""}
|
|
@@ -152,7 +152,7 @@ eval("\n\n/* global CloudCmd */\nconst {\n promisify\n} = __webpack_require__(/
|
|
|
152
152
|
/***/ (function(module, exports, __webpack_require__) {
|
|
153
153
|
|
|
154
154
|
"use strict";
|
|
155
|
-
eval("\n\n/* global CloudCmd */\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst itype = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n findObjByNameInArr\n} = __webpack_require__(/*! ../../common/util */ \"./common/util.js\");\nconst Files = __webpack_require__(/*! ./files */ \"./client/dom/files.js\");\nmodule.exports = (name, options, callback = options) => {\n const {\n prefix,\n config\n } = CloudCmd;\n const o = options;\n if (o.name && window[o.name]) return callback();\n Files.get('modules').then(async modules => {\n const online = config('online') && navigator.onLine;\n const module = findObjByNameInArr(modules.remote, name);\n const isArray = itype.array(module.local);\n const {\n version\n } = module;\n let remoteTmpls;\n let local;\n if (isArray) {\n remoteTmpls = module.remote;\n local = module
|
|
155
|
+
eval("\n\n/* global CloudCmd */\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst itype = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n findObjByNameInArr\n} = __webpack_require__(/*! ../../common/util */ \"./common/util.js\");\nconst Files = __webpack_require__(/*! ./files */ \"./client/dom/files.js\");\nmodule.exports = (name, options, callback = options) => {\n const {\n prefix,\n config\n } = CloudCmd;\n const o = options;\n if (o.name && window[o.name]) return callback();\n Files.get('modules').then(async modules => {\n const online = config('online') && navigator.onLine;\n const module = findObjByNameInArr(modules.remote, name);\n const isArray = itype.array(module.local);\n const {\n version\n } = module;\n let remoteTmpls;\n let local;\n if (isArray) {\n remoteTmpls = module.remote;\n ({\n local\n } = module);\n } else {\n remoteTmpls = [module.remote];\n local = [module.local];\n }\n const localURL = local.map(url => prefix + url);\n const remoteURL = remoteTmpls.map(tmpl => {\n return rendy(tmpl, {\n version\n });\n });\n if (online) {\n const [e] = await tryToCatch(load.parallel, remoteURL);\n if (!e) return callback();\n }\n const [e] = await tryToCatch(load.parallel, localURL);\n callback(e);\n });\n};\n\n//# sourceURL=file://cloudcmd/client/dom/load-remote.js");
|
|
156
156
|
|
|
157
157
|
/***/ }),
|
|
158
158
|
|
|
@@ -164,7 +164,7 @@ eval("\n\n/* global CloudCmd */\nconst rendy = __webpack_require__(/*! rendy */
|
|
|
164
164
|
/***/ (function(module, exports, __webpack_require__) {
|
|
165
165
|
|
|
166
166
|
"use strict";
|
|
167
|
-
eval("\n\nconst itype = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\nconst jonny = __webpack_require__(/*! jonny */ \"./node_modules/jonny/lib/jonny.js\");\nconst Emitify = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst Images = __webpack_require__(/*! ./images */ \"./client/dom/images.js\");\nmodule.exports.getIdBySrc = getIdBySrc;\n/**\n * Function gets id by src\n * @param src\n *\n * Example: http://domain.com/1.js -> 1_js\n */\nfunction getIdBySrc(src) {\n const isStr = itype.string(src);\n if (!isStr) return;\n if (src.includes(':')) src += '-join';\n const num = src.lastIndexOf('/') + 1;\n const sub = src.substr(src, num);\n const id = src.replace(sub, '').replace(/\\./g, '-');\n return id;\n}\n\n/**\n * load file countent via ajax\n *\n * @param params\n */\nmodule.exports.ajax = params => {\n const p = params;\n const isObject = itype.object(p.data);\n const isArray = itype.array(p.data);\n const isArrayBuf = itype(p.data) === 'arraybuffer';\n const type = p.type || p.method || 'GET';\n const {\n headers = {}\n } = p;\n const xhr = new XMLHttpRequest();\n xhr.open(type, p.url, true);\n for (const name of Object.keys(headers)) {\n const value = headers[name];\n xhr.setRequestHeader(name, value);\n }\n if (p.responseType) xhr.responseType = p.responseType;\n let data;\n if (!isArrayBuf && isObject || isArray) data = jonny.stringify(p.data);else data = p
|
|
167
|
+
eval("\n\nconst itype = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\nconst jonny = __webpack_require__(/*! jonny */ \"./node_modules/jonny/lib/jonny.js\");\nconst Emitify = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst Images = __webpack_require__(/*! ./images */ \"./client/dom/images.js\");\nmodule.exports.getIdBySrc = getIdBySrc;\n/**\n * Function gets id by src\n * @param src\n *\n * Example: http://domain.com/1.js -> 1_js\n */\nfunction getIdBySrc(src) {\n const isStr = itype.string(src);\n if (!isStr) return;\n if (src.includes(':')) src += '-join';\n const num = src.lastIndexOf('/') + 1;\n const sub = src.substr(src, num);\n const id = src.replace(sub, '').replace(/\\./g, '-');\n return id;\n}\n\n/**\n * load file countent via ajax\n *\n * @param params\n */\nmodule.exports.ajax = params => {\n const p = params;\n const isObject = itype.object(p.data);\n const isArray = itype.array(p.data);\n const isArrayBuf = itype(p.data) === 'arraybuffer';\n const type = p.type || p.method || 'GET';\n const {\n headers = {}\n } = p;\n const xhr = new XMLHttpRequest();\n xhr.open(type, p.url, true);\n for (const name of Object.keys(headers)) {\n const value = headers[name];\n xhr.setRequestHeader(name, value);\n }\n if (p.responseType) xhr.responseType = p.responseType;\n let data;\n if (!isArrayBuf && isObject || isArray) data = jonny.stringify(p.data);else ({\n data\n } = p);\n xhr.onreadystatechange = event => {\n const xhr = event.target;\n const OK = 200;\n if (xhr.readyState !== xhr.DONE) return;\n Images.clearProgress();\n const TYPE_JSON = 'application/json';\n const type = xhr.getResponseHeader('content-type');\n if (xhr.status !== OK) return exec(p.error, xhr);\n const notText = p.dataType !== 'text';\n const isContain = type.includes(TYPE_JSON);\n let data = xhr.response;\n if (type && isContain && notText) data = jonny.parse(xhr.response) || xhr.response;\n exec(p.success, data, xhr.statusText, xhr);\n };\n xhr.send(data);\n};\nmodule.exports.put = (url, body) => {\n const emitter = Emitify();\n const xhr = new XMLHttpRequest();\n url = encodeURI(url).replace(/#/g, '%23');\n xhr.open('put', url, true);\n xhr.upload.onprogress = event => {\n if (!event.lengthComputable) return;\n const percent = event.loaded / event.total * 100;\n const count = Math.round(percent);\n emitter.emit('progress', count);\n };\n xhr.onreadystatechange = () => {\n const over = xhr.readyState === xhr.DONE;\n const OK = 200;\n if (!over) return;\n if (xhr.status === OK) {\n emitter.emit('progress', 100);\n return emitter.emit('end');\n }\n const error = Error(xhr.responseText);\n emitter.emit('error', error);\n };\n xhr.send(body);\n return emitter;\n};\n\n//# sourceURL=file://cloudcmd/client/dom/load.js");
|
|
168
168
|
|
|
169
169
|
/***/ }),
|
|
170
170
|
|
|
@@ -260,7 +260,7 @@ eval("/* WEBPACK VAR INJECTION */(function(Buffer) {\n\nmodule.exports.btoa = st
|
|
|
260
260
|
/***/ (function(module, exports, __webpack_require__) {
|
|
261
261
|
|
|
262
262
|
"use strict";
|
|
263
|
-
eval("\n\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst store = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\nconst {\n encode\n} = __webpack_require__(/*! ./entity */ \"./common/entity.js\");\nconst {\n btoa\n} = __webpack_require__(/*! ./base64 */ \"./common/base64.js\");\nconst getHeaderField = currify(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = store();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nmodule.exports.FS = FS;\nmodule.exports.apiURL = '/api/v1';\nmodule.exports.MAX_FILE_SIZE = 500 * 1024;\nmodule.exports.getHeaderField = getHeaderField;\nmodule.exports.getPathLink = getPathLink;\nmodule.exports.getDotDot = getDotDot;\nmodule.exports.formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nmodule.exports.getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push(rendy(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nconst getDataName = name => {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n};\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nmodule.exports.buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = encode(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = rendy(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = rendy(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n
|
|
263
|
+
eval("\n\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst store = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\nconst {\n encode\n} = __webpack_require__(/*! ./entity */ \"./common/entity.js\");\nconst {\n btoa\n} = __webpack_require__(/*! ./base64 */ \"./common/base64.js\");\nconst getHeaderField = currify(_getHeaderField);\n\n/* КОНСТАНТЫ (общие для клиента и сервера)*/\n/* название программы */\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = store();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nmodule.exports.FS = FS;\nmodule.exports.apiURL = '/api/v1';\nmodule.exports.MAX_FILE_SIZE = 500 * 1024;\nmodule.exports.getHeaderField = getHeaderField;\nmodule.exports.getPathLink = getPathLink;\nmodule.exports.getDotDot = getDotDot;\nmodule.exports.formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nmodule.exports.getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push(rendy(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nconst getDataName = name => {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n};\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nmodule.exports.buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = encode(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = rendy(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = rendy(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n /* Если мы не в корне */\n if (path !== '/') {\n const dotDot = getDotDot(path);\n const link = prefix + FS + dotDot;\n const linkResult = rendy(template.link, {\n link,\n title: '..',\n name: '..'\n });\n const dataName = getDataName('..');\n const attribute = `draggable=\"true\" ${dataName}`;\n\n /* Сохраняем путь к каталогу верхнего уровня*/\n fileTable += rendy(template.file, {\n tag: 'li',\n attribute,\n className: '',\n type: 'directory',\n name: linkResult,\n size: '<dir>',\n date: '--.--.----',\n owner: '.',\n mode: '--- --- ---'\n });\n }\n fileTable += files.filter(filterOutDotFiles({\n showDotFiles\n })).map(updateField).map(file => {\n const name = encode(file.name);\n const link = prefix + FS + path + name;\n const {\n type,\n mode,\n date,\n owner,\n size\n } = file;\n const linkResult = rendy(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type)\n });\n const dataName = getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n return rendy(templateFile, {\n tag: 'li',\n attribute,\n className: '',\n type,\n name: linkResult,\n size,\n date,\n owner,\n mode\n });\n }).join('');\n fileTable += '</ul>';\n return fileTable;\n};\nconst updateField = file => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file)\n});\nfunction getAttribute(type) {\n if (type === 'directory') return '';\n return 'target=\"_blank\" ';\n}\nmodule.exports._getSize = getSize;\nfunction getSize({\n size,\n type\n}) {\n if (type === 'directory') return '<dir>';\n if (/link/.test(type)) return '<link>';\n return size;\n}\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n if (sort !== name) return name;\n if (sort === 'name' && order === 'asc') return name;\n return `${name}${arrow}`;\n}\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n if (!dotDot) return '/';\n return dotDot;\n}\n\n//# sourceURL=file://cloudcmd/common/cloudfunc.js");
|
|
264
264
|
|
|
265
265
|
/***/ }),
|
|
266
266
|
|
package/dist-dev/cloudcmd.js
CHANGED
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
/***/ (function(module, exports, __webpack_require__) {
|
|
164
164
|
|
|
165
165
|
"use strict";
|
|
166
|
-
eval("\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n\n/* global DOM */\nconst Emitify = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n addSlashToEnd\n} = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\nconst pascalCase = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.cjs\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst Images = __webpack_require__(/*! ./dom/images */ \"./client/dom/images.js\");\nconst {\n unregisterSW\n} = __webpack_require__(/*! ./sw/register */ \"./client/sw/register.js\");\nconst getJsonFromFileTable = __webpack_require__(/*! ./get-json-from-file-table */ \"./client/get-json-from-file-table.js\");\nconst Key = __webpack_require__(/*! ./key */ \"./client/key/index.js\");\nconst {\n apiURL,\n formatMsg,\n buildFromJSON\n} = __webpack_require__(/*! ../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst loadModule = __webpack_require__(/*! ./load-module */ \"./client/load-module.js\");\nconst noJS = a => a.replace(/.js$/, '');\nconst isDev = process.env.NODE_ENV === 'development';\ninherits(CloudCmdProto, Emitify);\nmodule.exports = new CloudCmdProto(DOM);\nload.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n Images.show.error(msg);\n});\nfunction CloudCmdProto(DOM) {\n let Listeners;\n Emitify.call(this);\n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n const {\n Storage,\n Files\n } = DOM;\n this.log = (...a) => {\n if (!isDev) return;\n console.log(...a);\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n this.MIN_ONE_PANEL_WIDTH = DOM.getCSSVar('min-one-panel-width');\n this.HOST = location.origin || location.protocol + '//' + location.host;\n this.sort = {\n left: 'name',\n right: 'name'\n };\n this.order = {\n left: 'asc',\n right: 'asc'\n };\n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName\n } = overrides;\n const refresh = isRefresh;\n let panelChanged;\n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n let imgPosition;\n if (panelChanged || refresh || !history) imgPosition = 'top';\n Images.show.load(imgPosition, panel);\n /* загружаем содержимое каталога */\n await ajaxLoad(addSlashToEnd(path), {\n refresh,\n history,\n noCurrent,\n currentName,\n showDotFiles: CloudCmd.config('showDotFiles')\n }, panel);\n };\n\n /**\n * Конструктор CloudClient, который\n * выполняет весь функционал по\n * инициализации\n */\n this.init = async (prefix, config) => {\n CloudCmd.prefix = prefix;\n CloudCmd.prefixURL = `${prefix}${apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n CloudCmd.config = key => config[key];\n CloudCmd.config.if = currify((key, fn, a) => config[key] && fn(a));\n CloudCmd._config = (key, value) => {\n /*\n * should be called from config.js only\n * after successful update on server\n */\n if (key === 'password') return;\n config[key] = value;\n };\n if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n if (!document.body.scrollIntoViewIfNeeded) await load.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n await initModules();\n await baseInit();\n await loadStyle();\n CloudCmd.route(location.hash);\n };\n async function loadStyle() {\n const {\n prefix\n } = CloudCmd;\n const name = `${prefix}/dist/cloudcmd.common.css`;\n await load.css(name);\n }\n this.route = path => {\n const query = path.split('/');\n if (!path) return;\n const [kebabModule] = query;\n const module = noJS(pascalCase(kebabModule.slice(1)));\n const file = query[1];\n const current = DOM.getCurrentByName(file);\n if (file && !current) {\n const msg = formatMsg('set current file', file, 'error');\n CloudCmd.log(msg);\n return;\n }\n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {\n prefix\n } = CloudCmd;\n await DOM.Storage.clear();\n unregisterSW(prefix);\n DOM.load.ajax({\n url,\n error\n });\n };\n const initModules = async () => {\n CloudCmd.Key = Key;\n CloudCmd.Key.bind();\n const [, modules] = await tryToCatch(Files.get, 'modules');\n const showLoad = Images.show.load;\n const doBefore = {\n edit: showLoad,\n menu: showLoad\n };\n const load = (name, path, dobefore) => {\n loadModule({\n name,\n path,\n dobefore\n });\n };\n if (!modules) return;\n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n async function baseInit() {\n const files = DOM.getFiles();\n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n\n /* выделяем строку с первым файлом */\n if (files) DOM.setCurrentFile(currentFile, {\n // when hash is present\n // it should be handled with this.route\n // overwre otherwise\n history: !location.hash\n });\n const dirPath = DOM.getCurrentDirPath();\n Listeners = CloudCmd.Listeners;\n Listeners.init();\n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n Listeners.initKeysPanel();\n if (!CloudCmd.config('dirStorage')) return;\n const data = await Storage.get(dirPath);\n if (!data) await Storage.setJson(dirPath, getJsonFromFileTable());\n }\n function getPanels() {\n const panels = ['left'];\n if (CloudCmd.config('oneFilePanel')) return panels;\n return [...panels, 'right'];\n }\n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n this.refresh = async (options = {}) => {\n const {\n panel = Info.panel,\n currentName\n } = options;\n const path = DOM.getCurrentDirPath(panel);\n const isRefresh = true;\n const history = false;\n const noCurrent = options === null || options === void 0 ? void 0 : options.noCurrent;\n await CloudCmd.changeDir(path, {\n isRefresh,\n history,\n panel,\n noCurrent,\n currentName\n });\n };\n\n /**\n * Функция загружает json-данные о Файловой Системе\n * через ajax-запрос.\n * @param path - каталог для чтения\n * @param options\n * { refresh, history } - необходимость обновить данные о каталоге\n * @param panel\n *\n */\n async function ajaxLoad(path, options = {}, panel) {\n const {\n RESTful\n } = DOM;\n CloudCmd.log(`reading dir: \"${path}\";`);\n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && (await Storage.getJson(path));\n const name = options.currentName || Info.name;\n const {\n noCurrent,\n refresh\n } = options;\n if (!refresh && json) return await createFileTable(json, panel, options);\n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n const query = rendy('?sort={{ sort }}&order={{ order }}', {\n sort,\n order\n });\n const [, newObj] = await RESTful.read(path + query, 'json');\n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n options.sort = sort;\n options.order = order;\n await createFileTable(newObj, panel, options);\n if (refresh && !noCurrent) DOM.setCurrentByName(name);\n if (!CloudCmd.config('dirStorage')) return;\n Storage.setJson(path, newObj);\n }\n\n /**\n * Функция строит файловую таблицу\n * @param data - данные о файлах\n * @param panelParam\n * @param options - history, noCurrent, showDotFiles\n */\n async function createFileTable(data, panelParam, options) {\n const {\n history,\n noCurrent,\n showDotFiles\n } = options;\n const names = ['file', 'path', 'link', 'pathLink'];\n const [error, [file, path, link, pathLink]] = await tryToCatch(Files.get, names);\n if (error) return DOM.Dialog.alert(error.responseText);\n const panel = panelParam || DOM.getPanel();\n const {\n prefix\n } = CloudCmd;\n const {\n dir,\n name\n } = Info;\n const {\n childNodes\n } = panel;\n let i = childNodes.length;\n while (i--) panel.removeChild(panel.lastChild);\n panel.innerHTML = buildFromJSON({\n sort: options.sort,\n order: options.order,\n data,\n id: panel.id,\n prefix,\n showDotFiles,\n template: {\n file,\n path,\n pathLink,\n link\n }\n });\n Listeners.setOnPanel(panel);\n if (!noCurrent) {\n let current;\n if (name === '..' && dir !== '/') current = DOM.getCurrentByName(dir);\n if (!current) [current] = DOM.getFiles(panel);\n DOM.setCurrentFile(current, {\n history\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel\n } = Info;\n if (dirPath === parentDirPath) return;\n const path = parentDirPath;\n await CloudCmd.changeDir(path);\n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n DOM.setCurrentFile(current || first, {\n history\n });\n };\n}\n\n//# sourceURL=file://cloudcmd/client/client.js");
|
|
166
|
+
eval("\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n\n/* global DOM */\nconst Emitify = __webpack_require__(/*! emitify */ \"./node_modules/emitify/lib/emitify.js\");\nconst inherits = __webpack_require__(/*! inherits */ \"./node_modules/inherits/inherits_browser.js\");\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n addSlashToEnd\n} = __webpack_require__(/*! format-io */ \"./node_modules/format-io/lib/format.js\");\nconst pascalCase = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.cjs\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst Images = __webpack_require__(/*! ./dom/images */ \"./client/dom/images.js\");\nconst {\n unregisterSW\n} = __webpack_require__(/*! ./sw/register */ \"./client/sw/register.js\");\nconst getJsonFromFileTable = __webpack_require__(/*! ./get-json-from-file-table */ \"./client/get-json-from-file-table.js\");\nconst Key = __webpack_require__(/*! ./key */ \"./client/key/index.js\");\nconst {\n apiURL,\n formatMsg,\n buildFromJSON\n} = __webpack_require__(/*! ../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst loadModule = __webpack_require__(/*! ./load-module */ \"./client/load-module.js\");\nconst noJS = a => a.replace(/.js$/, '');\nconst isDev = process.env.NODE_ENV === 'development';\ninherits(CloudCmdProto, Emitify);\nmodule.exports = new CloudCmdProto(DOM);\nload.addErrorListener((e, src) => {\n const msg = `file ${src} could not be loaded`;\n Images.show.error(msg);\n});\nfunction CloudCmdProto(DOM) {\n let Listeners;\n Emitify.call(this);\n const CloudCmd = this;\n const Info = DOM.CurrentInfo;\n const {\n Storage,\n Files\n } = DOM;\n this.log = (...a) => {\n if (!isDev) return;\n console.log(...a);\n };\n this.prefix = '';\n this.prefixSocket = '';\n this.prefixURL = '';\n this.MIN_ONE_PANEL_WIDTH = DOM.getCSSVar('min-one-panel-width');\n this.HOST = location.origin || location.protocol + '//' + location.host;\n this.sort = {\n left: 'name',\n right: 'name'\n };\n this.order = {\n left: 'asc',\n right: 'asc'\n };\n this.changeDir = async (path, overrides = {}) => {\n const {\n isRefresh,\n panel,\n history = true,\n noCurrent,\n currentName\n } = overrides;\n const refresh = isRefresh;\n let panelChanged;\n if (!noCurrent && panel && panel !== Info.panel) {\n DOM.changePanel();\n panelChanged = true;\n }\n let imgPosition;\n if (panelChanged || refresh || !history) imgPosition = 'top';\n Images.show.load(imgPosition, panel);\n\n /* загружаем содержимое каталога */\n await ajaxLoad(addSlashToEnd(path), {\n refresh,\n history,\n noCurrent,\n currentName,\n showDotFiles: CloudCmd.config('showDotFiles')\n }, panel);\n };\n\n /**\n * Конструктор CloudClient, который\n * выполняет весь функционал по\n * инициализации\n */\n this.init = async (prefix, config) => {\n CloudCmd.prefix = prefix;\n CloudCmd.prefixURL = `${prefix}${apiURL}`;\n CloudCmd.prefixSocket = config.prefixSocket;\n CloudCmd.DIR_DIST = `${prefix}/dist`;\n CloudCmd.DIR_MODULES = `${this.DIR_DIST}/modules`;\n CloudCmd.config = key => config[key];\n CloudCmd.config.if = currify((key, fn, a) => config[key] && fn(a));\n CloudCmd._config = (key, value) => {\n /*\n * should be called from config.js only\n * after successful update on server\n */\n if (key === 'password') return;\n config[key] = value;\n };\n if (config.oneFilePanel) CloudCmd.MIN_ONE_PANEL_WIDTH = Infinity;\n if (!document.body.scrollIntoViewIfNeeded) await load.js(`${CloudCmd.DIR_MODULES}/polyfill.js`);\n await initModules();\n await baseInit();\n await loadStyle();\n CloudCmd.route(location.hash);\n };\n async function loadStyle() {\n const {\n prefix\n } = CloudCmd;\n const name = `${prefix}/dist/cloudcmd.common.css`;\n await load.css(name);\n }\n this.route = path => {\n const query = path.split('/');\n if (!path) return;\n const [kebabModule] = query;\n const module = noJS(pascalCase(kebabModule.slice(1)));\n const file = query[1];\n const current = DOM.getCurrentByName(file);\n if (file && !current) {\n const msg = formatMsg('set current file', file, 'error');\n CloudCmd.log(msg);\n return;\n }\n DOM.setCurrentFile(current);\n CloudCmd.execFromModule(module, 'show');\n };\n this.logOut = async () => {\n const url = CloudCmd.prefix + '/logout';\n const error = () => document.location.reload();\n const {\n prefix\n } = CloudCmd;\n await DOM.Storage.clear();\n unregisterSW(prefix);\n DOM.load.ajax({\n url,\n error\n });\n };\n const initModules = async () => {\n CloudCmd.Key = Key;\n CloudCmd.Key.bind();\n const [, modules] = await tryToCatch(Files.get, 'modules');\n const showLoad = Images.show.load;\n const doBefore = {\n edit: showLoad,\n menu: showLoad\n };\n const load = (name, path, dobefore) => {\n loadModule({\n name,\n path,\n dobefore\n });\n };\n if (!modules) return;\n for (const module of modules.local) {\n load(null, module, doBefore[module]);\n }\n };\n async function saveCurrentName(currentName) {\n await Storage.set('current-name', currentName);\n }\n async function baseInit() {\n const files = DOM.getFiles();\n CloudCmd.on('current-file', DOM.updateCurrentInfo);\n CloudCmd.on('current-name', saveCurrentName);\n const name = await Storage.get('current-name');\n const currentFile = name && DOM.getCurrentByName(name) || files[0];\n\n /* выделяем строку с первым файлом */\n if (files) DOM.setCurrentFile(currentFile, {\n // when hash is present\n // it should be handled with this.route\n // overwre otherwise\n history: !location.hash\n });\n const dirPath = DOM.getCurrentDirPath();\n ({\n Listeners\n } = CloudCmd);\n Listeners.init();\n const panels = getPanels();\n panels.forEach(Listeners.setOnPanel);\n Listeners.initKeysPanel();\n if (!CloudCmd.config('dirStorage')) return;\n const data = await Storage.get(dirPath);\n if (!data) await Storage.setJson(dirPath, getJsonFromFileTable());\n }\n function getPanels() {\n const panels = ['left'];\n if (CloudCmd.config('oneFilePanel')) return panels;\n return [...panels, 'right'];\n }\n this.execFromModule = async (moduleName, funcName, ...args) => {\n await CloudCmd[moduleName]();\n const func = CloudCmd[moduleName][funcName];\n func(...args);\n };\n this.refresh = async (options = {}) => {\n const {\n panel = Info.panel,\n currentName\n } = options;\n const path = DOM.getCurrentDirPath(panel);\n const isRefresh = true;\n const history = false;\n const noCurrent = options === null || options === void 0 ? void 0 : options.noCurrent;\n await CloudCmd.changeDir(path, {\n isRefresh,\n history,\n panel,\n noCurrent,\n currentName\n });\n };\n\n /**\n * Функция загружает json-данные о Файловой Системе\n * через ajax-запрос.\n * @param path - каталог для чтения\n * @param options\n * { refresh, history } - необходимость обновить данные о каталоге\n * @param panel\n *\n */\n async function ajaxLoad(path, options = {}, panel) {\n const {\n RESTful\n } = DOM;\n CloudCmd.log(`reading dir: \"${path}\";`);\n const dirStorage = CloudCmd.config('dirStorage');\n const json = dirStorage && (await Storage.getJson(path));\n const name = options.currentName || Info.name;\n const {\n noCurrent,\n refresh\n } = options;\n if (!refresh && json) return await createFileTable(json, panel, options);\n const position = DOM.getPanelPosition(panel);\n const sort = CloudCmd.sort[position];\n const order = CloudCmd.order[position];\n const query = rendy('?sort={{ sort }}&order={{ order }}', {\n sort,\n order\n });\n const [, newObj] = await RESTful.read(path + query, 'json');\n if (!newObj)\n // that's OK, error handled by RESTful\n return;\n options.sort = sort;\n options.order = order;\n await createFileTable(newObj, panel, options);\n if (refresh && !noCurrent) DOM.setCurrentByName(name);\n if (!CloudCmd.config('dirStorage')) return;\n Storage.setJson(path, newObj);\n }\n\n /**\n * Функция строит файловую таблицу\n * @param data - данные о файлах\n * @param panelParam\n * @param options - history, noCurrent, showDotFiles\n */\n async function createFileTable(data, panelParam, options) {\n const {\n history,\n noCurrent,\n showDotFiles\n } = options;\n const names = ['file', 'path', 'link', 'pathLink'];\n const [error, [file, path, link, pathLink]] = await tryToCatch(Files.get, names);\n if (error) return DOM.Dialog.alert(error.responseText);\n const panel = panelParam || DOM.getPanel();\n const {\n prefix\n } = CloudCmd;\n const {\n dir,\n name\n } = Info;\n const {\n childNodes\n } = panel;\n let i = childNodes.length;\n while (i--) panel.removeChild(panel.lastChild);\n panel.innerHTML = buildFromJSON({\n sort: options.sort,\n order: options.order,\n data,\n id: panel.id,\n prefix,\n showDotFiles,\n template: {\n file,\n path,\n pathLink,\n link\n }\n });\n Listeners.setOnPanel(panel);\n if (!noCurrent) {\n let current;\n if (name === '..' && dir !== '/') current = DOM.getCurrentByName(dir);\n if (!current) [current] = DOM.getFiles(panel);\n DOM.setCurrentFile(current, {\n history\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n }\n }\n this.goToParentDir = async () => {\n const {\n dir,\n dirPath,\n parentDirPath,\n panel\n } = Info;\n if (dirPath === parentDirPath) return;\n const path = parentDirPath;\n await CloudCmd.changeDir(path);\n const current = DOM.getCurrentByName(dir);\n const [first] = DOM.getFiles(panel);\n DOM.setCurrentFile(current || first, {\n history\n });\n };\n}\n\n//# sourceURL=file://cloudcmd/client/client.js");
|
|
167
167
|
|
|
168
168
|
/***/ }),
|
|
169
169
|
|
package/dist-dev/modules/menu.js
CHANGED
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
/***/ (function(module, exports, __webpack_require__) {
|
|
164
164
|
|
|
165
165
|
"use strict";
|
|
166
|
-
eval("/* global CloudCmd, DOM */\n\n\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst wrap = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst supermenu = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst {\n FS\n} = __webpack_require__(/*! ../../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst {\n getIdBySrc\n} = __webpack_require__(/*! ../dom/load */ \"./client/dom/load.js\");\nconst RESTful = __webpack_require__(/*! ../dom/rest */ \"./client/dom/rest.js\");\nconst {\n config,\n Key\n} = CloudCmd;\nconst {\n Buffer,\n Events,\n Dialog,\n Images\n} = DOM;\nconst Info = DOM.CurrentInfo;\nconst alertNoFiles = Dialog.alert.noFiles;\nconst uploadTo = wrap(_uploadTo);\nlet MenuShowedName;\nlet MenuContext;\nlet MenuContextFile;\nmodule.exports.ENABLED = false;\nCloudCmd.Menu = exports;\nmodule.exports.init = () => {\n const {\n isAuth,\n menuDataFile\n } = getFileMenuData();\n const fm = DOM.getFM();\n const menuData = getMenuData(isAuth);\n const options = getOptions({\n type: 'context'\n });\n const optionsFile = getOptions({\n type: 'file'\n });\n MenuContext = supermenu(fm, options, menuData);\n MenuContextFile = supermenu(fm, optionsFile, menuDataFile);\n MenuContext.addContextMenuListener();\n MenuContextFile.addContextMenuListener();\n Events.addKey(listener);\n};\nmodule.exports.hide = hide;\nfunction hide() {\n MenuContext.hide();\n MenuContextFile.hide();\n}\nmodule.exports.show = position => {\n const {\n x,\n y\n } = getPosition(position);\n MenuContext.show(x, y);\n MenuContextFile.show(x, y);\n Images.hide();\n};\nfunction getPosition(position) {\n if (position) return {\n x: position.x,\n y: position.y\n };\n return getCurrentPosition();\n}\nfunction getMenuNameByEl(el) {\n if (!el) return 'context';\n const name = DOM.getCurrentName(el);\n if (name === '..') return 'context';\n return 'contextFile';\n}\nfunction getOptions({\n type\n}) {\n let name;\n let func;\n if (type === 'context') {\n name = 'context';\n func = Key.unsetBind;\n } else if (type === 'file') {\n name = 'contextFile';\n }\n const options = {\n icon: true,\n beforeClose: Key.setBind,\n beforeShow: exec.with(beforeShow, func),\n beforeClick,\n name\n };\n return options;\n}\nfunction getMenuData(isAuth) {\n const menu = {\n 'Paste': Buffer.paste,\n 'New': {\n File: DOM.promptNewFile,\n Directory: DOM.promptNewDir\n },\n 'Upload': () => {\n CloudCmd.Upload.show();\n },\n 'Upload From Cloud': uploadFromCloud,\n 'Toggle File Selection': DOM.toggleSelectedFile,\n '(Un)Select All': DOM.toggleAllSelectedFiles\n };\n if (isAuth) menu['Log Out'] = CloudCmd.logOut;\n return menu;\n}\nfunction getFileMenuData() {\n const isAuth = CloudCmd.config('auth');\n const menuBottom = getMenuData(isAuth);\n const menuTop = {\n 'View': () => {\n CloudCmd.View.show();\n },\n 'Edit': () => {\n const name = config('vim') ? 'EditFileVim' : 'EditFile';\n CloudCmd[name].show();\n },\n 'Rename': () => {\n setTimeout(DOM.renameCurrent, 100);\n },\n 'Delete': () => {\n CloudCmd.Operation.show('delete');\n },\n 'Pack': () => {\n CloudCmd.Operation.show('pack');\n },\n 'Extract': () => {\n CloudCmd.Operation.show('extract');\n },\n 'Download': preDownload,\n 'Upload To Cloud': uploadTo('Cloud'),\n 'Cut': () => {\n isCurrent(Buffer.cut, alertNoFiles);\n },\n 'Copy': () => {\n isCurrent(Buffer.copy, alertNoFiles);\n }\n };\n const menuDataFile = {\n ...menuTop,\n ...menuBottom\n };\n return {\n isAuth,\n menuDataFile\n };\n}\nfunction isCurrent(yesFn, noFn) {\n if (Info.name !== '..') return yesFn();\n noFn();\n}\nfunction isPath(x, y) {\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return false;\n const el = document.elementFromPoint(x, y);\n const elements = panel.querySelectorAll('[data-name=\"js-path\"] *');\n return ~[].indexOf.call(elements, el);\n}\nfunction beforeShow(callback, params) {\n const {\n name\n } = params;\n const el = DOM.getCurrentByPosition({\n x: params.x,\n y: params.y\n });\n const menuName = getMenuNameByEl(el);\n let isShow = menuName !== 'contextFile';\n if (params.name === 'contextFile') isShow = !isShow;\n if (isShow) MenuShowedName = name;\n exec(callback);\n if (isShow) isShow = isPath(params.x, params.y);\n return isShow;\n}\nconst beforeClick = name => MenuShowedName !== name;\nasync function _uploadTo(nameModule) {\n const [error, data] = await Info.getData();\n if (error) return;\n const {\n name\n } = Info;\n CloudCmd.execFromModule(nameModule, 'uploadFile', name, data);\n CloudCmd.log(`Uploading to ${name}...`);\n}\nfunction uploadFromCloud() {\n Images.show.load('top');\n CloudCmd.execFromModule('Cloud', 'saveFile', async (currentName, data) => {\n const path = DOM.getCurrentDirPath() + currentName;\n const [e] = await RESTful.write(path, data);\n if (e) return;\n await CloudCmd.refresh({\n currentName\n });\n });\n}\nfunction preDownload() {\n download(config('packer'));\n}\nfunction download(type) {\n const TIME = 30 * 1000;\n const {\n prefixURL\n } = CloudCmd;\n const PACK = '/pack';\n const date = Date.now();\n const files = DOM.getActiveFiles();\n if (!files.length) return alertNoFiles();\n for (const file of files) {\n const selected = DOM.isSelected(file);\n const isDir = DOM.isCurrentIsDir(file);\n const path = DOM.getCurrentPath(file);\n CloudCmd.log(`downloading file ${path}...`);\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n * and all other characters, like \"%\"\n */\n const encodedPath = encodeURI(path).replace(/#/g, '%23');\n const id = getIdBySrc(path);\n let src;\n if (isDir) src = prefixURL + PACK + encodedPath + DOM.getPackerExt(type);else src = prefixURL + FS + encodedPath + '?download';\n const element = createElement('iframe', {\n id: id + '-' + date,\n async: false,\n className: 'hidden',\n src\n });\n const {\n body\n } = document;\n const removeChild = body.removeChild.bind(body, element);\n setTimeout(removeChild, TIME);\n if (selected) DOM.toggleSelectedFile(file);\n }\n}\nfunction getCurrentPosition() {\n const current = Info.element;\n const rect = current.getBoundingClientRect();\n const position = {\n x: Math.round(rect.left + rect.width / 3),\n y: Math.round(rect.top)\n };\n return position;\n}\nfunction listener(event) {\n const {\n F9,\n ESC\n } = Key;\n const key = event.keyCode;\n const isBind = Key.isBind();\n if (!isBind) return;\n if (key === ESC) return hide();\n if (key === F9) {\n const position = getCurrentPosition();\n MenuContext.show(position.x, position.y);\n event.preventDefault();\n }\n}\n\n//# sourceURL=file://cloudcmd/client/modules/menu.js");
|
|
166
|
+
eval("/* global CloudCmd, DOM */\n\n\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst wrap = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst supermenu = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst {\n FS\n} = __webpack_require__(/*! ../../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst {\n getIdBySrc\n} = __webpack_require__(/*! ../dom/load */ \"./client/dom/load.js\");\nconst RESTful = __webpack_require__(/*! ../dom/rest */ \"./client/dom/rest.js\");\nconst {\n config,\n Key\n} = CloudCmd;\nconst {\n Buffer,\n Events,\n Dialog,\n Images\n} = DOM;\nconst Info = DOM.CurrentInfo;\nconst alertNoFiles = Dialog.alert.noFiles;\nconst uploadTo = wrap(_uploadTo);\nlet MenuShowedName;\nlet MenuContext;\nlet MenuContextFile;\nmodule.exports.ENABLED = false;\nCloudCmd.Menu = exports;\nmodule.exports.init = () => {\n const {\n isAuth,\n menuDataFile\n } = getFileMenuData();\n const fm = DOM.getFM();\n const menuData = getMenuData(isAuth);\n const options = getOptions({\n type: 'context'\n });\n const optionsFile = getOptions({\n type: 'file'\n });\n MenuContext = supermenu(fm, options, menuData);\n MenuContextFile = supermenu(fm, optionsFile, menuDataFile);\n MenuContext.addContextMenuListener();\n MenuContextFile.addContextMenuListener();\n Events.addKey(listener);\n};\nmodule.exports.hide = hide;\nfunction hide() {\n MenuContext.hide();\n MenuContextFile.hide();\n}\nmodule.exports.show = position => {\n const {\n x,\n y\n } = getPosition(position);\n MenuContext.show(x, y);\n MenuContextFile.show(x, y);\n Images.hide();\n};\nfunction getPosition(position) {\n if (position) return {\n x: position.x,\n y: position.y\n };\n return getCurrentPosition();\n}\nfunction getMenuNameByEl(el) {\n if (!el) return 'context';\n const name = DOM.getCurrentName(el);\n if (name === '..') return 'context';\n return 'contextFile';\n}\nfunction getOptions({\n type\n}) {\n let name;\n let func;\n if (type === 'context') {\n name = 'context';\n func = Key.unsetBind;\n } else if (type === 'file') {\n name = 'contextFile';\n }\n const options = {\n icon: true,\n beforeClose: Key.setBind,\n beforeShow: exec.with(beforeShow, func),\n beforeClick,\n name\n };\n return options;\n}\nfunction getMenuData(isAuth) {\n const menu = {\n 'Paste': Buffer.paste,\n 'New': {\n File: DOM.promptNewFile,\n Directory: DOM.promptNewDir\n },\n 'Upload': () => {\n CloudCmd.Upload.show();\n },\n 'Upload From Cloud': uploadFromCloud,\n 'Toggle File Selection': DOM.toggleSelectedFile,\n '(Un)Select All': DOM.toggleAllSelectedFiles\n };\n if (isAuth) menu['Log Out'] = CloudCmd.logOut;\n return menu;\n}\nfunction getFileMenuData() {\n const isAuth = CloudCmd.config('auth');\n const menuBottom = getMenuData(isAuth);\n const menuTop = {\n 'View': () => {\n CloudCmd.View.show();\n },\n 'Edit': () => {\n const name = config('vim') ? 'EditFileVim' : 'EditFile';\n CloudCmd[name].show();\n },\n 'Rename': () => {\n setTimeout(DOM.renameCurrent, 100);\n },\n 'Delete': () => {\n CloudCmd.Operation.show('delete');\n },\n 'Pack': () => {\n CloudCmd.Operation.show('pack');\n },\n 'Extract': () => {\n CloudCmd.Operation.show('extract');\n },\n 'Download': preDownload,\n 'Upload To Cloud': uploadTo('Cloud'),\n 'Cut': () => {\n isCurrent(Buffer.cut, alertNoFiles);\n },\n 'Copy': () => {\n isCurrent(Buffer.copy, alertNoFiles);\n }\n };\n const menuDataFile = {\n ...menuTop,\n ...menuBottom\n };\n return {\n isAuth,\n menuDataFile\n };\n}\nfunction isCurrent(yesFn, noFn) {\n if (Info.name !== '..') return yesFn();\n noFn();\n}\nfunction isPath(x, y) {\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return false;\n const el = document.elementFromPoint(x, y);\n const elements = panel.querySelectorAll('[data-name=\"js-path\"] *');\n return ~[].indexOf.call(elements, el);\n}\nfunction beforeShow(callback, params) {\n const {\n name\n } = params;\n const el = DOM.getCurrentByPosition({\n x: params.x,\n y: params.y\n });\n const menuName = getMenuNameByEl(el);\n let isShow = menuName !== 'contextFile';\n if (params.name === 'contextFile') isShow = !isShow;\n if (isShow) MenuShowedName = name;\n exec(callback);\n if (isShow) isShow = isPath(params.x, params.y);\n return isShow;\n}\nconst beforeClick = name => MenuShowedName !== name;\nasync function _uploadTo(nameModule) {\n const [error, data] = await Info.getData();\n if (error) return;\n const {\n name\n } = Info;\n CloudCmd.execFromModule(nameModule, 'uploadFile', name, data);\n CloudCmd.log(`Uploading to ${name}...`);\n}\nfunction uploadFromCloud() {\n Images.show.load('top');\n CloudCmd.execFromModule('Cloud', 'saveFile', async (currentName, data) => {\n const path = DOM.getCurrentDirPath() + currentName;\n const [e] = await RESTful.write(path, data);\n if (e) return;\n await CloudCmd.refresh({\n currentName\n });\n });\n}\nfunction preDownload() {\n download(config('packer'));\n}\nfunction download(type) {\n const TIME = 30 * 1000;\n const {\n prefixURL\n } = CloudCmd;\n const PACK = '/pack';\n const date = Date.now();\n const files = DOM.getActiveFiles();\n if (!files.length) return alertNoFiles();\n for (const file of files) {\n const selected = DOM.isSelected(file);\n const isDir = DOM.isCurrentIsDir(file);\n const path = DOM.getCurrentPath(file);\n CloudCmd.log(`downloading file ${path}...`);\n\n /*\n * if we send ajax request -\n * no need in hash so we escape #\n * and all other characters, like \"%\"\n */\n const encodedPath = encodeURI(path).replace(/#/g, '%23');\n const id = getIdBySrc(path);\n let src;\n if (isDir) src = prefixURL + PACK + encodedPath + DOM.getPackerExt(type);else src = prefixURL + FS + encodedPath + '?download';\n const element = createElement('iframe', {\n id: id + '-' + date,\n async: false,\n className: 'hidden',\n src\n });\n const {\n body\n } = document;\n const removeChild = body.removeChild.bind(body, element);\n setTimeout(removeChild, TIME);\n if (selected) DOM.toggleSelectedFile(file);\n }\n}\nfunction getCurrentPosition() {\n const current = Info.element;\n const rect = current.getBoundingClientRect();\n const position = {\n x: Math.round(rect.left + rect.width / 3),\n y: Math.round(rect.top)\n };\n return position;\n}\nfunction listener(event) {\n const {\n F9,\n ESC\n } = Key;\n const key = event.keyCode;\n const isBind = Key.isBind();\n if (!isBind) return;\n if (key === ESC) return hide();\n if (key === F9) {\n const position = getCurrentPosition();\n MenuContext.show(position.x, position.y);\n event.preventDefault();\n }\n}\n\n//# sourceURL=file://cloudcmd/client/modules/menu.js");
|
|
167
167
|
|
|
168
168
|
/***/ })
|
|
169
169
|
|
|
@@ -187,7 +187,7 @@ eval("\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/cu
|
|
|
187
187
|
/***/ (function(module, exports, __webpack_require__) {
|
|
188
188
|
|
|
189
189
|
"use strict";
|
|
190
|
-
eval("/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global fileop */\n\n\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n encode\n} = __webpack_require__(/*! ../../../common/entity */ \"./common/entity.js\");\nconst removeExtension = __webpack_require__(/*! ./remove-extension */ \"./client/modules/operation/remove-extension.js\");\nconst setListeners = __webpack_require__(/*! ./set-listeners */ \"./client/modules/operation/set-listeners.js\");\nconst getNextCurrentName = __webpack_require__(/*! ./get-next-current-name */ \"./client/modules/operation/get-next-current-name.js\");\nconst removeQuery = a => a.replace(/\\?.*/, '');\nconst Name = 'Operation';\nCloudCmd[Name] = exports;\nconst {\n config\n} = CloudCmd;\nconst {\n Dialog,\n Images\n} = DOM;\nconst authCheck = wraptile(_authCheck);\nconst Operation = {};\nlet Loaded;\nlet copyFn;\nlet moveFn;\nlet deleteFn;\nlet extractFn;\nlet packZipFn;\nlet packTarFn;\nconst Info = DOM.CurrentInfo;\nconst showLoad = Images.show.load.bind(null, 'top');\nconst processFiles = currify(_processFiles);\nconst noFilesCheck = () => {\n const {\n length\n } = DOM.getActiveFiles();\n const is = Boolean(!length);\n if (is) return Dialog.alert.noFiles();\n return is;\n};\nmodule.exports.init = promisify(callback => {\n showLoad();\n exec.series([DOM.loadSocket, async callback => {\n if (config('dropbox')) return callback();\n const {\n prefix,\n prefixSocket\n } = CloudCmd;\n await loadAll();\n await initOperations(prefix, prefixSocket, callback);\n }, callback => {\n Loaded = true;\n Images.hide();\n callback();\n }], callback);\n});\nfunction _authCheck(spawn, ok) {\n const accept = wraptile(ok);\n const alertDialog = wraptile(Dialog.alert);\n spawn.on('accept', accept(spawn));\n spawn.on('reject', alertDialog('Wrong credentials!'));\n spawn.emit('auth', config('username'), config('password'));\n}\nconst onConnect = currify((fn, operator) => {\n setOperations(operator);\n fn();\n});\nasync function initOperations(prefix, socketPrefix, fn) {\n socketPrefix = `${socketPrefix}/fileop`;\n const operator = await fileop({\n prefix,\n socketPrefix\n });\n operator.on('connect', authCheck(operator, onConnect(fn)));\n}\nfunction setOperations(operator) {\n packTarFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Tar';\n const listen = setListeners({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.tar(from, to, names).then(listen);\n };\n packZipFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Zip';\n const listen = setListeners({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.zip(from, to, names).then(listen);\n };\n deleteFn = (from, files, callback) => {\n from = removeQuery(from);\n const operation = 'Delete';\n const listen = setListeners({\n operation,\n callback,\n from\n });\n operator.remove(from, files).then(listen);\n };\n copyFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Copy';\n const listen = setListeners({\n operation,\n callback,\n from,\n to,\n names\n });\n operator.copy(from, to, names).then(listen);\n };\n moveFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Move';\n const listen = setListeners({\n operation,\n callback,\n from,\n to\n });\n operator.move(from, to, names).then(listen);\n };\n extractFn = ({\n from,\n to\n }, callback) => {\n const operation = 'Extract';\n const listen = setListeners({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.extract(from, to).then(listen);\n };\n}\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nmodule.exports.show = (operation, data) => {\n if (!Loaded) return;\n if (operation === 'copy') return Operation.copy(data);\n if (operation === 'move') return Operation.move(data);\n if (operation === 'delete') return Operation.delete();\n if (operation === 'delete:silent') return Operation.deleteSilent();\n if (operation === 'pack') return Operation.pack();\n if (operation === 'extract') return Operation.extract();\n};\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\nOperation.extract = () => {\n twopack('extract');\n};\n\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\nasync function promptDelete() {\n if (noFilesCheck()) return;\n const msgAsk = 'Do you really want to delete the ';\n const msgSel = 'selected ';\n const files = DOM.getActiveFiles();\n const names = DOM.getFilenames(files);\n const n = names.length;\n let msg;\n if (n) {\n let name = '';\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n if (n >= 5) name += '\\n...';\n msg = msgAsk + msgSel + n + ' files/directories?\\n' + encode(name);\n } else {\n const current = DOM.getCurrentFile();\n const isDir = DOM.isCurrentIsDir(current);\n const getType = isDir => isDir ? 'directory' : 'file';\n const type = getType(isDir) + ' ';\n const name = DOM.getCurrentName(current);\n msg = msgAsk + msgSel + type + name + '?';\n }\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n deleteSilent(files);\n}\n\n/**\n * delete current or selected files\n *\n * @files\n */\nfunction deleteSilent(files = DOM.getActiveFiles()) {\n const query = '?files';\n const path = Info.dirPath;\n if (noFilesCheck()) return;\n showLoad();\n const removedNames = DOM.getFilenames(files);\n const names = DOM.CurrentInfo.files.map(DOM.getCurrentName);\n const currentName = DOM.getCurrentName();\n const nextCurrentName = getNextCurrentName(currentName, names, removedNames);\n deleteFn(path + query, removedNames, async () => {\n await CloudCmd.refresh();\n const names = Info.files.map(DOM.getCurrentName);\n const isCurrent = names.includes(currentName);\n const name = isCurrent ? currentName : nextCurrentName;\n DOM.setCurrentByName(name);\n });\n}\n\n/*\n * process files (copy or move)\n * @param data\n * @param operation\n */\nasync function _processFiles(options, data) {\n let selFiles;\n let files;\n let panel;\n let shouldAsk;\n let ok;\n let from = '';\n let to = '';\n let names = [];\n if (data) {\n from = data.from;\n to = data.to;\n names = data.names;\n panel = Info.panel;\n } else {\n from = Info.dirPath;\n to = DOM.getNotCurrentDirPath();\n selFiles = DOM.getSelectedFiles();\n names = DOM.getFilenames(selFiles);\n data = {};\n shouldAsk = true;\n panel = Info.panelPassive;\n }\n if (!names.length) names.push(DOM.getCurrentName());\n const [name] = names;\n const sameName = DOM.getCurrentByName(name, panel);\n if (!data && noFilesCheck()) return;\n const {\n type\n } = options;\n const isCopy = type === 'copy';\n const option = isCopy ? 'confirmCopy' : 'confirmMove';\n const title = isCopy ? 'Copy' : 'Rename/Move';\n const operation = isCopy ? copyFn : moveFn;\n if (shouldAsk && config(option)) {\n const [cancel, newTo] = await prompt(title, to, names.map(encode));\n if (!cancel) ask(newTo);\n return;\n }\n ask(to);\n function ask(to) {\n ok = from !== to && to;\n if (ok && !shouldAsk || !sameName) return go();\n const str = `\"${name}\" already exist. Overwrite?`;\n const cancel = false;\n Dialog.confirm(str, {\n cancel\n }).then(go);\n function go() {\n showLoad();\n files = {\n from,\n to,\n names\n };\n operation(files, async () => {\n await DOM.Storage.remove(from);\n const {\n panel,\n panelPassive\n } = Info;\n if (!Info.isOnePanel) CloudCmd.refresh({\n panel: panelPassive,\n noCurrent: true\n });\n CloudCmd.refresh({\n panel\n });\n });\n }\n }\n}\nfunction checkEmpty(name, operation) {\n if (!operation) throw Error(`${name} could not be empty!`);\n}\nfunction twopack(operation, type) {\n let op;\n let fileFrom;\n let currentName = Info.name;\n const {\n path,\n dirPath\n } = Info;\n const activeFiles = DOM.getActiveFiles();\n const names = DOM.getFilenames(activeFiles);\n checkEmpty('operation', operation);\n if (!names.length) return Dialog.alert.noFiles();\n switch (operation) {\n case 'extract':\n op = extractFn;\n fileFrom = {\n from: path,\n to: dirPath\n };\n currentName = removeExtension(currentName);\n break;\n case 'pack':\n op = getPacker(type);\n if (names.length > 1) currentName = Info.dir;\n currentName += DOM.getPackerExt(type);\n fileFrom = {\n from: dirPath,\n to: dirPath + currentName,\n names\n };\n break;\n }\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\n });\n}\nasync function prompt(msg, to, names) {\n const n = names.length;\n const [name] = names;\n msg += ' ';\n if (names.length > 1) msg += `${n} file(s)`;else msg += `\"${name}\"`;\n msg += ' to';\n return await Dialog.prompt(msg, to);\n}\nasync function loadAll() {\n const {\n prefix\n } = CloudCmd;\n const file = `${prefix}/fileop/fileop.js`;\n const [error] = await tryToCatch(load.js, file);\n if (error) Dialog.alert(error.message);\n Loaded = true;\n}\n\n//# sourceURL=file://cloudcmd/client/modules/operation/index.js");
|
|
190
|
+
eval("/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global fileop */\n\n\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst {\n encode\n} = __webpack_require__(/*! ../../../common/entity */ \"./common/entity.js\");\nconst removeExtension = __webpack_require__(/*! ./remove-extension */ \"./client/modules/operation/remove-extension.js\");\nconst setListeners = __webpack_require__(/*! ./set-listeners */ \"./client/modules/operation/set-listeners.js\");\nconst getNextCurrentName = __webpack_require__(/*! ./get-next-current-name */ \"./client/modules/operation/get-next-current-name.js\");\nconst removeQuery = a => a.replace(/\\?.*/, '');\nconst Name = 'Operation';\nCloudCmd[Name] = exports;\nconst {\n config\n} = CloudCmd;\nconst {\n Dialog,\n Images\n} = DOM;\nconst authCheck = wraptile(_authCheck);\nconst Operation = {};\nlet Loaded;\nlet copyFn;\nlet moveFn;\nlet deleteFn;\nlet extractFn;\nlet packZipFn;\nlet packTarFn;\nconst Info = DOM.CurrentInfo;\nconst showLoad = Images.show.load.bind(null, 'top');\nconst processFiles = currify(_processFiles);\nconst noFilesCheck = () => {\n const {\n length\n } = DOM.getActiveFiles();\n const is = Boolean(!length);\n if (is) return Dialog.alert.noFiles();\n return is;\n};\nmodule.exports.init = promisify(callback => {\n showLoad();\n exec.series([DOM.loadSocket, async callback => {\n if (config('dropbox')) return callback();\n const {\n prefix,\n prefixSocket\n } = CloudCmd;\n await loadAll();\n await initOperations(prefix, prefixSocket, callback);\n }, callback => {\n Loaded = true;\n Images.hide();\n callback();\n }], callback);\n});\nfunction _authCheck(spawn, ok) {\n const accept = wraptile(ok);\n const alertDialog = wraptile(Dialog.alert);\n spawn.on('accept', accept(spawn));\n spawn.on('reject', alertDialog('Wrong credentials!'));\n spawn.emit('auth', config('username'), config('password'));\n}\nconst onConnect = currify((fn, operator) => {\n setOperations(operator);\n fn();\n});\nasync function initOperations(prefix, socketPrefix, fn) {\n socketPrefix = `${socketPrefix}/fileop`;\n const operator = await fileop({\n prefix,\n socketPrefix\n });\n operator.on('connect', authCheck(operator, onConnect(fn)));\n}\nfunction setOperations(operator) {\n packTarFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Tar';\n const listen = setListeners({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.tar(from, to, names).then(listen);\n };\n packZipFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Zip';\n const listen = setListeners({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.zip(from, to, names).then(listen);\n };\n deleteFn = (from, files, callback) => {\n from = removeQuery(from);\n const operation = 'Delete';\n const listen = setListeners({\n operation,\n callback,\n from\n });\n operator.remove(from, files).then(listen);\n };\n copyFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Copy';\n const listen = setListeners({\n operation,\n callback,\n from,\n to,\n names\n });\n operator.copy(from, to, names).then(listen);\n };\n moveFn = ({\n from,\n to,\n names\n }, callback) => {\n const operation = 'Move';\n const listen = setListeners({\n operation,\n callback,\n from,\n to\n });\n operator.move(from, to, names).then(listen);\n };\n extractFn = ({\n from,\n to\n }, callback) => {\n const operation = 'Extract';\n const listen = setListeners({\n operation,\n callback,\n noContinue: true,\n from,\n to\n });\n operator.extract(from, to).then(listen);\n };\n}\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nmodule.exports.show = (operation, data) => {\n if (!Loaded) return;\n if (operation === 'copy') return Operation.copy(data);\n if (operation === 'move') return Operation.move(data);\n if (operation === 'delete') return Operation.delete();\n if (operation === 'delete:silent') return Operation.deleteSilent();\n if (operation === 'pack') return Operation.pack();\n if (operation === 'extract') return Operation.extract();\n};\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\nOperation.extract = () => {\n twopack('extract');\n};\n\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\nasync function promptDelete() {\n if (noFilesCheck()) return;\n const msgAsk = 'Do you really want to delete the ';\n const msgSel = 'selected ';\n const files = DOM.getActiveFiles();\n const names = DOM.getFilenames(files);\n const n = names.length;\n let msg;\n if (n) {\n let name = '';\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n if (n >= 5) name += '\\n...';\n msg = msgAsk + msgSel + n + ' files/directories?\\n' + encode(name);\n } else {\n const current = DOM.getCurrentFile();\n const isDir = DOM.isCurrentIsDir(current);\n const getType = isDir => isDir ? 'directory' : 'file';\n const type = getType(isDir) + ' ';\n const name = DOM.getCurrentName(current);\n msg = msgAsk + msgSel + type + name + '?';\n }\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n deleteSilent(files);\n}\n\n/**\n * delete current or selected files\n *\n * @files\n */\nfunction deleteSilent(files = DOM.getActiveFiles()) {\n const query = '?files';\n const path = Info.dirPath;\n if (noFilesCheck()) return;\n showLoad();\n const removedNames = DOM.getFilenames(files);\n const names = DOM.CurrentInfo.files.map(DOM.getCurrentName);\n const currentName = DOM.getCurrentName();\n const nextCurrentName = getNextCurrentName(currentName, names, removedNames);\n deleteFn(path + query, removedNames, async () => {\n await CloudCmd.refresh();\n const names = Info.files.map(DOM.getCurrentName);\n const isCurrent = names.includes(currentName);\n const name = isCurrent ? currentName : nextCurrentName;\n DOM.setCurrentByName(name);\n });\n}\n\n/*\n * process files (copy or move)\n * @param data\n * @param operation\n */\nasync function _processFiles(options, data) {\n let selFiles;\n let files;\n let panel;\n let shouldAsk;\n let ok;\n let from = '';\n let to = '';\n let names = [];\n if (data) {\n ({\n from,\n to,\n names\n } = data);\n ({\n panel\n } = Info);\n } else {\n from = Info.dirPath;\n to = DOM.getNotCurrentDirPath();\n selFiles = DOM.getSelectedFiles();\n names = DOM.getFilenames(selFiles);\n data = {};\n shouldAsk = true;\n panel = Info.panelPassive;\n }\n if (!names.length) names.push(DOM.getCurrentName());\n const [name] = names;\n const sameName = DOM.getCurrentByName(name, panel);\n if (!data && noFilesCheck()) return;\n const {\n type\n } = options;\n const isCopy = type === 'copy';\n const option = isCopy ? 'confirmCopy' : 'confirmMove';\n const title = isCopy ? 'Copy' : 'Rename/Move';\n const operation = isCopy ? copyFn : moveFn;\n if (shouldAsk && config(option)) {\n const [cancel, newTo] = await prompt(title, to, names.map(encode));\n if (!cancel) ask(newTo);\n return;\n }\n ask(to);\n function ask(to) {\n ok = from !== to && to;\n if (ok && !shouldAsk || !sameName) return go();\n const str = `\"${name}\" already exist. Overwrite?`;\n const cancel = false;\n Dialog.confirm(str, {\n cancel\n }).then(go);\n function go() {\n showLoad();\n files = {\n from,\n to,\n names\n };\n operation(files, async () => {\n await DOM.Storage.remove(from);\n const {\n panel,\n panelPassive\n } = Info;\n if (!Info.isOnePanel) CloudCmd.refresh({\n panel: panelPassive,\n noCurrent: true\n });\n CloudCmd.refresh({\n panel\n });\n });\n }\n }\n}\nfunction checkEmpty(name, operation) {\n if (!operation) throw Error(`${name} could not be empty!`);\n}\nfunction twopack(operation, type) {\n let op;\n let fileFrom;\n let currentName = Info.name;\n const {\n path,\n dirPath\n } = Info;\n const activeFiles = DOM.getActiveFiles();\n const names = DOM.getFilenames(activeFiles);\n checkEmpty('operation', operation);\n if (!names.length) return Dialog.alert.noFiles();\n switch (operation) {\n case 'extract':\n op = extractFn;\n fileFrom = {\n from: path,\n to: dirPath\n };\n currentName = removeExtension(currentName);\n break;\n case 'pack':\n op = getPacker(type);\n if (names.length > 1) currentName = Info.dir;\n currentName += DOM.getPackerExt(type);\n fileFrom = {\n from: dirPath,\n to: dirPath + currentName,\n names\n };\n break;\n }\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\n });\n}\nasync function prompt(msg, to, names) {\n const n = names.length;\n const [name] = names;\n msg += ' ';\n if (names.length > 1) msg += `${n} file(s)`;else msg += `\"${name}\"`;\n msg += ' to';\n return await Dialog.prompt(msg, to);\n}\nasync function loadAll() {\n const {\n prefix\n } = CloudCmd;\n const file = `${prefix}/fileop/fileop.js`;\n const [error] = await tryToCatch(load.js, file);\n if (error) Dialog.alert(error.message);\n Loaded = true;\n}\n\n//# sourceURL=file://cloudcmd/client/modules/operation/index.js");
|
|
191
191
|
|
|
192
192
|
/***/ }),
|
|
193
193
|
|
package/dist-dev/sw.js
CHANGED
|
@@ -103,7 +103,7 @@ var serviceWorkerOption = {
|
|
|
103
103
|
/***/ (function(module, exports, __webpack_require__) {
|
|
104
104
|
|
|
105
105
|
"use strict";
|
|
106
|
-
eval("\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isDev = process.env.NODE_ENV === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"
|
|
106
|
+
eval("\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isDev = process.env.NODE_ENV === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"Thu Apr 10 2025 17:24:08 GMT+0300 (Eastern European Summer Time)\";\nconst NAME = `cloudcmd: ${date}`;\nconst createRequest = a => new Request(a, {\n credentials: 'same-origin'\n});\nconst getRequest = (a, request) => {\n if (a !== '/') return request;\n return createRequest('/');\n};\nself.addEventListener('install', wait(onInstall));\nself.addEventListener('fetch', respondWith(onFetch));\nself.addEventListener('activate', wait(onActivate));\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await self.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n await Promise.all(keys.map(deleteCache));\n}\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n await self.skipWaiting();\n}\nasync function onFetch(event) {\n const {\n request\n } = event;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n if (!isDev && response) return response;\n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin'\n });\n if (e) return new Response(e.message);\n await addToCache(request, resp.clone());\n return resp;\n}\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n\n//# sourceURL=file://cloudcmd/client/sw/sw.js");
|
|
107
107
|
|
|
108
108
|
/***/ }),
|
|
109
109
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcmd",
|
|
3
|
-
"version": "18.5.
|
|
3
|
+
"version": "18.5.2",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "File manager for the web with console and editor",
|
|
@@ -93,7 +93,6 @@
|
|
|
93
93
|
"@cloudcmd/move-files": "^8.0.0",
|
|
94
94
|
"@cloudcmd/read-files-sync": "^2.0.0",
|
|
95
95
|
"@putout/cli-validate-args": "^2.0.0",
|
|
96
|
-
"@putout/plugin-cloudcmd": "^3.1.1",
|
|
97
96
|
"apart": "^2.0.0",
|
|
98
97
|
"chalk": "^5.3.0",
|
|
99
98
|
"compression": "^1.7.4",
|
|
@@ -130,7 +129,7 @@
|
|
|
130
129
|
"package-json": "^10.0.0",
|
|
131
130
|
"ponse": "^7.0.0",
|
|
132
131
|
"pullout": "^5.0.0",
|
|
133
|
-
"putout": "^
|
|
132
|
+
"putout": "^40.0.3",
|
|
134
133
|
"redzip": "^3.0.0",
|
|
135
134
|
"rendy": "^4.1.3",
|
|
136
135
|
"restafary": "^12.0.0",
|
|
@@ -159,6 +158,7 @@
|
|
|
159
158
|
"@cloudcmd/olark": "^3.0.2",
|
|
160
159
|
"@cloudcmd/stub": "^4.0.1",
|
|
161
160
|
"@putout/babel": "^3.0.0",
|
|
161
|
+
"@putout/plugin-cloudcmd": "^4.0.0",
|
|
162
162
|
"@types/node-fetch": "^2.6.11",
|
|
163
163
|
"auto-globals": "^4.0.0",
|
|
164
164
|
"babel-loader": "^8.0.0",
|
|
@@ -171,9 +171,9 @@
|
|
|
171
171
|
"css-modules-require-hook": "^4.2.3",
|
|
172
172
|
"domtokenlist-shim": "^1.2.0",
|
|
173
173
|
"emitify": "^4.0.1",
|
|
174
|
-
"eslint": "^
|
|
174
|
+
"eslint": "^9.23.0",
|
|
175
175
|
"eslint-plugin-n": "^17.0.0-4",
|
|
176
|
-
"eslint-plugin-putout": "^
|
|
176
|
+
"eslint-plugin-putout": "^26.1.0",
|
|
177
177
|
"extract-text-webpack-plugin": "^4.0.0-alpha.0",
|
|
178
178
|
"gritty": "^8.0.0",
|
|
179
179
|
"gunzip-maybe": "^1.3.1",
|
|
@@ -184,7 +184,7 @@
|
|
|
184
184
|
"just-pascal-case": "^3.2.0",
|
|
185
185
|
"limier": "^3.0.0",
|
|
186
186
|
"load.js": "^3.0.0",
|
|
187
|
-
"madrun": "^
|
|
187
|
+
"madrun": "^11.0.0",
|
|
188
188
|
"memfs": "^4.2.0",
|
|
189
189
|
"minor": "^1.2.2",
|
|
190
190
|
"mock-require": "^3.0.1",
|
|
@@ -195,8 +195,9 @@
|
|
|
195
195
|
"optimize-css-assets-webpack-plugin": "^5.0.0",
|
|
196
196
|
"philip": "^3.0.0",
|
|
197
197
|
"place": "^1.1.4",
|
|
198
|
+
"postcss": "^8.5.3",
|
|
198
199
|
"readjson": "^2.0.1",
|
|
199
|
-
"redlint": "^
|
|
200
|
+
"redlint": "^4.1.1",
|
|
200
201
|
"request": "^2.76.0",
|
|
201
202
|
"rimraf": "^6.0.1",
|
|
202
203
|
"scroll-into-view-if-needed": "^3.0.4",
|
|
@@ -205,7 +206,7 @@
|
|
|
205
206
|
"smalltalk": "^4.0.0",
|
|
206
207
|
"style-loader": "^2.0.0",
|
|
207
208
|
"supermenu": "^4.0.1",
|
|
208
|
-
"supertape": "^
|
|
209
|
+
"supertape": "^11.0.4",
|
|
209
210
|
"tar-stream": "^3.0.0",
|
|
210
211
|
"unionfs": "^4.0.0",
|
|
211
212
|
"url-loader": "^4.0.0",
|
package/server/repl.js
CHANGED
|
@@ -6,22 +6,22 @@ const repl = require('node:repl');
|
|
|
6
6
|
|
|
7
7
|
module.exports = net
|
|
8
8
|
.createServer((socket) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
9
|
+
const {pid} = process;
|
|
10
|
+
const addr = socket.remoteAddress;
|
|
11
|
+
const port = socket.remotePort;
|
|
12
|
+
|
|
13
|
+
const r = repl.start({
|
|
14
|
+
prompt: `[${pid} ${addr}:${port}>`,
|
|
15
|
+
input: socket,
|
|
16
|
+
output: socket,
|
|
17
|
+
terminal: true,
|
|
18
|
+
useGlobal: false,
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
r.on('exit', () => {
|
|
22
|
+
socket.end();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
r.context.socket = socket;
|
|
26
|
+
})
|
|
27
27
|
.listen(1337);
|