cloudcmd 16.0.1 → 16.2.0
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 +21 -0
- package/HELP.md +4 -1
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/bin/cloudcmd.mjs +13 -12
- package/common/entity.js +1 -1
- package/dist/cloudcmd.common.js +3 -3
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/cloudcmd.js +1 -1
- package/dist/cloudcmd.js.map +1 -1
- package/dist/modules/cloud.js +1 -1
- package/dist/modules/cloud.js.map +1 -1
- package/dist/modules/config.js +1 -1
- package/dist/modules/edit.js +1 -1
- package/dist/modules/edit.js.map +1 -1
- package/dist/modules/markdown.js +1 -1
- package/dist/modules/markdown.js.map +1 -1
- package/dist/modules/menu.js +1 -1
- package/dist/modules/operation.js +1 -1
- package/dist/modules/operation.js.map +1 -1
- package/dist/modules/terminal-run.js +1 -1
- package/dist/modules/upload.js +1 -1
- package/dist/modules/user-menu.js +1 -1
- package/dist/modules/user-menu.js.map +1 -1
- package/dist/modules/view.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist-dev/cloudcmd.common.js +6 -6
- package/dist-dev/cloudcmd.js +5 -5
- package/dist-dev/modules/cloud.js +1 -1
- package/dist-dev/modules/edit.js +1 -1
- package/dist-dev/modules/markdown.js +1 -1
- package/dist-dev/modules/operation.js +2 -2
- package/dist-dev/modules/user-menu.js +1 -1
- package/dist-dev/sw.js +1 -1
- package/package.json +6 -6
- package/server/cloudcmd.js +5 -5
- package/server/config.js +4 -4
- package/server/distribute/import.js +2 -2
- package/server/markdown/index.js +2 -2
- package/server/rest/index.js +2 -2
- package/server/route.js +6 -6
- package/server/{server.js → server.mjs} +19 -22
- package/tmpl/config.hbs +2 -2
|
@@ -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\n/* global Util */\n\n/* global DOM */\n\n/* global fileop */\n\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst {\n encode\n} = __webpack_require__(/*! ../../../common/entity */ \"./common/entity.js\");\n\nconst removeExtension = __webpack_require__(/*! ./remove-extension */ \"./client/modules/operation/remove-extension.js\");\n\nconst setListeners = __webpack_require__(/*! ./set-listeners */ \"./client/modules/operation/set-listeners.js\");\n\nconst getNextCurrentName = __webpack_require__(/*! ./get-next-current-name */ \"./client/modules/operation/get-next-current-name.js\");\n\nconst removeQuery = a => a.replace(/\\?.*/, '');\n\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);\n\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};\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});\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}\n\nconst onConnect = currify((fn, operator) => {\n setOperations(operator);\n fn();\n});\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}\n\nfunction setOperations(operator) {\n packTarFn = (_ref, callback) => {\n let {\n from,\n to,\n names\n } = _ref;\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\n packZipFn = (_ref2, callback) => {\n let {\n from,\n to,\n names\n } = _ref2;\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\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\n copyFn = (_ref3, callback) => {\n let {\n from,\n to,\n names\n } = _ref3;\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\n moveFn = (_ref4, callback) => {\n let {\n from,\n to,\n names\n } = _ref4;\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\n extractFn = (_ref5, callback) => {\n let {\n from,\n to\n } = _ref5;\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}\n\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\n\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\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};\n\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\n\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\n\nOperation.extract = () => {\n twopack('extract');\n};\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\n\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\n if (n) {\n let name = '';\n\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n\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\n const getType = isDir => isDir ? 'directory' : 'file';\n\n const type = getType(isDir) + ' ';\n const name = DOM.getCurrentName(current);\n msg = msgAsk + msgSel + type + name + '?';\n }\n\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n deleteSilent(files);\n}\n/**\n * delete current or selected files\n *\n * @files\n */\n\n\nfunction deleteSilent() {\n let files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 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 * process files (copy or move)\n * @param data\n * @param operation\n */\n\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 /* eslint no-multi-spaces: 0 */\n\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\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\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\n ask(to);\n\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\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\n const setCurrent = () => {\n const currentName = name || data.names[0];\n DOM.setCurrentByName(currentName);\n };\n\n if (!Info.isOnePanel) CloudCmd.refresh({\n panel: panelPassive,\n noCurrent: true\n });\n CloudCmd.refresh({\n panel\n }, setCurrent);\n });\n }\n }\n}\n\nfunction checkEmpty(name, operation) {\n if (!operation) throw Error(name + ' could not be empty!');\n}\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\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\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\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\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}\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\n/* global Util */\n\n/* global DOM */\n\n/* global fileop */\n\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst {\n encode\n} = __webpack_require__(/*! ../../../common/entity */ \"./common/entity.js\");\n\nconst removeExtension = __webpack_require__(/*! ./remove-extension */ \"./client/modules/operation/remove-extension.js\");\n\nconst setListeners = __webpack_require__(/*! ./set-listeners */ \"./client/modules/operation/set-listeners.js\");\n\nconst getNextCurrentName = __webpack_require__(/*! ./get-next-current-name */ \"./client/modules/operation/get-next-current-name.js\");\n\nconst removeQuery = a => a.replace(/\\?.*/, '');\n\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);\n\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};\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});\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}\n\nconst onConnect = currify((fn, operator) => {\n setOperations(operator);\n fn();\n});\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}\n\nfunction setOperations(operator) {\n packTarFn = (_ref, callback) => {\n let {\n from,\n to,\n names\n } = _ref;\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\n packZipFn = (_ref2, callback) => {\n let {\n from,\n to,\n names\n } = _ref2;\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\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\n copyFn = (_ref3, callback) => {\n let {\n from,\n to,\n names\n } = _ref3;\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\n moveFn = (_ref4, callback) => {\n let {\n from,\n to,\n names\n } = _ref4;\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\n extractFn = (_ref5, callback) => {\n let {\n from,\n to\n } = _ref5;\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}\n\nfunction getPacker(type) {\n if (type === 'zip') return packZipFn;\n return packTarFn;\n}\n\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\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};\n\nOperation.copy = processFiles({\n type: 'copy'\n});\nOperation.move = processFiles({\n type: 'move'\n});\nOperation.delete = promptDelete;\nOperation.deleteSilent = deleteSilent;\n\nOperation.pack = () => {\n const isZip = config('packer') === 'zip';\n twopack('pack', isZip ? 'zip' : 'tar');\n};\n\nOperation.extract = () => {\n twopack('extract');\n};\n/**\n * prompt and delete current file or selected files\n *\n * @currentFile\n */\n\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\n if (n) {\n let name = '';\n\n for (let i = 0; i < 5 && i < n; i++) name += '\\n' + names[i];\n\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\n const getType = isDir => isDir ? 'directory' : 'file';\n\n const type = getType(isDir) + ' ';\n const name = DOM.getCurrentName(current);\n msg = msgAsk + msgSel + type + name + '?';\n }\n\n const [cancel] = await Dialog.confirm(msg);\n if (cancel) return;\n deleteSilent(files);\n}\n/**\n * delete current or selected files\n *\n * @files\n */\n\n\nfunction deleteSilent() {\n let files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 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 * process files (copy or move)\n * @param data\n * @param operation\n */\n\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 /* eslint no-multi-spaces: 0 */\n\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\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\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\n ask(to);\n\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\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}\n\nfunction checkEmpty(name, operation) {\n if (!operation) throw Error(name + ' could not be empty!');\n}\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\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\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\n showLoad();\n op(fileFrom, error => {\n !error && CloudCmd.refresh({\n currentName\n });\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}\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
|
|
|
@@ -211,7 +211,7 @@ eval("\n\nconst {\n getExt\n} = __webpack_require__(/*! ../../../common/util */
|
|
|
211
211
|
/***/ (function(module, exports, __webpack_require__) {
|
|
212
212
|
|
|
213
213
|
"use strict";
|
|
214
|
-
eval("\n/* global DOM */\n\nconst
|
|
214
|
+
eval("\n/* global DOM */\n\nconst forEachKey = __webpack_require__(/*! for-each-key */ \"./node_modules/for-each-key/lib/for-each-key.js\");\n\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n\nconst format = __webpack_require__(/*! ./format */ \"./client/modules/operation/format.js\");\n\nconst {\n Dialog,\n Images\n} = DOM;\n\nmodule.exports = options => emitter => {\n const {\n operation,\n callback,\n noContinue,\n from,\n to\n } = options;\n let done;\n let lastError;\n const onAbort = wraptile(_ref => {\n let {\n emitter,\n operation\n } = _ref;\n emitter.abort();\n const msg = `${operation} aborted`;\n lastError = true;\n Dialog.alert(msg, {\n cancel: false\n });\n });\n const removeListener = emitter.removeListener.bind(emitter);\n const on = emitter.on.bind(emitter);\n const message = format(operation, from, to);\n const progress = Dialog.progress(message);\n progress.catch(onAbort({\n emitter,\n operation\n }));\n const listeners = {\n progress: value => {\n done = value === 100;\n progress.setProgress(value);\n },\n end: () => {\n Images.hide();\n forEachKey(removeListener, listeners);\n progress.remove();\n if (lastError || done) callback();\n },\n error: async error => {\n lastError = error;\n\n if (noContinue) {\n listeners.end(error);\n Dialog.alert(error);\n progress.remove();\n return;\n }\n\n const [cancel] = await Dialog.confirm(error + '\\n Continue?');\n if (!done && !cancel) return emitter.continue();\n emitter.abort();\n progress.remove();\n }\n };\n forEachKey(on, listeners);\n};\n\n//# sourceURL=file://cloudcmd/client/modules/operation/set-listeners.js");
|
|
215
215
|
|
|
216
216
|
/***/ })
|
|
217
217
|
|
|
@@ -211,7 +211,7 @@ eval("\n\nconst isNumber = a => typeof a === 'number';\n\nmodule.exports = error
|
|
|
211
211
|
/***/ (function(module, exports, __webpack_require__) {
|
|
212
212
|
|
|
213
213
|
"use strict";
|
|
214
|
-
eval("\n\nconst {\n entries,\n assign\n} = Object;\n\nmodule.exports = userMenu => {\n const names = [];\n const keys = {};\n const items = {};\n const settings = {};\n\n for (const [str, fn] of entries(userMenu)) {\n if (str === '__settings') {\n assign(settings, userMenu[str]);\n continue;\n }\n\n if (
|
|
214
|
+
eval("\n\nconst {\n entries,\n assign\n} = Object;\n\nmodule.exports = userMenu => {\n const names = [];\n const keys = {};\n const items = {};\n const settings = {};\n\n for (const [str, fn] of entries(userMenu)) {\n if (str === '__settings') {\n assign(settings, userMenu[str]);\n continue;\n }\n\n if (str.startsWith('_')) {\n continue;\n }\n\n names.push(str);\n const [key, name] = str.split(' - ');\n keys[key] = fn;\n items[name] = fn;\n }\n\n return {\n names,\n keys,\n items,\n settings\n };\n};\n\n//# sourceURL=file://cloudcmd/client/modules/user-menu/parse-user-menu.js");
|
|
215
215
|
|
|
216
216
|
/***/ }),
|
|
217
217
|
|
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 (
|
|
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 = \"Fri Jun 17 2022 16:49:49 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.0
|
|
3
|
+
"version": "16.2.0",
|
|
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",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"deepmerge": "^4.0.0",
|
|
97
97
|
"deepword": "^8.0.0",
|
|
98
98
|
"dword": "^14.0.0",
|
|
99
|
-
"edward": "^
|
|
99
|
+
"edward": "^14.0.0",
|
|
100
100
|
"es6-promisify": "^7.0.0",
|
|
101
101
|
"execon": "^1.2.0",
|
|
102
102
|
"express": "^4.13.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"jju": "^1.3.0",
|
|
112
112
|
"jonny": "^3.0.0",
|
|
113
113
|
"just-snake-case": "^1.1.0",
|
|
114
|
-
"markdown-it": "^
|
|
114
|
+
"markdown-it": "^13.0.1",
|
|
115
115
|
"mellow": "^3.0.0",
|
|
116
116
|
"nomine": "^4.0.0",
|
|
117
117
|
"object.omit": "^3.0.0",
|
|
@@ -119,9 +119,9 @@
|
|
|
119
119
|
"onezip": "^5.0.0",
|
|
120
120
|
"open": "^8.0.5",
|
|
121
121
|
"package-json": "^7.0.0",
|
|
122
|
-
"ponse": "^
|
|
122
|
+
"ponse": "^7.0.0",
|
|
123
123
|
"pullout": "^4.0.0",
|
|
124
|
-
"putout": "^
|
|
124
|
+
"putout": "^26.0.1",
|
|
125
125
|
"redzip": "^2.0.0",
|
|
126
126
|
"rendy": "^3.0.0",
|
|
127
127
|
"restafary": "^11.0.0",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"socket.io-client": "^4.0.1",
|
|
133
133
|
"squad": "^3.0.0",
|
|
134
134
|
"table": "^6.0.1",
|
|
135
|
-
"thread-it": "^
|
|
135
|
+
"thread-it": "^2.0.0",
|
|
136
136
|
"try-catch": "^3.0.0",
|
|
137
137
|
"try-to-catch": "^3.0.0",
|
|
138
138
|
"tryrequire": "^3.0.0",
|
package/server/cloudcmd.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const DIR = __dirname + '/';
|
|
4
|
-
const DIR_ROOT = DIR + '../';
|
|
5
4
|
const DIR_COMMON = DIR + '../common/';
|
|
6
|
-
|
|
7
5
|
const path = require('path');
|
|
8
|
-
const fs = require('fs');
|
|
9
6
|
|
|
7
|
+
const fs = require('fs');
|
|
10
8
|
const cloudfunc = require(DIR_COMMON + 'cloudfunc');
|
|
9
|
+
|
|
11
10
|
const authentication = require(DIR + 'auth');
|
|
12
11
|
const {
|
|
13
12
|
createConfig,
|
|
14
13
|
configPath,
|
|
15
14
|
} = require(DIR + 'config');
|
|
16
|
-
|
|
17
15
|
const modulas = require(DIR + 'modulas');
|
|
16
|
+
|
|
18
17
|
const userMenu = require(DIR + 'user-menu');
|
|
19
18
|
const rest = require(DIR + 'rest');
|
|
20
19
|
const route = require(DIR + 'route');
|
|
@@ -22,8 +21,8 @@ const validate = require(DIR + 'validate');
|
|
|
22
21
|
const prefixer = require(DIR + 'prefixer');
|
|
23
22
|
const terminal = require(DIR + 'terminal');
|
|
24
23
|
const distribute = require(DIR + 'distribute');
|
|
25
|
-
|
|
26
24
|
const currify = require('currify');
|
|
25
|
+
|
|
27
26
|
const apart = require('apart');
|
|
28
27
|
const ponse = require('ponse');
|
|
29
28
|
const restafary = require('restafary');
|
|
@@ -34,6 +33,7 @@ const dword = require('dword');
|
|
|
34
33
|
const deepword = require('deepword');
|
|
35
34
|
const nomine = require('nomine');
|
|
36
35
|
const fileop = require('@cloudcmd/fileop');
|
|
36
|
+
const DIR_ROOT = DIR + '../';
|
|
37
37
|
|
|
38
38
|
const isDev = process.env.NODE_ENV === 'development';
|
|
39
39
|
const getDist = (isDev) => isDev ? 'dist-dev' : 'dist';
|
package/server/config.js
CHANGED
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
const DIR_SERVER = __dirname + '/';
|
|
4
4
|
const DIR_COMMON = '../common/';
|
|
5
|
-
const DIR = DIR_SERVER + '../';
|
|
6
|
-
|
|
7
5
|
const path = require('path');
|
|
6
|
+
|
|
8
7
|
const fs = require('fs');
|
|
9
8
|
const Emitter = require('events');
|
|
10
9
|
const {homedir} = require('os');
|
|
11
|
-
|
|
12
10
|
const exit = require(DIR_SERVER + 'exit');
|
|
13
|
-
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
|
14
11
|
|
|
12
|
+
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
|
15
13
|
const currify = require('currify');
|
|
14
|
+
|
|
16
15
|
const wraptile = require('wraptile');
|
|
17
16
|
const tryToCatch = require('try-to-catch');
|
|
18
17
|
const pullout = require('pullout');
|
|
@@ -22,6 +21,7 @@ const jju = require('jju');
|
|
|
22
21
|
const writejson = require('writejson');
|
|
23
22
|
const tryCatch = require('try-catch');
|
|
24
23
|
const criton = require('criton');
|
|
24
|
+
const DIR = DIR_SERVER + '../';
|
|
25
25
|
const HOME = homedir();
|
|
26
26
|
|
|
27
27
|
const resolve = Promise.resolve.bind(Promise);
|
|
@@ -6,10 +6,10 @@ const squad = require('squad');
|
|
|
6
6
|
const fullstore = require('fullstore');
|
|
7
7
|
|
|
8
8
|
const io = require('socket.io-client');
|
|
9
|
-
const forEachKey = currify(require('for-each-key'));
|
|
10
|
-
|
|
11
9
|
const log = require('./log');
|
|
10
|
+
|
|
12
11
|
const env = require('../env');
|
|
12
|
+
const forEachKey = currify(require('for-each-key'));
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
importStr,
|
package/server/markdown/index.js
CHANGED
|
@@ -8,10 +8,10 @@ const ponse = require('ponse');
|
|
|
8
8
|
const threadIt = require('thread-it');
|
|
9
9
|
const {read} = require('redzip');
|
|
10
10
|
|
|
11
|
-
const parse = threadIt(join(__dirname, 'worker'));
|
|
12
|
-
|
|
13
11
|
const root = require('../root');
|
|
14
12
|
|
|
13
|
+
const parse = threadIt(join(__dirname, 'worker'));
|
|
14
|
+
|
|
15
15
|
threadIt.init();
|
|
16
16
|
|
|
17
17
|
// warm up
|
package/server/rest/index.js
CHANGED
|
@@ -87,7 +87,7 @@ function rest(config, request, response) {
|
|
|
87
87
|
*/
|
|
88
88
|
function sendData(params, config, callback) {
|
|
89
89
|
const p = params;
|
|
90
|
-
const isMD =
|
|
90
|
+
const isMD = p.name.startsWith('/markdown');
|
|
91
91
|
const rootDir = config('root');
|
|
92
92
|
|
|
93
93
|
if (isMD)
|
|
@@ -122,7 +122,7 @@ function onGET(params, config, callback) {
|
|
|
122
122
|
if (p.name[0] === '/')
|
|
123
123
|
cmd = p.name.replace('/', '');
|
|
124
124
|
|
|
125
|
-
if (
|
|
125
|
+
if (cmd.startsWith('pack')) {
|
|
126
126
|
cmd = cmd.replace(/^pack/, '');
|
|
127
127
|
streamPack(root(cmd, rootDir), p.response, packer);
|
|
128
128
|
return;
|
package/server/route.js
CHANGED
|
@@ -20,9 +20,11 @@ const root = require(DIR_SERVER + 'root');
|
|
|
20
20
|
const prefixer = require(DIR_SERVER + 'prefixer');
|
|
21
21
|
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const Columns = require(`${DIR_SERVER}/columns`);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const Template = require(`${DIR_SERVER}/template`);
|
|
26
|
+
|
|
27
|
+
const {FS} = CloudFunc;
|
|
26
28
|
|
|
27
29
|
const sendIndex = (params, data) => {
|
|
28
30
|
const ponseParams = {
|
|
@@ -33,10 +35,8 @@ const sendIndex = (params, data) => {
|
|
|
33
35
|
ponse.send(data, ponseParams);
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const Columns = require(`${DIR_SERVER}/columns`);
|
|
39
|
-
const Template = require(`${DIR_SERVER}/template`);
|
|
38
|
+
const onceRequire = once(require);
|
|
39
|
+
const getPrefix = (config) => prefixer(config('prefix'));
|
|
40
40
|
|
|
41
41
|
const getReadDir = (config) => {
|
|
42
42
|
if (!config('dropbox'))
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import cloudcmd from './cloudcmd.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import http from 'http';
|
|
4
|
+
import {promisify} from 'util';
|
|
5
|
+
import currify from 'currify';
|
|
6
|
+
import squad from 'squad';
|
|
7
|
+
import tryToCatch from 'try-to-catch';
|
|
8
|
+
import wraptile from 'wraptile';
|
|
9
|
+
import compression from 'compression';
|
|
10
|
+
import threadIt from 'thread-it';
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const currify = require('currify');
|
|
9
|
-
const squad = require('squad');
|
|
10
|
-
const tryToCatch = require('try-to-catch');
|
|
11
|
-
const wraptile = require('wraptile');
|
|
12
|
-
const compression = require('compression');
|
|
13
|
-
const threadIt = require('thread-it');
|
|
12
|
+
import exit from './exit.js';
|
|
13
|
+
import opn from 'open';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import express from 'express';
|
|
16
|
+
import {Server} from 'socket.io';
|
|
17
|
+
import tryRequire from 'tryrequire';
|
|
17
18
|
|
|
18
|
-
const exitPort = two(exit, 'cloudcmd --port: %s');
|
|
19
19
|
const bind = (f, self) => f.bind(self);
|
|
20
|
-
const promisifySelf = squad(promisify, bind);
|
|
21
20
|
|
|
21
|
+
const two = currify((f, a, b) => f(a, b));
|
|
22
22
|
const shutdown = wraptile(async (promises) => {
|
|
23
23
|
console.log('closing cloudcmd...');
|
|
24
24
|
await Promise.all(promises);
|
|
25
25
|
threadIt.terminate();
|
|
26
26
|
process.exit(0);
|
|
27
27
|
});
|
|
28
|
+
const promisifySelf = squad(promisify, bind);
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
-
const express = require('express');
|
|
31
|
-
const io = require('socket.io');
|
|
32
|
-
|
|
33
|
-
const tryRequire = require('tryrequire');
|
|
30
|
+
const exitPort = two(exit, 'cloudcmd --port: %s');
|
|
34
31
|
const logger = tryRequire('morgan');
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
export default async (options, config) => {
|
|
37
34
|
const prefix = config('prefix');
|
|
38
35
|
const port = process.env.PORT /* c9 */
|
|
39
36
|
|| config('port');
|
|
@@ -51,7 +48,7 @@ module.exports = async (options, config) => {
|
|
|
51
48
|
if (prefix)
|
|
52
49
|
app.get('/', (req, res) => res.redirect(prefix + '/'));
|
|
53
50
|
|
|
54
|
-
const socketServer =
|
|
51
|
+
const socketServer = new Server(server, {
|
|
55
52
|
path: `${prefix}/socket.io`,
|
|
56
53
|
});
|
|
57
54
|
|
package/tmpl/config.hbs
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
Diff
|
|
35
35
|
</label>
|
|
36
36
|
</li>
|
|
37
|
-
<li title="Pack text data
|
|
37
|
+
<li title="Pack text data transferred by an Editor">
|
|
38
38
|
<label>
|
|
39
39
|
<input
|
|
40
40
|
data-name="js-zip"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
Zip
|
|
44
44
|
</label>
|
|
45
45
|
</li>
|
|
46
|
-
<li title="Visible
|
|
46
|
+
<li title="Visible Columns">
|
|
47
47
|
<select data-name="js-columns" class="form-control full-width" title="Visible Columns">
|
|
48
48
|
<option {{ name-size-date-owner-mode-selected }}>name-size-date-owner-mode</option>
|
|
49
49
|
<option {{ name-size-date-selected }}>name-size-date</option>
|