cloudcmd 19.17.0 → 19.18.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 +10 -0
- package/HELP.md +2 -1
- package/README.md +1 -1
- package/bin/cloudcmd.js +1 -1
- package/dist/cloudcmd.common.js +192 -158
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/cloudcmd.js +8 -0
- package/dist/cloudcmd.js.map +1 -1
- package/dist/index.html +2 -2
- package/dist/modules/cloud.js +8 -0
- package/dist/modules/cloud.js.map +1 -1
- package/dist/modules/command-line.js +8 -0
- package/dist/modules/command-line.js.map +1 -1
- package/dist/modules/config.js +8 -0
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/contact.js +8 -0
- package/dist/modules/contact.js.map +1 -1
- package/dist/modules/edit-file-vim.js +8 -0
- package/dist/modules/edit-file-vim.js.map +1 -1
- package/dist/modules/edit-file.js +8 -0
- package/dist/modules/edit-file.js.map +1 -1
- package/dist/modules/edit-names-vim.js +8 -0
- package/dist/modules/edit-names-vim.js.map +1 -1
- package/dist/modules/edit-names.js +8 -0
- package/dist/modules/edit-names.js.map +1 -1
- package/dist/modules/edit.js +8 -0
- package/dist/modules/edit.js.map +1 -1
- package/dist/modules/help.js +8 -0
- package/dist/modules/help.js.map +1 -1
- package/dist/modules/konsole.js +8 -0
- package/dist/modules/konsole.js.map +1 -1
- package/dist/modules/markdown.js +8 -0
- package/dist/modules/markdown.js.map +1 -1
- package/dist/modules/menu.js +8 -0
- package/dist/modules/menu.js.map +1 -1
- package/dist/modules/operation.js +8 -0
- package/dist/modules/operation.js.map +1 -1
- package/dist/modules/polyfill.js +8 -0
- package/dist/modules/polyfill.js.map +1 -1
- package/dist/modules/terminal-run.js +8 -0
- package/dist/modules/terminal-run.js.map +1 -1
- package/dist/modules/terminal.js +8 -0
- package/dist/modules/terminal.js.map +1 -1
- package/dist/modules/upload.js +8 -0
- package/dist/modules/upload.js.map +1 -1
- package/dist/modules/user-menu.js +8 -0
- package/dist/modules/user-menu.js.map +1 -1
- package/dist/modules/view.js +8 -0
- package/dist/modules/view.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist-dev/cloudcmd.common.js +26 -15
- package/dist-dev/cloudcmd.js +8 -0
- package/dist-dev/index.html +1 -2
- package/dist-dev/modules/cloud.js +8 -0
- package/dist-dev/modules/command-line.js +8 -0
- package/dist-dev/modules/config.js +8 -0
- package/dist-dev/modules/contact.js +8 -0
- package/dist-dev/modules/edit-file-vim.js +8 -0
- package/dist-dev/modules/edit-file.js +8 -0
- package/dist-dev/modules/edit-names-vim.js +8 -0
- package/dist-dev/modules/edit-names.js +8 -0
- package/dist-dev/modules/edit.js +8 -0
- package/dist-dev/modules/help.js +8 -0
- package/dist-dev/modules/konsole.js +8 -0
- package/dist-dev/modules/markdown.js +8 -0
- package/dist-dev/modules/menu.js +8 -0
- package/dist-dev/modules/operation.js +8 -0
- package/dist-dev/modules/polyfill.js +8 -0
- package/dist-dev/modules/terminal-run.js +8 -0
- package/dist-dev/modules/terminal.js +8 -0
- package/dist-dev/modules/upload.js +8 -0
- package/dist-dev/modules/user-menu.js +8 -0
- package/dist-dev/modules/view.js +8 -0
- package/dist-dev/sw.js +1 -1
- package/package.json +2 -1
- package/server/rest/index.js +1 -1
- package/server/server.js +14 -2
- package/server/validate.js +1 -1
- package/public/manifest.json +0 -11
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 May 26 2026 00:21:38 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.
|
|
3
|
+
"version": "19.18.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",
|
|
@@ -105,6 +105,7 @@
|
|
|
105
105
|
"es6-promisify": "^7.0.0",
|
|
106
106
|
"execon": "^1.2.0",
|
|
107
107
|
"express": "^5.1.0",
|
|
108
|
+
"express-rate-limit": "^8.5.2",
|
|
108
109
|
"files-io": "^4.0.0",
|
|
109
110
|
"find-up": "^8.0.0",
|
|
110
111
|
"for-each-key": "^2.0.0",
|
package/server/rest/index.js
CHANGED
package/server/server.js
CHANGED
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
import http from 'node:http';
|
|
2
2
|
import {promisify} from 'node:util';
|
|
3
3
|
import process from 'node:process';
|
|
4
|
+
import {rateLimit} from 'express-rate-limit';
|
|
4
5
|
import currify from 'currify';
|
|
5
6
|
import squad from 'squad';
|
|
6
7
|
import {tryToCatch} from 'try-to-catch';
|
|
7
8
|
import opn from 'open';
|
|
8
9
|
import express from 'express';
|
|
9
10
|
import {Server} from 'socket.io';
|
|
10
|
-
import tryRequire from 'tryrequire';
|
|
11
11
|
import wraptile from 'wraptile';
|
|
12
12
|
import compression from 'compression';
|
|
13
|
+
import tryRequire from 'tryrequire';
|
|
13
14
|
import {cloudcmd} from '#server/cloudcmd';
|
|
14
15
|
import exit from './exit.js';
|
|
15
16
|
|
|
17
|
+
const RATE_LIMIT = 1000;
|
|
18
|
+
const RATE_WINDOW = 15 * 60 * 1000;
|
|
19
|
+
|
|
16
20
|
const bind = (f, self) => f.bind(self);
|
|
17
21
|
|
|
18
22
|
const two = currify((f, a, b) => f(a, b));
|
|
@@ -25,6 +29,7 @@ const shutdown = wraptile(async (promises) => {
|
|
|
25
29
|
const promisifySelf = squad(promisify, bind);
|
|
26
30
|
|
|
27
31
|
const exitPort = two(exit, 'cloudcmd --port: %s');
|
|
32
|
+
|
|
28
33
|
const logger = tryRequire('morgan');
|
|
29
34
|
|
|
30
35
|
export default async (options, config) => {
|
|
@@ -46,8 +51,13 @@ export default async (options, config) => {
|
|
|
46
51
|
path: `${prefix}/socket.io`,
|
|
47
52
|
});
|
|
48
53
|
|
|
49
|
-
|
|
54
|
+
const limiter = rateLimit({
|
|
55
|
+
windowMs: RATE_WINDOW,
|
|
56
|
+
limit: RATE_LIMIT,
|
|
57
|
+
});
|
|
50
58
|
|
|
59
|
+
app.use(compression());
|
|
60
|
+
app.use(limiter);
|
|
51
61
|
app.use(prefix, cloudcmd({
|
|
52
62
|
config: options,
|
|
53
63
|
socket: socketServer,
|
|
@@ -65,7 +75,9 @@ export default async (options, config) => {
|
|
|
65
75
|
await listen(port, ip);
|
|
66
76
|
|
|
67
77
|
const close = shutdown([closeServer, closeSocket]);
|
|
78
|
+
|
|
68
79
|
process.on('SIGINT', close);
|
|
80
|
+
process.on('SIUSR1', close);
|
|
69
81
|
|
|
70
82
|
const host = config('ip') || 'localhost';
|
|
71
83
|
const port0 = port || server.address().port;
|
package/server/validate.js
CHANGED
|
@@ -31,7 +31,7 @@ export const editor = (name, {exit = _exit} = {}) => {
|
|
|
31
31
|
const reg = /^(dword|edward|deepword|qword)$/;
|
|
32
32
|
|
|
33
33
|
if (!reg.test(name))
|
|
34
|
-
exit(`cloudcmd --editor: could be "dword", "edward", "deepword" or "qword" only,
|
|
34
|
+
exit(`cloudcmd --editor: could be "dword", "edward", "deepword" or "qword" only, received: "${name}"`);
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
export const menu = (name, {exit = _exit} = {}) => {
|