cloudcmd 19.0.17 → 19.1.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 +9 -0
- package/HELP.md +2 -1
- package/README.md +1 -1
- package/bin/cloudcmd.mjs +1 -1
- package/common/try-to-promise-all.js +1 -1
- 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/cloud.js +1 -1
- package/dist/modules/cloud.js.map +1 -1
- package/dist/modules/command-line.js +1 -1
- package/dist/modules/command-line.js.map +1 -1
- package/dist/modules/config.js +1 -1
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/contact.js +1 -1
- package/dist/modules/contact.js.map +1 -1
- package/dist/modules/edit-file-vim.js +1 -1
- package/dist/modules/edit-file-vim.js.map +1 -1
- package/dist/modules/edit-file.js +1 -1
- package/dist/modules/edit-file.js.map +1 -1
- package/dist/modules/edit-names-vim.js +1 -1
- package/dist/modules/edit-names-vim.js.map +1 -1
- package/dist/modules/edit-names.js +1 -1
- package/dist/modules/edit-names.js.map +1 -1
- package/dist/modules/edit.js +1 -1
- package/dist/modules/edit.js.map +1 -1
- package/dist/modules/help.js +1 -1
- package/dist/modules/help.js.map +1 -1
- package/dist/modules/konsole.js +1 -1
- package/dist/modules/konsole.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/menu.js.map +1 -1
- package/dist/modules/operation.js +1 -1
- package/dist/modules/operation.js.map +1 -1
- package/dist/modules/polyfill.js +1 -1
- package/dist/modules/polyfill.js.map +1 -1
- package/dist/modules/terminal-run.js +1 -1
- package/dist/modules/terminal-run.js.map +1 -1
- package/dist/modules/terminal.js +1 -1
- package/dist/modules/terminal.js.map +1 -1
- package/dist/modules/upload.js +1 -1
- package/dist/modules/upload.js.map +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/modules/view.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist-dev/cloudcmd.common.js +57 -24
- package/dist-dev/sw.js +43 -3
- package/package.json +4 -4
- package/server/columns.mjs +3 -2
- package/server/config.js +2 -2
- package/server/route.mjs +1 -1
- package/server/server.mjs +1 -1
- package/server/terminal.js +1 -1
- package/server/theme.mjs +2 -3
- package/server/user-menu.mjs +1 -1
- package/server/validate.mjs +1 -1
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
16
16
|
|
|
17
17
|
"use strict";
|
|
18
|
-
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 CloudCmd.route(location.hash);\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;\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\n}");
|
|
18
|
+
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 {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\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 CloudCmd.route(location.hash);\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;\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\n}");
|
|
19
19
|
|
|
20
20
|
/***/ },
|
|
21
21
|
|
|
@@ -48,7 +48,7 @@ eval("{\n\n/* global CloudCmd */\nconst tryToPromiseAll = __webpack_require__(/*
|
|
|
48
48
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
49
49
|
|
|
50
50
|
"use strict";
|
|
51
|
-
eval("{\n\n/* global DOM */\n/* global CloudCmd */\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst {\n atob,\n btoa\n} = __webpack_require__(/*! ../../common/base64 */ \"./common/base64.js\");\nconst {\n encode,\n decode\n} = __webpack_require__(/*! ../../common/entity */ \"./common/entity.js\");\nconst {\n getTitle,\n FS\n} = __webpack_require__(/*! ../../common/cloudfunc */ \"./common/cloudfunc.js\");\nlet Title;\nconst CURRENT_FILE = 'current-file';\nconst encodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace('\\xa0', ' ');\nconst decodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace(' ', '\\xa0');\nmodule.exports._CURRENT_FILE = CURRENT_FILE;\n/**\n * set name from current (or param) file\n *\n * @param name\n * @param current\n */\nmodule.exports.setCurrentName = (name, current) => {\n const Info = DOM.CurrentInfo;\n const {\n link\n } = Info;\n const {\n prefix\n } = CloudCmd;\n const dir = prefix + FS + Info.dirPath;\n const encoded = encode(name);\n link.title = encoded;\n link.href = dir + encoded;\n link.innerHTML = encoded;\n current.setAttribute('data-name', createNameAttribute(name));\n CloudCmd.emit('current-file', current);\n return link;\n};\n\n/**\n * get name from current (or param) file\n *\n * @param currentFile\n */\nmodule.exports.getCurrentName = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n if (!current) return '';\n return parseNameAttribute(current.getAttribute('data-name'));\n};\n\n/**\n * Generate a `data-name` attribute for the given filename\n * @param name The string name to encode\n */\nconst createNameAttribute = name => {\n const encoded = btoa(encodeURI(name));\n return `js-file-${encoded}`;\n};\n\n/**\n * Parse a `data-name` attribute string back into the original filename\n * @param attribute The string we wish to decode\n */\nconst parseNameAttribute = attribute => {\n attribute = attribute.replace('js-file-', '');\n return decodeNBSP(decodeURI(atob(attribute)));\n};\nmodule.exports._parseNameAttribute = parseNameAttribute;\nconst parseHrefAttribute = (prefix, attribute) => {\n attribute = attribute.replace(RegExp('^' + prefix + FS), '');\n return decode(decodeNBSP(attribute));\n};\nmodule.exports._parseHrefAttribute = parseHrefAttribute;\n/**\n * get current direcotory path\n */\nmodule.exports.getCurrentDirPath = (panel = DOM.getPanel()) => {\n const path = DOM.getByDataName('js-path', panel);\n return path.textContent;\n};\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nmodule.exports.getCurrentPath = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const [element] = DOM.getByTag('a', current);\n const {\n prefix\n } = CloudCmd;\n return parseHrefAttribute(prefix, element.getAttribute('href'));\n};\n\n/**\n * get current direcotory name\n */\nmodule.exports.getCurrentDirName = () => {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n};\n\n/**\n * get current direcotory path\n */\nmodule.exports.getParentDirPath = panel => {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path === '/') return path;\n return path.slice(0, index);\n};\n\n/**\n * get not current direcotory path\n */\nmodule.exports.getNotCurrentDirPath = () => {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n};\n\n/**\n * unified way to get current file\n *\n * @currentFile\n */\nmodule.exports.getCurrentFile = () => {\n return DOM.getByClass(CURRENT_FILE);\n};\n\n/**\n * get current file by name\n */\nmodule.exports.getCurrentByName = (name, panel = DOM.CurrentInfo.panel) => {\n const dataName = 'js-file-' + btoa(encodeURI(encodeNBSP(name)));\n return DOM.getByDataName(dataName, panel);\n};\n\n/**\n * private function thet unset currentfile\n *\n * @currentFile\n */\nfunction unsetCurrentFile(currentFile) {\n const is = DOM.isCurrentFile(currentFile);\n if (!is) return;\n currentFile.classList.remove(CURRENT_FILE);\n}\n\n/**\n * unified way to set current file\n */\nmodule.exports.setCurrentFile = (currentFile, options) => {\n const o = options;\n const currentFileWas = DOM.getCurrentFile();\n if (!currentFile) return DOM;\n let pathWas = '';\n if (currentFileWas) {\n pathWas = DOM.getCurrentDirPath();\n unsetCurrentFile(currentFileWas);\n }\n currentFile.classList.add(CURRENT_FILE);\n const path = DOM.getCurrentDirPath();\n const name = CloudCmd.config('name');\n if (path !== pathWas) {\n DOM.setTitle(getTitle({\n name,\n path\n }));\n\n /* history could be present\n * but it should be false\n * to prevent default behavior\n */\n if (!o || o.history) {\n const historyPath = path === '/' ? path : FS + path;\n DOM.setHistory(historyPath, null, historyPath);\n }\n }\n\n /* scrolling to current file */\n const CENTER = true;\n DOM.scrollIntoViewIfNeeded(currentFile, CENTER);\n CloudCmd.emit('current-file', currentFile);\n CloudCmd.emit('current-path', path);\n CloudCmd.emit('current-name', DOM.getCurrentName(currentFile));\n return DOM;\n};\nthis.setCurrentByName = name => {\n const current = DOM.getCurrentByName(name);\n return DOM.setCurrentFile(current);\n};\n\n/*\n * set current file by position\n *\n * @param layer - element\n * @param - position {x, y}\n */\nmodule.exports.getCurrentByPosition = ({\n x,\n y\n}) => {\n const element = document.elementFromPoint(x, y);\n const getEl = el => {\n const {\n tagName\n } = el;\n const isChild = /A|SPAN|LI/.test(tagName);\n if (!isChild) return null;\n if (tagName === 'A') return el.parentElement.parentElement;\n if (tagName === 'SPAN') return el.parentElement;\n return el;\n };\n const el = getEl(element);\n if (el && el.tagName !== 'LI') return null;\n return el;\n};\n\n/**\n * current file check\n *\n * @param currentFile\n */\nmodule.exports.isCurrentFile = currentFile => {\n if (!currentFile) return false;\n return DOM.isContainClass(currentFile, CURRENT_FILE);\n};\n\n/**\n * set title or create title element\n *\n * @param name\n */\nmodule.exports.setTitle = name => {\n if (!Title) Title = DOM.getByTag('title')[0] || createElement('title', {\n innerHTML: name,\n parent: document.head\n });\n Title.textContent = name;\n return DOM;\n};\n\n/**\n * check is current file is a directory\n *\n * @param currentFile\n */\nmodule.exports.isCurrentIsDir = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const fileType = DOM.getCurrentType(current);\n const isZip =
|
|
51
|
+
eval("{\n\n/* global DOM */\n/* global CloudCmd */\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst {\n atob,\n btoa\n} = __webpack_require__(/*! ../../common/base64 */ \"./common/base64.js\");\nconst {\n encode,\n decode\n} = __webpack_require__(/*! ../../common/entity */ \"./common/entity.js\");\nconst {\n getTitle,\n FS\n} = __webpack_require__(/*! ../../common/cloudfunc */ \"./common/cloudfunc.js\");\nlet Title;\nconst CURRENT_FILE = 'current-file';\nconst encodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace('\\xa0', ' ');\nconst decodeNBSP = a => a === null || a === void 0 ? void 0 : a.replace(' ', '\\xa0');\nmodule.exports._CURRENT_FILE = CURRENT_FILE;\n/**\n * set name from current (or param) file\n *\n * @param name\n * @param current\n */\nmodule.exports.setCurrentName = (name, current) => {\n const Info = DOM.CurrentInfo;\n const {\n link\n } = Info;\n const {\n prefix\n } = CloudCmd;\n const dir = prefix + FS + Info.dirPath;\n const encoded = encode(name);\n link.title = encoded;\n link.href = dir + encoded;\n link.innerHTML = encoded;\n current.setAttribute('data-name', createNameAttribute(name));\n CloudCmd.emit('current-file', current);\n return link;\n};\n\n/**\n * get name from current (or param) file\n *\n * @param currentFile\n */\nmodule.exports.getCurrentName = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n if (!current) return '';\n return parseNameAttribute(current.getAttribute('data-name'));\n};\n\n/**\n * Generate a `data-name` attribute for the given filename\n * @param name The string name to encode\n */\nconst createNameAttribute = name => {\n const encoded = btoa(encodeURI(name));\n return `js-file-${encoded}`;\n};\n\n/**\n * Parse a `data-name` attribute string back into the original filename\n * @param attribute The string we wish to decode\n */\nconst parseNameAttribute = attribute => {\n attribute = attribute.replace('js-file-', '');\n return decodeNBSP(decodeURI(atob(attribute)));\n};\nmodule.exports._parseNameAttribute = parseNameAttribute;\nconst parseHrefAttribute = (prefix, attribute) => {\n attribute = attribute.replace(RegExp('^' + prefix + FS), '');\n return decode(decodeNBSP(attribute));\n};\nmodule.exports._parseHrefAttribute = parseHrefAttribute;\n/**\n * get current direcotory path\n */\nmodule.exports.getCurrentDirPath = (panel = DOM.getPanel()) => {\n const path = DOM.getByDataName('js-path', panel);\n return path.textContent;\n};\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nmodule.exports.getCurrentPath = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const [element] = DOM.getByTag('a', current);\n const {\n prefix\n } = CloudCmd;\n return parseHrefAttribute(prefix, element.getAttribute('href'));\n};\n\n/**\n * get current direcotory name\n */\nmodule.exports.getCurrentDirName = () => {\n const href = DOM.getCurrentDirPath().replace(/\\/$/, '');\n const substr = href.substr(href, href.lastIndexOf('/'));\n return href.replace(`${substr}/`, '') || '/';\n};\n\n/**\n * get current direcotory path\n */\nmodule.exports.getParentDirPath = panel => {\n const path = DOM.getCurrentDirPath(panel);\n const dirName = DOM.getCurrentDirName() + '/';\n const index = path.lastIndexOf(dirName);\n if (path === '/') return path;\n return path.slice(0, index);\n};\n\n/**\n * get not current direcotory path\n */\nmodule.exports.getNotCurrentDirPath = () => {\n const panel = DOM.getPanel({\n active: false\n });\n return DOM.getCurrentDirPath(panel);\n};\n\n/**\n * unified way to get current file\n *\n * @currentFile\n */\nmodule.exports.getCurrentFile = () => {\n return DOM.getByClass(CURRENT_FILE);\n};\n\n/**\n * get current file by name\n */\nmodule.exports.getCurrentByName = (name, panel = DOM.CurrentInfo.panel) => {\n const dataName = 'js-file-' + btoa(encodeURI(encodeNBSP(name)));\n return DOM.getByDataName(dataName, panel);\n};\n\n/**\n * private function thet unset currentfile\n *\n * @currentFile\n */\nfunction unsetCurrentFile(currentFile) {\n const is = DOM.isCurrentFile(currentFile);\n if (!is) return;\n currentFile.classList.remove(CURRENT_FILE);\n}\n\n/**\n * unified way to set current file\n */\nmodule.exports.setCurrentFile = (currentFile, options) => {\n const o = options;\n const currentFileWas = DOM.getCurrentFile();\n if (!currentFile) return DOM;\n let pathWas = '';\n if (currentFileWas) {\n pathWas = DOM.getCurrentDirPath();\n unsetCurrentFile(currentFileWas);\n }\n currentFile.classList.add(CURRENT_FILE);\n const path = DOM.getCurrentDirPath();\n const name = CloudCmd.config('name');\n if (path !== pathWas) {\n DOM.setTitle(getTitle({\n name,\n path\n }));\n\n /* history could be present\n * but it should be false\n * to prevent default behavior\n */\n if (!o || o.history) {\n const historyPath = path === '/' ? path : FS + path;\n DOM.setHistory(historyPath, null, historyPath);\n }\n }\n\n /* scrolling to current file */\n const CENTER = true;\n DOM.scrollIntoViewIfNeeded(currentFile, CENTER);\n CloudCmd.emit('current-file', currentFile);\n CloudCmd.emit('current-path', path);\n CloudCmd.emit('current-name', DOM.getCurrentName(currentFile));\n return DOM;\n};\nthis.setCurrentByName = name => {\n const current = DOM.getCurrentByName(name);\n return DOM.setCurrentFile(current);\n};\n\n/*\n * set current file by position\n *\n * @param layer - element\n * @param - position {x, y}\n */\nmodule.exports.getCurrentByPosition = ({\n x,\n y\n}) => {\n const element = document.elementFromPoint(x, y);\n const getEl = el => {\n const {\n tagName\n } = el;\n const isChild = /A|SPAN|LI/.test(tagName);\n if (!isChild) return null;\n if (tagName === 'A') return el.parentElement.parentElement;\n if (tagName === 'SPAN') return el.parentElement;\n return el;\n };\n const el = getEl(element);\n if (el && el.tagName !== 'LI') return null;\n return el;\n};\n\n/**\n * current file check\n *\n * @param currentFile\n */\nmodule.exports.isCurrentFile = currentFile => {\n if (!currentFile) return false;\n return DOM.isContainClass(currentFile, CURRENT_FILE);\n};\n\n/**\n * set title or create title element\n *\n * @param name\n */\nmodule.exports.setTitle = name => {\n if (!Title) Title = DOM.getByTag('title')[0] || createElement('title', {\n innerHTML: name,\n parent: document.head\n });\n Title.textContent = name;\n return DOM;\n};\n\n/**\n * check is current file is a directory\n *\n * @param currentFile\n */\nmodule.exports.isCurrentIsDir = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const fileType = DOM.getCurrentType(current);\n const isZip = path.endsWith('.zip');\n const isDir = /^directory(-link)?/.test(fileType);\n return isDir || isZip;\n};\nmodule.exports.getCurrentType = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const el = DOM.getByDataName('js-type', current);\n const type = el.className.split(' ').pop();\n return type;\n};\n\n//# sourceURL=file://cloudcmd/client/dom/current-file.js\n}");
|
|
52
52
|
|
|
53
53
|
/***/ },
|
|
54
54
|
|
|
@@ -59,7 +59,7 @@ eval("{\n\n/* global DOM */\n/* global CloudCmd */\nconst createElement = __webp
|
|
|
59
59
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
60
60
|
|
|
61
61
|
"use strict";
|
|
62
|
-
eval("{\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
62
|
+
eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst {\n alert,\n prompt,\n confirm,\n progress\n} = __webpack_require__(/*! smalltalk */ \"./node_modules/smalltalk/lib/smalltalk.js\");\nconst title = 'Cloud Commander';\nmodule.exports.alert = (...a) => alert(title, ...a, {\n cancel: false\n});\nmodule.exports.prompt = (...a) => tryToCatch(prompt, title, ...a);\nmodule.exports.confirm = (...a) => tryToCatch(confirm, title, ...a);\nmodule.exports.progress = (...a) => progress(title, ...a);\nmodule.exports.alert.noFiles = () => {\n return alert(title, 'No files selected!', {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd/client/dom/dialog.js\n}");
|
|
63
63
|
|
|
64
64
|
/***/ },
|
|
65
65
|
|
|
@@ -169,7 +169,7 @@ eval("{\n\n/* global CloudCmd */\nconst {\n promisify\n} = __webpack_require__(
|
|
|
169
169
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
170
170
|
|
|
171
171
|
"use strict";
|
|
172
|
-
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.
|
|
172
|
+
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 {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\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\n}");
|
|
173
173
|
|
|
174
174
|
/***/ },
|
|
175
175
|
|
|
@@ -202,7 +202,7 @@ eval("{\n\n/* global CloudCmd */\nconst capitalize = __webpack_require__(/*! jus
|
|
|
202
202
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
203
203
|
|
|
204
204
|
"use strict";
|
|
205
|
-
eval("{\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
205
|
+
eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst {\n encode\n} = __webpack_require__(/*! ../../common/entity */ \"./common/entity.js\");\nconst Images = __webpack_require__(/*! ./images */ \"./client/dom/images.js\");\nconst IO = __webpack_require__(/*! ./io */ \"./client/dom/io/index.js\");\nconst Dialog = __webpack_require__(/*! ./dialog */ \"./client/dom/dialog.js\");\nconst handleError = promise => async (...args) => {\n const [e, data] = await tryToCatch(promise, ...args);\n if (!e) return [e, data];\n const encoded = encode(e.message);\n Images.show.error(encoded);\n Dialog.alert(encoded);\n return [e, data];\n};\nmodule.exports[\"delete\"] = handleError(IO.delete);\nmodule.exports.patch = handleError(IO.patch);\nmodule.exports.write = handleError(IO.write);\nmodule.exports.createDirectory = handleError(IO.createDirectory);\nmodule.exports.read = handleError(IO.read);\nmodule.exports.copy = handleError(IO.copy);\nmodule.exports.pack = handleError(IO.pack);\nmodule.exports.extract = handleError(IO.extract);\nmodule.exports.move = handleError(IO.move);\nmodule.exports.rename = handleError(IO.rename);\nmodule.exports.Config = {\n read: handleError(IO.Config.read),\n write: handleError(IO.Config.write)\n};\nmodule.exports.Markdown = {\n read: handleError(IO.Markdown.read),\n render: handleError(IO.Markdown.render)\n};\n\n//# sourceURL=file://cloudcmd/client/dom/rest.js\n}");
|
|
206
206
|
|
|
207
207
|
/***/ },
|
|
208
208
|
|
|
@@ -367,7 +367,7 @@ eval("{\n\nmodule.exports = (indexFrom, indexTo, files) => {\n if (indexFrom <
|
|
|
367
367
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
368
368
|
|
|
369
369
|
"use strict";
|
|
370
|
-
eval("{/* global DOM, CloudCmd */\n\n\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst itype = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\nconst clipboard = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\nconst getRange = __webpack_require__(/*! ./get-range */ \"./client/listeners/get-range.js\");\nconst uploadFiles = __webpack_require__(/*! ../dom/upload-files */ \"./client/dom/upload-files.js\");\nconst {\n FS\n} = __webpack_require__(/*! ../../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst getIndex = currify(__webpack_require__(/*! ./get-index */ \"./client/listeners/get-index.js\"));\nconst NBSP_REG = RegExp(String.fromCharCode(160), 'g');\nconst SPACE = ' ';\nmodule.exports.init = async () => {\n await Promise.all([contextMenu(), dragndrop(), unload(), pop(), resize(), header(), config()]);\n};\nCloudCmd.Listeners = module.exports;\nconst unselect = event => {\n const isMac = /Mac/.test(window.navigator.platform);\n const {\n shiftKey,\n metaKey,\n ctrlKey\n } = event;\n if (shiftKey || isMac && metaKey || ctrlKey) return;\n DOM.unselectFiles();\n};\nconst execAll = currify((funcs, event) => {\n for (const fn of funcs) fn(event);\n});\nconst Info = DOM.CurrentInfo;\nconst {\n Events\n} = DOM;\nconst EventsFiles = {\n mousedown: exec.with(execIfNotUL, setCurrentFileByEvent),\n click: execAll([onClick, exec.with(execIfNotMobile, unselect)]),\n dragstart: exec.with(execIfNotUL, onDragStart),\n dblclick: exec.with(execIfNotUL, onDblClick),\n touchstart: exec.with(execIfNotUL, onTouch)\n};\nlet EXT;\nfunction header() {\n const fm = DOM.getFM();\n const isDataset = el => el.dataset;\n const isPanel = el => {\n return /^js-(left|right)$/.test(el.dataset.name);\n };\n Events.addClick(fm, event => {\n const el = event.target;\n const parent = el.parentElement;\n if (parent.dataset.name !== 'js-fm-header') return;\n const name = (el.dataset.name || '').replace('js-', '');\n if (!/^(name|size|date)$/.test(name)) return;\n const panel = getPath(el).filter(isDataset).filter(isPanel).pop();\n CloudCmd.sortPanel(name, panel);\n });\n}\nfunction getPath(el, path = []) {\n if (!el) return path;\n return getPath(el.parentElement, path.concat(el));\n}\nasync function config() {\n const [, config] = await tryToCatch(DOM.Files.get, 'config');\n const type = config === null || config === void 0 ? void 0 : config.packer;\n EXT = DOM.getPackerExt(type);\n}\nmodule.exports.initKeysPanel = () => {\n const keysElement = DOM.getById('js-keyspanel');\n if (!keysElement) return;\n Events.addClick(keysElement, event => {\n const {\n target\n } = event;\n const {\n id\n } = target;\n const operation = name => {\n const {\n Operation\n } = CloudCmd;\n return Operation.show.bind(null, name);\n };\n const clickFuncs = {\n 'f1': CloudCmd.Help.show,\n 'f2': CloudCmd.UserMenu.show,\n 'f3': CloudCmd.View.show,\n 'f4': CloudCmd.EditFile.show,\n 'f5': operation('copy'),\n 'f6': operation('move'),\n 'f7': DOM.promptNewDir,\n 'f8': operation('delete'),\n 'f9': () => {\n event.stopPropagation();\n CloudCmd.Menu.show();\n },\n 'f10': CloudCmd.Config.show,\n '~': CloudCmd.Konsole.show,\n 'shift~': CloudCmd.Terminal.show,\n 'contact': CloudCmd.Contact.show\n };\n exec(clickFuncs[id]);\n });\n};\nconst getPanel = side => {\n if (!itype.string(side)) return side;\n return DOM.getByDataName(`js-${side}`);\n};\nmodule.exports.setOnPanel = side => {\n const panel = getPanel(side);\n const filesElement = DOM.getByDataName('js-files', panel);\n const pathElement = DOM.getByDataName('js-path', panel);\n\n /* ставим загрузку гифа на клик*/\n Events.addClick(pathElement, getPathListener(panel));\n Events.add(filesElement, EventsFiles);\n};\nfunction getPathListener(panel) {\n return onPathElementClick.bind(null, panel);\n}\nfunction isNoCurrent(panel) {\n const infoPanel = Info.panel;\n if (!infoPanel) return true;\n const namePanel = panel.getAttribute('data-name');\n const nameInfoPanel = infoPanel.getAttribute('data-name');\n return namePanel !== nameInfoPanel;\n}\nfunction decodePath(path) {\n const url = CloudCmd.HOST;\n const {\n prefix\n } = CloudCmd;\n const prefixReg = RegExp('^' + prefix + FS);\n return decodeURI(path).replace(url, '').replace(prefixReg, '') // browser doesn't replace % -> %25% do it for him\n .replace('%%', '%25%').replace(NBSP_REG, SPACE) || '/';\n}\nasync function onPathElementClick(panel, event) {\n event.preventDefault();\n const element = event.target;\n const attr = element.getAttribute('data-name');\n const noCurrent = isNoCurrent(panel);\n if (attr === 'js-copy-path') return copyPath(element);\n if (attr === 'js-refresh') return CloudCmd.refresh({\n panel,\n noCurrent\n });\n if (attr !== 'js-path-link') return;\n const {\n href\n } = element;\n const path = decodePath(href);\n await CloudCmd.changeDir(path, {\n isRefresh: false,\n panel: noCurrent ? panel : Info.panel\n });\n}\nfunction copyPath(el) {\n clipboard.writeText(el.parentElement.title).then(CloudCmd.log).catch(CloudCmd.log);\n}\nfunction execIfNotMobile(callback, event) {\n const isMobile = DOM.getCSSVar('is-mobile');\n if (!isMobile) callback(event);\n}\nfunction execIfNotUL(callback, event) {\n const {\n target\n } = event;\n const {\n tagName\n } = target;\n if (tagName !== 'UL') callback(event);\n}\nfunction onClick(event) {\n event.preventDefault();\n changePanel(event.target);\n}\nfunction toggleSelect(key, files) {\n const isMac = /Mac/.test(window.navigator.platform);\n if (!key) throw Error('key should not be undefined!');\n const [file] = files;\n if (isMac && key.meta) return DOM.toggleSelectedFile(file);\n if (key.shift) return files.map(DOM.selectFile);\n}\nfunction changePanel(element) {\n const {\n panel\n } = Info;\n const files = DOM.getByDataName('js-files', panel);\n const ul = getULElement(element);\n if (ul !== files) DOM.changePanel();\n}\nasync function onDblClick(event) {\n event.preventDefault();\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n const path = DOM.getCurrentPath(current);\n if (!isDir) return CloudCmd.View.show();\n await CloudCmd.changeDir(path);\n}\nasync function onTouch(event) {\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n if (!isDir) return;\n const isCurrent = DOM.isCurrentFile(current);\n if (!isCurrent) return;\n await CloudCmd.changeDir(DOM.getCurrentPath(current));\n}\n\n/*\n * download file from browser to desktop\n * in Chrome (HTML5)\n */\nfunction onDragStart(event) {\n const {\n prefixURL\n } = CloudCmd;\n const element = getLIElement(event.target);\n const {\n isDir\n } = Info;\n let link = DOM.getCurrentLink(element);\n let name = DOM.getCurrentName(element);\n\n /* if it's directory - adding json extension */\n if (isDir) {\n name += EXT;\n link = document.createElement('a');\n link.textContent = name;\n link.href = prefixURL + '/pack' + Info.path + EXT;\n }\n event.dataTransfer.setData('DownloadURL', 'application/octet-stream' + ':' + name + ':' + link);\n}\nfunction getLIElement(element) {\n if (!element) return element;\n while (element.tagName !== 'LI') element = element.parentElement;\n return element;\n}\nfunction getULElement(element) {\n while (element.tagName !== 'UL') element = element.parentElement;\n return element;\n}\nfunction setCurrentFileByEvent(event) {\n const BUTTON_LEFT = 0;\n const key = {\n alt: event.altKey,\n ctrl: event.ctrlKey,\n meta: event.metaKey,\n shift: event.shiftKey\n };\n const element = getLIElement(event.target);\n const fromName = Info.name;\n DOM.setCurrentFile(element);\n const toName = Info.name;\n let files = [];\n if (key.shift) files = getFilesRange(fromName, toName);else files.push(Info.element);\n if (event.button === BUTTON_LEFT) toggleSelect(key, files);\n}\nfunction getFilesRange(from, to) {\n const files = DOM.getAllFiles();\n const names = DOM.getFilenames(files);\n const getNameIndex = getIndex(names);\n const indexFrom = getNameIndex(from);\n const indexTo = getNameIndex(to);\n return getRange(indexFrom, indexTo, files);\n}\nfunction contextMenu() {\n const fm = DOM.getFM();\n Events.addOnce('contextmenu', fm, event => {\n CloudCmd.Menu.show({\n x: event.clientX,\n y: event.clientY\n });\n });\n Events.addContextMenu(fm, event => {\n CloudCmd.Menu.ENABLED || event.preventDefault();\n });\n}\nfunction dragndrop() {\n const panels = DOM.getByClassAll('panel');\n const select = ({\n target\n }) => {\n target.classList.add('selected-panel');\n };\n const unselect = ({\n target\n }) => {\n target.classList.remove('selected-panel');\n };\n const onDrop = event => {\n const {\n files,\n items\n } = event.dataTransfer;\n const {\n length: filesCount\n } = files;\n event.preventDefault();\n if (filesCount && (!items || !items.length || !items[0].webkitGetAsEntry)) return uploadFiles(files);\n const isFile = item => item.kind === 'file';\n const dirFiles = Array.from(items).filter(isFile);\n if (dirFiles.length) return DOM.uploadDirectory(dirFiles);\n const {\n Operation\n } = CloudCmd;\n const operation = event.shiftKey ? 'move' : 'copy';\n return Operation.show(operation);\n };\n\n /**\n * In macOS Chrome dropEffect = 'none'\n * so drop do not firing up when try\n * to upload file from download bar\n */\n const onDragOver = event => {\n const {\n dataTransfer\n } = event;\n const {\n effectAllowed\n } = dataTransfer;\n if (/move|linkMove/.test(effectAllowed)) dataTransfer.dropEffect = 'move';else dataTransfer.dropEffect = 'copy';\n event.preventDefault();\n };\n for (const panel of panels) Events.add('dragover', panel, onDragOver).add('drop', panel, onDrop).add('dragenter', select).add(['dragleave', 'drop'], unselect);\n}\nfunction unload() {\n DOM.Events.add(['unload', 'beforeunload'], event => {\n const {\n Key\n } = CloudCmd;\n const isBind = Key === null || Key === void 0 ? void 0 : Key.isBind();\n if (isBind) return;\n event.preventDefault();\n return 'Please make sure that you saved all work.';\n });\n}\nfunction pop() {\n Events.add('popstate', async ({\n state\n }) => {\n const path = (state || '').replace(FS, '');\n if (!path) return CloudCmd.route(location.hash);\n const history = false;\n await CloudCmd.changeDir(path, {\n history\n });\n });\n}\nfunction resize() {\n Events.add('resize', () => {\n const is = window.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH;\n if (!is) return;\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return;\n const name = panel.getAttribute('data-name');\n const isLeft = name === 'js-left';\n if (isLeft) return;\n DOM.changePanel();\n });\n}\n\n//# sourceURL=file://cloudcmd/client/listeners/index.js\n}");
|
|
370
|
+
eval("{/* global DOM, CloudCmd */\n\n\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst itype = __webpack_require__(/*! itype */ \"./node_modules/itype/lib/itype.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst clipboard = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\nconst getRange = __webpack_require__(/*! ./get-range */ \"./client/listeners/get-range.js\");\nconst uploadFiles = __webpack_require__(/*! ../dom/upload-files */ \"./client/dom/upload-files.js\");\nconst {\n FS\n} = __webpack_require__(/*! ../../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst getIndex = currify(__webpack_require__(/*! ./get-index */ \"./client/listeners/get-index.js\"));\nconst NBSP_REG = RegExp(String.fromCharCode(160), 'g');\nconst SPACE = ' ';\nmodule.exports.init = async () => {\n await Promise.all([contextMenu(), dragndrop(), unload(), pop(), resize(), header(), config()]);\n};\nCloudCmd.Listeners = module.exports;\nconst unselect = event => {\n const isMac = /Mac/.test(window.navigator.platform);\n const {\n shiftKey,\n metaKey,\n ctrlKey\n } = event;\n if (shiftKey || isMac && metaKey || ctrlKey) return;\n DOM.unselectFiles();\n};\nconst execAll = currify((funcs, event) => {\n for (const fn of funcs) fn(event);\n});\nconst Info = DOM.CurrentInfo;\nconst {\n Events\n} = DOM;\nconst EventsFiles = {\n mousedown: exec.with(execIfNotUL, setCurrentFileByEvent),\n click: execAll([onClick, exec.with(execIfNotMobile, unselect)]),\n dragstart: exec.with(execIfNotUL, onDragStart),\n dblclick: exec.with(execIfNotUL, onDblClick),\n touchstart: exec.with(execIfNotUL, onTouch)\n};\nlet EXT;\nfunction header() {\n const fm = DOM.getFM();\n const isDataset = el => el.dataset;\n const isPanel = el => {\n return /^js-(left|right)$/.test(el.dataset.name);\n };\n Events.addClick(fm, event => {\n const el = event.target;\n const parent = el.parentElement;\n if (parent.dataset.name !== 'js-fm-header') return;\n const name = (el.dataset.name || '').replace('js-', '');\n if (!/^(name|size|date)$/.test(name)) return;\n const panel = getPath(el).filter(isDataset).filter(isPanel).pop();\n CloudCmd.sortPanel(name, panel);\n });\n}\nfunction getPath(el, path = []) {\n if (!el) return path;\n return getPath(el.parentElement, path.concat(el));\n}\nasync function config() {\n const [, config] = await tryToCatch(DOM.Files.get, 'config');\n const type = config === null || config === void 0 ? void 0 : config.packer;\n EXT = DOM.getPackerExt(type);\n}\nmodule.exports.initKeysPanel = () => {\n const keysElement = DOM.getById('js-keyspanel');\n if (!keysElement) return;\n Events.addClick(keysElement, event => {\n const {\n target\n } = event;\n const {\n id\n } = target;\n const operation = name => {\n const {\n Operation\n } = CloudCmd;\n return Operation.show.bind(null, name);\n };\n const clickFuncs = {\n 'f1': CloudCmd.Help.show,\n 'f2': CloudCmd.UserMenu.show,\n 'f3': CloudCmd.View.show,\n 'f4': CloudCmd.EditFile.show,\n 'f5': operation('copy'),\n 'f6': operation('move'),\n 'f7': DOM.promptNewDir,\n 'f8': operation('delete'),\n 'f9': () => {\n event.stopPropagation();\n CloudCmd.Menu.show();\n },\n 'f10': CloudCmd.Config.show,\n '~': CloudCmd.Konsole.show,\n 'shift~': CloudCmd.Terminal.show,\n 'contact': CloudCmd.Contact.show\n };\n exec(clickFuncs[id]);\n });\n};\nconst getPanel = side => {\n if (!itype.string(side)) return side;\n return DOM.getByDataName(`js-${side}`);\n};\nmodule.exports.setOnPanel = side => {\n const panel = getPanel(side);\n const filesElement = DOM.getByDataName('js-files', panel);\n const pathElement = DOM.getByDataName('js-path', panel);\n\n /* ставим загрузку гифа на клик*/\n Events.addClick(pathElement, getPathListener(panel));\n Events.add(filesElement, EventsFiles);\n};\nfunction getPathListener(panel) {\n return onPathElementClick.bind(null, panel);\n}\nfunction isNoCurrent(panel) {\n const infoPanel = Info.panel;\n if (!infoPanel) return true;\n const namePanel = panel.getAttribute('data-name');\n const nameInfoPanel = infoPanel.getAttribute('data-name');\n return namePanel !== nameInfoPanel;\n}\nfunction decodePath(path) {\n const url = CloudCmd.HOST;\n const {\n prefix\n } = CloudCmd;\n const prefixReg = RegExp('^' + prefix + FS);\n return decodeURI(path).replace(url, '').replace(prefixReg, '') // browser doesn't replace % -> %25% do it for him\n .replace('%%', '%25%').replace(NBSP_REG, SPACE) || '/';\n}\nasync function onPathElementClick(panel, event) {\n event.preventDefault();\n const element = event.target;\n const attr = element.getAttribute('data-name');\n const noCurrent = isNoCurrent(panel);\n if (attr === 'js-copy-path') return copyPath(element);\n if (attr === 'js-refresh') return CloudCmd.refresh({\n panel,\n noCurrent\n });\n if (attr !== 'js-path-link') return;\n const {\n href\n } = element;\n const path = decodePath(href);\n await CloudCmd.changeDir(path, {\n isRefresh: false,\n panel: noCurrent ? panel : Info.panel\n });\n}\nfunction copyPath(el) {\n clipboard.writeText(el.parentElement.title).then(CloudCmd.log).catch(CloudCmd.log);\n}\nfunction execIfNotMobile(callback, event) {\n const isMobile = DOM.getCSSVar('is-mobile');\n if (!isMobile) callback(event);\n}\nfunction execIfNotUL(callback, event) {\n const {\n target\n } = event;\n const {\n tagName\n } = target;\n if (tagName !== 'UL') callback(event);\n}\nfunction onClick(event) {\n event.preventDefault();\n changePanel(event.target);\n}\nfunction toggleSelect(key, files) {\n const isMac = /Mac/.test(window.navigator.platform);\n if (!key) throw Error('key should not be undefined!');\n const [file] = files;\n if (isMac && key.meta) return DOM.toggleSelectedFile(file);\n if (key.shift) return files.map(DOM.selectFile);\n}\nfunction changePanel(element) {\n const {\n panel\n } = Info;\n const files = DOM.getByDataName('js-files', panel);\n const ul = getULElement(element);\n if (ul !== files) DOM.changePanel();\n}\nasync function onDblClick(event) {\n event.preventDefault();\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n const path = DOM.getCurrentPath(current);\n if (!isDir) return CloudCmd.View.show();\n await CloudCmd.changeDir(path);\n}\nasync function onTouch(event) {\n const current = getLIElement(event.target);\n const isDir = DOM.isCurrentIsDir(current);\n if (!isDir) return;\n const isCurrent = DOM.isCurrentFile(current);\n if (!isCurrent) return;\n await CloudCmd.changeDir(DOM.getCurrentPath(current));\n}\n\n/*\n * download file from browser to desktop\n * in Chrome (HTML5)\n */\nfunction onDragStart(event) {\n const {\n prefixURL\n } = CloudCmd;\n const element = getLIElement(event.target);\n const {\n isDir\n } = Info;\n let link = DOM.getCurrentLink(element);\n let name = DOM.getCurrentName(element);\n\n /* if it's directory - adding json extension */\n if (isDir) {\n name += EXT;\n link = document.createElement('a');\n link.textContent = name;\n link.href = prefixURL + '/pack' + Info.path + EXT;\n }\n event.dataTransfer.setData('DownloadURL', 'application/octet-stream' + ':' + name + ':' + link);\n}\nfunction getLIElement(element) {\n if (!element) return element;\n while (element.tagName !== 'LI') element = element.parentElement;\n return element;\n}\nfunction getULElement(element) {\n while (element.tagName !== 'UL') element = element.parentElement;\n return element;\n}\nfunction setCurrentFileByEvent(event) {\n const BUTTON_LEFT = 0;\n const key = {\n alt: event.altKey,\n ctrl: event.ctrlKey,\n meta: event.metaKey,\n shift: event.shiftKey\n };\n const element = getLIElement(event.target);\n const fromName = Info.name;\n DOM.setCurrentFile(element);\n const toName = Info.name;\n let files = [];\n if (key.shift) files = getFilesRange(fromName, toName);else files.push(Info.element);\n if (event.button === BUTTON_LEFT) toggleSelect(key, files);\n}\nfunction getFilesRange(from, to) {\n const files = DOM.getAllFiles();\n const names = DOM.getFilenames(files);\n const getNameIndex = getIndex(names);\n const indexFrom = getNameIndex(from);\n const indexTo = getNameIndex(to);\n return getRange(indexFrom, indexTo, files);\n}\nfunction contextMenu() {\n const fm = DOM.getFM();\n Events.addOnce('contextmenu', fm, event => {\n CloudCmd.Menu.show({\n x: event.clientX,\n y: event.clientY\n });\n });\n Events.addContextMenu(fm, event => {\n CloudCmd.Menu.ENABLED || event.preventDefault();\n });\n}\nfunction dragndrop() {\n const panels = DOM.getByClassAll('panel');\n const select = ({\n target\n }) => {\n target.classList.add('selected-panel');\n };\n const unselect = ({\n target\n }) => {\n target.classList.remove('selected-panel');\n };\n const onDrop = event => {\n const {\n files,\n items\n } = event.dataTransfer;\n const {\n length: filesCount\n } = files;\n event.preventDefault();\n if (filesCount && (!items || !items.length || !items[0].webkitGetAsEntry)) return uploadFiles(files);\n const isFile = item => item.kind === 'file';\n const dirFiles = Array.from(items).filter(isFile);\n if (dirFiles.length) return DOM.uploadDirectory(dirFiles);\n const {\n Operation\n } = CloudCmd;\n const operation = event.shiftKey ? 'move' : 'copy';\n return Operation.show(operation);\n };\n\n /**\n * In macOS Chrome dropEffect = 'none'\n * so drop do not firing up when try\n * to upload file from download bar\n */\n const onDragOver = event => {\n const {\n dataTransfer\n } = event;\n const {\n effectAllowed\n } = dataTransfer;\n if (/move|linkMove/.test(effectAllowed)) dataTransfer.dropEffect = 'move';else dataTransfer.dropEffect = 'copy';\n event.preventDefault();\n };\n for (const panel of panels) Events.add('dragover', panel, onDragOver).add('drop', panel, onDrop).add('dragenter', select).add(['dragleave', 'drop'], unselect);\n}\nfunction unload() {\n DOM.Events.add(['unload', 'beforeunload'], event => {\n const {\n Key\n } = CloudCmd;\n const isBind = Key === null || Key === void 0 ? void 0 : Key.isBind();\n if (isBind) return;\n event.preventDefault();\n return 'Please make sure that you saved all work.';\n });\n}\nfunction pop() {\n Events.add('popstate', async ({\n state\n }) => {\n const path = (state || '').replace(FS, '');\n if (!path) return CloudCmd.route(location.hash);\n const history = false;\n await CloudCmd.changeDir(path, {\n history\n });\n });\n}\nfunction resize() {\n Events.add('resize', () => {\n const is = window.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH;\n if (!is) return;\n const {\n panel\n } = Info;\n const isEmptyRoot = !panel;\n if (isEmptyRoot) return;\n const name = panel.getAttribute('data-name');\n const isLeft = name === 'js-left';\n if (isLeft) return;\n DOM.changePanel();\n });\n}\n\n//# sourceURL=file://cloudcmd/client/listeners/index.js\n}");
|
|
371
371
|
|
|
372
372
|
/***/ },
|
|
373
373
|
|
|
@@ -378,7 +378,7 @@ eval("{/* global DOM, CloudCmd */\n\n\n\nconst exec = __webpack_require__(/*! ex
|
|
|
378
378
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
379
379
|
|
|
380
380
|
"use strict";
|
|
381
|
-
eval("{\n\n/* global CloudCmd */\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
381
|
+
eval("{\n\n/* global CloudCmd */\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst loadJS = (__webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\").js);\nconst pascalCase = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.cjs\");\nconst noJS = a => a.replace(/.js$/, '');\n\n/**\n * function load modules\n * @params = {name, path, func, dobefore, arg}\n */\nmodule.exports = function loadModule(params) {\n if (!params) return;\n const {\n path\n } = params;\n const name = path && noJS(pascalCase(path));\n const doBefore = params.dobefore;\n if (CloudCmd[name]) return;\n CloudCmd[name] = async () => {\n exec(doBefore);\n const {\n DIR_MODULES\n } = CloudCmd;\n const pathFull = `${DIR_MODULES}/${path}.js`;\n await loadJS(pathFull);\n const newModule = async f => f && f();\n const module = CloudCmd[name];\n Object.assign(newModule, module);\n CloudCmd[name] = newModule;\n CloudCmd.log('init', name);\n await module.init();\n return newModule;\n };\n CloudCmd[name].show = async (...args) => {\n CloudCmd.log('show', name, args);\n const m = CloudCmd[name];\n const [e, a] = await tryToCatch(m);\n if (e) return console.error(e);\n return await a.show(...args);\n };\n};\n\n//# sourceURL=file://cloudcmd/client/load-module.js\n}");
|
|
382
382
|
|
|
383
383
|
/***/ },
|
|
384
384
|
|
|
@@ -411,7 +411,7 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.CommandLine = exports;\nconst Dialog
|
|
|
411
411
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
412
412
|
|
|
413
413
|
"use strict";
|
|
414
|
-
eval("{\n\n/* global CloudCmd, DOM, io */\n__webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst squad = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
414
|
+
eval("{\n\n/* global CloudCmd, DOM, io */\n__webpack_require__(/*! ../../../css/config.css */ \"./css/config.css\");\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst squad = __webpack_require__(/*! squad */ \"./node_modules/squad/lib/squad.js\");\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst input = __webpack_require__(/*! ./input */ \"./client/modules/config/input.js\");\nconst Images = __webpack_require__(/*! ../../dom/images */ \"./client/dom/images.js\");\nconst Events = __webpack_require__(/*! ../../dom/events */ \"./client/dom/events/index.js\");\nconst Files = __webpack_require__(/*! ../../dom/files */ \"./client/dom/files.js\");\nconst {\n getTitle\n} = __webpack_require__(/*! ../../../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst {\n Dialog,\n setTitle\n} = DOM;\nconst Name = 'Config';\nCloudCmd[Name] = module.exports;\nconst loadSocket = promisify(DOM.loadSocket);\nconst showLoad = () => {\n Images.show.load('top');\n};\nconst addKey = currify((fn, input) => {\n Events.addKey(input, fn);\n return input;\n});\nconst addChange = currify((fn, input) => {\n Events.add('change', input, fn);\n return input;\n});\nconst Config = {};\nlet Template;\nconst loadCSS = load.css;\nmodule.exports.init = async () => {\n if (!CloudCmd.config('configDialog')) return;\n showLoad();\n const {\n DIR_DIST\n } = CloudCmd;\n [Template] = await Promise.all([Files.get('config-tmpl'), loadSocket(), loadCSS(`${DIR_DIST}/config.css`), CloudCmd.View()]);\n initSocket();\n};\nconst {\n config,\n Key\n} = CloudCmd;\nlet Element;\nfunction getHost() {\n const {\n host,\n origin,\n protocol\n } = location;\n return origin || `${protocol}//${host}`;\n}\nfunction initSocket() {\n const href = getHost();\n const {\n prefixSocket,\n prefix\n } = CloudCmd;\n const ONE_MINUTE = 60 * 1000;\n const socket = io.connect(href + prefixSocket + '/config', {\n reconnectionAttempts: Infinity,\n reconnectionDelay: ONE_MINUTE,\n path: `${prefix}/socket.io`\n });\n const save = data => {\n onSave(data);\n socket.send(data);\n };\n authCheck(socket);\n socket.on('connect', () => {\n Config.save = save;\n });\n socket.on('message', onSave);\n socket.on('log', CloudCmd.log);\n socket.on('disconnect', () => {\n Config.save = saveHttp;\n });\n socket.on('err', Dialog.alert);\n}\nfunction authCheck(socket) {\n socket.emit('auth', config('username'), config('password'));\n socket.on('reject', wraptile(Dialog.alert, 'Wrong credentials!'));\n}\nConfig.save = saveHttp;\nmodule.exports.show = show;\nasync function show() {\n if (!CloudCmd.config('configDialog')) return;\n await fillTemplate();\n}\nasync function fillTemplate() {\n const [error, config] = await tryToCatch(Files.get, 'config');\n if (error) return Dialog.alert('Could not load config!');\n const {\n editor,\n menu,\n packer,\n columns,\n theme,\n configAuth,\n ...obj\n } = input.convert(config);\n obj[`${menu}-selected`] = 'selected';\n obj[`${editor}-selected`] = 'selected';\n obj[`${packer}-selected`] = 'selected';\n obj[`${columns}-selected`] = 'selected';\n obj[`${theme}-selected`] = 'selected';\n obj.configAuth = configAuth ? '' : 'hidden';\n const innerHTML = rendy(Template, obj);\n Element = createElement('form', {\n className: 'config',\n innerHTML\n });\n const inputs = document.querySelectorAll('input, select', Element);\n const [inputFirst] = inputs;\n let afterShow;\n if (inputFirst) {\n onAuthChange(inputFirst.checked);\n afterShow = inputFirst.focus.bind(inputFirst);\n }\n const getTarget = ({\n target\n }) => target;\n const handleChange = squad(onChange, getTarget);\n Array.from(inputs).map(addKey(onKey)).map(addChange(handleChange));\n const autoSize = true;\n CloudCmd.View.show(Element, {\n autoSize,\n afterShow\n });\n}\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nasync function onChange(el) {\n const obj = {};\n const name = input.getName(el);\n const data = input.getValue(name, Element);\n if (name === 'name') onNameChange(data);else if (name === 'auth') onAuthChange(data);\n obj[name] = data;\n await Config.save(obj);\n}\nfunction onSave(obj) {\n for (const name of Object.keys(obj)) {\n const data = obj[name];\n CloudCmd._config(name, data);\n input.setValue(name, data, Element);\n }\n}\nasync function saveHttp(obj) {\n const {\n RESTful\n } = DOM;\n const [e] = await RESTful.Config.write(obj);\n if (e) return;\n onSave(obj);\n}\nfunction onAuthChange(checked) {\n const elUsername = input.getElementByName('username', Element);\n const elPassword = input.getElementByName('password', Element);\n elUsername.disabled = !checked;\n elPassword.disabled = !checked;\n}\nfunction onNameChange(name) {\n setTitle(getTitle({\n name\n }));\n}\nasync function onKey({\n keyCode,\n target\n}) {\n switch (keyCode) {\n case Key.ESC:\n return hide();\n case Key.ENTER:\n return await onChange(target);\n }\n}\n\n//# sourceURL=file://cloudcmd/client/modules/config/index.js\n}");
|
|
415
415
|
|
|
416
416
|
/***/ },
|
|
417
417
|
|
|
@@ -488,7 +488,7 @@ eval("{\n\n/* global CloudCmd, DOM */\nCloudCmd.EditNames = exports;\nconst curr
|
|
|
488
488
|
(module, exports, __webpack_require__) {
|
|
489
489
|
|
|
490
490
|
"use strict";
|
|
491
|
-
eval("{/* global CloudCmd */\n\n\n\nconst montag = __webpack_require__(/*! montag */ \"./node_modules/montag/lib/montag.js\");\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
491
|
+
eval("{/* global CloudCmd */\n\n\n\nconst montag = __webpack_require__(/*! montag */ \"./node_modules/montag/lib/montag.js\");\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst {\n MAX_FILE_SIZE: maxSize\n} = __webpack_require__(/*! ../../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst {\n time,\n timeEnd\n} = __webpack_require__(/*! ../../common/util */ \"./common/util.js\");\nconst getEditor = () => editor;\nconst isFn = a => typeof a === 'function';\nconst loadJS = load.js;\nconst Name = 'Edit';\nCloudCmd[Name] = exports;\nconst EditorName = CloudCmd.config('editor');\nlet Loading = true;\nlet Element;\nlet editor;\nconst ConfigView = {\n afterShow: () => {\n editor.moveCursorTo(0, 0).focus();\n }\n};\nmodule.exports.init = async () => {\n const element = create();\n await CloudCmd.View();\n await loadFiles(element);\n};\nfunction create() {\n const element = createElement('div', {\n style: montag`\n width: 100%;\n height: 100%;\n font-family: \"Droid Sans Mono\";\n `,\n notAppend: true\n });\n Element = element;\n return element;\n}\nfunction checkFn(name, fn) {\n if (!isFn(fn)) throw Error(`${name} should be a function!`);\n}\nfunction initConfig(options = {}) {\n const config = {\n ...options,\n ...ConfigView\n };\n if (!options.afterShow) return config;\n checkFn('options.afterShow', options.afterShow);\n config.afterShow = () => {\n ConfigView.afterShow();\n options.afterShow();\n };\n return config;\n}\nmodule.exports.show = options => {\n if (Loading) return;\n CloudCmd.View.show(Element, initConfig(options));\n getEditor().setOptions({\n fontSize: 16\n });\n};\nmodule.exports.getEditor = getEditor;\nmodule.exports.getElement = () => Element;\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nconst loadFiles = async element => {\n const prefix = `${CloudCmd.prefix}/${EditorName}`;\n const socketPath = CloudCmd.prefix;\n const prefixSocket = `${CloudCmd.prefixSocket}/${EditorName}`;\n const url = `${prefix}/${EditorName}.js`;\n time(`${Name} load`);\n await loadJS(url);\n const word = promisify(window[EditorName]);\n const [ed] = await tryToCatch(word, element, {\n maxSize,\n prefix,\n prefixSocket,\n socketPath\n });\n timeEnd(`${Name} load`);\n editor = ed;\n Loading = false;\n};\n\n//# sourceURL=file://cloudcmd/client/modules/edit.js\n}");
|
|
492
492
|
|
|
493
493
|
/***/ },
|
|
494
494
|
|
|
@@ -510,7 +510,7 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.Help = exports;\nconst Images = __web
|
|
|
510
510
|
(module, exports, __webpack_require__) {
|
|
511
511
|
|
|
512
512
|
"use strict";
|
|
513
|
-
eval("{\n\n/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global Console */\nCloudCmd.Konsole = exports;\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
513
|
+
eval("{\n\n/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global Console */\nCloudCmd.Konsole = exports;\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst loadJS = (__webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\").js);\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst Images = __webpack_require__(/*! ../dom/images */ \"./client/dom/images.js\");\nconst {\n Dialog,\n CurrentInfo: Info\n} = DOM;\nconst rmLastSlash = a => a.replace(/\\/$/, '') || '/';\nlet konsole;\nconst {\n config\n} = CloudCmd;\nconst cd = currify((fn, dir) => fn(`cd ${rmLastSlash(dir)}`));\nconst Name = 'Konsole';\nlet Element;\nlet Loaded;\nmodule.exports.init = async () => {\n if (!config('console')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await load();\n await create();\n};\nmodule.exports.hide = () => {\n CloudCmd.View.hide();\n};\nmodule.exports.clear = () => {\n konsole.clear();\n};\nconst getPrefix = () => CloudCmd.prefix + '/console';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/console';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath.bind(DOM),\n PASSIVE_DIR: DOM.getNotCurrentDirPath.bind(DOM),\n CURRENT_NAME: DOM.getCurrentName.bind(DOM),\n CURRENT_PATH: () => Info.path\n});\nasync function onPath(path) {\n if (Info.dirPath === path) return;\n await CloudCmd.changeDir(path);\n}\nconst getDirPath = () => {\n if (config('syncConsolePath')) return Info.dirPath;\n};\nconst create = async () => {\n const options = {\n cwd: getDirPath(),\n env: getEnv(),\n prefix: getPrefix(),\n prefixSocket: getPrefixSocket(),\n socketPath: CloudCmd.prefix\n };\n Element = createElement('div', {\n className: 'console'\n });\n konsole = await Console(Element, options);\n konsole.on('connect', exec.with(authCheck, konsole));\n konsole.on('path', config.if('syncConsolePath', onPath));\n CloudCmd.on('active-dir', config.if('syncConsolePath', cd(konsole.handler)));\n konsole.addShortCuts({\n P: () => {\n const command = konsole.getPromptText();\n const path = DOM.getCurrentDirPath();\n konsole.setPromptText(command + path);\n }\n });\n};\nfunction authCheck(konsole) {\n konsole.emit('auth', config('username'), config('password'));\n konsole.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nmodule.exports.show = callback => {\n if (!Loaded) return;\n if (!config('console')) return;\n CloudCmd.View.show(Element, {\n afterShow: () => {\n konsole.focus();\n exec(callback);\n }\n });\n};\nconst load = async () => {\n Util.time(`${Name} load`);\n const prefix = getPrefix();\n const url = `${prefix}/console.js`;\n const [error] = await tryToCatch(loadJS, url);\n Loaded = true;\n Util.timeEnd(`${Name} load`);\n if (error) return Dialog.alert(error.message, {\n cancel: false\n });\n};\n\n//# sourceURL=file://cloudcmd/client/modules/konsole.js\n}");
|
|
514
514
|
|
|
515
515
|
/***/ },
|
|
516
516
|
|
|
@@ -576,7 +576,7 @@ eval("{\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/c
|
|
|
576
576
|
(module, exports, __webpack_require__) {
|
|
577
577
|
|
|
578
578
|
"use strict";
|
|
579
|
-
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.js\");\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\n}");
|
|
579
|
+
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.js\");\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 {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\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\n}");
|
|
580
580
|
|
|
581
581
|
/***/ },
|
|
582
582
|
|
|
@@ -587,7 +587,7 @@ eval("{/* global CloudCmd */\n/* global Util */\n/* global DOM */\n/* global fil
|
|
|
587
587
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
588
588
|
|
|
589
589
|
"use strict";
|
|
590
|
-
eval("{\n\nconst {\n getExt\n} = __webpack_require__(/*! ../../../common/util */ \"./common/util.js\");\nmodule.exports = name => {\n const ext = getExtension(name);\n return name.replace(ext, '');\n};\nfunction getExtension(name) {\n if (
|
|
590
|
+
eval("{\n\nconst {\n getExt\n} = __webpack_require__(/*! ../../../common/util */ \"./common/util.js\");\nmodule.exports = name => {\n const ext = getExtension(name);\n return name.replace(ext, '');\n};\nfunction getExtension(name) {\n if (name.endsWith('.tar.gz')) return '.tar.gz';\n if (name.endsWith('.tar.bz2')) return '.tar.bz2';\n return getExt(name);\n}\n\n//# sourceURL=file://cloudcmd/client/modules/operation/remove-extension.js\n}");
|
|
591
591
|
|
|
592
592
|
/***/ },
|
|
593
593
|
|
|
@@ -620,7 +620,7 @@ eval("{\n\n/* global DOM */\n__webpack_require__(/*! domtokenlist-shim */ \"./no
|
|
|
620
620
|
(module, exports, __webpack_require__) {
|
|
621
621
|
|
|
622
622
|
"use strict";
|
|
623
|
-
eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
623
|
+
eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst fullstore = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\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 DOM = __webpack_require__(/*! ../dom */ \"./client/dom/index.js\");\nconst Images = __webpack_require__(/*! ../dom/images */ \"./client/dom/images.js\");\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = fullstore();\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(load.parallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(window.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n};\nmodule.exports.show = promisify((options = {}, fn) => {\n if (!Loaded) return fn(null, -1);\n if (!config('terminal')) return;\n create(options);\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n },\n afterClose: (/* exec.series args */\n ) => {\n fn(null, exitCodeStore());\n }\n });\n});\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create(createOptions) {\n const {\n cwd = DOM.getCurrentDirPath(),\n command,\n autoClose,\n closeMessage = 'Press any key to close Terminal...'\n } = createOptions;\n const options = {\n cwd,\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono',\n command,\n autoRestart: false\n };\n let commandExit = false;\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (commandExit) hide();\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('exit', code => {\n exitCodeStore(code);\n if (autoClose) return hide();\n terminal.write(`\\n${closeMessage}`);\n commandExit = true;\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\n\n//# sourceURL=file://cloudcmd/client/modules/terminal-run.js\n}");
|
|
624
624
|
|
|
625
625
|
/***/ },
|
|
626
626
|
|
|
@@ -631,7 +631,7 @@ eval("{\n\n/* global CloudCmd, gritty */\nconst {\n promisify\n} = __webpack_re
|
|
|
631
631
|
(module, exports, __webpack_require__) {
|
|
632
632
|
|
|
633
633
|
"use strict";
|
|
634
|
-
eval("{\n\n/* global CloudCmd */\n/* global gritty */\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
634
|
+
eval("{\n\n/* global CloudCmd */\n/* global gritty */\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\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 DOM = __webpack_require__(/*! ../dom */ \"./client/dom/index.js\");\nconst Images = __webpack_require__(/*! ../dom/images */ \"./client/dom/images.js\");\nconst loadParallel = load.parallel;\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.Terminal = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst loadAll = async () => {\n const {\n prefix\n } = CloudCmd;\n const prefixGritty = getPrefix();\n const js = `${prefixGritty}/gritty.js`;\n const css = `${prefix}/dist/terminal.css`;\n const [e] = await tryToCatch(loadParallel, [js, css]);\n if (e) {\n const src = e.target.src.replace(window.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n Loaded = true;\n};\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n create();\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst getPrefix = () => CloudCmd.prefix + '/gritty';\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\nconst getEnv = () => ({\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n});\nfunction create() {\n const options = {\n env: getEnv(),\n prefix: getPrefixSocket(),\n socketPath: CloudCmd.prefix,\n fontFamily: 'Droid Sans Mono'\n };\n const {\n socket,\n terminal\n } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(({\n domEvent\n }) => {\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (shiftKey && keyCode === Key.ESC) hide();\n });\n Socket.on('connect', exec.with(authCheck, socket));\n}\nfunction authCheck(spawn) {\n spawn.emit('auth', config('username'), config('password'));\n spawn.on('reject', () => {\n Dialog.alert('Wrong credentials!');\n });\n}\nfunction show() {\n if (!Loaded) return;\n if (!config('terminal')) return;\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n }\n });\n}\n\n//# sourceURL=file://cloudcmd/client/modules/terminal.js\n}");
|
|
635
635
|
|
|
636
636
|
/***/ },
|
|
637
637
|
|
|
@@ -664,7 +664,7 @@ eval("{\n\nmodule.exports = menuFn => {\n const module = {};\n const fn = Func
|
|
|
664
664
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
665
665
|
|
|
666
666
|
"use strict";
|
|
667
|
-
eval("{\n\n/* global CloudCmd, DOM */\n__webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst fullstore = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst tryCatch = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.
|
|
667
|
+
eval("{\n\n/* global CloudCmd, DOM */\n__webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst fullstore = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst {\n tryCatch\n} = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.cjs\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst {\n codeFrameColumns\n} = __webpack_require__(/*! @babel/code-frame */ \"./node_modules/@babel/code-frame/lib/index.js\");\nconst Images = __webpack_require__(/*! ../../dom/images */ \"./client/dom/images.js\");\nconst Dialog = __webpack_require__(/*! ../../dom/dialog */ \"./client/dom/dialog.js\");\nconst getUserMenu = __webpack_require__(/*! ./get-user-menu */ \"./client/modules/user-menu/get-user-menu.js\");\nconst navigate = __webpack_require__(/*! ./navigate */ \"./client/modules/user-menu/navigate.js\");\nconst parseError = __webpack_require__(/*! ./parse-error */ \"./client/modules/user-menu/parse-error.js\");\nconst parseUserMenu = __webpack_require__(/*! ./parse-user-menu */ \"./client/modules/user-menu/parse-user-menu.js\");\nconst {\n runSelected\n} = __webpack_require__(/*! ./run */ \"./client/modules/user-menu/run.js\");\nconst loadCSS = load.css;\nconst sourceStore = fullstore();\nconst Name = 'UserMenu';\nCloudCmd[Name] = module.exports;\nconst {\n Key\n} = CloudCmd;\nmodule.exports.init = async () => {\n await Promise.all([loadCSS(`${CloudCmd.prefix}/dist/user-menu.css`), CloudCmd.View()]);\n};\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nconst {\n CurrentInfo\n} = DOM;\nasync function show() {\n Images.show.load('top');\n const {\n dirPath\n } = CurrentInfo;\n const res = await fetch(`${CloudCmd.prefix}/api/v1/user-menu?dir=${dirPath}`);\n const source = await res.text();\n const [error, userMenu] = tryCatch(getUserMenu, source);\n Images.hide();\n if (error) return Dialog.alert(getCodeFrame({\n error,\n source\n }));\n sourceStore(source);\n const {\n names,\n keys,\n items,\n settings\n } = parseUserMenu(userMenu);\n if (settings.run) return runSelected(settings.select, items, runUserMenu);\n const button = createElement('button', {\n className: 'cloudcmd-user-menu-button',\n innerText: 'User Menu',\n notAppend: true\n });\n const select = createElement('select', {\n className: 'cloudcmd-user-menu',\n innerHTML: fillTemplate(names),\n notAppend: true,\n size: 10\n });\n button.addEventListener('click', onButtonClick(userMenu, select));\n select.addEventListener('dblclick', onDblClick(userMenu));\n select.addEventListener('keydown', onKeyDown({\n keys,\n userMenu\n }));\n const afterShow = () => select.focus();\n const autoSize = true;\n CloudCmd.View.show([button, select], {\n autoSize,\n afterShow\n });\n}\nfunction fillTemplate(options) {\n const result = [];\n for (const option of options) result.push(`<option>${option}</option>`);\n return result.join('');\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst onDblClick = currify(async (items, e) => {\n const {\n value\n } = e.target;\n await runUserMenu(items[value]);\n});\nconst onButtonClick = wraptile(async (items, {\n value\n}) => {\n await runUserMenu(items[value]);\n});\nconst onKeyDown = currify(async ({\n keys,\n userMenu\n}, e) => {\n const {\n keyCode,\n target\n } = e;\n const keyName = e.key.toUpperCase();\n e.preventDefault();\n e.stopPropagation();\n let value;\n if (keyCode === Key.ESC) return hide();\n if (keyCode === Key.ENTER) value = userMenu[target.value];else if (keys[keyName]) value = keys[keyName];else return navigate(target, e);\n await runUserMenu(value);\n});\nconst runUserMenu = async fn => {\n hide();\n const [error] = await tryToCatch(fn, {\n DOM,\n CloudCmd,\n tryToCatch\n });\n if (!error) return;\n const source = sourceStore();\n return Dialog.alert(getCodeFrame({\n error,\n source\n }));\n};\nfunction getCodeFrame({\n error,\n source\n}) {\n const {\n code\n } = error;\n if (!code || code === 'frame') return error.message;\n const [line, column] = parseError(error);\n const start = {\n line,\n column\n };\n const location = {\n start\n };\n const frame = codeFrameColumns(source, location, {\n message: error.message,\n highlightCode: false\n });\n return `<pre>${frame}</pre>`;\n}\n\n//# sourceURL=file://cloudcmd/client/modules/user-menu/index.js\n}");
|
|
668
668
|
|
|
669
669
|
/***/ },
|
|
670
670
|
|
|
@@ -719,7 +719,7 @@ eval("{\n\nmodule.exports.runSelected = async (selectedItems, items, runUserMenu
|
|
|
719
719
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
720
720
|
|
|
721
721
|
"use strict";
|
|
722
|
-
eval("{/* global CloudCmd, DOM */\n\n\n\n__webpack_require__(/*! ../../../css/view.css */ \"./css/view.css\");\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
722
|
+
eval("{/* global CloudCmd, DOM */\n\n\n\n__webpack_require__(/*! ../../../css/view.css */ \"./css/view.css\");\nconst rendy = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst modal = __webpack_require__(/*! @cloudcmd/modal */ \"./node_modules/@cloudcmd/modal/lib/modal.js\");\nconst createElement = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\nconst {\n time\n} = __webpack_require__(/*! ../../../common/util */ \"./common/util.js\");\nconst {\n FS\n} = __webpack_require__(/*! ../../../common/cloudfunc */ \"./common/cloudfunc.js\");\nconst {\n isImage,\n isAudio,\n getType\n} = __webpack_require__(/*! ./types */ \"./client/modules/view/types.js\");\nconst Files = __webpack_require__(/*! ../../dom/files */ \"./client/dom/files.js\");\nconst Events = __webpack_require__(/*! ../../dom/events */ \"./client/dom/events/index.js\");\nconst Images = __webpack_require__(/*! ../../dom/images */ \"./client/dom/images.js\");\nconst {\n encode\n} = __webpack_require__(/*! ../../../common/entity */ \"./common/entity.js\");\nconst isString = a => typeof a === 'string';\nconst {\n assign\n} = Object;\nconst {\n isArray\n} = Array;\nconst lifo = currify((fn, el, cb, name) => fn(name, el, cb));\nconst series = wraptile((...a) => {\n for (const f of a) f();\n});\nconst isFn = a => typeof a === 'function';\nconst noop = () => {};\nconst addEvent = lifo(Events.add);\nconst loadCSS = load.css;\nmodule.exports.show = show;\nmodule.exports.hide = hide;\nlet Loading = false;\nconst Name = 'View';\nCloudCmd[Name] = module.exports;\nconst Info = DOM.CurrentInfo;\nconst {\n Key\n} = CloudCmd;\nconst basename = a => a.split('/').pop();\nlet El;\nlet TemplateAudio;\nlet Overlay;\nconst Config = {\n beforeShow: () => {\n Images.hide();\n Key.unsetBind();\n },\n beforeClose: () => {\n Events.rmKey(listener);\n Key.setBind();\n },\n afterShow: () => {\n El.focus();\n },\n onOverlayClick,\n afterClose: noop,\n autoSize: false,\n helpers: {\n title: {}\n }\n};\nmodule.exports._Config = Config;\nmodule.exports.init = async () => {\n await loadAll();\n const events = ['click', 'contextmenu'];\n events.forEach(addEvent(Overlay, onOverlayClick));\n};\nasync function show(data, options = {}) {\n const prefixURL = CloudCmd.prefixURL + FS;\n if (Loading) return;\n if (!options || options.bindKeys !== false) Events.addKey(listener);\n El = createElement('div', {\n className: 'view',\n notAppend: true\n });\n El.tabIndex = 0;\n if (data) {\n if (isArray(data)) El.append(...data);else El.append(data);\n modal.open(El, initConfig(options));\n return;\n }\n Images.show.load();\n const path = prefixURL + Info.path;\n const type = options.raw ? '' : await getType(path);\n switch (type) {\n default:\n return await viewFile();\n case 'markdown':\n return await CloudCmd.Markdown.show(Info.path);\n case 'html':\n return viewHtml(path);\n case 'image':\n return viewImage(Info.path, prefixURL);\n case 'media':\n return await viewMedia(path);\n case 'pdf':\n return viewPDF(path);\n }\n}\nmodule.exports._createIframe = createIframe;\nfunction createIframe(src) {\n const element = createElement('iframe', {\n src,\n width: '100%',\n height: '100%'\n });\n element.addEventListener('load', () => {\n element.contentWindow.addEventListener('keydown', listener);\n });\n return element;\n}\nmodule.exports._viewHtml = viewHtml;\nfunction viewHtml(src) {\n modal.open(createIframe(src), Config);\n}\nfunction viewPDF(src) {\n const element = createIframe(src);\n const options = assign({}, Config);\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n modal.open(element, options);\n}\nasync function viewMedia(path) {\n const [e, element] = await getMediaElement(path);\n if (e) return alert(e);\n const allConfig = {\n ...Config,\n ...{\n autoSize: true,\n afterShow: () => {\n element.querySelector('audio, video').focus();\n }\n }\n };\n modal.open(element, allConfig);\n}\nasync function viewFile() {\n const [error, data] = await Info.getData();\n if (error) return Images.hide();\n const element = document.createTextNode(data);\n const options = Config;\n if (CloudCmd.config('showFileName')) options.title = Info.name;\n El.append(element);\n modal.open(El, options);\n}\nconst copy = a => assign({}, a);\nmodule.exports._initConfig = initConfig;\nfunction initConfig(options) {\n const config = copy(Config);\n if (!options) return config;\n const names = Object.keys(options);\n for (const name of names) {\n const isConfig = Boolean(config[name]);\n const item = options[name];\n if (!isFn(item) || !isConfig) {\n config[name] = options[name];\n continue;\n }\n const fn = config[name];\n config[name] = series(fn, item);\n }\n return config;\n}\nfunction hide() {\n modal.close();\n}\nfunction viewImage(path, prefixURL) {\n const isSupportedImage = a => isImage(a) || a === path;\n const makeTitle = path => ({\n href: `${prefixURL}${path}`,\n title: encode(basename(path))\n });\n const names = Info.files.map(DOM.getCurrentPath).filter(isSupportedImage);\n const titles = names.map(makeTitle);\n const index = names.indexOf(Info.path);\n const imageConfig = {\n index,\n autoSize: true,\n arrows: true,\n keys: true,\n helpers: {\n title: {}\n }\n };\n const config = {\n ...Config,\n ...imageConfig\n };\n modal.open(titles, config);\n}\nasync function getMediaElement(src) {\n check(src);\n const [error, template] = await tryToCatch(Files.get, 'view/media-tmpl');\n if (error) return [error];\n const {\n name\n } = Info;\n if (!TemplateAudio) TemplateAudio = template;\n const is = isAudio(name);\n const type = is ? 'audio' : 'video';\n const innerHTML = rendy(TemplateAudio, {\n src,\n type,\n name\n });\n const element = createElement('div', {\n innerHTML\n });\n return [null, element];\n}\nfunction check(src) {\n if (!isString(src)) throw Error('src should be a string!');\n}\nasync function loadAll() {\n const {\n DIR_DIST\n } = CloudCmd;\n time(`${Name} load`);\n Loading = true;\n await loadCSS(`${DIR_DIST}/view.css`);\n Loading = false;\n}\nfunction onOverlayClick(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n setCurrentByPosition(position);\n}\nfunction setCurrentByPosition(position) {\n const element = DOM.getCurrentByPosition(position);\n if (!element) return;\n const {\n files,\n filesPassive\n } = Info;\n const isFiles = files.includes(element);\n const isFilesPassive = filesPassive.includes(element);\n if (!isFiles && !isFilesPassive) return;\n const isCurrent = DOM.isCurrentFile(element);\n if (isCurrent) return;\n DOM.setCurrentFile(element);\n}\nfunction listener({\n keyCode\n}) {\n if (keyCode === Key.ESC) hide();\n}\n\n//# sourceURL=file://cloudcmd/client/modules/view/index.js\n}");
|
|
723
723
|
|
|
724
724
|
/***/ },
|
|
725
725
|
|
|
@@ -730,7 +730,7 @@ eval("{/* global CloudCmd, DOM */\n\n\n\n__webpack_require__(/*! ../../../css/vi
|
|
|
730
730
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
731
731
|
|
|
732
732
|
"use strict";
|
|
733
|
-
eval("{\n\nconst {\n extname\n} = __webpack_require__(/*! node:path */ \"./node_modules/path-browserify/index.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isAudio = name => /\\.(mp3|ogg|m4a)$/i.test(name);\nconst testRegExp = currify((name, reg) => reg.test(name));\nconst getRegExp = ext => RegExp(`\\\\.${ext}$`, 'i');\nconst isPDF = a => /\\.pdf$/i.test(a);\nconst isHTML = a =>
|
|
733
|
+
eval("{\n\nconst {\n extname\n} = __webpack_require__(/*! node:path */ \"./node_modules/path-browserify/index.js\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isAudio = name => /\\.(mp3|ogg|m4a)$/i.test(name);\nconst testRegExp = currify((name, reg) => reg.test(name));\nconst getRegExp = ext => RegExp(`\\\\.${ext}$`, 'i');\nconst isPDF = a => /\\.pdf$/i.test(a);\nconst isHTML = a => a.endsWith('.html');\nconst isMarkdown = a => /.\\.md$/.test(a);\nmodule.exports.getType = async path => {\n const ext = extname(path);\n if (!ext) path = await detectType(path);\n if (isPDF(path)) return 'pdf';\n if (isImage(path)) return 'image';\n if (isMedia(path)) return 'media';\n if (isHTML(path)) return 'html';\n if (isMarkdown(path)) return 'markdown';\n};\nmodule.exports.isImage = isImage;\nfunction isImage(name) {\n const images = ['jp(e|g|eg)', 'gif', 'png', 'bmp', 'webp', 'svg', 'ico'];\n return images.map(getRegExp).some(testRegExp(name));\n}\nfunction isMedia(name) {\n return isAudio(name) || isVideo(name);\n}\nmodule.exports.isAudio = isAudio;\nfunction isVideo(name) {\n return /\\.(mp4|avi|webm)$/i.test(name);\n}\nmodule.exports._detectType = detectType;\nasync function detectType(path) {\n const {\n headers\n } = await fetch(path, {\n method: 'HEAD'\n });\n for (const [name, value] of headers) {\n if (name === 'content-type') return `.${value.split('/').pop()}`;\n }\n return '';\n}\n\n//# sourceURL=file://cloudcmd/client/modules/view/types.js\n}");
|
|
734
734
|
|
|
735
735
|
/***/ },
|
|
736
736
|
|
|
@@ -752,7 +752,7 @@ eval("{\n\n/* global CloudCmd */\nconst DOM = __webpack_require__(/*! ./dom */ \
|
|
|
752
752
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
753
753
|
|
|
754
754
|
"use strict";
|
|
755
|
-
eval("{\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
755
|
+
eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nmodule.exports.registerSW = registerSW;\nmodule.exports.unregisterSW = unregisterSW;\nmodule.exports.listenSW = (sw, ...args) => {\n sw === null || sw === void 0 || sw.addEventListener(...args);\n};\nasync function registerSW(prefix) {\n if (!navigator.serviceWorker) return;\n const isHTTPS = location.protocol === 'https:';\n const isLocalhost = location.hostname === 'localhost';\n if (!isHTTPS && !isLocalhost) return;\n const {\n serviceWorker\n } = navigator;\n const register = serviceWorker.register.bind(serviceWorker);\n const [e, sw] = await tryToCatch(register, `${prefix}/sw.js`);\n if (e) return null;\n return sw;\n}\nasync function unregisterSW(prefix) {\n const reg = await registerSW(prefix);\n reg === null || reg === void 0 || reg.unregister(prefix);\n}\n\n//# sourceURL=file://cloudcmd/client/sw/register.js\n}");
|
|
756
756
|
|
|
757
757
|
/***/ },
|
|
758
758
|
|
|
@@ -796,7 +796,7 @@ eval("{\n\nconst Entities = {\n // ' ': ' ',\n '<': '<',\n '>':
|
|
|
796
796
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
797
797
|
|
|
798
798
|
"use strict";
|
|
799
|
-
eval("{\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.
|
|
799
|
+
eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst all = Promise.all.bind(Promise);\nmodule.exports = async a => {\n const [e, result = []] = await tryToCatch(all, a);\n return [e, ...result];\n};\n\n//# sourceURL=file://cloudcmd/common/try-to-promise-all.js\n}");
|
|
800
800
|
|
|
801
801
|
/***/ },
|
|
802
802
|
|
|
@@ -1199,7 +1199,18 @@ eval("{\n\nmodule.exports = type;\n\nfor (const name of ['null', 'arrayBuffer',
|
|
|
1199
1199
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
1200
1200
|
|
|
1201
1201
|
"use strict";
|
|
1202
|
-
eval("{\n\nconst tryCatch = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.js\");\n\nconst {\n parse,\n stringify,\n} = JSON;\n\nmodule.exports.parse = (...args) => {\n const [, data] = tryCatch(parse, ...args);\n \n return data;\n};\n\nmodule.exports.stringify = (...args) => {\n const [, data] = tryCatch(stringify, ...args);\n \n return data;\n};\n\n\n\n//# sourceURL=file://cloudcmd/node_modules/jonny/lib/jonny.js\n}");
|
|
1202
|
+
eval("{\n\nconst tryCatch = __webpack_require__(/*! try-catch */ \"./node_modules/jonny/node_modules/try-catch/lib/try-catch.js\");\n\nconst {\n parse,\n stringify,\n} = JSON;\n\nmodule.exports.parse = (...args) => {\n const [, data] = tryCatch(parse, ...args);\n \n return data;\n};\n\nmodule.exports.stringify = (...args) => {\n const [, data] = tryCatch(stringify, ...args);\n \n return data;\n};\n\n\n\n//# sourceURL=file://cloudcmd/node_modules/jonny/lib/jonny.js\n}");
|
|
1203
|
+
|
|
1204
|
+
/***/ },
|
|
1205
|
+
|
|
1206
|
+
/***/ "./node_modules/jonny/node_modules/try-catch/lib/try-catch.js"
|
|
1207
|
+
/*!********************************************************************!*\
|
|
1208
|
+
!*** ./node_modules/jonny/node_modules/try-catch/lib/try-catch.js ***!
|
|
1209
|
+
\********************************************************************/
|
|
1210
|
+
(module) {
|
|
1211
|
+
|
|
1212
|
+
"use strict";
|
|
1213
|
+
eval("{\n\nmodule.exports = (fn, ...args) => {\n try {\n return [null, fn(...args)];\n } catch(e) {\n return [e];\n }\n};\n\n\n\n//# sourceURL=file://cloudcmd/node_modules/jonny/node_modules/try-catch/lib/try-catch.js\n}");
|
|
1203
1214
|
|
|
1204
1215
|
/***/ },
|
|
1205
1216
|
|
|
@@ -1462,14 +1473,36 @@ eval("{\n\nmodule.exports.MAIN = '<ul data-name=\"js-menu\" class=\"menu menu-hi
|
|
|
1462
1473
|
|
|
1463
1474
|
/***/ },
|
|
1464
1475
|
|
|
1476
|
+
/***/ "./node_modules/try-catch/lib/try-catch.cjs"
|
|
1477
|
+
/*!**************************************************!*\
|
|
1478
|
+
!*** ./node_modules/try-catch/lib/try-catch.cjs ***!
|
|
1479
|
+
\**************************************************/
|
|
1480
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
1481
|
+
|
|
1482
|
+
"use strict";
|
|
1483
|
+
eval("{\n\nconst {tryCatch} = __webpack_require__(/*! ./try-catch.js */ \"./node_modules/try-catch/lib/try-catch.js\");\n\nmodule.exports = tryCatch;\nmodule.exports.tryCatch = tryCatch;\n\n\n//# sourceURL=file://cloudcmd/node_modules/try-catch/lib/try-catch.cjs\n}");
|
|
1484
|
+
|
|
1485
|
+
/***/ },
|
|
1486
|
+
|
|
1465
1487
|
/***/ "./node_modules/try-catch/lib/try-catch.js"
|
|
1466
1488
|
/*!*************************************************!*\
|
|
1467
1489
|
!*** ./node_modules/try-catch/lib/try-catch.js ***!
|
|
1468
1490
|
\*************************************************/
|
|
1469
|
-
(
|
|
1491
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1470
1492
|
|
|
1471
1493
|
"use strict";
|
|
1472
|
-
eval("{\n\
|
|
1494
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ tryCatch: () => (/* binding */ tryCatch)\n/* harmony export */ });\nconst tryCatch = (fn, ...args) => {\n try {\n return [null, fn(...args)];\n } catch(e) {\n return [e];\n }\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (tryCatch);\n\n\n//# sourceURL=file://cloudcmd/node_modules/try-catch/lib/try-catch.js\n}");
|
|
1495
|
+
|
|
1496
|
+
/***/ },
|
|
1497
|
+
|
|
1498
|
+
/***/ "./node_modules/try-to-catch/lib/try-to-catch.cjs"
|
|
1499
|
+
/*!********************************************************!*\
|
|
1500
|
+
!*** ./node_modules/try-to-catch/lib/try-to-catch.cjs ***!
|
|
1501
|
+
\********************************************************/
|
|
1502
|
+
(module, __unused_webpack_exports, __webpack_require__) {
|
|
1503
|
+
|
|
1504
|
+
"use strict";
|
|
1505
|
+
eval("{\n\nconst {tryToCatch} = __webpack_require__(/*! ./try-to-catch.js */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nmodule.exports = tryToCatch;\nmodule.exports.tryToCatch = tryToCatch;\n\n\n//# sourceURL=file://cloudcmd/node_modules/try-to-catch/lib/try-to-catch.cjs\n}");
|
|
1473
1506
|
|
|
1474
1507
|
/***/ },
|
|
1475
1508
|
|
|
@@ -1477,10 +1510,10 @@ eval("{\n\nmodule.exports = (fn, ...args) => {\n try {\n return [null,
|
|
|
1477
1510
|
/*!*******************************************************!*\
|
|
1478
1511
|
!*** ./node_modules/try-to-catch/lib/try-to-catch.js ***!
|
|
1479
1512
|
\*******************************************************/
|
|
1480
|
-
(
|
|
1513
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1481
1514
|
|
|
1482
1515
|
"use strict";
|
|
1483
|
-
eval("{\n\
|
|
1516
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__),\n/* harmony export */ tryToCatch: () => (/* binding */ tryToCatch)\n/* harmony export */ });\nconst isFn = (a) => typeof a === 'function';\n\nconst tryToCatch = async (fn, ...args) => {\n check(fn);\n \n try {\n return [null, await fn(...args)];\n } catch(e) {\n return [e];\n }\n};\n\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (tryToCatch);\n\nfunction check(fn) {\n if (!isFn(fn))\n throw Error('fn should be a function!');\n}\n\n\n//# sourceURL=file://cloudcmd/node_modules/try-to-catch/lib/try-to-catch.js\n}");
|
|
1484
1517
|
|
|
1485
1518
|
/***/ },
|
|
1486
1519
|
|