cloudcmd 19.10.1 → 19.11.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/dist/index.html CHANGED
@@ -1,6 +1,6 @@
1
1
  <!doctype html><meta charset=utf-8><meta name=robots content=noindex,nofollow><meta name=theme-color content=rgb(49,123,249)><meta content="width=device-width,initial-scale=1,maximum-scale=1,user-scalable=no" name=viewport><link rel=icon href="{{ prefix }}/favicon.ico"><link rel=stylesheet href="{{ prefix }}/dist/cloudcmd.common.css"><link rel=manifest href="{{ prefix }}/public/manifest.json"><noscript><link rel=stylesheet href="{{ prefix }}/dist/nojs.css"></noscript><style data-name=columns>{{ columns }}</style><style data-name=themes>{{ themes }}</style><div data-name=js-fm class=fm>{{ fm }}</div><div id=js-keyspanel class=keyspanel><button id=f1 class="cmd-button reduce-text icon-help" title=Help>F1</button> <button id=f2 class="cmd-button reduce-text icon-user-menu" title="User Menu">F2</button> <button id=f3 class="cmd-button reduce-text icon-view" title=View>F3</button> <button id=f4 class="cmd-button reduce-text icon-edit" title=Edit>F4</button> <button id=f5 class="cmd-button reduce-text icon-copy" title=Copy>F5</button> <button id=f6 class="cmd-button reduce-text icon-move" title=Move>F6</button> <button id=f7 class="cmd-button reduce-text icon-directory" title="New Directory">F7</button> <button id=f8 class="cmd-button reduce-text icon-delete" title=Delete>F8</button> <button id=f9 class="cmd-button reduce-text icon-menu" title=Menu>F9</button> <button id=f10 class="cmd-button reduce-text icon-config" title=Config>F10</button> <button id=~ class="cmd-button reduce-text icon-console" title=Console>~</button> <button id=shift~ class="cmd-button reduce-text icon-terminal" title=Terminal>⇧ ~</button> <button id=contact class="cmd-button reduce-text icon-contact" title=Contact></button></div><script src="{{ prefix }}/dist/cloudcmd.common.js"></script><script src="{{ prefix }}/dist/cloudcmd.js"></script><script>CloudCmd({{ config }});</script><script data-name=aleman-importmap type=importmap>{
2
2
  "imports": {
3
- "putout": "https://esm.sh/@putout/bundle@4.7.6",
3
+ "putout": "https://esm.sh/@putout/bundle@5",
4
4
  "@putout/processor-html": "https://esm.sh/@putout/processor-html",
5
5
  "fullstore": "https://esm.sh/fullstore",
6
6
  "jessy": "https://esm.sh/jessy"
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 = "Fri Apr 03 2026 23:12:18 GMT+0300 (Eastern European Summer Time)";
314
+ const date = "Sat Apr 04 2026 02:05:19 GMT+0300 (Eastern European Summer Time)";
315
315
  const NAME = `cloudcmd: ${date}`;
316
316
  const createRequest = a => new Request(a, {
317
317
  credentials: 'same-origin'
@@ -1756,7 +1756,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
1756
1756
  (__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
1757
1757
 
1758
1758
  "use strict";
1759
- 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_terminal_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom */ \"./client/dom/index.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n\n\n\n\n\n\n\n\nconst {\n Dialog\n} = _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\nconst {\n CloudCmd\n} = globalThis;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = {\n init,\n show,\n hide\n};\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_3__.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 (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_5__.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};\nasync function init() {\n if (!config('terminal')) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.show.load('top');\n await CloudCmd.View();\n await loadAll();\n}\nasync function show(options = {}) {\n await runTerminal(options);\n}\nconst runTerminal = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.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});\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__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentDirPath,\n PASSIVE_DIR: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getNotCurrentDirPath,\n CURRENT_NAME: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentName,\n CURRENT_PATH: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentPath\n});\nfunction create(createOptions) {\n const {\n cwd = _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].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 } = globalThis.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', execon__WEBPACK_IMPORTED_MODULE_4__[\"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//Users/coderaiser/cloudcmd/client/modules/terminal-run.js\n}");
1759
+ 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_terminal_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\n/* harmony import */ var es6_promisify__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n/* harmony import */ var try_to_catch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* harmony import */ var fullstore__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n/* harmony import */ var execon__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n/* harmony import */ var load_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n/* harmony import */ var _dom__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! #dom */ \"./client/dom/index.js\");\n/* harmony import */ var _dom_images__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! #dom/images */ \"./client/dom/images.js\");\n\n\n\n\n\n\n\n\nconst {\n Dialog\n} = _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\nconst {\n CloudCmd\n} = globalThis;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = {\n init,\n show,\n hide\n};\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = (0,fullstore__WEBPACK_IMPORTED_MODULE_3__.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 (0,try_to_catch__WEBPACK_IMPORTED_MODULE_2__.tryToCatch)(load_js__WEBPACK_IMPORTED_MODULE_5__.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};\nasync function init() {\n if (!config('terminal')) return;\n _dom_images__WEBPACK_IMPORTED_MODULE_7__.show.load('top');\n await CloudCmd.View();\n await loadAll();\n}\nasync function show(options = {}) {\n return await runTerminal(options);\n}\nconst runTerminal = (0,es6_promisify__WEBPACK_IMPORTED_MODULE_1__.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});\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__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentDirPath,\n PASSIVE_DIR: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getNotCurrentDirPath,\n CURRENT_NAME: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentName,\n CURRENT_PATH: _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].getCurrentPath\n});\nfunction create(createOptions) {\n const {\n cwd = _dom__WEBPACK_IMPORTED_MODULE_6__[\"default\"].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 } = globalThis.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', execon__WEBPACK_IMPORTED_MODULE_4__[\"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//Users/coderaiser/cloudcmd/client/modules/terminal-run.js\n}");
1760
1760
 
1761
1761
  /***/ },
1762
1762
 
@@ -45,7 +45,7 @@
45
45
  <script data-name="aleman-importmap" type="importmap">
46
46
  {
47
47
  "imports": {
48
- "putout": "https://esm.sh/@putout/bundle@4.7.6",
48
+ "putout": "https://esm.sh/@putout/bundle@5",
49
49
  "@putout/processor-html": "https://esm.sh/@putout/processor-html",
50
50
  "fullstore": "https://esm.sh/fullstore",
51
51
  "jessy": "https://esm.sh/jessy"
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 = \"Fri Apr 03 2026 23:12:20 GMT+0300 (Eastern European Summer 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}");
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 = \"Sat Apr 04 2026 02:05:21 GMT+0300 (Eastern European Summer 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.10.1",
3
+ "version": "19.11.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",
@@ -89,7 +89,8 @@
89
89
  "@cloudcmd/move-files": "^8.0.0",
90
90
  "@cloudcmd/read-files-sync": "^2.0.0",
91
91
  "@putout/cli-validate-args": "^2.0.0",
92
- "aleman": "^2.0.0",
92
+ "@putout/plugin-cloudcmd": "^5.2.0",
93
+ "aleman": "^2.0.1",
93
94
  "apart": "^2.0.0",
94
95
  "chalk": "^5.3.0",
95
96
  "compression": "^1.7.4",
@@ -129,7 +130,6 @@
129
130
  "ponse": "^7.0.0",
130
131
  "pullout": "^5.0.0",
131
132
  "putout": "^42.0.5",
132
- "@putout/plugin-cloudcmd": "^5.2.0",
133
133
  "redzip": "^4.6.1",
134
134
  "rendy": "^5.0.0",
135
135
  "restafary": "^13.0.1",
@@ -242,6 +242,7 @@ function cloudcmdMiddle({modules, config}) {
242
242
  }),
243
243
  userMenu({
244
244
  menuName: '.cloudcmd.menu.js',
245
+ config,
245
246
  }),
246
247
  rest({
247
248
  config,
@@ -12,7 +12,7 @@ transpile('');
12
12
 
13
13
  const PREFIX = '/api/v1/user-menu';
14
14
 
15
- export const userMenu = currify(async ({menuName, readFile = _readFile}, req, res, next) => {
15
+ export const userMenu = currify(async ({menuName, readFile = _readFile, config}, req, res, next) => {
16
16
  if (!req.url.startsWith(PREFIX))
17
17
  return next();
18
18
 
@@ -24,12 +24,13 @@ export const userMenu = currify(async ({menuName, readFile = _readFile}, req, re
24
24
  res,
25
25
  menuName,
26
26
  readFile,
27
+ config,
27
28
  });
28
29
 
29
30
  next();
30
31
  });
31
32
 
32
- async function onGET({req, res, menuName, readFile}) {
33
+ async function onGET({req, res, menuName, readFile, config}) {
33
34
  const {dir} = req.query;
34
35
  const url = req.url.replace(PREFIX, '');
35
36
 
@@ -40,8 +41,9 @@ async function onGET({req, res, menuName, readFile}) {
40
41
 
41
42
  const {findUp} = await import('find-up');
42
43
 
44
+ const cwd = join(config('root'), dir);
43
45
  const [errorFind, currentMenuPath] = await tryToCatch(findUp, [menuName], {
44
- cwd: dir,
46
+ cwd,
45
47
  });
46
48
 
47
49
  if (errorFind && errorFind.code !== 'ENOENT')