cloudcmd 16.3.0 → 16.4.1
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 +20 -0
- package/HELP.md +10 -5
- package/README.md +6 -4
- 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/edit-file.js +1 -1
- package/dist/modules/edit-names.js +1 -1
- package/dist/modules/menu.js +1 -1
- package/dist/modules/user-menu.js +1 -1
- package/dist/sw.js +1 -1
- package/dist-dev/cloudcmd.common.css +6 -6
- package/dist-dev/cloudcmd.common.js +1 -1
- package/dist-dev/cloudcmd.js +1 -1
- package/dist-dev/sw.js +1 -1
- package/package.json +4 -3
- package/server/env.js +8 -2
- package/server/rest/index.js +1 -0
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t){function e(e){for(var n,d,l=e[0],u=e[1],a=e[2],c=0,f=[];c<l.length;c++)d=l[c],Object.prototype.hasOwnProperty.call(r,d)&&r[d]&&f.push(r[d][0]),r[d]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(t[n]=u[n]);for(s&&s(e);f.length;)f.shift()();return i.push.apply(i,a||[]),o()}function o(){for(var t,e=0;e<i.length;e++){for(var o=i[e],n=!0,l=1;l<o.length;l++){var u=o[l];0!==r[u]&&(n=!1)}n&&(i.splice(e--,1),t=d(d.s=o[0]))}return t}var n={},r={5:0},i=[];function d(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,d),o.l=!0,o.exports}d.m=t,d.c=n,d.d=function(t,e,o){d.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},d.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},d.t=function(t,e){if(1&e&&(t=d(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(d.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)d.d(o,n,function(e){return t[e]}.bind(null,n));return o},d.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return d.d(e,"a",e),e},d.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},d.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],u=l.push.bind(l);l.push=e,l=l.slice();for(var a=0;a<l.length;a++)e(l[a]);var s=u;i.push([84,0]),o()}({84:function(t,e,o){"use strict";CloudCmd.EditFile=e;const n=o(32),r=o(7),i=o(5),d=o(
|
|
1
|
+
!function(t){function e(e){for(var n,d,l=e[0],u=e[1],a=e[2],c=0,f=[];c<l.length;c++)d=l[c],Object.prototype.hasOwnProperty.call(r,d)&&r[d]&&f.push(r[d][0]),r[d]=0;for(n in u)Object.prototype.hasOwnProperty.call(u,n)&&(t[n]=u[n]);for(s&&s(e);f.length;)f.shift()();return i.push.apply(i,a||[]),o()}function o(){for(var t,e=0;e<i.length;e++){for(var o=i[e],n=!0,l=1;l<o.length;l++){var u=o[l];0!==r[u]&&(n=!1)}n&&(i.splice(e--,1),t=d(d.s=o[0]))}return t}var n={},r={5:0},i=[];function d(e){if(n[e])return n[e].exports;var o=n[e]={i:e,l:!1,exports:{}};return t[e].call(o.exports,o,o.exports,d),o.l=!0,o.exports}d.m=t,d.c=n,d.d=function(t,e,o){d.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},d.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},d.t=function(t,e){if(1&e&&(t=d(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(d.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)d.d(o,n,function(e){return t[e]}.bind(null,n));return o},d.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return d.d(e,"a",e),e},d.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},d.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],u=l.push.bind(l);l.push=e,l=l.slice();for(var a=0;a<l.length;a++)e(l[a]);var s=u;i.push([84,0]),o()}({84:function(t,e,o){"use strict";CloudCmd.EditFile=e;const n=o(32),r=o(7),i=o(5),d=o(21),l=DOM.CurrentInfo,{Dialog:u,Images:a}=DOM,{config:s}=CloudCmd;let c,f;const C=r(),p={beforeClose:async()=>{i.ifExist(c,"hide"),await g()}};function m(){CloudCmd.Edit.hide()}function h(t){const e={x:t.clientX,y:t.clientY};if(t.preventDefault(),c)return;const o={beforeShow:t=>{t.x-=18,t.y-=27},afterClick:()=>{CloudCmd.Edit.getEditor().focus()}},n=CloudCmd.Edit.getElement();c=d(n,o,function(){const t=CloudCmd.Edit.getEditor();return{"Save Ctrl+S":()=>{t.save()},"Go To Line Ctrl+G":()=>{t.goToLine()},"Cut Ctrl+X":()=>{t.cutToClipboard()},"Copy Ctrl+C":()=>{t.copyToClipboard()},"Paste Ctrl+V":()=>{t.pasteFromClipboard()},"Delete Del":()=>{t.remove("right")},"Select All Ctrl+A":()=>{t.selectAll()},"Close Esc":m}}()),c.addContextMenuListener(),c.show(e.x,e.y)}async function g(){const t=CloudCmd.Edit.getEditor();if(!t.isChanged())return;const[e]=await u.confirm(f);e||t.save()}t.exports.init=async()=>{C(!0),await CloudCmd.Edit();const t=CloudCmd.Edit.getEditor();var e;(e=t).emit("auth",s("username"),s("password")),e.on("reject",()=>{u.alert("Wrong credentials!")}),function(t){const e=CloudCmd.Edit.getElement();DOM.Events.addOnce("contextmenu",e,h),t.on("save",t=>{DOM.setCurrentSize(n.size(t))})}(t),C(!1)},t.exports.show=async t=>{if(C())return;const e={...p,...t};CloudCmd.config("showFileName")&&(e.title=l.name),a.show.load(),CloudCmd.Edit.getEditor().setOption("keyMap","default");const[o,n]=await l.getData();if(o)return a.hide(),CloudCmd.Edit;const{path:r}=l,i=function(){const{name:t,isDir:e}=l;return e?t+".json":t}();return function(t){f="Do you want to save changes to "+t+"?"}(i),CloudCmd.Edit.getEditor().setValueFirst(r,n).setModeForPath(i).enableKey(),CloudCmd.Edit.show(e),CloudCmd.Edit},t.exports.hide=m,t.exports.isChanged=g}});
|
|
2
2
|
//# sourceMappingURL=edit-file.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e){function t(t){for(var o,d,l=t[0],u=t[1],s=t[2],a=0,f=[];a<l.length;a++)d=l[a],Object.prototype.hasOwnProperty.call(r,d)&&r[d]&&f.push(r[d][0]),r[d]=0;for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&(e[o]=u[o]);for(c&&c(t);f.length;)f.shift()();return i.push.apply(i,s||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],o=!0,l=1;l<n.length;l++){var u=n[l];0!==r[u]&&(o=!1)}o&&(i.splice(t--,1),e=d(d.s=n[0]))}return e}var o={},r={7:0},i=[];function d(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,d),n.l=!0,n.exports}d.m=e,d.c=o,d.d=function(e,t,n){d.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.t=function(e,t){if(1&t&&(e=d(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(d.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)d.d(n,o,function(t){return e[t]}.bind(null,o));return n},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,"a",t),t},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],u=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var c=u;i.push([89,0]),n()}({89:function(e,t,n){"use strict";CloudCmd.EditNames=t;const o=n(0),r=n(5),i=n(
|
|
1
|
+
!function(e){function t(t){for(var o,d,l=t[0],u=t[1],s=t[2],a=0,f=[];a<l.length;a++)d=l[a],Object.prototype.hasOwnProperty.call(r,d)&&r[d]&&f.push(r[d][0]),r[d]=0;for(o in u)Object.prototype.hasOwnProperty.call(u,o)&&(e[o]=u[o]);for(c&&c(t);f.length;)f.shift()();return i.push.apply(i,s||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],o=!0,l=1;l<n.length;l++){var u=n[l];0!==r[u]&&(o=!1)}o&&(i.splice(t--,1),e=d(d.s=n[0]))}return e}var o={},r={7:0},i=[];function d(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,d),n.l=!0,n.exports}d.m=e,d.c=o,d.d=function(e,t,n){d.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},d.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},d.t=function(e,t){if(1&t&&(e=d(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(d.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)d.d(n,o,function(t){return e[t]}.bind(null,o));return n},d.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return d.d(t,"a",t),t},d.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},d.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],u=l.push.bind(l);l.push=t,l=l.slice();for(var s=0;s<l.length;s++)t(l[s]);var c=u;i.push([89,0]),n()}({89:function(e,t,n){"use strict";CloudCmd.EditNames=t;const o=n(0),r=n(5),i=n(21),d=n(90),l=Promise.reject.bind(Promise),u=DOM.CurrentInfo,{Dialog:s}=DOM,c=o((function(e,t,n){if(404===n.status)return n.text().then(l);const o=e[t];CloudCmd.refresh({currentName:o})})),a=o((function(e,t,n,o){const r=function(e,t){return"/"===e?t:e+t}(o,e),{prefix:i}=CloudCmd;return fetch(i+"/rename",{method:"put",credentials:"include",body:JSON.stringify({from:t,to:n,dir:r})})}));let f;const p={beforeClose:async()=>{r.ifExist(f,"hide"),DOM.Events.remove("keydown",C),await b()}};async function C(e){const t=e.ctrlKey,n=e.metaKey,o=t||n,{Key:r}=CloudCmd;if(o&&e.keyCode===r.S)y();else if(o&&e.keyCode===r.P){const[,e]=await s.prompt("Apply pattern:","[n][e]");e&&function(e){const t=d(e,m());CloudCmd.Edit.getEditor().setValue(t.join("\n"))}(e)}}function m(){return DOM.getFilenames(DOM.getActiveFiles())}function y(){CloudCmd.Edit.hide()}function h(){const e=u.dirPath,t=m(),n=t.indexOf(u.name),o=CloudCmd.Edit.getEditor().getValue().split("\n"),r=CloudCmd.config("root");Promise.resolve(r).then(a(e,t,o)).then(c(o,n)).catch(alert)}function g(e){const t={x:e.clientX,y:e.clientY};if(e.preventDefault(),f)return;const n=CloudCmd.Edit.getEditor(),o={beforeShow:e=>{e.x-=18,e.y-=27},afterClick:()=>{n.focus()}},r={"Save Ctrl+S":()=>{h(),y()},"Go To Line Ctrl+G":()=>{n.goToLine()},"Cut Ctrl+X":()=>{n.cutToClipboard()},"Copy Ctrl+C":()=>{n.copyToClipboard()},"Paste Ctrl+V":()=>{n.pasteFromClipboard()},"Delete Del":()=>{n.remove("right")},"Select All Ctrl+A":()=>{n.selectAll()},"Close Esc":y},d=CloudCmd.Edit.getElement();f=i(d,o,r),f.addContextMenuListener(),f.show(t.x,t.y)}async function b(){if(!CloudCmd.Edit.getEditor().isChanged())return;const[,e]=await s.confirm("Apply new names?");e&&h()}e.exports.init=async()=>{await CloudCmd.Edit(),function(){const e=CloudCmd.Edit.getElement();DOM.Events.addOnce("contextmenu",e,g)}()},e.exports.show=e=>{const t=m().join("\n"),n={...p,...e};return".."===u.name&&1===t.length?s.alert.noFiles():(DOM.Events.addKey(C),CloudCmd.Edit.getEditor().setValueFirst("edit-names",t).setMode().setOption("keyMap","default").disableKey(),CloudCmd.Edit.show(n),CloudCmd.Edit)},e.exports.hide=y,e.exports.isChanged=b}});
|
|
2
2
|
//# sourceMappingURL=edit-names.js.map
|
package/dist/modules/menu.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e){function t(t){for(var o,u,l=t[0],c=t[1],d=t[2],s=0,f=[];s<l.length;s++)u=l[s],Object.prototype.hasOwnProperty.call(r,u)&&r[u]&&f.push(r[u][0]),r[u]=0;for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(e[o]=c[o]);for(a&&a(t);f.length;)f.shift()();return i.push.apply(i,d||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],o=!0,l=1;l<n.length;l++){var c=n[l];0!==r[c]&&(o=!1)}o&&(i.splice(t--,1),e=u(u.s=n[0]))}return e}var o={},r={12:0},i=[];function u(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=o,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)u.d(n,o,function(t){return e[t]}.bind(null,o));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],c=l.push.bind(l);l.push=t,l=l.slice();for(var d=0;d<l.length;d++)t(l[d]);var a=c;i.push([93,0]),n()}({93:function(e,t,n){"use strict";const o=n(5),r=n(8),i=n(
|
|
1
|
+
!function(e){function t(t){for(var o,u,l=t[0],c=t[1],d=t[2],s=0,f=[];s<l.length;s++)u=l[s],Object.prototype.hasOwnProperty.call(r,u)&&r[u]&&f.push(r[u][0]),r[u]=0;for(o in c)Object.prototype.hasOwnProperty.call(c,o)&&(e[o]=c[o]);for(a&&a(t);f.length;)f.shift()();return i.push.apply(i,d||[]),n()}function n(){for(var e,t=0;t<i.length;t++){for(var n=i[t],o=!0,l=1;l<n.length;l++){var c=n[l];0!==r[c]&&(o=!1)}o&&(i.splice(t--,1),e=u(u.s=n[0]))}return e}var o={},r={12:0},i=[];function u(t){if(o[t])return o[t].exports;var n=o[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=o,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)u.d(n,o,function(t){return e[t]}.bind(null,o));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/dist/";var l=window.webpackJsonp=window.webpackJsonp||[],c=l.push.bind(l);l.push=t,l=l.slice();for(var d=0;d<l.length;d++)t(l[d]);var a=c;i.push([93,0]),n()}({93:function(e,t,n){"use strict";const o=n(5),r=n(8),i=n(21),u=n(2),{FS:l}=n(6),{getIdBySrc:c}=n(14),d=n(18),{config:a,Key:s}=CloudCmd,{Buffer:f,Events:p,Dialog:C,Images:m}=DOM,h=DOM.CurrentInfo,y=C.alert.noFiles,g=r((async function(e){const[t,n]=await h.getData();if(t)return;const{name:o}=h;CloudCmd.execFromModule(e,"uploadFile",o,n),CloudCmd.log("Uploading to "+o+"...")}));let w,x,O;function D(){x.hide(),O.hide()}function M(e){let t,n,{type:r}=e;"context"===r?(t="context",n=s.unsetBind):"file"===r&&(t="contextFile");return{icon:!0,beforeClose:s.setBind,beforeShow:o.with(v,n),beforeClick:P,name:t}}function b(e){const t={Paste:f.paste,New:{File:DOM.promptNewFile,Directory:DOM.promptNewDir},Upload:()=>{CloudCmd.Upload.show()},"Upload From Cloud":S,"(Un)Select All":DOM.toggleAllSelectedFiles};return e&&(t["Log Out"]=CloudCmd.logOut),t}function F(e,t){if(".."!==h.name)return e();t()}function v(e,t){const{name:n}=t;let r="contextFile"!==function(e){return e?".."===DOM.getCurrentName(e)?"context":"contextFile":"context"}(DOM.getCurrentByPosition({x:t.x,y:t.y}));return"contextFile"===t.name&&(r=!r),r&&(w=n),o(e),r&&(r=function(e,t){const{panel:n}=h;if(!n)return!1;const o=document.elementFromPoint(e,t),r=n.querySelectorAll('[data-name="js-path"] *');return~[].indexOf.call(r,o)}(t.x,t.y)),r}function P(e){return w!==e}function S(){m.show.load("top"),CloudCmd.execFromModule("Cloud","saveFile",async(e,t)=>{const n=DOM.getCurrentDirPath()+e,[o]=await d.write(n,t);o||await CloudCmd.refresh({currentName:e})})}function j(){!function(e){const{prefixURL:t}=CloudCmd,n=Date.now(),o=DOM.getActiveFiles();if(!o.length)return y();for(const r of o){const o=DOM.isSelected(r),i=DOM.isCurrentIsDir(r),d=DOM.getCurrentPath(r);CloudCmd.log("downloading file "+d+"...");const a=encodeURI(d).replace(/#/g,"%23"),s=c(d);let f;f=i?t+"/pack"+a+DOM.getPackerExt(e):t+l+a+"?download";const p=u("iframe",{id:s+"-"+n,async:!1,className:"hidden",src:f}),{body:C}=document,m=C.removeChild.bind(C,p);setTimeout(m,3e4),o&&DOM.toggleSelectedFile(r)}}(a("packer"))}function k(){const e=h.element.getBoundingClientRect();return{x:Math.round(e.left+e.width/3),y:Math.round(e.top)}}function E(e){const{F9:t,ESC:n}=s,o=e.keyCode;if(s.isBind()){if(o===n)return D();if(o===t){const t=k();x.show(t.x,t.y),e.preventDefault()}}}e.exports.ENABLED=!1,CloudCmd.Menu=t,e.exports.init=()=>{const{isAuth:e,menuDataFile:t}=function(){const e=CloudCmd.config("auth"),t=b(e),n={View:()=>{CloudCmd.View.show()},Edit:()=>{const e=a("vim")?"EditFileVim":"EditFile";CloudCmd[e].show()},Rename:()=>{setTimeout(DOM.renameCurrent,100)},Delete:()=>{CloudCmd.Operation.show("delete")},Pack:()=>{CloudCmd.Operation.show("pack")},Extract:()=>{CloudCmd.Operation.show("extract")},Download:j,"Upload To Cloud":g("Cloud"),Cut:()=>{F(f.cut,y)},Copy:()=>{F(f.copy,y)},...t};return{isAuth:e,menuDataFile:n}}(),n=DOM.getFM(),o=b(e),r=M({type:"context"}),u=M({type:"file"});x=i(n,r,o),O=i(n,u,t),x.addContextMenuListener(),O.addContextMenuListener(),p.addKey(E)},e.exports.hide=D,e.exports.show=e=>{const{x:t,y:n}=function(e){return e?{x:e.x,y:e.y}:k()}(e);x.show(t,n),O.show(t,n),m.hide()}}});
|
|
2
2
|
//# sourceMappingURL=menu.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e){function t(t){for(var r,u,c=t[0],i=t[1],a=t[2],d=0,f=[];d<c.length;d++)u=c[d],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&f.push(o[u][0]),o[u]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(l&&l(t);f.length;)f.shift()();return s.push.apply(s,a||[]),n()}function n(){for(var e,t=0;t<s.length;t++){for(var n=s[t],r=!0,c=1;c<n.length;c++){var i=n[c];0!==o[i]&&(r=!1)}r&&(s.splice(t--,1),e=u(u.s=n[0]))}return e}var r={},o={18:0},s=[];function u(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=r,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/dist/";var c=window.webpackJsonp=window.webpackJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var a=0;a<c.length;a++)t(c[a]);var l=i;s.push([117,0]),n()}({117:function(e,t,n){"use strict";n(181);const r=n(0),o=n(8),s=n(7),u=n(4),c=n(2),i=n(
|
|
1
|
+
!function(e){function t(t){for(var r,u,c=t[0],i=t[1],a=t[2],d=0,f=[];d<c.length;d++)u=c[d],Object.prototype.hasOwnProperty.call(o,u)&&o[u]&&f.push(o[u][0]),o[u]=0;for(r in i)Object.prototype.hasOwnProperty.call(i,r)&&(e[r]=i[r]);for(l&&l(t);f.length;)f.shift()();return s.push.apply(s,a||[]),n()}function n(){for(var e,t=0;t<s.length;t++){for(var n=s[t],r=!0,c=1;c<n.length;c++){var i=n[c];0!==o[i]&&(r=!1)}r&&(s.splice(t--,1),e=u(u.s=n[0]))}return e}var r={},o={18:0},s=[];function u(t){if(r[t])return r[t].exports;var n=r[t]={i:t,l:!1,exports:{}};return e[t].call(n.exports,n,n.exports,u),n.l=!0,n.exports}u.m=e,u.c=r,u.d=function(e,t,n){u.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},u.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},u.t=function(e,t){if(1&t&&(e=u(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(u.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)u.d(n,r,function(t){return e[t]}.bind(null,r));return n},u.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return u.d(t,"a",t),t},u.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},u.p="/dist/";var c=window.webpackJsonp=window.webpackJsonp||[],i=c.push.bind(c);c.push=t,c=c.slice();for(var a=0;a<c.length;a++)t(c[a]);var l=i;s.push([117,0]),n()}({117:function(e,t,n){"use strict";n(181);const r=n(0),o=n(8),s=n(7),u=n(4),c=n(2),i=n(27),a=n(3),{codeFrameColumns:l}=n(118),d=n(1),f=n(11),p=n(133),m=n(134),y=n(135),h=n(136),{runSelected:b}=n(137),x=u.css,C=s();CloudCmd.UserMenu=e.exports;const{Key:g}=CloudCmd;e.exports.init=async()=>{await Promise.all([x(CloudCmd.prefix+"/dist/user-menu.css"),CloudCmd.View()])},e.exports.show=async function(){d.show.load("top");const{dirPath:e}=w,t=await fetch(`${CloudCmd.prefix}/api/v1/user-menu?dir=${e}`),n=await t.text(),[r,o]=i(p,n);if(d.hide(),r)return f.alert(S({error:r,source:n}));C(n);const{names:s,keys:u,items:a,settings:l}=h(o);if(l.run)return b(l.select,a,P);const m=c("button",{className:"cloudcmd-user-menu-button",innerText:"User Menu",notAppend:!0}),y=c("select",{className:"cloudcmd-user-menu",innerHTML:v(s),notAppend:!0,size:10});m.addEventListener("click",M(o,y)),y.addEventListener("dblclick",k(o)),y.addEventListener("keydown",j({keys:u,userMenu:o}));CloudCmd.View.show([m,y],{autoSize:!0,afterShow:()=>y.focus()})},e.exports.hide=O;const{CurrentInfo:w}=DOM;function v(e){const t=[];for(const n of e)t.push(`<option>${n}</option>`);return t.join("")}function O(){CloudCmd.View.hide()}const k=r(async(e,t)=>{const{value:n}=t.target;await P(e[n])}),M=o(async(e,t)=>{let{value:n}=t;await P(e[n])}),j=r(async(e,t)=>{let{keys:n,userMenu:r}=e;const{keyCode:o,target:s}=t,u=t.key.toUpperCase();let c;if(t.preventDefault(),t.stopPropagation(),o===g.ESC)return O();if(o===g.ENTER)c=r[s.value];else{if(!n[u])return m(s,t);c=n[u]}await P(c)}),P=async e=>{O();const[t]=await a(e,{DOM:DOM,CloudCmd:CloudCmd,tryToCatch:a});if(!t)return;const n=C();return f.alert(S({error:t,source:n}))};function S(e){let{error:t,source:n}=e;const{code:r}=t;if(!r||"frame"===r)return t.message;const[o,s]=y(t);return`<pre>${l(n,{start:{line:o,column:s}},{message:t.message,highlightCode:!1})}</pre>`}},133:function(e,t,n){"use strict";e.exports=e=>{const t={};return Function("module",e)(t),t.exports}},134:function(e,t,n){"use strict";const{J:r,K:o,UP:s,DOWN:u}=n(36);e.exports=(e,t)=>{let{keyCode:n}=t;return n===u||n===r?function(e){const{length:t}=e;e.selectedIndex===t-1?e.selectedIndex=0:++e.selectedIndex}(e):n===s||n===o?function(e){const{length:t}=e;e.selectedIndex?--e.selectedIndex:e.selectedIndex=t-1}(e):void 0}},135:function(e,t,n){"use strict";const r=e=>"number"==typeof e;e.exports=e=>{const{lineNumber:t,columnNumber:n}=e;if(r(t)&&r(n))return[t,n];const o=e.stack.indexOf(">"),s=e.stack.slice(o+1),u=s.indexOf(")"),c=s.slice(1,u),[i,a]=c.split(":");return[Number(i),Number(a)]}},136:function(e,t,n){"use strict";const{entries:r,assign:o}=Object;e.exports=e=>{const t=[],n={},s={},u={};for(const[c,i]of r(e)){if("__settings"===c){o(u,e[c]);continue}if(c.startsWith("_"))continue;t.push(c);const[r,a]=c.split(" - ");n[r]=i,s[a]=i}return{names:t,keys:n,items:s,settings:u}}},137:function(e,t,n){"use strict";e.exports.runSelected=async(e,t,n)=>{for(const r of e)await n(t[r])}},181:function(e,t){}});
|
|
2
2
|
//# sourceMappingURL=user-menu.js.map
|
package/dist/sw.js
CHANGED
|
@@ -5,5 +5,5 @@ var serviceWorkerOption = {
|
|
|
5
5
|
]
|
|
6
6
|
};
|
|
7
7
|
|
|
8
|
-
!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=o((t,e)=>e.waitUntil(t())),c=o((t,e)=>{const{request:n}=e,{url:r}=n,o=u(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)))}),u=t=>new URL(t).pathname,s="cloudcmd:
|
|
8
|
+
!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=o((t,e)=>e.waitUntil(t())),c=o((t,e)=>{const{request:n}=e,{url:r}=n,o=u(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)))}),u=t=>new URL(t).pathname,s="cloudcmd: Wed Jul 20 2022 20:17:36 GMT+0300 (Eastern European Summer Time)",a=(t,e)=>"/"!==t?e:(t=>new Request(t,{credentials:"same-origin"}))("/");self.addEventListener("install",i((async function(){console.info("cloudcmd: sw: install: "+s),await self.skipWaiting()}))),self.addEventListener("fetch",c((async function(t){const{request:e}=t,{url:n}=e,o=u(n),i=a(o,t.request),c=await caches.open(s),f=await c.match(e);if(f)return f;const[l,d]=await r(fetch,i,{credentials:"same-origin"});return l?new Response(l.message):(await async function(t,e){return(await caches.open(s)).put(t,e)}(e,d.clone()),d)}))),self.addEventListener("activate",i((async function(){console.info("cloudcmd: sw: activate: "+s),await self.clients.claim();const t=await caches.keys(),e=caches.delete.bind(caches);await Promise.all(t.map(e))})))},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}]);
|
|
9
9
|
//# sourceMappingURL=sw.js.map
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
.smalltalk .page {
|
|
26
26
|
border-radius: 3px;
|
|
27
27
|
background: white;
|
|
28
|
-
box-shadow: 0 4px 23px 5px
|
|
28
|
+
box-shadow: 0 4px 23px 5px rgb(0 0 0 / 20%), 0 2px 6px rgb(0 0 0 / 15%);
|
|
29
29
|
color: #333;
|
|
30
30
|
min-width: 400px;
|
|
31
31
|
padding: 0;
|
|
@@ -88,7 +88,7 @@
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
button {
|
|
91
|
-
font-family: Ubuntu, Arial, sans-serif;
|
|
91
|
+
font-family: 'Ubuntu', 'Arial', sans-serif;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
.smalltalk button, .smalltalk .smalltalk {
|
|
@@ -101,13 +101,13 @@ button {
|
|
|
101
101
|
user-select: none;
|
|
102
102
|
background-image: linear-gradient(#ededed, #ededed 38%, #dedede);
|
|
103
103
|
|
|
104
|
-
border: 1px solid
|
|
104
|
+
border: 1px solid rgb(0 0 0 / 25%);
|
|
105
105
|
border-radius: 2px;
|
|
106
|
-
box-shadow: 0 1px 0
|
|
106
|
+
box-shadow: 0 1px 0 rgb(0 0 0 / 8%), inset 0 1px 2px rgb(255 255 255 / 75%);
|
|
107
107
|
color: #444;
|
|
108
108
|
font: inherit;
|
|
109
109
|
margin: 0 1px 0 0;
|
|
110
|
-
text-shadow: 0 1px 0 rgb(240
|
|
110
|
+
text-shadow: 0 1px 0 rgb(240 240 240);
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
.smalltalk button::-moz-focus-inner {
|
|
@@ -146,7 +146,7 @@ button {
|
|
|
146
146
|
|
|
147
147
|
.smalltalk button:enabled:focus, .smalltalk input:enabled:focus {
|
|
148
148
|
transition: border-color 200ms;
|
|
149
|
-
border-color: rgb(77
|
|
149
|
+
border-color: rgb(77 144 254);
|
|
150
150
|
outline: none;
|
|
151
151
|
}
|
|
152
152
|
|
|
@@ -1033,7 +1033,7 @@ eval("// removed by extract-text-webpack-plugin\n\n//# sourceURL=file://cloudcmd
|
|
|
1033
1033
|
/***/ (function(module, exports, __webpack_require__) {
|
|
1034
1034
|
|
|
1035
1035
|
"use strict";
|
|
1036
|
-
eval("\n\n__webpack_require__(/*! ../css/smalltalk.css */ \"./node_modules/smalltalk/css/smalltalk.css\");\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst store = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n\nconst keyDown = currify(keyDown_);\n\nconst BUTTON_OK = {\n ok: 'OK',\n};\n\nconst BUTTON_OK_CANCEL = {\n ok: 'OK',\n cancel: 'Cancel',\n};\n\nconst zIndex = store(100);\n\nexports.alert = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK;\n return showDialog(title, msg, '', buttons, options);\n};\n\nexports.prompt = (title, msg, value = '', options) => {\n const type = getType(options);\n const val = String(value)\n .replace(/\"/g, '"');\n \n const valueStr = `<input type=\"${ type }\" value=\"${ val }\" data-name=\"js-input\">`;\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, valueStr, buttons, options);\n};\n\nexports.confirm = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, '', buttons, options);\n};\n\nexports.progress = (title, message, options) => {\n const valueStr = `\n <progress value=\"0\" data-name=\"js-progress\" class=\"progress\" max=\"100\"></progress>\n <span data-name=\"js-counter\">0%</span>\n `;\n \n const buttons = {\n cancel: 'Abort',\n };\n \n const promise = showDialog(title, message, valueStr, buttons, options);\n const {ok, dialog} = promise;\n const resolve = ok();\n \n find(dialog, ['cancel'])
|
|
1036
|
+
eval("\n\n__webpack_require__(/*! ../css/smalltalk.css */ \"./node_modules/smalltalk/css/smalltalk.css\");\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst store = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n\nconst isBool = (a) => typeof a === 'boolean';\n\nconst keyDown = currify(keyDown_);\n\nconst BUTTON_OK = {\n ok: 'OK',\n};\n\nconst BUTTON_OK_CANCEL = {\n ok: 'OK',\n cancel: 'Cancel',\n};\n\nconst zIndex = store(100);\n\nexports.alert = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK;\n return showDialog(title, msg, '', buttons, options);\n};\n\nexports.prompt = (title, msg, value = '', options) => {\n const type = getType(options);\n const val = String(value)\n .replace(/\"/g, '"');\n \n const valueStr = `<input type=\"${ type }\" value=\"${ val }\" data-name=\"js-input\">`;\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, valueStr, buttons, options);\n};\n\nexports.confirm = (title, msg, options) => {\n const buttons = getButtons(options) || BUTTON_OK_CANCEL;\n \n return showDialog(title, msg, '', buttons, options);\n};\n\nexports.progress = (title, message, options) => {\n const valueStr = `\n <progress value=\"0\" data-name=\"js-progress\" class=\"progress\" max=\"100\"></progress>\n <span data-name=\"js-counter\">0%</span>\n `;\n \n const buttons = {\n cancel: 'Abort',\n };\n \n const promise = showDialog(title, message, valueStr, buttons, options);\n const {ok, dialog} = promise;\n const resolve = ok();\n \n for (const el of find(dialog, ['cancel'])) {\n el.focus();\n }\n \n Object.assign(promise, {\n setProgress(count) {\n const [elProgress] = find(dialog, ['progress']);\n const [elCounter] = find(dialog, ['counter']);\n \n elProgress.value = count;\n elCounter.textContent = `${count}%`;\n \n if (count === 100) {\n remove(dialog);\n resolve();\n }\n },\n \n remove() {\n remove(dialog);\n },\n });\n \n return promise;\n};\n\nfunction getButtons(options = {}) {\n const {buttons} = options;\n \n if (!buttons)\n return null;\n \n return buttons;\n}\n\nfunction getType(options = {}) {\n const {type} = options;\n \n if (type === 'password')\n return 'password';\n \n return 'text';\n}\n\nfunction getTemplate(title, msg, value, buttons) {\n const encodedMsg = msg.replace(/\\n/g, '<br>');\n \n return `<div class=\"page\">\n <div data-name=\"js-close\" class=\"close-button\"></div>\n <header>${ title }</header>\n <div class=\"content-area\">${ encodedMsg }${ value }</div>\n <div class=\"action-area\">\n <div class=\"button-strip\">\n ${parseButtons(buttons)}\n </div>\n </div>\n </div>`;\n}\n\nfunction parseButtons(buttons) {\n const names = Object.keys(buttons);\n const parse = currify((buttons, name, i) => `<button\n tabindex=${i}\n data-name=\"js-${name.toLowerCase()}\">\n ${buttons[name]}\n </button>`);\n \n return names\n .map(parse(buttons))\n .join('');\n}\n\nfunction showDialog(title, msg, value, buttons, options) {\n const ok = store();\n const cancel = store();\n \n const closeButtons = [\n 'cancel',\n 'close',\n 'ok',\n ];\n \n const promise = new Promise((resolve, reject) => {\n const noCancel = options && isBool(options.cancel) && !options.cancel;\n const empty = () => {};\n const rejectError = () => reject(Error());\n \n ok(resolve);\n cancel(noCancel ? empty : rejectError);\n });\n \n const innerHTML = getTemplate(title, msg, value, buttons);\n \n const dialog = createElement('div', {\n innerHTML,\n className: 'smalltalk',\n style: `z-index: ${zIndex(zIndex() + 1)}`,\n });\n \n for (const el of find(dialog, ['ok', 'input']))\n el.focus();\n \n for (const el of find(dialog, ['input'])) {\n el.setSelectionRange(0, value.length);\n }\n \n addListenerAll('click', dialog, closeButtons, (event) => {\n closeDialog(event.target, dialog, ok(), cancel());\n });\n \n for (const event of ['click', 'contextmenu'])\n dialog.addEventListener(event, (e) => {\n e.stopPropagation();\n for (const el of find(dialog, ['ok', 'input']))\n el.focus();\n });\n \n dialog.addEventListener('keydown', keyDown(dialog, ok(), cancel()));\n \n return Object.assign(promise, {\n dialog,\n ok,\n });\n}\n\nfunction keyDown_(dialog, ok, cancel, event) {\n const KEY = {\n ENTER : 13,\n ESC : 27,\n TAB : 9,\n LEFT : 37,\n UP : 38,\n RIGHT : 39,\n DOWN : 40,\n };\n \n const {keyCode} = event;\n const el = event.target;\n \n const namesAll = ['ok', 'cancel', 'input'];\n const names = find(dialog, namesAll)\n .map(getDataName);\n \n switch(keyCode) {\n case KEY.ENTER:\n closeDialog(el, dialog, ok, cancel);\n event.preventDefault();\n break;\n \n case KEY.ESC:\n remove(dialog);\n cancel();\n break;\n \n case KEY.TAB:\n if (event.shiftKey)\n tab(dialog, names);\n \n tab(dialog, names);\n event.preventDefault();\n break;\n \n default:\n ['left', 'right', 'up', 'down'].filter((name) => keyCode === KEY[name.toUpperCase()]).forEach(() => {\n changeButtonFocus(dialog, names);\n });\n \n break;\n }\n \n event.stopPropagation();\n}\n\nfunction getDataName(el) {\n return el\n .getAttribute('data-name')\n .replace('js-', '');\n}\n\nconst getName = (activeName) => {\n if (activeName === 'cancel')\n return 'ok';\n \n return 'cancel';\n};\n\nfunction changeButtonFocus(dialog, names) {\n const active = document.activeElement;\n const activeName = getDataName(active);\n const isButton = /ok|cancel/.test(activeName);\n const count = names.length - 1;\n \n if (activeName === 'input' || !count || !isButton)\n return;\n \n const name = getName(activeName);\n \n for (const el of find(dialog, [name])) {\n el.focus();\n }\n}\n\nconst getIndex = (count, index) => {\n if (index === count)\n return 0;\n \n return index + 1;\n};\n\nfunction tab(dialog, names) {\n const active = document.activeElement;\n const activeName = getDataName(active);\n const count = names.length - 1;\n \n const activeIndex = names.indexOf(activeName);\n const index = getIndex(count, activeIndex);\n \n const name = names[index];\n \n for (const el of find(dialog, [name]))\n el.focus();\n}\n\nfunction closeDialog(el, dialog, ok, cancel) {\n const name = el\n .getAttribute('data-name')\n .replace('js-', '');\n \n if (/close|cancel/.test(name)) {\n cancel();\n remove(dialog);\n \n return;\n }\n \n let value = null;\n \n for (const el of find(dialog, ['input'])) {\n value = el.value;\n }\n \n ok(value);\n remove(dialog);\n}\n\nconst query = currify((element, name) => element.querySelector(`[data-name=\"js-${ name }\"]`));\n\nfunction find(element, names) {\n const elements = names\n .map(query(element))\n .filter(Boolean);\n \n return elements;\n}\n\nfunction addListenerAll(event, parent, elements, fn) {\n for (const el of find(parent, elements)) {\n el.addEventListener(event, fn);\n }\n}\n\nfunction remove(dialog) {\n const {parentElement} = dialog;\n \n if (parentElement)\n parentElement.removeChild(dialog);\n}\n\n\n\n//# sourceURL=file://cloudcmd/node_modules/smalltalk/lib/smalltalk.js");
|
|
1037
1037
|
|
|
1038
1038
|
/***/ }),
|
|
1039
1039
|
|
package/dist-dev/cloudcmd.js
CHANGED
|
@@ -175,7 +175,7 @@ eval("\n/* global DOM */\n\nconst Emitify = __webpack_require__(/*! emitify */ \
|
|
|
175
175
|
/***/ (function(module, exports, __webpack_require__) {
|
|
176
176
|
|
|
177
177
|
"use strict";
|
|
178
|
-
eval("\n\n__webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n\n__webpack_require__(/*! ../css/nojs.css */ \"./css/nojs.css\");\n\n__webpack_require__(/*! ../css/columns/name-size-date.css */ \"./css/columns/name-size-date.css\");\n\n__webpack_require__(/*! ../css/columns/name-size.css */ \"./css/columns/name-size.css\");\n\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n\nconst {\n registerSW,\n listenSW\n} = __webpack_require__(/*! ./sw/register */ \"./client/sw/register.js\");\n\nconst isDev = \"development\" === 'development'
|
|
178
|
+
eval("\n\n__webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\n\n__webpack_require__(/*! ../css/nojs.css */ \"./css/nojs.css\");\n\n__webpack_require__(/*! ../css/columns/name-size-date.css */ \"./css/columns/name-size-date.css\");\n\n__webpack_require__(/*! ../css/columns/name-size.css */ \"./css/columns/name-size.css\");\n\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n\nconst {\n registerSW,\n listenSW\n} = __webpack_require__(/*! ./sw/register */ \"./client/sw/register.js\");\n\nconst isDev = \"development\" === 'development';\n\nmodule.exports = window.CloudCmd = async config => {\n window.Util = __webpack_require__(/*! ../common/util */ \"./common/util.js\");\n window.CloudFunc = __webpack_require__(/*! ../common/cloudfunc */ \"./common/cloudfunc.js\");\n window.DOM = __webpack_require__(/*! ./dom */ \"./client/dom/index.js\");\n window.CloudCmd = __webpack_require__(/*! ./client */ \"./client/client.js\");\n await register(config);\n\n __webpack_require__(/*! ./listeners */ \"./client/listeners/index.js\");\n\n __webpack_require__(/*! ./key */ \"./client/key/index.js\");\n\n __webpack_require__(/*! ./sort */ \"./client/sort.js\");\n\n const prefix = getPrefix(config.prefix);\n window.CloudCmd.init(prefix, config);\n};\n\nfunction getPrefix(prefix) {\n if (!prefix) return '';\n if (!prefix.indexOf('/')) return prefix;\n return `/${prefix}`;\n}\n\nconst onUpdateFound = wraptile(async config => {\n if (isDev) return;\n const {\n DOM\n } = window;\n const prefix = getPrefix(config.prefix);\n await load.js(`${prefix}/dist/cloudcmd.common.js`);\n await load.js(`${prefix}/dist/cloudcmd.js`);\n console.log('cloudcmd: sw: updated');\n DOM.Events.removeAll();\n window.CloudCmd(config);\n});\n\nasync function register(config) {\n const {\n prefix\n } = config;\n const sw = await registerSW(prefix);\n listenSW(sw, 'updatefound', onUpdateFound(config));\n}\n\n//# sourceURL=file://cloudcmd/client/cloudcmd.js");
|
|
179
179
|
|
|
180
180
|
/***/ }),
|
|
181
181
|
|
package/dist-dev/sw.js
CHANGED
|
@@ -101,7 +101,7 @@ var serviceWorkerOption = {
|
|
|
101
101
|
/***/ (function(module, exports, __webpack_require__) {
|
|
102
102
|
|
|
103
103
|
"use strict";
|
|
104
|
-
eval("\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst isDev = \"development\" === 'development';\n\nconst isGet = a => a.method === 'GET';\n\nconst isBasic = a => a.type === 'basic';\n\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});\n\nconst getPathName = url => new URL(url).pathname;\n\nconst date = \"
|
|
104
|
+
eval("\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst isDev = \"development\" === 'development';\n\nconst isGet = a => a.method === 'GET';\n\nconst isBasic = a => a.type === 'basic';\n\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});\n\nconst getPathName = url => new URL(url).pathname;\n\nconst date = \"Wed Jul 20 2022 20:17:46 GMT+0300 (Eastern European Summer Time)\";\nconst NAME = `cloudcmd: ${date}`;\n\nconst createRequest = a => new Request(a, {\n credentials: 'same-origin'\n});\n\nconst getRequest = (a, request) => {\n if (a !== '/') return request;\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 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}\n\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n await self.skipWaiting();\n}\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}\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");
|
|
105
105
|
|
|
106
106
|
/***/ }),
|
|
107
107
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcmd",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.4.1",
|
|
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",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"package-json": "^7.0.0",
|
|
122
122
|
"ponse": "^7.0.0",
|
|
123
123
|
"pullout": "^4.0.0",
|
|
124
|
-
"putout": "^
|
|
124
|
+
"putout": "^27.0.1",
|
|
125
125
|
"redzip": "^2.0.0",
|
|
126
126
|
"rendy": "^3.0.0",
|
|
127
127
|
"restafary": "^11.0.0",
|
|
@@ -164,8 +164,9 @@
|
|
|
164
164
|
"domtokenlist-shim": "^1.2.0",
|
|
165
165
|
"emitify": "^4.0.1",
|
|
166
166
|
"eslint": "^8.0.1",
|
|
167
|
+
"eslint-plugin-n": "^15.2.4",
|
|
167
168
|
"eslint-plugin-node": "^11.0.0",
|
|
168
|
-
"eslint-plugin-putout": "^
|
|
169
|
+
"eslint-plugin-putout": "^16.0.0",
|
|
169
170
|
"extract-text-webpack-plugin": "^4.0.0-alpha.0",
|
|
170
171
|
"gritty": "^6.0.0",
|
|
171
172
|
"gunzip-maybe": "^1.3.1",
|
package/server/env.js
CHANGED
|
@@ -8,12 +8,18 @@ const up = (a) => a.toUpperCase();
|
|
|
8
8
|
module.exports = parse;
|
|
9
9
|
module.exports.bool = (name) => {
|
|
10
10
|
const value = parse(name);
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
if (value === 'true')
|
|
13
13
|
return true;
|
|
14
|
-
|
|
14
|
+
|
|
15
|
+
if (value === '1')
|
|
16
|
+
return true;
|
|
17
|
+
|
|
15
18
|
if (value === 'false')
|
|
16
19
|
return false;
|
|
20
|
+
|
|
21
|
+
if (value === '0')
|
|
22
|
+
return false;
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
function parse(name) {
|