cloudcmd 19.1.2 → 19.1.4
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 +13 -0
- package/HELP.md +3 -1
- package/README.md +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 +40 -29
- package/dist-dev/sw.js +1 -1
- package/package.json +2 -3
|
@@ -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 {\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}");
|
|
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 {\n getJsonFromFileTable\n} = __webpack_require__(/*! ./get-json-from-file-table.mjs */ \"./client/get-json-from-file-table.mjs\");\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 {\n loadModule\n} = __webpack_require__(/*! ./load-module.mjs */ \"./client/load-module.mjs\");\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
|
|
|
@@ -26,7 +26,7 @@ eval("{\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modu
|
|
|
26
26
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
27
27
|
|
|
28
28
|
"use strict";
|
|
29
|
-
eval("{\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n__webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst {\n registerSW,\n listenSW\n} = __webpack_require__(/*! ./sw/register */ \"./client/sw/register.js\");\nconst isDev = process.env.NODE_ENV === 'development';\nmodule.exports = async config => {\n
|
|
29
|
+
eval("{\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n__webpack_require__(/*! ../css/main.css */ \"./css/main.css\");\nconst wraptile = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\nconst {\n registerSW,\n listenSW\n} = __webpack_require__(/*! ./sw/register */ \"./client/sw/register.js\");\nconst {\n initSortPanel,\n sortPanel\n} = __webpack_require__(/*! ./sort.mjs */ \"./client/sort.mjs\");\nconst isDev = process.env.NODE_ENV === 'development';\nmodule.exports = async config => {\n globalThis.Util = __webpack_require__(/*! ../common/util */ \"./common/util.js\");\n globalThis.CloudFunc = __webpack_require__(/*! ../common/cloudfunc */ \"./common/cloudfunc.js\");\n globalThis.DOM = __webpack_require__(/*! ./dom */ \"./client/dom/index.js\");\n globalThis.CloudCmd = __webpack_require__(/*! ./client */ \"./client/client.js\");\n await register(config);\n __webpack_require__(/*! ./listeners */ \"./client/listeners/index.js\");\n __webpack_require__(/*! ./key */ \"./client/key/index.js\");\n initSortPanel();\n globalThis.CloudCmd.sortPanel = sortPanel;\n const prefix = getPrefix(config.prefix);\n globalThis.CloudCmd.init(prefix, config);\n if (globalThis.CloudCmd.config('menu') === 'aleman') setTimeout(() => {\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/processor-html */ \"https://esm.sh/@putout/processor-html\"));\n Promise.resolve(/*! import() */).then(__webpack_require__.bind(__webpack_require__, /*! https://esm.sh/@putout/bundle */ \"https://esm.sh/@putout/bundle\"));\n }, 100);\n};\nglobalThis.CloudCmd = module.exports;\nfunction getPrefix(prefix) {\n if (!prefix) return '';\n if (!prefix.indexOf('/')) return prefix;\n return `/${prefix}`;\n}\nconst onUpdateFound = wraptile(async config => {\n if (isDev) return;\n const {\n DOM\n } = globalThis;\n const prefix = getPrefix(config.prefix);\n await load.js(`${prefix}/dist/cloudcmd.common.js`);\n await load.js(`${prefix}/dist/cloudcmd.js`);\n console.log('cloudcmd: sw: updated');\n DOM.Events.removeAll();\n globalThis.CloudCmd(config);\n});\nasync function register(config) {\n const {\n prefix\n } = config;\n const sw = await registerSW(prefix);\n listenSW(sw, 'updatefound', onUpdateFound(config));\n}\n\n//# sourceURL=file://cloudcmd/client/cloudcmd.js\n}");
|
|
30
30
|
|
|
31
31
|
/***/ },
|
|
32
32
|
|
|
@@ -136,7 +136,7 @@ eval("{/* global DOM */\n\n\n\nconst createElement = __webpack_require__(/*! @cl
|
|
|
136
136
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
137
137
|
|
|
138
138
|
"use strict";
|
|
139
|
-
eval("{\n\n/* global CloudCmd */\nconst Util = __webpack_require__(/*! ../../common/util */ \"./common/util.js\");\nconst Images = __webpack_require__(/*! ./images */ \"./client/dom/images.js\");\nconst RESTful = __webpack_require__(/*! ./rest */ \"./client/dom/rest.js\");\nconst Storage = __webpack_require__(/*! ./storage */ \"./client/dom/storage.js\");\nconst renameCurrent = __webpack_require__(/*! ./operations/rename-current */ \"./client/dom/operations/rename-current.js\");\nconst CurrentFile = __webpack_require__(/*! ./current-file */ \"./client/dom/current-file.js\");\nconst DOMTree = __webpack_require__(/*! ./dom-tree */ \"./client/dom/dom-tree.js\");\nconst Cmd = module.exports;\nconst DOM = {\n ...DOMTree,\n ...CurrentFile,\n ...Cmd\n};\nconst CurrentInfo = {};\nDOM.Images = Images;\nDOM.load = __webpack_require__(/*! ./load */ \"./client/dom/load.js\");\nDOM.Files = __webpack_require__(/*! ./files */ \"./client/dom/files.js\");\nDOM.RESTful = RESTful;\nDOM.IO = __webpack_require__(/*! ./io */ \"./client/dom/io/index.js\");\nDOM.Storage = Storage;\nDOM.Dialog = __webpack_require__(/*! ./dialog */ \"./client/dom/dialog.js\");\nDOM.CurrentInfo = CurrentInfo;\nmodule.exports = DOM;\nDOM.uploadDirectory = __webpack_require__(/*! ./directory */ \"./client/dom/directory.js\");\nDOM.Buffer = __webpack_require__(/*! ./buffer */ \"./client/dom/buffer.js\");\nDOM.Events = __webpack_require__(/*! ./events */ \"./client/dom/events/index.js\");\nconst loadRemote = __webpack_require__(/*! ./load-remote */ \"./client/dom/load-remote.js\");\nconst selectByPattern = __webpack_require__(/*! ./select-by-pattern */ \"./client/dom/select-by-pattern.js\");\nconst isString = a => typeof a === 'string';\nconst SELECTED_FILE = 'selected-file';\nconst TabPanel = {\n 'js-left': null,\n 'js-right': null\n};\nmodule.exports.loadRemote = (name, options, callback) => {\n loadRemote(name, options, callback);\n return DOM;\n};\nmodule.exports.loadSocket = callback => {\n DOM.loadRemote('socket', {\n name: 'io'\n }, callback);\n return DOM;\n};\n\n/**\n * create new folder\n *\n */\nmodule.exports.promptNewDir = async function () {\n await promptNew('directory');\n};\n\n/**\n * create new file\n *\n * @typeName\n * @type\n */\nmodule.exports.promptNewFile = async () => {\n await promptNew('file');\n};\nasync function promptNew(typeName) {\n const {\n Dialog\n } = DOM;\n const dir = DOM.getCurrentDirPath();\n const msg = `New ${typeName}` || 'File';\n const getName = () => {\n const name = DOM.getCurrentName();\n if (name === '..') return '';\n return name;\n };\n const name = getName();\n const [cancel, currentName] = await Dialog.prompt(msg, name);\n if (cancel) return;\n const path = `${dir}${currentName}`;\n if (typeName === 'directory') await RESTful.createDirectory(path);else await RESTful.write(path);\n await CloudCmd.refresh({\n currentName\n });\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.slice(0, index);\n return path;\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 selected files\n *\n * @currentFile\n */\nmodule.exports.getSelectedFiles = () => {\n const panel = DOM.getPanel();\n const selected = DOM.getByClassAll(SELECTED_FILE, panel);\n return Array.from(selected);\n};\n\n/*\n * unselect all files\n */\nmodule.exports.unselectFiles = files => {\n files = files || DOM.getSelectedFiles();\n Array.from(files).forEach(DOM.toggleSelectedFile);\n};\n\n/**\n * get all selected files or current when none selected\n *\n * @currentFile\n */\nmodule.exports.getActiveFiles = () => {\n const current = DOM.getCurrentFile();\n const files = DOM.getSelectedFiles();\n const name = DOM.getCurrentName(current);\n if (!files.length && name !== '..') return [current];\n return files;\n};\nmodule.exports.getCurrentDate = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n return DOM.getByDataName('js-date', current).textContent;\n};\n\n/**\n * get size\n * @currentFile\n */\nmodule.exports.getCurrentSize = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n\n /* если это папка - возвращаем слово dir вместо размера*/\n const size = DOM.getByDataName('js-size', current).textContent.replace(/^<|>$/g, '');\n return size;\n};\n\n/**\n * get size\n * @currentFile\n */\nmodule.exports.loadCurrentSize = async currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?size';\n const link = DOM.getCurrentPath(current);\n Images.show.load();\n if (name === '..') return;\n const [, size] = await RESTful.read(link + query);\n DOM.setCurrentSize(size, current);\n Images.hide();\n return current;\n};\n\n/**\n * load hash\n * @callback\n * @currentFile\n */\nmodule.exports.loadCurrentHash = async currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?hash';\n const link = DOM.getCurrentPath(current);\n const [, data] = await RESTful.read(link + query);\n return data;\n};\n\n/**\n * set size\n * @currentFile\n */\nmodule.exports.setCurrentSize = (size, currentFile) => {\n const current = currentFile || DOM.getCurrentFile();\n const sizeElement = DOM.getByDataName('js-size', current);\n sizeElement.textContent = size;\n};\n\n/**\n * @currentFile\n */\nmodule.exports.getCurrentMode = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const mode = DOM.getByDataName('js-mode', current);\n return mode.textContent;\n};\n\n/**\n * @currentFile\n */\nmodule.exports.getCurrentOwner = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const owner = DOM.getByDataName('js-owner', current);\n return owner.textContent;\n};\n\n/**\n * unified way to get current file content\n *\n * @param currentFile\n */\nmodule.exports.getCurrentData = async currentFile => {\n const {\n Dialog\n } = DOM;\n const Info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const isDir = DOM.isCurrentIsDir(current);\n if (Info.name === '..') {\n Dialog.alert.noFiles();\n return [Error('No Files')];\n }\n if (isDir) return await RESTful.read(path);\n const [hashNew, hash] = await DOM.checkStorageHash(path);\n if (!hashNew) return [Error(`Can't get hash of a file`)];\n if (hash === hashNew) return [null, await Storage.get(`${path}-data`)];\n const [e, data] = await RESTful.read(path);\n if (e) return [e, null];\n const ONE_MEGABYTE = 1024 ** 2 * 1024;\n const {\n length\n } = data;\n if (hash && length < ONE_MEGABYTE) await DOM.saveDataToStorage(path, data, hashNew);\n return [null, data];\n};\n\n/**\n * unified way to get RefreshButton\n */\nmodule.exports.getRefreshButton = (panel = DOM.getPanel()) => {\n return DOM.getByDataName('js-refresh', panel);\n};\n\n/**\n * select current file\n * @param currentFile\n */\nmodule.exports.selectFile = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.add(SELECTED_FILE);\n return Cmd;\n};\nmodule.exports.unselectFile = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.remove(SELECTED_FILE);\n return Cmd;\n};\nmodule.exports.toggleSelectedFile = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const name = DOM.getCurrentName(current);\n if (name === '..') return Cmd;\n current.classList.toggle(SELECTED_FILE);\n return Cmd;\n};\nmodule.exports.toggleAllSelectedFiles = () => {\n DOM.getAllFiles().map(DOM.toggleSelectedFile);\n return Cmd;\n};\nmodule.exports.selectAllFiles = () => {\n DOM.getAllFiles().map(DOM.selectFile);\n return Cmd;\n};\nmodule.exports.getAllFiles = () => {\n const panel = DOM.getPanel();\n const files = DOM.getFiles(panel);\n const name = DOM.getCurrentName(files[0]);\n const from = a => a === '..' ? 1 : 0;\n const i = from(name);\n return Array.from(files).slice(i);\n};\n\n/**\n * open dialog with expand selection\n */\nmodule.exports.expandSelection = () => {\n const msg = 'expand';\n const {\n files\n } = CurrentInfo;\n selectByPattern(msg, files);\n};\n\n/**\n * open dialog with shrink selection\n */\nmodule.exports.shrinkSelection = () => {\n const msg = 'shrink';\n const {\n files\n } = CurrentInfo;\n selectByPattern(msg, files);\n};\n\n/**\n * setting history wrapper\n */\nmodule.exports.setHistory = (data, title, url) => {\n const ret = window.history;\n const {\n prefix\n } = CloudCmd;\n url = prefix + url;\n if (ret) history.pushState(data, title, url);\n return ret;\n};\n\n/**\n * selected file check\n *\n * @param currentFile\n */\nmodule.exports.isSelected = selected => {\n if (!selected) return false;\n return DOM.isContainClass(selected, SELECTED_FILE);\n};\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nmodule.exports.getCurrentLink = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const link = DOM.getByTag('a', current);\n return link[0];\n};\nmodule.exports.getFilenames = files => {\n if (!files) throw Error('AllFiles could not be empty');\n const first = files[0] || DOM.getCurrentFile();\n const name = DOM.getCurrentName(first);\n const allFiles = Array.from(files);\n if (name === '..') allFiles.shift();\n const names = allFiles.map(current => {\n return DOM.getCurrentName(current);\n });\n return names;\n};\n\n/**\n * check storage hash\n */\nmodule.exports.checkStorageHash = async name => {\n const nameHash = `${name}-hash`;\n if (!isString(name)) throw Error('name should be a string!');\n const [loadHash, storeHash] = await Promise.all([DOM.loadCurrentHash(), Storage.get(nameHash)]);\n return [loadHash, storeHash];\n};\n\n/**\n * save data to storage\n *\n * @param name\n * @param data\n * @param hash\n * @param callback\n */\nmodule.exports.saveDataToStorage = async (name, data, hash) => {\n const isDir = DOM.isCurrentIsDir();\n if (isDir) return;\n hash = hash || (await DOM.loadCurrentHash());\n const nameHash = `${name}-hash`;\n const nameData = `${name}-data`;\n await Storage.set(nameHash, hash);\n await Storage.set(nameData, data);\n return hash;\n};\nmodule.exports.getFM = () => DOM.getPanel().parentElement;\nmodule.exports.getPanelPosition = panel => {\n panel = panel || DOM.getPanel();\n return panel.dataset.name.replace('js-', '');\n};\nmodule.exports.getCSSVar = (name, {\n body = document.body\n} = {}) => {\n const bodyStyle = getComputedStyle(body);\n return bodyStyle.getPropertyValue(`--${name}`);\n};\n\n/** function getting panel active, or passive\n * @param options = {active: true}\n */\nmodule.exports.getPanel = options => {\n let files;\n let panel;\n let isLeft;\n let dataName = 'js-';\n const current = DOM.getCurrentFile();\n if (!current) {\n panel = DOM.getByDataName('js-left');\n } else {\n files = current.parentElement;\n panel = files.parentElement;\n isLeft = panel.getAttribute('data-name') === 'js-left';\n }\n\n /* if {active : false} getting passive panel */\n if (options && !options.active) {\n dataName += isLeft ? 'right' : 'left';\n panel = DOM.getByDataName(dataName);\n }\n\n /* if two panels showed\n * then always work with passive\n * panel\n */\n if (window.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH) panel = DOM.getByDataName('js-left');\n if (!panel) throw Error('can not find Active Panel!');\n return panel;\n};\nmodule.exports.getFiles = element => {\n const files = DOM.getByDataName('js-files', element);\n return files.children || [];\n};\n\n/**\n * shows panel right or left (or active)\n */\nmodule.exports.showPanel = active => {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n DOM.show(panel);\n return true;\n};\n\n/**\n * hides panel right or left (or active)\n */\nmodule.exports.hidePanel = active => {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n return DOM.hide(panel);\n};\n\n/**\n * remove child of element\n * @param pChild\n * @param element\n */\nmodule.exports.remove = (child, element) => {\n const parent = element || document.body;\n parent.removeChild(child);\n return DOM;\n};\n\n/**\n * remove current file from file table\n * @param current\n *\n */\nmodule.exports.deleteCurrent = current => {\n if (!current) DOM.getCurrentFile();\n const parent = current === null || current === void 0 ? void 0 : current.parentElement;\n const name = DOM.getCurrentName(current);\n if (current && name !== '..') {\n const next = current.nextSibling;\n const prev = current.previousSibling;\n DOM.setCurrentFile(next || prev);\n parent.removeChild(current);\n }\n};\n\n/**\n * remove selected files from file table\n * @Selected\n */\nmodule.exports.deleteSelected = selected => {\n selected = selected || DOM.getSelectedFiles();\n if (!selected) return;\n selected.map(DOM.deleteCurrent);\n};\n\n/**\n * rename current file\n *\n * @currentFile\n */\nmodule.exports.renameCurrent = renameCurrent;\n/**\n * unified way to scrollIntoViewIfNeeded\n * (native suporte by webkit only)\n * @param element\n * @param center - to scroll as small as possible param should be false\n */\nmodule.exports.scrollIntoViewIfNeeded = (element, center = false) => {\n if (!element || !element.scrollIntoViewIfNeeded) return;\n element.scrollIntoViewIfNeeded(center);\n};\n\n/* scroll on one page */\nmodule.exports.scrollByPages = (element, pPages) => {\n const ret = (element === null || element === void 0 ? void 0 : element.scrollByPages) && pPages;\n if (ret) element.scrollByPages(pPages);\n return ret;\n};\nmodule.exports.changePanel = () => {\n const Info = CurrentInfo;\n let panel = DOM.getPanel();\n CloudCmd.emit('passive-dir', Info.dirPath);\n const panelPassive = DOM.getPanel({\n active: false\n });\n let name = DOM.getCurrentName();\n const filesPassive = DOM.getFiles(panelPassive);\n let dataName = panel.getAttribute('data-name');\n TabPanel[dataName] = name;\n panel = panelPassive;\n dataName = panel.getAttribute('data-name');\n name = TabPanel[dataName];\n let files;\n let current;\n if (name) {\n current = DOM.getCurrentByName(name, panel);\n if (current) files = current.parentElement;\n }\n if (!files || !files.parentElement) {\n current = DOM.getCurrentByName(name, panel);\n if (!current) [current] = filesPassive;\n }\n DOM.setCurrentFile(current, {\n history: true\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n return DOM;\n};\nmodule.exports.getPackerExt = type => {\n if (type === 'zip') return '.zip';\n return '.tar.gz';\n};\nmodule.exports.goToDirectory = async (overrides = {}) => {\n const {\n Dialog\n } = DOM;\n const {\n prompt = Dialog.prompt,\n changeDir = CloudCmd.changeDir\n } = overrides;\n const msg = 'Go to directory:';\n const {\n dirPath\n } = CurrentInfo;\n const [cancel, path = dirPath] = await prompt(msg, dirPath);\n if (cancel) return;\n await changeDir(path);\n};\nmodule.exports.duplicatePanel = async () => {\n const Info = CurrentInfo;\n const {\n isDir\n } = Info;\n const panel = Info.panelPassive;\n const noCurrent = !Info.isOnePanel;\n const getPath = isDir => {\n if (isDir) return Info.path;\n return Info.dirPath;\n };\n const path = getPath(isDir);\n await CloudCmd.changeDir(path, {\n panel,\n noCurrent\n });\n};\nmodule.exports.swapPanels = async () => {\n const Info = CurrentInfo;\n const {\n panel,\n files,\n element,\n panelPassive\n } = Info;\n const path = DOM.getCurrentDirPath();\n const dirPathPassive = DOM.getNotCurrentDirPath();\n let currentIndex = files.indexOf(element);\n await CloudCmd.changeDir(path, {\n panel: panelPassive,\n noCurrent: true\n });\n await CloudCmd.changeDir(dirPathPassive, {\n panel\n });\n const length = Info.files.length - 1;\n if (currentIndex > length) currentIndex = length;\n const el = Info.files[currentIndex];\n DOM.setCurrentFile(el);\n};\nmodule.exports.CurrentInfo = CurrentInfo;\nmodule.exports.updateCurrentInfo = currentFile => {\n const info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const files = current.parentElement;\n const panelPassive = DOM.getPanel({\n active: false\n });\n const filesPassive = DOM.getFiles(panelPassive);\n const name = DOM.getCurrentName(current);\n info.dir = DOM.getCurrentDirName();\n info.dirPath = DOM.getCurrentDirPath();\n info.parentDirPath = DOM.getParentDirPath();\n info.element = current;\n info.ext = Util.getExt(name);\n info.files = Array.from(files.children);\n info.filesPassive = Array.from(filesPassive);\n info.first = files.firstChild;\n info.getData = DOM.getCurrentData;\n info.last = files.lastChild;\n info.link = DOM.getCurrentLink(current);\n info.mode = DOM.getCurrentMode(current);\n info.name = name;\n info.path = DOM.getCurrentPath(current);\n info.panel = files.parentElement || DOM.getPanel();\n info.panelPassive = panelPassive;\n info.size = DOM.getCurrentSize(current);\n info.isDir = DOM.isCurrentIsDir();\n info.isSelected = DOM.isSelected(current);\n info.panelPosition = DOM.getPanel().dataset.name.replace('js-', '');\n info.isOnePanel = info.panel.getAttribute('data-name') === info.panelPassive.getAttribute('data-name');\n};\n\n//# sourceURL=file://cloudcmd/client/dom/index.js\n}");
|
|
139
|
+
eval("{\n\n/* global CloudCmd */\nconst Util = __webpack_require__(/*! ../../common/util */ \"./common/util.js\");\nconst Images = __webpack_require__(/*! ./images */ \"./client/dom/images.js\");\nconst RESTful = __webpack_require__(/*! ./rest */ \"./client/dom/rest.js\");\nconst Storage = __webpack_require__(/*! ./storage */ \"./client/dom/storage.js\");\nconst renameCurrent = __webpack_require__(/*! ./operations/rename-current */ \"./client/dom/operations/rename-current.js\");\nconst CurrentFile = __webpack_require__(/*! ./current-file */ \"./client/dom/current-file.js\");\nconst DOMTree = __webpack_require__(/*! ./dom-tree */ \"./client/dom/dom-tree.js\");\nconst Cmd = module.exports;\nconst DOM = {\n ...DOMTree,\n ...CurrentFile,\n ...Cmd\n};\nconst CurrentInfo = {};\nDOM.Images = Images;\nDOM.load = __webpack_require__(/*! ./load */ \"./client/dom/load.js\");\nDOM.Files = __webpack_require__(/*! ./files */ \"./client/dom/files.js\");\nDOM.RESTful = RESTful;\nDOM.IO = __webpack_require__(/*! ./io */ \"./client/dom/io/index.js\");\nDOM.Storage = Storage;\nDOM.Dialog = __webpack_require__(/*! ./dialog */ \"./client/dom/dialog.js\");\nDOM.CurrentInfo = CurrentInfo;\nmodule.exports = DOM;\nDOM.uploadDirectory = __webpack_require__(/*! ./directory */ \"./client/dom/directory.js\");\nDOM.Buffer = __webpack_require__(/*! ./buffer */ \"./client/dom/buffer.js\");\nDOM.Events = __webpack_require__(/*! ./events */ \"./client/dom/events/index.js\");\nconst loadRemote = __webpack_require__(/*! ./load-remote */ \"./client/dom/load-remote.js\");\nconst selectByPattern = __webpack_require__(/*! ./select-by-pattern */ \"./client/dom/select-by-pattern.js\");\nconst isString = a => typeof a === 'string';\nconst SELECTED_FILE = 'selected-file';\nconst TabPanel = {\n 'js-left': null,\n 'js-right': null\n};\nmodule.exports.loadRemote = (name, options, callback) => {\n loadRemote(name, options, callback);\n return DOM;\n};\nmodule.exports.loadSocket = callback => {\n DOM.loadRemote('socket', {\n name: 'io'\n }, callback);\n return DOM;\n};\n\n/**\n * create new folder\n *\n */\nmodule.exports.promptNewDir = async function () {\n await promptNew('directory');\n};\n\n/**\n * create new file\n *\n * @typeName\n * @type\n */\nmodule.exports.promptNewFile = async () => {\n await promptNew('file');\n};\nasync function promptNew(typeName) {\n const {\n Dialog\n } = DOM;\n const dir = DOM.getCurrentDirPath();\n const msg = `New ${typeName}` || 'File';\n const getName = () => {\n const name = DOM.getCurrentName();\n if (name === '..') return '';\n return name;\n };\n const name = getName();\n const [cancel, currentName] = await Dialog.prompt(msg, name);\n if (cancel) return;\n const path = `${dir}${currentName}`;\n if (typeName === 'directory') await RESTful.createDirectory(path);else await RESTful.write(path);\n await CloudCmd.refresh({\n currentName\n });\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.slice(0, index);\n return path;\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 selected files\n *\n * @currentFile\n */\nmodule.exports.getSelectedFiles = () => {\n const panel = DOM.getPanel();\n const selected = DOM.getByClassAll(SELECTED_FILE, panel);\n return Array.from(selected);\n};\n\n/*\n * unselect all files\n */\nmodule.exports.unselectFiles = files => {\n files = files || DOM.getSelectedFiles();\n Array.from(files).forEach(DOM.toggleSelectedFile);\n};\n\n/**\n * get all selected files or current when none selected\n *\n * @currentFile\n */\nmodule.exports.getActiveFiles = () => {\n const current = DOM.getCurrentFile();\n const files = DOM.getSelectedFiles();\n const name = DOM.getCurrentName(current);\n if (!files.length && name !== '..') return [current];\n return files;\n};\nmodule.exports.getCurrentDate = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n return DOM.getByDataName('js-date', current).textContent;\n};\n\n/**\n * get size\n * @currentFile\n */\nmodule.exports.getCurrentSize = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n\n /* если это папка - возвращаем слово dir вместо размера*/\n const size = DOM.getByDataName('js-size', current).textContent.replace(/^<|>$/g, '');\n return size;\n};\n\n/**\n * get size\n * @currentFile\n */\nmodule.exports.loadCurrentSize = async currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?size';\n const link = DOM.getCurrentPath(current);\n Images.show.load();\n if (name === '..') return;\n const [, size] = await RESTful.read(link + query);\n DOM.setCurrentSize(size, current);\n Images.hide();\n return current;\n};\n\n/**\n * load hash\n * @callback\n * @currentFile\n */\nmodule.exports.loadCurrentHash = async currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const query = '?hash';\n const link = DOM.getCurrentPath(current);\n const [, data] = await RESTful.read(link + query);\n return data;\n};\n\n/**\n * set size\n * @currentFile\n */\nmodule.exports.setCurrentSize = (size, currentFile) => {\n const current = currentFile || DOM.getCurrentFile();\n const sizeElement = DOM.getByDataName('js-size', current);\n sizeElement.textContent = size;\n};\n\n/**\n * @currentFile\n */\nmodule.exports.getCurrentMode = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const mode = DOM.getByDataName('js-mode', current);\n return mode.textContent;\n};\n\n/**\n * @currentFile\n */\nmodule.exports.getCurrentOwner = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const owner = DOM.getByDataName('js-owner', current);\n return owner.textContent;\n};\n\n/**\n * unified way to get current file content\n *\n * @param currentFile\n */\nmodule.exports.getCurrentData = async currentFile => {\n const {\n Dialog\n } = DOM;\n const Info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const path = DOM.getCurrentPath(current);\n const isDir = DOM.isCurrentIsDir(current);\n if (Info.name === '..') {\n Dialog.alert.noFiles();\n return [Error('No Files')];\n }\n if (isDir) return await RESTful.read(path);\n const [hashNew, hash] = await DOM.checkStorageHash(path);\n if (!hashNew) return [Error(`Can't get hash of a file`)];\n if (hash === hashNew) return [null, await Storage.get(`${path}-data`)];\n const [e, data] = await RESTful.read(path);\n if (e) return [e, null];\n const ONE_MEGABYTE = 1024 ** 2 * 1024;\n const {\n length\n } = data;\n if (hash && length < ONE_MEGABYTE) await DOM.saveDataToStorage(path, data, hashNew);\n return [null, data];\n};\n\n/**\n * unified way to get RefreshButton\n */\nmodule.exports.getRefreshButton = (panel = DOM.getPanel()) => {\n return DOM.getByDataName('js-refresh', panel);\n};\n\n/**\n * select current file\n * @param currentFile\n */\nmodule.exports.selectFile = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.add(SELECTED_FILE);\n return Cmd;\n};\nmodule.exports.unselectFile = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n current.classList.remove(SELECTED_FILE);\n return Cmd;\n};\nmodule.exports.toggleSelectedFile = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const name = DOM.getCurrentName(current);\n if (name === '..') return Cmd;\n current.classList.toggle(SELECTED_FILE);\n return Cmd;\n};\nmodule.exports.toggleAllSelectedFiles = () => {\n DOM.getAllFiles().map(DOM.toggleSelectedFile);\n return Cmd;\n};\nmodule.exports.selectAllFiles = () => {\n DOM.getAllFiles().map(DOM.selectFile);\n return Cmd;\n};\nmodule.exports.getAllFiles = () => {\n const panel = DOM.getPanel();\n const files = DOM.getFiles(panel);\n const name = DOM.getCurrentName(files[0]);\n const from = a => a === '..' ? 1 : 0;\n const i = from(name);\n return Array.from(files).slice(i);\n};\n\n/**\n * open dialog with expand selection\n */\nmodule.exports.expandSelection = () => {\n const msg = 'expand';\n const {\n files\n } = CurrentInfo;\n selectByPattern(msg, files);\n};\n\n/**\n * open dialog with shrink selection\n */\nmodule.exports.shrinkSelection = () => {\n const msg = 'shrink';\n const {\n files\n } = CurrentInfo;\n selectByPattern(msg, files);\n};\n\n/**\n * setting history wrapper\n */\nmodule.exports.setHistory = (data, title, url) => {\n const ret = globalThis.history;\n const {\n prefix\n } = CloudCmd;\n url = prefix + url;\n if (ret) history.pushState(data, title, url);\n return ret;\n};\n\n/**\n * selected file check\n *\n * @param currentFile\n */\nmodule.exports.isSelected = selected => {\n if (!selected) return false;\n return DOM.isContainClass(selected, SELECTED_FILE);\n};\n\n/**\n * get link from current (or param) file\n *\n * @param currentFile - current file by default\n */\nmodule.exports.getCurrentLink = currentFile => {\n const current = currentFile || DOM.getCurrentFile();\n const link = DOM.getByTag('a', current);\n return link[0];\n};\nmodule.exports.getFilenames = files => {\n if (!files) throw Error('AllFiles could not be empty');\n const first = files[0] || DOM.getCurrentFile();\n const name = DOM.getCurrentName(first);\n const allFiles = Array.from(files);\n if (name === '..') allFiles.shift();\n const names = allFiles.map(current => {\n return DOM.getCurrentName(current);\n });\n return names;\n};\n\n/**\n * check storage hash\n */\nmodule.exports.checkStorageHash = async name => {\n const nameHash = `${name}-hash`;\n if (!isString(name)) throw Error('name should be a string!');\n const [loadHash, storeHash] = await Promise.all([DOM.loadCurrentHash(), Storage.get(nameHash)]);\n return [loadHash, storeHash];\n};\n\n/**\n * save data to storage\n *\n * @param name\n * @param data\n * @param hash\n * @param callback\n */\nmodule.exports.saveDataToStorage = async (name, data, hash) => {\n const isDir = DOM.isCurrentIsDir();\n if (isDir) return;\n hash = hash || (await DOM.loadCurrentHash());\n const nameHash = `${name}-hash`;\n const nameData = `${name}-data`;\n await Storage.set(nameHash, hash);\n await Storage.set(nameData, data);\n return hash;\n};\nmodule.exports.getFM = () => DOM.getPanel().parentElement;\nmodule.exports.getPanelPosition = panel => {\n panel = panel || DOM.getPanel();\n return panel.dataset.name.replace('js-', '');\n};\nmodule.exports.getCSSVar = (name, {\n body = document.body\n} = {}) => {\n const bodyStyle = getComputedStyle(body);\n return bodyStyle.getPropertyValue(`--${name}`);\n};\n\n/** function getting panel active, or passive\n * @param options = {active: true}\n */\nmodule.exports.getPanel = options => {\n let files;\n let panel;\n let isLeft;\n let dataName = 'js-';\n const current = DOM.getCurrentFile();\n if (!current) {\n panel = DOM.getByDataName('js-left');\n } else {\n files = current.parentElement;\n panel = files.parentElement;\n isLeft = panel.getAttribute('data-name') === 'js-left';\n }\n\n /* if {active : false} getting passive panel */\n if (options && !options.active) {\n dataName += isLeft ? 'right' : 'left';\n panel = DOM.getByDataName(dataName);\n }\n\n /* if two panels showed\n * then always work with passive\n * panel\n */\n if (globalThis.innerWidth < CloudCmd.MIN_ONE_PANEL_WIDTH) panel = DOM.getByDataName('js-left');\n if (!panel) throw Error('can not find Active Panel!');\n return panel;\n};\nmodule.exports.getFiles = element => {\n const files = DOM.getByDataName('js-files', element);\n return files.children || [];\n};\n\n/**\n * shows panel right or left (or active)\n */\nmodule.exports.showPanel = active => {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n DOM.show(panel);\n return true;\n};\n\n/**\n * hides panel right or left (or active)\n */\nmodule.exports.hidePanel = active => {\n const panel = DOM.getPanel({\n active\n });\n if (!panel) return false;\n return DOM.hide(panel);\n};\n\n/**\n * remove child of element\n * @param pChild\n * @param element\n */\nmodule.exports.remove = (child, element) => {\n const parent = element || document.body;\n parent.removeChild(child);\n return DOM;\n};\n\n/**\n * remove current file from file table\n * @param current\n *\n */\nmodule.exports.deleteCurrent = current => {\n if (!current) DOM.getCurrentFile();\n const parent = current === null || current === void 0 ? void 0 : current.parentElement;\n const name = DOM.getCurrentName(current);\n if (current && name !== '..') {\n const next = current.nextSibling;\n const prev = current.previousSibling;\n DOM.setCurrentFile(next || prev);\n parent.removeChild(current);\n }\n};\n\n/**\n * remove selected files from file table\n * @Selected\n */\nmodule.exports.deleteSelected = selected => {\n selected = selected || DOM.getSelectedFiles();\n if (!selected) return;\n selected.map(DOM.deleteCurrent);\n};\n\n/**\n * rename current file\n *\n * @currentFile\n */\nmodule.exports.renameCurrent = renameCurrent;\n/**\n * unified way to scrollIntoViewIfNeeded\n * (native suporte by webkit only)\n * @param element\n * @param center - to scroll as small as possible param should be false\n */\nmodule.exports.scrollIntoViewIfNeeded = (element, center = false) => {\n if (!element || !element.scrollIntoViewIfNeeded) return;\n element.scrollIntoViewIfNeeded(center);\n};\n\n/* scroll on one page */\nmodule.exports.scrollByPages = (element, pPages) => {\n const ret = (element === null || element === void 0 ? void 0 : element.scrollByPages) && pPages;\n if (ret) element.scrollByPages(pPages);\n return ret;\n};\nmodule.exports.changePanel = () => {\n const Info = CurrentInfo;\n let panel = DOM.getPanel();\n CloudCmd.emit('passive-dir', Info.dirPath);\n const panelPassive = DOM.getPanel({\n active: false\n });\n let name = DOM.getCurrentName();\n const filesPassive = DOM.getFiles(panelPassive);\n let dataName = panel.getAttribute('data-name');\n TabPanel[dataName] = name;\n panel = panelPassive;\n dataName = panel.getAttribute('data-name');\n name = TabPanel[dataName];\n let files;\n let current;\n if (name) {\n current = DOM.getCurrentByName(name, panel);\n if (current) files = current.parentElement;\n }\n if (!files || !files.parentElement) {\n current = DOM.getCurrentByName(name, panel);\n if (!current) [current] = filesPassive;\n }\n DOM.setCurrentFile(current, {\n history: true\n });\n CloudCmd.emit('active-dir', Info.dirPath);\n return DOM;\n};\nmodule.exports.getPackerExt = type => {\n if (type === 'zip') return '.zip';\n return '.tar.gz';\n};\nmodule.exports.goToDirectory = async (overrides = {}) => {\n const {\n Dialog\n } = DOM;\n const {\n prompt = Dialog.prompt,\n changeDir = CloudCmd.changeDir\n } = overrides;\n const msg = 'Go to directory:';\n const {\n dirPath\n } = CurrentInfo;\n const [cancel, path = dirPath] = await prompt(msg, dirPath);\n if (cancel) return;\n await changeDir(path);\n};\nmodule.exports.duplicatePanel = async () => {\n const Info = CurrentInfo;\n const {\n isDir\n } = Info;\n const panel = Info.panelPassive;\n const noCurrent = !Info.isOnePanel;\n const getPath = isDir => {\n if (isDir) return Info.path;\n return Info.dirPath;\n };\n const path = getPath(isDir);\n await CloudCmd.changeDir(path, {\n panel,\n noCurrent\n });\n};\nmodule.exports.swapPanels = async () => {\n const Info = CurrentInfo;\n const {\n panel,\n files,\n element,\n panelPassive\n } = Info;\n const path = DOM.getCurrentDirPath();\n const dirPathPassive = DOM.getNotCurrentDirPath();\n let currentIndex = files.indexOf(element);\n await CloudCmd.changeDir(path, {\n panel: panelPassive,\n noCurrent: true\n });\n await CloudCmd.changeDir(dirPathPassive, {\n panel\n });\n const length = Info.files.length - 1;\n if (currentIndex > length) currentIndex = length;\n const el = Info.files[currentIndex];\n DOM.setCurrentFile(el);\n};\nmodule.exports.CurrentInfo = CurrentInfo;\nmodule.exports.updateCurrentInfo = currentFile => {\n const info = DOM.CurrentInfo;\n const current = currentFile || DOM.getCurrentFile();\n const files = current.parentElement;\n const panelPassive = DOM.getPanel({\n active: false\n });\n const filesPassive = DOM.getFiles(panelPassive);\n const name = DOM.getCurrentName(current);\n info.dir = DOM.getCurrentDirName();\n info.dirPath = DOM.getCurrentDirPath();\n info.parentDirPath = DOM.getParentDirPath();\n info.element = current;\n info.ext = Util.getExt(name);\n info.files = Array.from(files.children);\n info.filesPassive = Array.from(filesPassive);\n info.first = files.firstChild;\n info.getData = DOM.getCurrentData;\n info.last = files.lastChild;\n info.link = DOM.getCurrentLink(current);\n info.mode = DOM.getCurrentMode(current);\n info.name = name;\n info.path = DOM.getCurrentPath(current);\n info.panel = files.parentElement || DOM.getPanel();\n info.panelPassive = panelPassive;\n info.size = DOM.getCurrentSize(current);\n info.isDir = DOM.isCurrentIsDir();\n info.isSelected = DOM.isSelected(current);\n info.panelPosition = DOM.getPanel().dataset.name.replace('js-', '');\n info.isOnePanel = info.panel.getAttribute('data-name') === info.panelPassive.getAttribute('data-name');\n};\n\n//# sourceURL=file://cloudcmd/client/dom/index.js\n}");
|
|
140
140
|
|
|
141
141
|
/***/ },
|
|
142
142
|
|
|
@@ -239,14 +239,14 @@ eval("{\n\n/* global CloudCmd */\nconst {\n eachSeries\n} = __webpack_require__
|
|
|
239
239
|
|
|
240
240
|
/***/ },
|
|
241
241
|
|
|
242
|
-
/***/ "./client/get-json-from-file-table.
|
|
243
|
-
|
|
244
|
-
!*** ./client/get-json-from-file-table.
|
|
245
|
-
|
|
246
|
-
(
|
|
242
|
+
/***/ "./client/get-json-from-file-table.mjs"
|
|
243
|
+
/*!*********************************************!*\
|
|
244
|
+
!*** ./client/get-json-from-file-table.mjs ***!
|
|
245
|
+
\*********************************************/
|
|
246
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
247
247
|
|
|
248
248
|
"use strict";
|
|
249
|
-
eval("{\n\n/*
|
|
249
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ getJsonFromFileTable: () => (/* binding */ getJsonFromFileTable)\n/* harmony export */ });\n/* global DOM */\n/**\n * Функция генерирует JSON из html-таблицы файлов и\n * используеться при первом заходе в корень\n */\nconst getJsonFromFileTable = () => {\n const Info = DOM.CurrentInfo;\n const path = DOM.getCurrentDirPath();\n const infoFiles = Info.files || [];\n \n const notParent = (current) => {\n const name = DOM.getCurrentName(current);\n return name !== '..';\n };\n \n const parse = (current) => {\n const name = DOM.getCurrentName(current);\n const size = DOM.getCurrentSize(current);\n const owner = DOM.getCurrentOwner(current);\n const mode = DOM.getCurrentMode(current);\n const date = DOM.getCurrentDate(current);\n const type = DOM.getCurrentType(current);\n \n return {\n name,\n size,\n mode,\n owner,\n date,\n type,\n };\n };\n \n const files = infoFiles\n .filter(notParent)\n .map(parse);\n \n const fileTable = {\n path,\n files,\n };\n \n return fileTable;\n};\n\n\n//# sourceURL=file://cloudcmd/client/get-json-from-file-table.mjs\n}");
|
|
250
250
|
|
|
251
251
|
/***/ },
|
|
252
252
|
|
|
@@ -268,7 +268,7 @@ eval("{\n\nmodule.exports.createBinder = () => {\n let binded = false;\n retur
|
|
|
268
268
|
(module, __unused_webpack_exports, __webpack_require__) {
|
|
269
269
|
|
|
270
270
|
"use strict";
|
|
271
|
-
eval("{\n\n/* global CloudCmd, DOM */\nconst clipboard = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.cjs\");\nconst Buffer = __webpack_require__(/*! ../dom/buffer */ \"./client/dom/buffer.js\");\nconst Events = __webpack_require__(/*! ../dom/events */ \"./client/dom/events/index.js\");\nconst KEY = __webpack_require__(/*! ./key */ \"./client/key/key.js\");\nconst vim = __webpack_require__(/*! ./vim */ \"./client/key/vim/index.js\");\nconst setCurrentByChar = __webpack_require__(/*! ./set-current-by-char */ \"./client/key/set-current-by-char.js\");\nconst {\n createBinder\n} = __webpack_require__(/*! ./binder */ \"./client/key/binder.js\");\nconst Info = DOM.CurrentInfo;\nconst Chars = fullstore();\nconst toggleVim = (keyCode, overrides = {}) => {\n const {\n _config,\n config\n } = overrides;\n if (keyCode === KEY.ESC) _config('vim', !config('vim'));\n};\nconst isUndefined = a => typeof a === 'undefined';\nChars([]);\nconst {\n assign\n} = Object;\nconst binder = createBinder();\nmodule.exports = assign(binder, KEY);\nmodule.exports.bind = () => {\n Events.addKey(listener, true);\n binder.setBind();\n};\nmodule.exports._listener = listener;\nfunction getChar(event) {\n /*\n * event.keyIdentifier deprecated in chrome v51\n * but event.key is absent in chrome <= v51\n */\n const {\n key,\n shift,\n keyCode,\n keyIdentifier\n } = event;\n const char = key || fromCharCode(keyIdentifier);\n const symbol = getSymbol(shift, keyCode);\n return [symbol, char];\n}\nasync function listener(event, overrides = {}) {\n const {\n config = CloudCmd.config,\n _config = CloudCmd._config,\n switchKey = _switchKey\n } = overrides;\n const {\n keyCode\n } = event;\n\n // strange chrome bug calles listener twice\n // in second time event misses a lot fields\n if (isUndefined(event.altKey)) return;\n const alt = event.altKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const isBetween = keyCode >= KEY.ZERO && keyCode <= KEY.Z;\n const isNumpad = /Numpad/.test(event.code);\n const [symbol, char] = getChar(event);\n if (!binder.isBind()) return;\n toggleVim(keyCode, {\n config,\n _config\n });\n const isVim = config('vim');\n if (!isVim && !isNumpad && !alt && !ctrl && !meta && (isBetween || symbol)) return setCurrentByChar(char, Chars);\n Chars([]);\n await switchKey(event);\n if (keyCode >= KEY.F1 && keyCode <= KEY.F10) return;\n if (isVim) vim(char, event);\n}\nfunction getSymbol(shift, keyCode) {\n switch (keyCode) {\n case KEY.DOT:\n return '.';\n case KEY.HYPHEN:\n return shift ? '_' : '-';\n case KEY.EQUAL:\n return shift ? '+' : '=';\n }\n return '';\n}\nfunction fromCharCode(keyIdentifier) {\n const code = keyIdentifier.substring(2);\n const hex = parseInt(code, 16);\n return String.fromCharCode(hex);\n}\nasync function _switchKey(event) {\n let i;\n let isSelected;\n let prev;\n let next;\n let current = Info.element;\n let dataName;\n const {\n name,\n panel,\n path,\n isDir\n } = Info;\n const {\n Operation,\n changeDir,\n config\n } = CloudCmd;\n const {\n keyCode\n } = event;\n const alt = event.altKey;\n const shift = event.shiftKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n if (current) {\n prev = current.previousSibling;\n next = current.nextSibling;\n }\n switch (keyCode) {\n case KEY.TAB:\n DOM.changePanel();\n event.preventDefault();\n break;\n case KEY.INSERT:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case KEY.INSERT_MAC:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case KEY.DELETE:\n if (shift) Operation.show('delete:silent');else Operation.show('delete');\n break;\n case KEY.ASTERISK:\n DOM.toggleAllSelectedFiles(current);\n break;\n case KEY.PLUS:\n DOM.expandSelection();\n event.preventDefault();\n break;\n case KEY.MINUS:\n DOM.shrinkSelection();\n event.preventDefault();\n break;\n case KEY.F1:\n CloudCmd.Help.show();\n event.preventDefault();\n break;\n case KEY.F2:\n CloudCmd.UserMenu.show();\n break;\n case KEY.F3:\n event.preventDefault();\n if (Info.isDir) await changeDir(path);else if (shift) CloudCmd.View.show(null, {\n raw: true\n });else if (ctrlMeta) CloudCmd.sortPanel('name');else CloudCmd.View.show();\n break;\n case KEY.F4:\n if (config('vim')) CloudCmd.EditFileVim.show();else CloudCmd.EditFile.show();\n event.preventDefault();\n break;\n case KEY.F5:\n if (ctrlMeta) CloudCmd.sortPanel('date');else if (alt) Operation.show('pack');else Operation.show('copy');\n event.preventDefault();\n break;\n case KEY.F6:\n if (ctrlMeta) CloudCmd.sortPanel('size');else if (shift) DOM.renameCurrent(current);else Operation.show('move');\n event.preventDefault();\n break;\n case KEY.F7:\n if (shift) DOM.promptNewFile();else DOM.promptNewDir();\n event.preventDefault();\n break;\n case KEY.F8:\n Operation.show('delete');\n event.preventDefault();\n break;\n case KEY.F9:\n if (alt) Operation.show('extract');else CloudCmd.Menu.show();\n event.preventDefault();\n break;\n case KEY.F10:\n CloudCmd.Config.show();\n event.preventDefault();\n break;\n case KEY.TRA:\n event.preventDefault();\n if (shift) return CloudCmd.Terminal.show();\n CloudCmd.Konsole.show();\n break;\n case KEY.BRACKET_CLOSE:\n CloudCmd.Konsole.show();\n event.preventDefault();\n break;\n case KEY.SPACE:\n event.preventDefault();\n if (!isDir || name === '..') isSelected = true;else isSelected = DOM.isSelected(current);\n if (!isSelected) await DOM.loadCurrentSize(current);\n DOM.toggleSelectedFile(current);\n break;\n case KEY.U:\n if (ctrlMeta) {\n DOM.swapPanels();\n event.preventDefault();\n }\n break;\n\n /* navigation on file table: *\n * in case of pressing button 'up', *\n * select previous row */\n case KEY.UP:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(prev);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'down', *\n * select next row */\n case KEY.DOWN:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(next);\n event.preventDefault();\n break;\n case KEY.LEFT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-right') DOM.duplicatePanel();\n break;\n case KEY.RIGHT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-left') DOM.duplicatePanel();\n break;\n\n /* in case of pressing button 'Home', *\n * go to top element */\n case KEY.HOME:\n DOM.setCurrentFile(Info.first);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'End', select last element */\n case KEY.END:\n DOM.setCurrentFile(Info.last);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page down проматываем экран */\n case KEY.PAGE_DOWN:\n DOM.scrollByPages(panel, 1);\n for (i = 0; i < 30; i++) {\n if (!current.nextSibling) break;\n current = current.nextSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page up проматываем экран */\n case KEY.PAGE_UP:\n DOM.scrollByPages(panel, -1);\n for (i = 0; i < 30; i++) {\n if (!current.previousSibling) break;\n current = current.previousSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n case KEY.ENTER:\n if (Info.isDir) await changeDir(path);else CloudCmd.View.show();\n break;\n case KEY.BACKSPACE:\n CloudCmd.goToParentDir();\n event.preventDefault();\n break;\n case KEY.BACKSLASH:\n if (ctrlMeta) await changeDir('/');\n break;\n case KEY.A:\n if (ctrlMeta) {\n DOM.selectAllFiles();\n event.preventDefault();\n }\n break;\n case KEY.G:\n if (alt) {\n DOM.goToDirectory();\n event.preventDefault();\n }\n break;\n case KEY.M:\n if (ctrlMeta) {\n if (config('vim')) CloudCmd.EditNamesVim.show();else CloudCmd.EditNames.show();\n event.preventDefault();\n }\n break;\n case KEY.P:\n if (!ctrlMeta) return;\n event.preventDefault();\n clipboard.writeText(Info.dirPath).catch(CloudCmd.log);\n break;\n\n /**\n * обновляем страницу,\n * загружаем содержимое каталога\n * при этом данные берём всегда с\n * сервера, а не из кэша\n * (обновляем кэш)\n */\n case KEY.R:\n if (ctrlMeta) {\n CloudCmd.log('reloading page...\\n');\n CloudCmd.refresh();\n event.preventDefault();\n }\n break;\n case KEY.C:\n if (ctrlMeta) Buffer.copy();\n break;\n case KEY.X:\n if (ctrlMeta) Buffer.cut();\n break;\n case KEY.V:\n if (ctrlMeta) Buffer.paste();\n break;\n case KEY.Z:\n if (ctrlMeta) Buffer.clear();\n break;\n case KEY.COLON:\n CloudCmd.CommandLine.show();\n event.preventDefault();\n break;\n\n /* чистим хранилище */\n case KEY.D:\n if (ctrlMeta) {\n CloudCmd.log('clearing storage...');\n await DOM.Storage.clear();\n CloudCmd.log('storage cleared');\n event.preventDefault();\n }\n break;\n case KEY.DOT:\n if (meta && shift) {\n const showDotFiles = !CloudCmd.config('showDotFiles');\n CloudCmd._config('showDotFiles', showDotFiles);\n CloudCmd.refresh();\n await DOM.RESTful.Config.write({\n showDotFiles\n });\n }\n break;\n }\n}\n\n//# sourceURL=file://cloudcmd/client/key/index.js\n}");
|
|
271
|
+
eval("{\n\n/* global CloudCmd, DOM */\nconst clipboard = __webpack_require__(/*! @cloudcmd/clipboard */ \"./node_modules/@cloudcmd/clipboard/lib/clipboard.js\");\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.cjs\");\nconst Buffer = __webpack_require__(/*! ../dom/buffer */ \"./client/dom/buffer.js\");\nconst Events = __webpack_require__(/*! ../dom/events */ \"./client/dom/events/index.js\");\nconst KEY = __webpack_require__(/*! ./key */ \"./client/key/key.js\");\nconst _vim = __webpack_require__(/*! ./vim */ \"./client/key/vim/index.js\");\nconst setCurrentByChar = __webpack_require__(/*! ./set-current-by-char */ \"./client/key/set-current-by-char.js\");\nconst {\n createBinder\n} = __webpack_require__(/*! ./binder */ \"./client/key/binder.js\");\nconst Info = DOM.CurrentInfo;\nconst Chars = fullstore();\nconst toggleVim = (keyCode, overrides = {}) => {\n const {\n _config,\n config\n } = overrides;\n if (keyCode === KEY.ESC) _config('vim', !config('vim'));\n};\nconst isUndefined = a => typeof a === 'undefined';\nChars([]);\nconst {\n assign\n} = Object;\nconst binder = createBinder();\nmodule.exports = assign(binder, KEY);\nmodule.exports.bind = () => {\n Events.addKey(listener, true);\n binder.setBind();\n};\nmodule.exports._listener = listener;\nfunction getChar(event) {\n /*\n * event.keyIdentifier deprecated in chrome v51\n * but event.key is absent in chrome <= v51\n */\n const {\n key,\n shift,\n keyCode,\n keyIdentifier\n } = event;\n const char = key || fromCharCode(keyIdentifier);\n const symbol = getSymbol(shift, keyCode);\n return [symbol, char];\n}\nasync function listener(event, overrides = {}) {\n const {\n config = CloudCmd.config,\n _config = CloudCmd._config,\n switchKey = _switchKey,\n vim = _vim\n } = overrides;\n const {\n keyCode\n } = event;\n\n // strange chrome bug calles listener twice\n // in second time event misses a lot fields\n if (isUndefined(event.altKey)) return;\n const alt = event.altKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const isBetween = keyCode >= KEY.ZERO && keyCode <= KEY.Z;\n const isNumpad = /Numpad/.test(event.code);\n const [symbol, char] = getChar(event);\n if (!binder.isBind()) return;\n toggleVim(keyCode, {\n config,\n _config\n });\n const isVim = config('vim');\n if (!isVim && !isNumpad && !alt && !ctrl && !meta && (isBetween || symbol)) return setCurrentByChar(char, Chars);\n Chars([]);\n await switchKey(event);\n if (keyCode >= KEY.F1 && keyCode <= KEY.F10) return;\n if (isVim) await vim(char, event);\n}\nfunction getSymbol(shift, keyCode) {\n switch (keyCode) {\n case KEY.DOT:\n return '.';\n case KEY.HYPHEN:\n return shift ? '_' : '-';\n case KEY.EQUAL:\n return shift ? '+' : '=';\n }\n return '';\n}\nfunction fromCharCode(keyIdentifier) {\n const code = keyIdentifier.substring(2);\n const hex = parseInt(code, 16);\n return String.fromCharCode(hex);\n}\nasync function _switchKey(event) {\n let i;\n let isSelected;\n let prev;\n let next;\n let current = Info.element;\n let dataName;\n const {\n name,\n panel,\n path,\n isDir\n } = Info;\n const {\n Operation,\n changeDir,\n config\n } = CloudCmd;\n const {\n keyCode\n } = event;\n const alt = event.altKey;\n const shift = event.shiftKey;\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n if (current) {\n prev = current.previousSibling;\n next = current.nextSibling;\n }\n switch (keyCode) {\n case KEY.TAB:\n DOM.changePanel();\n event.preventDefault();\n break;\n case KEY.INSERT:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case KEY.INSERT_MAC:\n DOM.toggleSelectedFile(current).setCurrentFile(next);\n break;\n case KEY.DELETE:\n if (shift) Operation.show('delete:silent');else Operation.show('delete');\n break;\n case KEY.ASTERISK:\n DOM.toggleAllSelectedFiles(current);\n break;\n case KEY.PLUS:\n DOM.expandSelection();\n event.preventDefault();\n break;\n case KEY.MINUS:\n DOM.shrinkSelection();\n event.preventDefault();\n break;\n case KEY.F1:\n CloudCmd.Help.show();\n event.preventDefault();\n break;\n case KEY.F2:\n CloudCmd.UserMenu.show();\n break;\n case KEY.F3:\n event.preventDefault();\n if (Info.isDir) await changeDir(path);else if (shift) CloudCmd.View.show(null, {\n raw: true\n });else if (ctrlMeta) CloudCmd.sortPanel('name');else CloudCmd.View.show();\n break;\n case KEY.F4:\n if (config('vim')) CloudCmd.EditFileVim.show();else CloudCmd.EditFile.show();\n event.preventDefault();\n break;\n case KEY.F5:\n if (ctrlMeta) CloudCmd.sortPanel('date');else if (alt) Operation.show('pack');else Operation.show('copy');\n event.preventDefault();\n break;\n case KEY.F6:\n if (ctrlMeta) CloudCmd.sortPanel('size');else if (shift) DOM.renameCurrent(current);else Operation.show('move');\n event.preventDefault();\n break;\n case KEY.F7:\n if (shift) DOM.promptNewFile();else DOM.promptNewDir();\n event.preventDefault();\n break;\n case KEY.F8:\n Operation.show('delete');\n event.preventDefault();\n break;\n case KEY.F9:\n if (alt) Operation.show('extract');else CloudCmd.Menu.show();\n event.preventDefault();\n break;\n case KEY.F10:\n CloudCmd.Config.show();\n event.preventDefault();\n break;\n case KEY.TRA:\n event.preventDefault();\n if (shift) return CloudCmd.Terminal.show();\n CloudCmd.Konsole.show();\n break;\n case KEY.BRACKET_CLOSE:\n CloudCmd.Konsole.show();\n event.preventDefault();\n break;\n case KEY.SPACE:\n event.preventDefault();\n if (!isDir || name === '..') isSelected = true;else isSelected = DOM.isSelected(current);\n if (!isSelected) await DOM.loadCurrentSize(current);\n DOM.toggleSelectedFile(current);\n break;\n case KEY.U:\n if (ctrlMeta) {\n DOM.swapPanels();\n event.preventDefault();\n }\n break;\n\n /* navigation on file table: *\n * in case of pressing button 'up', *\n * select previous row */\n case KEY.UP:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(prev);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'down', *\n * select next row */\n case KEY.DOWN:\n if (shift) DOM.toggleSelectedFile(current);\n DOM.setCurrentFile(next);\n event.preventDefault();\n break;\n case KEY.LEFT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-right') DOM.duplicatePanel();\n break;\n case KEY.RIGHT:\n if (!alt) return;\n event.preventDefault();\n dataName = Info.panel.getAttribute('data-name');\n if (dataName === 'js-left') DOM.duplicatePanel();\n break;\n\n /* in case of pressing button 'Home', *\n * go to top element */\n case KEY.HOME:\n DOM.setCurrentFile(Info.first);\n event.preventDefault();\n break;\n\n /* in case of pressing button 'End', select last element */\n case KEY.END:\n DOM.setCurrentFile(Info.last);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page down проматываем экран */\n case KEY.PAGE_DOWN:\n DOM.scrollByPages(panel, 1);\n for (i = 0; i < 30; i++) {\n if (!current.nextSibling) break;\n current = current.nextSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n\n /* если нажали клавишу page up проматываем экран */\n case KEY.PAGE_UP:\n DOM.scrollByPages(panel, -1);\n for (i = 0; i < 30; i++) {\n if (!current.previousSibling) break;\n current = current.previousSibling;\n }\n DOM.setCurrentFile(current);\n event.preventDefault();\n break;\n case KEY.ENTER:\n if (Info.isDir) await changeDir(path);else CloudCmd.View.show();\n break;\n case KEY.BACKSPACE:\n CloudCmd.goToParentDir();\n event.preventDefault();\n break;\n case KEY.BACKSLASH:\n if (ctrlMeta) await changeDir('/');\n break;\n case KEY.A:\n if (ctrlMeta) {\n DOM.selectAllFiles();\n event.preventDefault();\n }\n break;\n case KEY.G:\n if (alt) {\n DOM.goToDirectory();\n event.preventDefault();\n }\n break;\n case KEY.M:\n if (ctrlMeta) {\n if (config('vim')) CloudCmd.EditNamesVim.show();else CloudCmd.EditNames.show();\n event.preventDefault();\n }\n break;\n case KEY.P:\n if (!ctrlMeta) return;\n event.preventDefault();\n clipboard.writeText(Info.dirPath).catch(CloudCmd.log);\n break;\n\n /**\n * обновляем страницу,\n * загружаем содержимое каталога\n * при этом данные берём всегда с\n * сервера, а не из кэша\n * (обновляем кэш)\n */\n case KEY.R:\n if (ctrlMeta) {\n CloudCmd.log('reloading page...\\n');\n CloudCmd.refresh();\n event.preventDefault();\n }\n break;\n case KEY.C:\n if (ctrlMeta) Buffer.copy();\n break;\n case KEY.X:\n if (ctrlMeta) Buffer.cut();\n break;\n case KEY.V:\n if (ctrlMeta) Buffer.paste();\n break;\n case KEY.Z:\n if (ctrlMeta) Buffer.clear();\n break;\n case KEY.COLON:\n CloudCmd.CommandLine.show();\n event.preventDefault();\n break;\n\n /* чистим хранилище */\n case KEY.D:\n if (ctrlMeta) {\n CloudCmd.log('clearing storage...');\n await DOM.Storage.clear();\n CloudCmd.log('storage cleared');\n event.preventDefault();\n }\n break;\n case KEY.DOT:\n if (meta && shift) {\n const showDotFiles = !CloudCmd.config('showDotFiles');\n CloudCmd._config('showDotFiles', showDotFiles);\n CloudCmd.refresh();\n await DOM.RESTful.Config.write({\n showDotFiles\n });\n }\n break;\n }\n}\n\n//# sourceURL=file://cloudcmd/client/key/index.js\n}");
|
|
272
272
|
|
|
273
273
|
/***/ },
|
|
274
274
|
|
|
@@ -367,18 +367,18 @@ 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 {\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}");
|
|
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(globalThis.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(globalThis.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 = globalThis.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
|
|
|
374
|
-
/***/ "./client/load-module.
|
|
375
|
-
|
|
376
|
-
!*** ./client/load-module.
|
|
377
|
-
|
|
378
|
-
(
|
|
374
|
+
/***/ "./client/load-module.mjs"
|
|
375
|
+
/*!********************************!*\
|
|
376
|
+
!*** ./client/load-module.mjs ***!
|
|
377
|
+
\********************************/
|
|
378
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
379
379
|
|
|
380
380
|
"use strict";
|
|
381
|
-
eval("{\n\n/*
|
|
381
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadModule: () => (/* binding */ loadModule)\n/* harmony export */ });\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var just_pascal_case__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! just-pascal-case */ \"./node_modules/just-pascal-case/index.mjs\");\n/* global CloudCmd */\n\n\n\n\n\nconst noJS = (a) => a.replace(/.js$/, '');\n\n/**\n * function load modules\n * @params = {name, path, func, dobefore, arg}\n */\nconst loadModule = (params) => {\n if (!params)\n return;\n \n const {path} = params;\n \n const name = path && noJS((0,just_pascal_case__WEBPACK_IMPORTED_MODULE_3__[\"default\"])(path));\n const doBefore = params.dobefore;\n \n if (CloudCmd[name])\n return;\n \n CloudCmd[name] = async () => {\n execon__WEBPACK_IMPORTED_MODULE_0__(doBefore);\n \n const {DIR_MODULES} = CloudCmd;\n const pathFull = `${DIR_MODULES}/${path}.js`;\n \n await (0,load_js__WEBPACK_IMPORTED_MODULE_2__.js)(pathFull);\n const newModule = async (f) => f && f();\n const module = CloudCmd[name];\n \n Object.assign(newModule, module);\n \n CloudCmd[name] = newModule;\n CloudCmd.log('init', name);\n \n await module.init();\n \n return newModule;\n };\n \n CloudCmd[name].show = async (...args) => {\n CloudCmd.log('show', name, args);\n const m = CloudCmd[name];\n \n const [e, a] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.tryToCatch)(m);\n \n if (e)\n return;\n \n return await a.show(...args);\n };\n};\n\n\n//# sourceURL=file://cloudcmd/client/load-module.mjs\n}");
|
|
382
382
|
|
|
383
383
|
/***/ },
|
|
384
384
|
|
|
@@ -477,7 +477,7 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.EditNamesVim = exports;\nconst Events
|
|
|
477
477
|
(module, exports, __webpack_require__) {
|
|
478
478
|
|
|
479
479
|
"use strict";
|
|
480
|
-
eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\n\n/* global CloudCmd, DOM */\nCloudCmd.EditNames = exports;\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst supermenu = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\nconst multiRename = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n exec.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nmodule.exports.init = async () => {\n await CloudCmd.Edit();\n setListeners();\n};\nmodule.exports.show = options => {\n const names = getActiveNames().join('\\n');\n const config = {\n ...ConfigView,\n ...options\n };\n if (Info.name === '..' && names.length === 1) return Dialog.alert.noFiles();\n DOM.Events.addKey(keyListener);\n CloudCmd.Edit.getEditor().setValueFirst('edit-names', names).setMode().setOption('keyMap', 'default').disableKey();\n CloudCmd.Edit.show(config);\n return CloudCmd.Edit;\n};\nasync function keyListener(event) {\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n const {\n Key\n } = CloudCmd;\n if (ctrlMeta && event.keyCode === Key.S) {\n hide();\n } else if (ctrlMeta && event.keyCode === Key.P) {\n const [, pattern] = await Dialog.prompt('Apply pattern:', '[n][e]');\n pattern && applyPattern(pattern);\n }\n}\nfunction applyPattern(pattern) {\n const newNames = multiRename(pattern, getActiveNames());\n const editor = CloudCmd.Edit.getEditor();\n editor.setValue(newNames.join('\\n'));\n}\nfunction getActiveNames() {\n return DOM.getFilenames(DOM.getActiveFiles());\n}\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners() {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n}\nasync function applyNames() {\n const dir = Info.dirPath;\n const from = getActiveNames();\n const nameIndex = from.indexOf(Info.name);\n const editor = CloudCmd.Edit.getEditor();\n const to = editor.getValue().split('\\n');\n const root = CloudCmd.config('root');\n const response = rename(dir, from, to, root);\n const [error] = await tryToCatch(refresh, to, nameIndex, response);\n if (error) alert(error);\n}\nfunction refresh(to, nameIndex, res) {\n if (res.status === 404) {\n const error = res.text();\n throw error;\n }\n const currentName = to[nameIndex];\n CloudCmd.refresh({\n currentName\n });\n}\nfunction getDir(root, dir) {\n if (root === '/') return dir;\n return root + dir;\n}\nfunction rename(path, from, to, root) {\n const dir = getDir(root, path);\n const {\n prefix\n } = CloudCmd;\n return fetch(`${prefix}/rename`, {\n method: 'put',\n credentials: 'include',\n body: JSON.stringify({\n from,\n to,\n dir\n })\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const editor = CloudCmd.Edit.getEditor();\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n editor.focus();\n }\n };\n const menuData = {\n 'Save Ctrl+S': async () => {\n await applyNames();\n hide();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu(element, options, menuData);\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nmodule.exports.isChanged = isChanged;\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const msg = 'Apply new names?';\n if (!editor.isChanged()) return;\n const [cancel] = await Dialog.confirm(msg);\n !cancel && (await applyNames());\n}\n\n//# sourceURL=file://cloudcmd/client/modules/edit-names.js\n}");
|
|
480
|
+
eval("{\n\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\n\n/* global CloudCmd, DOM */\nCloudCmd.EditNames = exports;\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\nconst supermenu = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\nconst {\n multiRename\n} = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n exec.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nmodule.exports.init = async () => {\n await CloudCmd.Edit();\n setListeners();\n};\nmodule.exports.show = options => {\n const names = getActiveNames().join('\\n');\n const config = {\n ...ConfigView,\n ...options\n };\n if (Info.name === '..' && names.length === 1) return Dialog.alert.noFiles();\n DOM.Events.addKey(keyListener);\n CloudCmd.Edit.getEditor().setValueFirst('edit-names', names).setMode().setOption('keyMap', 'default').disableKey();\n CloudCmd.Edit.show(config);\n return CloudCmd.Edit;\n};\nasync function keyListener(event) {\n const ctrl = event.ctrlKey;\n const meta = event.metaKey;\n const ctrlMeta = ctrl || meta;\n const {\n Key\n } = CloudCmd;\n if (ctrlMeta && event.keyCode === Key.S) {\n hide();\n } else if (ctrlMeta && event.keyCode === Key.P) {\n const [, pattern] = await Dialog.prompt('Apply pattern:', '[n][e]');\n pattern && applyPattern(pattern);\n }\n}\nfunction applyPattern(pattern) {\n const newNames = multiRename(pattern, getActiveNames());\n const editor = CloudCmd.Edit.getEditor();\n editor.setValue(newNames.join('\\n'));\n}\nfunction getActiveNames() {\n return DOM.getFilenames(DOM.getActiveFiles());\n}\nmodule.exports.hide = hide;\nfunction hide() {\n CloudCmd.Edit.hide();\n}\nfunction setListeners() {\n const element = CloudCmd.Edit.getElement();\n DOM.Events.addOnce('contextmenu', element, setMenu);\n}\nasync function applyNames() {\n const dir = Info.dirPath;\n const from = getActiveNames();\n const nameIndex = from.indexOf(Info.name);\n const editor = CloudCmd.Edit.getEditor();\n const to = editor.getValue().split('\\n');\n const root = CloudCmd.config('root');\n const response = rename(dir, from, to, root);\n const [error] = await tryToCatch(refresh, to, nameIndex, response);\n if (error) alert(error);\n}\nfunction refresh(to, nameIndex, res) {\n if (res.status === 404) {\n const error = res.text();\n throw error;\n }\n const currentName = to[nameIndex];\n CloudCmd.refresh({\n currentName\n });\n}\nfunction getDir(root, dir) {\n if (root === '/') return dir;\n return root + dir;\n}\nfunction rename(path, from, to, root) {\n const dir = getDir(root, path);\n const {\n prefix\n } = CloudCmd;\n return fetch(`${prefix}/rename`, {\n method: 'put',\n credentials: 'include',\n body: JSON.stringify({\n from,\n to,\n dir\n })\n });\n}\nfunction setMenu(event) {\n const position = {\n x: event.clientX,\n y: event.clientY\n };\n event.preventDefault();\n if (Menu) return;\n const editor = CloudCmd.Edit.getEditor();\n const options = {\n beforeShow: params => {\n params.x -= 18;\n params.y -= 27;\n },\n afterClick: () => {\n editor.focus();\n }\n };\n const menuData = {\n 'Save Ctrl+S': async () => {\n await applyNames();\n hide();\n },\n 'Go To Line Ctrl+G': () => {\n editor.goToLine();\n },\n 'Cut Ctrl+X': () => {\n editor.cutToClipboard();\n },\n 'Copy Ctrl+C': () => {\n editor.copyToClipboard();\n },\n 'Paste Ctrl+V': () => {\n editor.pasteFromClipboard();\n },\n 'Delete Del': () => {\n editor.remove('right');\n },\n 'Select All Ctrl+A': () => {\n editor.selectAll();\n },\n 'Close Esc': hide\n };\n const element = CloudCmd.Edit.getElement();\n Menu = supermenu(element, options, menuData);\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\nmodule.exports.isChanged = isChanged;\nasync function isChanged() {\n const editor = CloudCmd.Edit.getEditor();\n const msg = 'Apply new names?';\n if (!editor.isChanged()) return;\n const [cancel] = await Dialog.confirm(msg);\n !cancel && (await applyNames());\n}\n\n//# sourceURL=file://cloudcmd/client/modules/edit-names.js\n}");
|
|
481
481
|
|
|
482
482
|
/***/ },
|
|
483
483
|
|
|
@@ -532,7 +532,7 @@ eval("{\n\n/* global CloudCmd */\nCloudCmd.Markdown = exports;\nconst createElem
|
|
|
532
532
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
533
533
|
|
|
534
534
|
"use strict";
|
|
535
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudMenu: () => (/* binding */ createCloudMenu)\n/* harmony export */ });\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n\n\nconst noop = () => {};\nconst {CloudCmd} = globalThis;\n\nconst createCloudMenu = async (fm, options, menuData) => {\n const createMenu = await loadMenu();\n const menu = await createMenu(fm, options, menuData);\n \n menu.addContextMenuListener = menu.addContextMenuListener || noop;\n \n return menu;\n};\n\nasync function loadMenu() {\n if (CloudCmd.config('menu') === 'aleman') {\n const {host, protocol} =
|
|
535
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ createCloudMenu: () => (/* binding */ createCloudMenu)\n/* harmony export */ });\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n\n\nconst noop = () => {};\nconst {CloudCmd} = globalThis;\n\nconst createCloudMenu = async (fm, options, menuData) => {\n const createMenu = await loadMenu();\n const menu = await createMenu(fm, options, menuData);\n \n menu.addContextMenuListener = menu.addContextMenuListener || noop;\n \n return menu;\n};\n\nasync function loadMenu() {\n if (CloudCmd.config('menu') === 'aleman') {\n const {host, protocol} = globalThis.location;\n const url = `${protocol}//${host}/node_modules/aleman/menu/menu.js`;\n const {createMenu} = await import(/* webpackIgnore: true */url);\n \n return createMenu;\n }\n \n return createSupermenu;\n}\n\nfunction createSupermenu(name, options, menuData) {\n const element = document.querySelector('[data-name=\"js-fm\"]');\n return supermenu__WEBPACK_IMPORTED_MODULE_0__(element, options, menuData);\n}\n\n\n//# sourceURL=file://cloudcmd/client/modules/menu/cloudmenu.mjs\n}");
|
|
536
536
|
|
|
537
537
|
/***/ },
|
|
538
538
|
|
|
@@ -620,7 +620,7 @@ eval("{\n\n__webpack_require__(/*! domtokenlist-shim */ \"./node_modules/domtoke
|
|
|
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 {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.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 {\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(
|
|
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 {\n fullstore\n} = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.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 {\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(globalThis.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 {\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(
|
|
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(globalThis.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
|
|
|
@@ -734,14 +734,14 @@ eval("{\n\nconst {\n extname\n} = __webpack_require__(/*! node:path */ \"./node
|
|
|
734
734
|
|
|
735
735
|
/***/ },
|
|
736
736
|
|
|
737
|
-
/***/ "./client/sort.
|
|
738
|
-
|
|
739
|
-
!*** ./client/sort.
|
|
740
|
-
|
|
741
|
-
(
|
|
737
|
+
/***/ "./client/sort.mjs"
|
|
738
|
+
/*!*************************!*\
|
|
739
|
+
!*** ./client/sort.mjs ***!
|
|
740
|
+
\*************************/
|
|
741
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
742
742
|
|
|
743
743
|
"use strict";
|
|
744
|
-
eval("{\n\n/*
|
|
744
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ initSortPanel: () => (/* binding */ initSortPanel),\n/* harmony export */ sortPanel: () => (/* binding */ sortPanel)\n/* harmony export */ });\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _dom_index_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./dom/index.js */ \"./client/dom/index.js\");\n/* global CloudCmd */\n\n\n\nconst sortPrevious = (0,fullstore__WEBPACK_IMPORTED_MODULE_0__.fullstore)();\n\nconst {getPanel} = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__;\n\nconst initSortPanel = () => {\n const {sort} = CloudCmd;\n const position = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__.getPanelPosition();\n \n sortPrevious(sort[position]);\n};\n\nconst sortPanel = (name, panel = getPanel()) => {\n const {sort, order} = CloudCmd;\n const Info = _dom_index_js__WEBPACK_IMPORTED_MODULE_1__.CurrentInfo;\n const position = panel.dataset.name.replace('js-', '');\n \n if (name !== sortPrevious())\n order[position] = 'asc';\n else if (order[position] === 'asc')\n order[position] = 'desc';\n else\n order[position] = 'asc';\n \n sortPrevious(name);\n sort[position] = name;\n const noCurrent = position !== Info.panelPosition;\n \n CloudCmd.refresh({\n panel,\n noCurrent,\n });\n};\n\n\n//# sourceURL=file://cloudcmd/client/sort.mjs\n}");
|
|
745
745
|
|
|
746
746
|
/***/ },
|
|
747
747
|
|
|
@@ -1265,6 +1265,17 @@ eval("{module.exports = pascalCase;\n\n/*\n pascalCase('the quick brown fox');
|
|
|
1265
1265
|
|
|
1266
1266
|
/***/ },
|
|
1267
1267
|
|
|
1268
|
+
/***/ "./node_modules/just-pascal-case/index.mjs"
|
|
1269
|
+
/*!*************************************************!*\
|
|
1270
|
+
!*** ./node_modules/just-pascal-case/index.mjs ***!
|
|
1271
|
+
\*************************************************/
|
|
1272
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1273
|
+
|
|
1274
|
+
"use strict";
|
|
1275
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (/* binding */ stringPascalCase)\n/* harmony export */ });\nvar stringPascalCase = pascalCase;\n\n/*\n pascalCase('the quick brown fox'); // 'TheQuickBrownFox'\n pascalCase('the_quick_brown_fox'); // 'TheQuickBrownFox'\n pascalCase('the-quick-brown-fox'); // 'TheQuickBrownFox'\n pascalCase('theQuickBrownFox'); // 'TheQuickBrownFox'\n pascalCase('thequickbrownfox'); // 'Thequickbrownfox'\n pascalCase('the - quick * brown# fox'); // 'TheQuickBrownFox'\n pascalCase('theQUICKBrownFox'); // 'TheQUICKBrownFox'\n*/\n\n// any combination of spaces and punctuation characters\n// thanks to http://stackoverflow.com/a/25575009\nvar wordSeparators = /[\\s\\u2000-\\u206F\\u2E00-\\u2E7F\\\\'!\"#$%&()*+,\\-.\\/:;<=>?@\\[\\]^_`{|}~]+/;\n\nfunction pascalCase(str) {\n var words = str.split(wordSeparators);\n var len = words.length;\n var mappedWords = new Array(len);\n for (var i = 0; i < len; i++) {\n var word = words[i];\n if (word === '') {\n continue;\n }\n mappedWords[i] = word[0].toUpperCase() + word.slice(1);\n }\n return mappedWords.join('');\n}\n\n\n\n\n//# sourceURL=file://cloudcmd/node_modules/just-pascal-case/index.mjs\n}");
|
|
1276
|
+
|
|
1277
|
+
/***/ },
|
|
1278
|
+
|
|
1268
1279
|
/***/ "./node_modules/limier/lib/limier.js"
|
|
1269
1280
|
/*!*******************************************!*\
|
|
1270
1281
|
!*** ./node_modules/limier/lib/limier.js ***!
|
|
@@ -1313,10 +1324,10 @@ eval("{\n\nconst START = 1;\nconst END = -1;\n\nmodule.exports = (strs, ...args)
|
|
|
1313
1324
|
/*!*******************************************************!*\
|
|
1314
1325
|
!*** ./node_modules/multi-rename/lib/multi-rename.js ***!
|
|
1315
1326
|
\*******************************************************/
|
|
1316
|
-
(
|
|
1327
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1317
1328
|
|
|
1318
1329
|
"use strict";
|
|
1319
|
-
eval("{\n\
|
|
1330
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ multiRename: () => (/* binding */ multiRename)\n/* harmony export */ });\n/* harmony import */ var shortdate__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! shortdate */ \"./node_modules/shortdate/lib/shortdate.js\");\n\n\nconst multiRename = (pattern, names, overrides) => {\n check(pattern, names);\n \n return names.map(parse(pattern, overrides));\n};\n\nconst parse = (pattern, overrides = {}) => (full, i) => {\n const {\n shortdate = shortdate__WEBPACK_IMPORTED_MODULE_0__,\n } = overrides;\n \n const [name, ext] = splitName(full);\n const date = shortdate(new Date(), {\n sep: '-',\n });\n \n return pattern\n .replace('[n]', name)\n .replace('[e]', ext)\n .replace('[c]', i + 1)\n .replace('[ymd]', date);\n};\n\nfunction splitName(str) {\n const index = str.lastIndexOf('.');\n \n if (!~index)\n return [str, ''];\n \n return [\n str.substr(0, index),\n str.substr(index),\n ];\n}\n\nfunction check(pattern, names) {\n if (!pattern)\n throw Error('pattern could not be empty!');\n \n if (!Array.isArray(names))\n throw Error('names should be an array!');\n}\n\n\n//# sourceURL=file://cloudcmd/node_modules/multi-rename/lib/multi-rename.js\n}");
|
|
1320
1331
|
|
|
1321
1332
|
/***/ },
|
|
1322
1333
|
|
package/dist-dev/sw.js
CHANGED
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
(__unused_webpack_module, __unused_webpack_exports, __webpack_require__) {
|
|
17
17
|
|
|
18
18
|
"use strict";
|
|
19
|
-
eval("{\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isDev = process.env.NODE_ENV === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"
|
|
19
|
+
eval("{\n\nconst process = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\nconst {\n tryToCatch\n} = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.cjs\");\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\nconst isDev = process.env.NODE_ENV === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (url.endsWith('/') || /\\^\\/fs/.test(pathname)) return;\n if (!isGet(request)) return;\n if (!isBasic(request)) return;\n if (pathname.startsWith('/api')) return;\n if (/^socket.io/.test(pathname)) return;\n e.respondWith(f(e));\n});\nconst getPathName = url => new URL(url).pathname;\nconst date = \"Thu Jan 15 2026 22:14:29 GMT+0200 (Eastern European Standard Time)\";\nconst NAME = `cloudcmd: ${date}`;\nconst createRequest = a => new Request(a, {\n credentials: 'same-origin'\n});\nconst getRequest = (a, request) => {\n if (a !== '/') return request;\n return createRequest('/');\n};\nglobalThis.addEventListener('install', wait(onInstall));\nglobalThis.addEventListener('fetch', respondWith(onFetch));\nglobalThis.addEventListener('activate', wait(onActivate));\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await globalThis.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n await Promise.all(keys.map(deleteCache));\n}\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n await globalThis.skipWaiting();\n}\nasync function onFetch(event) {\n const {\n request\n } = event;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n if (!isDev && response) return response;\n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin'\n });\n if (e) return new Response(e.message);\n await addToCache(request, resp.clone());\n return resp;\n}\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n\n//# sourceURL=file://cloudcmd/client/sw/sw.js\n}");
|
|
20
20
|
|
|
21
21
|
/***/ },
|
|
22
22
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcmd",
|
|
3
|
-
"version": "19.1.
|
|
4
|
-
"type": "commonjs",
|
|
3
|
+
"version": "19.1.4",
|
|
5
4
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
5
|
"description": "File manager for the web with console and editor",
|
|
7
6
|
"homepage": "http://cloudcmd.io",
|
|
@@ -190,7 +189,7 @@
|
|
|
190
189
|
"minor": "^1.2.2",
|
|
191
190
|
"mock-require": "^3.0.1",
|
|
192
191
|
"morgan": "^1.6.1",
|
|
193
|
-
"multi-rename": "^
|
|
192
|
+
"multi-rename": "^3.0.0",
|
|
194
193
|
"nodemon": "^3.0.1",
|
|
195
194
|
"optimize-css-assets-webpack-plugin": "^6.0.1",
|
|
196
195
|
"path-browserify": "^1.0.1",
|