cloudcmd 19.6.8 → 19.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ChangeLog +14 -0
- package/HELP.md +3 -1
- package/README.md +1 -1
- package/common/cloudfunc.js +10 -5
- package/dist/cloudcmd.common.js +16 -8
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist-dev/cloudcmd.common.js +3 -3
- package/dist-dev/sw.js +1 -1
- package/package.json +5 -5
- package/server/cloudcmd.js +1 -0
- package/server/columns.js +1 -0
- package/server/config.js +1 -0
- package/server/route.js +1 -0
- package/server/theme.js +1 -0
- package/server/validate.js +2 -0
package/dist/sw.js
CHANGED
|
@@ -311,7 +311,7 @@ const respondWith = currify((f, e) => {
|
|
|
311
311
|
e.respondWith(f(e));
|
|
312
312
|
});
|
|
313
313
|
const getPathName = url => new URL(url).pathname;
|
|
314
|
-
const date = "
|
|
314
|
+
const date = "Tue Mar 17 2026 21:11:13 GMT+0200 (Eastern European Standard Time)";
|
|
315
315
|
const NAME = `cloudcmd: ${date}`;
|
|
316
316
|
const createRequest = a => new Request(a, {
|
|
317
317
|
credentials: 'same-origin'
|
|
@@ -1613,7 +1613,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1613
1613
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1614
1614
|
|
|
1615
1615
|
"use strict";
|
|
1616
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* harmony import */ var multi_rename__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\n\n\n\n\nconst {\n CloudCmd,\n DOM\n} = globalThis;\nCloudCmd.EditNames = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_1__.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nasync function init() {\n await CloudCmd.Edit();\n setListeners();\n}\nfunction 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 }
|
|
1616
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ isChanged: () => (/* binding */ isChanged),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var supermenu__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! supermenu */ \"./node_modules/supermenu/lib/supermenu.js\");\n/* harmony import */ var multi_rename__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! multi-rename */ \"./node_modules/multi-rename/lib/multi-rename.js\");\n\n\n\n\nconst {\n CloudCmd,\n DOM\n} = globalThis;\nCloudCmd.EditNames = {\n init,\n show,\n hide,\n isChanged\n};\nconst Info = DOM.CurrentInfo;\nconst {\n Dialog\n} = DOM;\nlet Menu;\nconst ConfigView = {\n beforeClose: async () => {\n execon__WEBPACK_IMPORTED_MODULE_1__.ifExist(Menu, 'hide');\n DOM.Events.remove('keydown', keyListener);\n await isChanged();\n }\n};\nasync function init() {\n await CloudCmd.Edit();\n setListeners();\n}\nfunction 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 return;\n }\n 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 = (0,multi_rename__WEBPACK_IMPORTED_MODULE_3__.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}\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 (0,try_to_catch__WEBPACK_IMPORTED_MODULE_0__.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 = (0,supermenu__WEBPACK_IMPORTED_MODULE_2__.supermenu)(element, options, menuData);\n Menu.addContextMenuListener();\n Menu.show(position.x, position.y);\n}\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//Users/coderaiser/cloudcmd/client/modules/edit-names.js\n}");
|
|
1617
1617
|
|
|
1618
1618
|
/***/ },
|
|
1619
1619
|
|
|
@@ -1800,7 +1800,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1800
1800
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1801
1801
|
|
|
1802
1802
|
"use strict";
|
|
1803
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_user_menu_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var try_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _babel_code_frame__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/code-frame */ \"./node_modules/@babel/code-frame/lib/index.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _get_user_menu_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./get-user-menu.js */ \"./client/modules/user-menu/get-user-menu.js\");\n/* harmony import */ var _navigate_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./navigate.js */ \"./client/modules/user-menu/navigate.js\");\n/* harmony import */ var _parse_error_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./parse-error.js */ \"./client/modules/user-menu/parse-error.js\");\n/* harmony import */ var _parse_user_menu_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./parse-user-menu.js */ \"./client/modules/user-menu/parse-user-menu.js\");\n/* harmony import */ var _run_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./run.js */ \"./client/modules/user-menu/run.js\");\n
|
|
1803
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ hide: () => (/* binding */ hide),\n/* harmony export */ init: () => (/* binding */ init),\n/* harmony export */ show: () => (/* binding */ show)\n/* harmony export */ });\n/* harmony import */ var _css_user_menu_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../../css/user-menu.css */ \"./css/user-menu.css\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var wraptile__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! wraptile */ \"./node_modules/wraptile/lib/wraptile.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @cloudcmd/create-element */ \"./node_modules/@cloudcmd/create-element/lib/create-element.js\");\n/* harmony import */ var try_catch__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! try-catch */ \"./node_modules/try-catch/lib/try-catch.js\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var _babel_code_frame__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! @babel/code-frame */ \"./node_modules/@babel/code-frame/lib/index.js\");\n/* harmony import */ var _dom_dialog__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! #dom/dialog */ \"./client/dom/dialog.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n/* harmony import */ var _get_user_menu_js__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./get-user-menu.js */ \"./client/modules/user-menu/get-user-menu.js\");\n/* harmony import */ var _navigate_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./navigate.js */ \"./client/modules/user-menu/navigate.js\");\n/* harmony import */ var _parse_error_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./parse-error.js */ \"./client/modules/user-menu/parse-error.js\");\n/* harmony import */ var _parse_user_menu_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./parse-user-menu.js */ \"./client/modules/user-menu/parse-user-menu.js\");\n/* harmony import */ var _run_js__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./run.js */ \"./client/modules/user-menu/run.js\");\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nconst loadCSS = load_js__WEBPACK_IMPORTED_MODULE_4__.css;\nconst sourceStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_3__.fullstore)();\nconst {\n CloudCmd,\n DOM,\n CloudFunc\n} = globalThis;\nconst Name = 'UserMenu';\nCloudCmd[Name] = {\n init,\n show,\n hide\n};\nconst {\n Key\n} = CloudCmd;\nasync function init() {\n await Promise.all([loadCSS(`${CloudCmd.prefix}/dist/user-menu.css`), CloudCmd.View()]);\n}\nconst {\n CurrentInfo\n} = DOM;\nasync function show() {\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.show.load('top');\n const {\n dirPath\n } = CurrentInfo;\n const res = await fetch(`${CloudCmd.prefix}/api/v1/user-menu?dir=${dirPath}`);\n const source = await res.text();\n const [error, userMenu] = (0,try_catch__WEBPACK_IMPORTED_MODULE_6__.tryCatch)(_get_user_menu_js__WEBPACK_IMPORTED_MODULE_11__.getUserMenu, source);\n _dom_images__WEBPACK_IMPORTED_MODULE_10__.hide();\n if (error) return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n sourceStore(source);\n const {\n names,\n keys,\n items,\n settings\n } = (0,_parse_user_menu_js__WEBPACK_IMPORTED_MODULE_14__.parseUserMenu)(userMenu);\n if (settings.run) return (0,_run_js__WEBPACK_IMPORTED_MODULE_15__.runSelected)(settings.select, items, runUserMenu);\n const button = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('button', {\n className: 'cloudcmd-user-menu-button',\n innerText: 'User Menu',\n notAppend: true\n });\n const select = _cloudcmd_create_element__WEBPACK_IMPORTED_MODULE_5__('select', {\n className: 'cloudcmd-user-menu',\n innerHTML: fillTemplate(names),\n notAppend: true,\n size: 10\n });\n button.addEventListener('click', onButtonClick(userMenu, select));\n select.addEventListener('dblclick', onDblClick(userMenu));\n select.addEventListener('keydown', onKeyDown({\n keys,\n userMenu\n }));\n const afterShow = () => select.focus();\n const autoSize = true;\n CloudCmd.View.show([button, select], {\n autoSize,\n afterShow\n });\n}\nfunction fillTemplate(options) {\n const result = [];\n for (const option of options) result.push(`<option>${option}</option>`);\n return result.join('');\n}\nfunction hide() {\n CloudCmd.View.hide();\n}\nconst onDblClick = currify__WEBPACK_IMPORTED_MODULE_1__(async (items, e) => {\n const {\n value\n } = e.target;\n await runUserMenu(items[value]);\n});\nconst onButtonClick = wraptile__WEBPACK_IMPORTED_MODULE_2__(async (items, {\n value\n}) => {\n await runUserMenu(items[value]);\n});\nconst onKeyDown = currify__WEBPACK_IMPORTED_MODULE_1__(async ({\n keys,\n userMenu\n}, e) => {\n const {\n keyCode,\n target\n } = e;\n const keyName = e.key.toUpperCase();\n e.preventDefault();\n e.stopPropagation();\n let value;\n if (keyCode === Key.ESC) return hide();\n if (keyCode === Key.ENTER) value = userMenu[target.value];else if (keys[keyName]) value = keys[keyName];else return (0,_navigate_js__WEBPACK_IMPORTED_MODULE_12__.navigate)(target, e);\n await runUserMenu(value);\n});\nconst runUserMenu = async fn => {\n hide();\n const [error] = await (0,try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch)(fn, {\n DOM,\n CloudCmd,\n CloudFunc,\n tryToCatch: try_to_catch__WEBPACK_IMPORTED_MODULE_7__.tryToCatch\n });\n if (!error) return;\n const source = sourceStore();\n return _dom_dialog__WEBPACK_IMPORTED_MODULE_9__.alert(getCodeFrame({\n error,\n source\n }));\n};\nfunction getCodeFrame({\n error,\n source\n}) {\n const {\n code\n } = error;\n if (!code || code === 'frame') return error.message;\n const [line, column] = (0,_parse_error_js__WEBPACK_IMPORTED_MODULE_13__.parseError)(error);\n const start = {\n line,\n column\n };\n const location = {\n start\n };\n const frame = (0,_babel_code_frame__WEBPACK_IMPORTED_MODULE_8__.codeFrameColumns)(source, location, {\n message: error.message,\n highlightCode: false\n });\n return `<pre>${frame}</pre>`;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/client/modules/user-menu/index.js\n}");
|
|
1804
1804
|
|
|
1805
1805
|
/***/ },
|
|
1806
1806
|
|
|
@@ -1899,7 +1899,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
1899
1899
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
1900
1900
|
|
|
1901
1901
|
"use strict";
|
|
1902
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n\n\n\n\nconst
|
|
1902
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ FS: () => (/* binding */ FS),\n/* harmony export */ MAX_FILE_SIZE: () => (/* binding */ MAX_FILE_SIZE),\n/* harmony export */ _getDataName: () => (/* binding */ _getDataName),\n/* harmony export */ _getSize: () => (/* binding */ _getSize),\n/* harmony export */ apiURL: () => (/* binding */ apiURL),\n/* harmony export */ buildFromJSON: () => (/* binding */ buildFromJSON),\n/* harmony export */ dateFormatter: () => (/* binding */ dateFormatter),\n/* harmony export */ formatMsg: () => (/* binding */ formatMsg),\n/* harmony export */ getDotDot: () => (/* binding */ getDotDot),\n/* harmony export */ getHeaderField: () => (/* binding */ getHeaderField),\n/* harmony export */ getPathLink: () => (/* binding */ getPathLink),\n/* harmony export */ getTitle: () => (/* binding */ getTitle)\n/* harmony export */ });\n/* harmony import */ var rendy__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rendy */ \"./node_modules/rendy/lib/rendy.js\");\n/* harmony import */ var currify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var _common_entity__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! #common/entity */ \"./common/entity.js\");\n\n\n\n\nconst id = a => a;\nconst dateFormatter = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__.fullstore)(id);\nconst getHeaderField = currify__WEBPACK_IMPORTED_MODULE_1__(_getHeaderField);\nconst NAME = 'Cloud Commander';\nconst FS = '/fs';\nconst Path = (0,fullstore__WEBPACK_IMPORTED_MODULE_2__.fullstore)();\nPath('/');\nconst filterOutDotFiles = ({\n showDotFiles\n}) => ({\n name\n}) => {\n if (showDotFiles) return true;\n return !name.startsWith('.');\n};\nconst apiURL = '/api/v1';\nconst MAX_FILE_SIZE = 500 * 1024;\nconst formatMsg = (msg, name, status) => {\n status = status || 'ok';\n name = name || '';\n if (name) name = `(\"${name}\")`;\n return `${msg}: ${status}${name}`;\n};\n\n/**\n * Функция возвращает заголовок веб страницы\n * @path\n */\nconst getTitle = options => {\n options = options || {};\n const {\n path = Path(),\n name\n } = options;\n const array = [name || NAME, path];\n return array.filter(Boolean).join(' - ');\n};\n\n/** Функция получает адреса каждого каталога в пути\n * возвращаеться массив каталогов\n * @param url - адрес каталога\n */\nfunction getPathLink(url, prefix, template) {\n if (!url) throw Error('url could not be empty!');\n if (!template) throw Error('template could not be empty!');\n const names = url.split('/').slice(1, -1);\n const allNames = ['/', ...names];\n const lines = [];\n const n = allNames.length;\n let path = '/';\n for (let i = 0; i < n; i++) {\n const name = allNames[i];\n const isLast = i === n - 1;\n if (i) path += `${name}/`;\n if (i && isLast) {\n lines.push(`${name}/`);\n continue;\n }\n const slash = i ? '/' : '';\n lines.push((0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template, {\n path,\n name,\n slash,\n prefix\n }));\n }\n return lines.join('');\n}\nfunction _getDataName(name) {\n const encoded = btoa(encodeURI(name));\n return `data-name=\"js-file-${encoded}\" `;\n}\n\n/**\n * Функция строит таблицу файлв из JSON-информации о файлах\n * @param params - информация о файлах\n *\n */\nconst buildFromJSON = params => {\n const {\n prefix,\n template,\n sort = 'name',\n order = 'asc',\n showDotFiles\n } = params;\n const formatDate = dateFormatter();\n const templateFile = template.file;\n const templateLink = template.link;\n const json = params.data;\n const path = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(json.path);\n const {\n files\n } = json;\n\n /*\n * Строим путь каталога в котором мы находимся\n * со всеми подкаталогами\n */\n const htmlPath = getPathLink(path, prefix, template.pathLink);\n let fileTable = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template.path, {\n link: prefix + FS + path,\n fullPath: path,\n path: htmlPath\n });\n const owner = 'owner';\n const mode = 'mode';\n const getFieldName = getHeaderField(sort, order);\n const name = getFieldName('name');\n const size = getFieldName('size');\n const date = getFieldName('date');\n const header = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(templateFile, {\n tag: 'div',\n attribute: 'data-name=\"js-fm-header\" ',\n className: 'fm-header',\n type: '',\n name,\n size,\n date,\n owner,\n mode\n });\n\n /* сохраняем путь */\n Path(path);\n fileTable += `${header}<ul data-name=\"js-files\" class=\"files\">`;\n\n /* Если мы не в корне */\n if (path !== '/') {\n const dotDot = getDotDot(path);\n const link = prefix + FS + dotDot;\n const linkResult = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template.link, {\n link,\n title: '..',\n name: '..'\n });\n const dataName = _getDataName('..');\n const attribute = `draggable=\"true\" ${dataName}`;\n\n /* Сохраняем путь к каталогу верхнего уровня*/\n fileTable += (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(template.file, {\n tag: 'li',\n attribute,\n className: '',\n type: 'directory',\n name: linkResult,\n size: '<dir>',\n date: '--.--.----',\n owner: '.',\n mode: '--- --- ---'\n });\n }\n fileTable += files.filter(filterOutDotFiles({\n showDotFiles\n })).map(updateField).map(file => {\n const name = (0,_common_entity__WEBPACK_IMPORTED_MODULE_3__.encode)(file.name);\n const link = prefix + FS + path + name;\n const {\n type,\n mode,\n date,\n owner,\n size\n } = file;\n const linkResult = (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(templateLink, {\n link,\n title: name,\n name,\n attribute: getAttribute(file.type)\n });\n const dataName = _getDataName(file.name);\n const attribute = `draggable=\"true\" ${dataName}`;\n return (0,rendy__WEBPACK_IMPORTED_MODULE_0__.rendy)(templateFile, {\n tag: 'li',\n attribute,\n className: '',\n type,\n name: linkResult,\n size,\n date: formatDate(date),\n owner,\n mode\n });\n }).join('');\n fileTable += '</ul>';\n return fileTable;\n};\nconst updateField = file => ({\n ...file,\n date: file.date || '--.--.----',\n owner: file.owner || 'root',\n size: getSize(file)\n});\nfunction getAttribute(type) {\n if (type === 'directory') return '';\n return 'target=\"_blank\" ';\n}\nconst _getSize = getSize;\nfunction getSize({\n size,\n type\n}) {\n if (type === 'directory') return '<dir>';\n if (/link/.test(type)) return '<link>';\n return size;\n}\nfunction _getHeaderField(sort, order, name) {\n const arrow = order === 'asc' ? '↑' : '↓';\n if (sort !== name) return name;\n if (sort === 'name' && order === 'asc') return name;\n return `${name}${arrow}`;\n}\nfunction getDotDot(path) {\n // убираем последний слеш и каталог в котором мы сейчас находимся\n const lastSlash = path.substr(path, path.lastIndexOf('/'));\n const dotDot = lastSlash.substr(lastSlash, lastSlash.lastIndexOf('/'));\n if (!dotDot) return '/';\n return dotDot;\n}\n\n//# sourceURL=file://cloudcmd//Users/coderaiser/cloudcmd/common/cloudfunc.js\n}");
|
|
1903
1903
|
|
|
1904
1904
|
/***/ },
|
|
1905
1905
|
|
package/dist-dev/sw.js
CHANGED
|
@@ -37,7 +37,7 @@ eval("{// shim for using process in browser\nvar process = module.exports = {};\
|
|
|
37
37
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
38
38
|
|
|
39
39
|
"use strict";
|
|
40
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.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 currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\n\nconst isDev = \"development\" === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => e.waitUntil(f()));\nconst respondWith = currify__WEBPACK_IMPORTED_MODULE_2__((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 = \"
|
|
40
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var node_process__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.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 currify__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\n\n\nconst isDev = \"development\" === 'development';\nconst isGet = a => a.method === 'GET';\nconst isBasic = a => a.type === 'basic';\nconst wait = currify__WEBPACK_IMPORTED_MODULE_2__((f, e) => e.waitUntil(f()));\nconst respondWith = currify__WEBPACK_IMPORTED_MODULE_2__((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 = \"Tue Mar 17 2026 21:11:15 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 (0,try_to_catch__WEBPACK_IMPORTED_MODULE_1__.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//Users/coderaiser/cloudcmd/client/sw/sw.js\n}");
|
|
41
41
|
|
|
42
42
|
/***/ },
|
|
43
43
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcmd",
|
|
3
|
-
"version": "19.
|
|
3
|
+
"version": "19.7.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "File manager for the web with console and editor",
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
"dependencies": {
|
|
87
87
|
"@babel/plugin-transform-optional-chaining": "^7.21.0",
|
|
88
88
|
"@cloudcmd/dropbox": "^5.0.1",
|
|
89
|
-
"@cloudcmd/fileop": "^9.0.
|
|
89
|
+
"@cloudcmd/fileop": "^9.0.5",
|
|
90
90
|
"@cloudcmd/move-files": "^8.0.0",
|
|
91
91
|
"@cloudcmd/read-files-sync": "^2.0.0",
|
|
92
92
|
"@putout/cli-validate-args": "^2.0.0",
|
|
@@ -130,7 +130,7 @@
|
|
|
130
130
|
"ponse": "^7.0.0",
|
|
131
131
|
"pullout": "^5.0.0",
|
|
132
132
|
"putout": "^42.0.5",
|
|
133
|
-
"redzip": "^4.
|
|
133
|
+
"redzip": "^4.6.1",
|
|
134
134
|
"rendy": "^5.0.0",
|
|
135
135
|
"restafary": "^13.0.1",
|
|
136
136
|
"restbox": "^4.0.0",
|
|
@@ -169,7 +169,7 @@
|
|
|
169
169
|
"clean-css-loader": "^4.2.1",
|
|
170
170
|
"codegen.macro": "^4.0.0",
|
|
171
171
|
"css-loader": "^7.1.2",
|
|
172
|
-
"css-minimizer-webpack-plugin": "^
|
|
172
|
+
"css-minimizer-webpack-plugin": "^8.0.0",
|
|
173
173
|
"css-modules-require-hook": "^4.2.3",
|
|
174
174
|
"cssnano-preset-default": "^7.0.10",
|
|
175
175
|
"domtokenlist-shim": "^1.2.0",
|
|
@@ -215,7 +215,7 @@
|
|
|
215
215
|
"url-loader": "^4.0.0",
|
|
216
216
|
"util": "^0.12.5",
|
|
217
217
|
"webpack": "^5.99.9",
|
|
218
|
-
"webpack-cli": "^
|
|
218
|
+
"webpack-cli": "^7.0.2",
|
|
219
219
|
"webpack-merge": "^6.0.1",
|
|
220
220
|
"webpackbar": "^7.0.0"
|
|
221
221
|
},
|
package/server/cloudcmd.js
CHANGED
package/server/columns.js
CHANGED
|
@@ -35,6 +35,7 @@ export const getColumns = ({isDev = _isDev()} = {}) => {
|
|
|
35
35
|
const readFilesSyncMemo = nanomemoize((isDev) => {
|
|
36
36
|
const dist = getDist(isDev);
|
|
37
37
|
const columnsDir = path.join(__dirname, '..', dist, 'columns');
|
|
38
|
+
|
|
38
39
|
const names = fs
|
|
39
40
|
.readdirSync(columnsDir)
|
|
40
41
|
.filter(not(isMap));
|
package/server/config.js
CHANGED
package/server/route.js
CHANGED
package/server/theme.js
CHANGED
|
@@ -24,6 +24,7 @@ export const getThemes = ({isDev = _isDev()} = {}) => {
|
|
|
24
24
|
const readFilesSyncMemo = nanomemoize((isDev) => {
|
|
25
25
|
const dist = getDist(isDev);
|
|
26
26
|
const themesDir = path.join(__dirname, '..', dist, 'themes');
|
|
27
|
+
|
|
27
28
|
const names = fs
|
|
28
29
|
.readdirSync(themesDir)
|
|
29
30
|
.filter(not(isMap));
|
package/server/validate.js
CHANGED
|
@@ -55,6 +55,7 @@ export const columns = (type, overrides = {}) => {
|
|
|
55
55
|
} = overrides;
|
|
56
56
|
|
|
57
57
|
const addQuotes = (a) => `"${a}"`;
|
|
58
|
+
|
|
58
59
|
const all = Object
|
|
59
60
|
.keys(getColumns())
|
|
60
61
|
.concat('');
|
|
@@ -75,6 +76,7 @@ export const theme = (type, overrides = {}) => {
|
|
|
75
76
|
} = overrides;
|
|
76
77
|
|
|
77
78
|
const addQuotes = (a) => `"${a}"`;
|
|
79
|
+
|
|
78
80
|
const all = Object
|
|
79
81
|
.keys(getThemes())
|
|
80
82
|
.concat('');
|