cloudcmd 19.21.0 → 19.21.2
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 +3 -1
- package/README.md +1 -1
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/modules/menu.js +99 -62
- package/dist/modules/menu.js.map +1 -1
- package/dist/sw.js +1 -1
- package/dist-dev/cloudcmd.common.js +1 -1
- package/dist-dev/modules/menu.js +2343 -423
- package/dist-dev/sw.js +1 -1
- package/package.json +1 -1
- package/server/cloudcmd.js +12 -0
- package/server/rest/index.js +7 -1
package/dist-dev/sw.js
CHANGED
|
@@ -23,7 +23,7 @@ eval("{// shim for using process in browser\nvar process = module.exports = {};\
|
|
|
23
23
|
\*************************/
|
|
24
24
|
(__unused_rspack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
25
25
|
"use strict";
|
|
26
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* import */ var node_process__rspack_import_0 = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* import */ var try_to_catch__rspack_import_1 = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* import */ var currify__rspack_import_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__rspack_import_2((f, e) => e.waitUntil(f()));\nconst respondWith = currify__rspack_import_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 = \"
|
|
26
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* import */ var node_process__rspack_import_0 = __webpack_require__(/*! node:process */ \"./node_modules/process/browser.js\");\n/* import */ var try_to_catch__rspack_import_1 = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n/* import */ var currify__rspack_import_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__rspack_import_2((f, e) => e.waitUntil(f()));\nconst respondWith = currify__rspack_import_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 Oct 13 2026 22:42:10 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__rspack_import_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}");
|
|
27
27
|
|
|
28
28
|
},
|
|
29
29
|
"./node_modules/try-to-catch/lib/try-to-catch.js"
|
package/package.json
CHANGED
package/server/cloudcmd.js
CHANGED
|
@@ -186,6 +186,11 @@ function listen({prefixSocket, socket, config}) {
|
|
|
186
186
|
distributeExport(config, socket);
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
+
function cutPrefix(prefix, req, next) {
|
|
190
|
+
req.url = req.url.replace(prefix, '') || '/';
|
|
191
|
+
next();
|
|
192
|
+
}
|
|
193
|
+
|
|
189
194
|
function cloudcmdMiddle({modules, config}) {
|
|
190
195
|
const online = apart(config, 'online');
|
|
191
196
|
const cache = false;
|
|
@@ -200,8 +205,15 @@ function cloudcmdMiddle({modules, config}) {
|
|
|
200
205
|
|
|
201
206
|
const dropbox = config('dropbox');
|
|
202
207
|
const dropboxToken = config('dropboxToken');
|
|
208
|
+
const prefix = prefixer(config('prefix'));
|
|
203
209
|
|
|
204
210
|
const funcs = clean([
|
|
211
|
+
prefix && ((req, res, next) => {
|
|
212
|
+
if (!req.url.startsWith(prefix))
|
|
213
|
+
return next();
|
|
214
|
+
|
|
215
|
+
cutPrefix(prefix, req, next);
|
|
216
|
+
}),
|
|
205
217
|
config('console') && konsole({
|
|
206
218
|
online,
|
|
207
219
|
}),
|
package/server/rest/index.js
CHANGED
|
@@ -127,7 +127,13 @@ function onGET(params, config, callback) {
|
|
|
127
127
|
|
|
128
128
|
if (cmd.startsWith('pack')) {
|
|
129
129
|
cmd = cmd.replace(/^pack/, '');
|
|
130
|
-
|
|
130
|
+
|
|
131
|
+
const [error, rooted] = tryCatch(root.resolve, cmd, rootDir);
|
|
132
|
+
|
|
133
|
+
if (error)
|
|
134
|
+
return callback(error);
|
|
135
|
+
|
|
136
|
+
streamPack(rooted, p.response, packer);
|
|
131
137
|
|
|
132
138
|
return;
|
|
133
139
|
}
|