cloudcmd 19.9.10 → 19.9.12
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 +4 -2
- package/README.md +1 -1
- package/bin/cloudcmd.js +21 -28
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist-dev/sw.js +1 -1
- package/package.json +1 -2
- package/server/config.js +8 -10
package/ChangeLog
CHANGED
package/HELP.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Cloud Commander v19.9.
|
|
1
|
+
# Cloud Commander v19.9.12
|
|
2
2
|
|
|
3
3
|
### [Main][MainURL] [Blog][BlogURL] [Support][SupportURL] [Demo][DemoURL]
|
|
4
4
|
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
**Cloud Commander** is a file manager for the web. It includes a command-line console and a text editor. Cloud Commander helps you manage your server and work with files, directories and programs in a web browser from any computer, mobile or tablet.
|
|
17
17
|
|
|
18
|
-

|
|
18
|
+

|
|
19
19
|
|
|
20
20
|
## Benefits
|
|
21
21
|
|
|
@@ -1114,6 +1114,8 @@ There are a lot of ways to be involved in `Cloud Commander` development:
|
|
|
1114
1114
|
|
|
1115
1115
|
## Version history
|
|
1116
1116
|
|
|
1117
|
+
- *2026.03.29*, **[v19.9.12](//github.com/coderaiser/cloudcmd/releases/tag/v19.9.12)**
|
|
1118
|
+
- *2026.03.29*, **[v19.9.11](//github.com/coderaiser/cloudcmd/releases/tag/v19.9.11)**
|
|
1117
1119
|
- *2026.03.29*, **[v19.9.10](//github.com/coderaiser/cloudcmd/releases/tag/v19.9.10)**
|
|
1118
1120
|
- *2026.03.29*, **[v19.9.9](//github.com/coderaiser/cloudcmd/releases/tag/v19.9.9)**
|
|
1119
1121
|
- *2026.03.28*, **[v19.9.8](//github.com/coderaiser/cloudcmd/releases/tag/v19.9.8)**
|
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Cloud Commander v19.9.
|
|
1
|
+
# Cloud Commander v19.9.12 [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Codacy][CodacyIMG]][CodacyURL] [![Gitter][GitterIMGURL]][GitterURL]
|
|
2
2
|
|
|
3
3
|
### [Main][MainURL] [Blog][BlogURL] [Support][SupportURL] [Demo][DemoURL]
|
|
4
4
|
|
package/bin/cloudcmd.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
import process from 'node:process';
|
|
4
|
-
import {createRequire} from 'node:module';
|
|
5
4
|
import {promisify} from 'node:util';
|
|
6
5
|
import {tryToCatch} from 'try-to-catch';
|
|
7
|
-
import {createSimport} from 'simport';
|
|
8
6
|
import parse from 'yargs-parser';
|
|
9
7
|
import exit from '../server/exit.js';
|
|
10
8
|
import {createConfig, configPath} from '../server/config.js';
|
|
11
9
|
import * as env from '../server/env.js';
|
|
12
10
|
import prefixer from '../server/prefixer.js';
|
|
13
11
|
import * as validate from '../server/validate.js';
|
|
12
|
+
import Info from '../package.json' with {
|
|
13
|
+
type: 'json',
|
|
14
|
+
};
|
|
14
15
|
|
|
15
16
|
process.on('unhandledRejection', exit);
|
|
16
17
|
|
|
17
|
-
const require = createRequire(import.meta.url);
|
|
18
|
-
|
|
19
|
-
const Info = require('../package.json');
|
|
20
18
|
const isUndefined = (a) => typeof a === 'undefined';
|
|
21
|
-
const simport = createSimport(import.meta.url);
|
|
22
19
|
|
|
23
20
|
const choose = (a, b) => {
|
|
24
21
|
if (isUndefined(a))
|
|
@@ -31,8 +28,6 @@ const config = createConfig({
|
|
|
31
28
|
configPath,
|
|
32
29
|
});
|
|
33
30
|
|
|
34
|
-
const DIR_SERVER = '../server/';
|
|
35
|
-
|
|
36
31
|
const maybeRoot = (a) => {
|
|
37
32
|
if (a === '.')
|
|
38
33
|
return process.cwd();
|
|
@@ -170,7 +165,7 @@ else
|
|
|
170
165
|
main();
|
|
171
166
|
|
|
172
167
|
async function main() {
|
|
173
|
-
const {validateArgs} = await
|
|
168
|
+
const {validateArgs} = await import('@putout/cli-validate-args');
|
|
174
169
|
|
|
175
170
|
const error = await validateArgs(args, [
|
|
176
171
|
...yargsOptions.boolean,
|
|
@@ -181,7 +176,7 @@ async function main() {
|
|
|
181
176
|
return exit(error);
|
|
182
177
|
|
|
183
178
|
if (args.repl)
|
|
184
|
-
repl();
|
|
179
|
+
await repl();
|
|
185
180
|
|
|
186
181
|
validate.columns(args.columns);
|
|
187
182
|
validate.theme(args.theme);
|
|
@@ -251,7 +246,7 @@ async function main() {
|
|
|
251
246
|
if (args.showConfig)
|
|
252
247
|
await showConfig();
|
|
253
248
|
|
|
254
|
-
const {distributeImport} = await
|
|
249
|
+
const {distributeImport} = await import('../server/distribute/import.js');
|
|
255
250
|
const importConfig = promisify(distributeImport);
|
|
256
251
|
|
|
257
252
|
await start(options, config);
|
|
@@ -273,7 +268,7 @@ function validateRoot(root, config) {
|
|
|
273
268
|
}
|
|
274
269
|
|
|
275
270
|
async function getPassword(password) {
|
|
276
|
-
const criton = await
|
|
271
|
+
const {default: criton} = await import('criton');
|
|
277
272
|
return criton(password, config('algo'));
|
|
278
273
|
}
|
|
279
274
|
|
|
@@ -282,12 +277,10 @@ function version() {
|
|
|
282
277
|
}
|
|
283
278
|
|
|
284
279
|
async function start(options, config) {
|
|
285
|
-
const SERVER = `../server/server.js`;
|
|
286
|
-
|
|
287
280
|
if (!args.server)
|
|
288
281
|
return;
|
|
289
282
|
|
|
290
|
-
const server = await
|
|
283
|
+
const {default: server} = await import('../server/server.js');
|
|
291
284
|
server(options, config);
|
|
292
285
|
}
|
|
293
286
|
|
|
@@ -311,13 +304,13 @@ async function readConfig(name) {
|
|
|
311
304
|
if (!name)
|
|
312
305
|
return;
|
|
313
306
|
|
|
314
|
-
const
|
|
315
|
-
const forEachKey = await simport('for-each-key');
|
|
316
|
-
|
|
317
|
-
const [error, data] = await tryToCatch(simport, name);
|
|
307
|
+
const {default: forEachKey} = await import('for-each-key');
|
|
318
308
|
|
|
319
|
-
|
|
320
|
-
|
|
309
|
+
const data = await import(name, {
|
|
310
|
+
with: {
|
|
311
|
+
type: 'json',
|
|
312
|
+
},
|
|
313
|
+
});
|
|
321
314
|
|
|
322
315
|
forEachKey(config, data);
|
|
323
316
|
}
|
|
@@ -329,8 +322,8 @@ async function help() {
|
|
|
329
322
|
},
|
|
330
323
|
});
|
|
331
324
|
|
|
332
|
-
const forEachKey = await
|
|
333
|
-
const currify = await
|
|
325
|
+
const {default: forEachKey} = await import('for-each-key');
|
|
326
|
+
const {currify} = await import('currify');
|
|
334
327
|
|
|
335
328
|
const usage = 'Usage: cloudcmd [options]';
|
|
336
329
|
const url = Info.homepage;
|
|
@@ -342,15 +335,15 @@ async function help() {
|
|
|
342
335
|
console.log('\nGeneral help using Cloud Commander: <%s>', url);
|
|
343
336
|
}
|
|
344
337
|
|
|
345
|
-
function repl() {
|
|
338
|
+
async function repl() {
|
|
346
339
|
console.log('REPL mode enabled (telnet localhost 1337)');
|
|
347
|
-
|
|
340
|
+
await import('../server/repl.js');
|
|
348
341
|
}
|
|
349
342
|
|
|
350
343
|
async function checkUpdate() {
|
|
351
|
-
const load = await
|
|
352
|
-
|
|
344
|
+
const {default: load} = await import('package-json');
|
|
353
345
|
const {version} = await load(Info.name, 'latest');
|
|
346
|
+
|
|
354
347
|
await showUpdateInfo(version);
|
|
355
348
|
}
|
|
356
349
|
|
|
@@ -358,7 +351,7 @@ async function showUpdateInfo(version) {
|
|
|
358
351
|
if (version === Info.version)
|
|
359
352
|
return;
|
|
360
353
|
|
|
361
|
-
const chalk = await
|
|
354
|
+
const {default: chalk} = await import('chalk');
|
|
362
355
|
|
|
363
356
|
const latestVersion = chalk.green.bold(`v${version}`);
|
|
364
357
|
const latest = `update available: ${latestVersion}`;
|
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 = "Sun Mar 29 2026
|
|
314
|
+
const date = "Sun Mar 29 2026 12:38:37 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'
|
package/dist/sw.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sw.js","mappings":";;;;;;;AAAa;;AAEb;AACA;AACA,kBAAkB,yBAAyB;AAC3C,qBAAqB,yBAAyB;AAC9C,wBAAwB,yBAAyB;AACjD,2BAA2B,yBAAyB;AACpD,8BAA8B,yBAAyB;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;;;;;;;AChCA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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md//Users/coderaiser/cloudcmd/node_modules/process/browser.js","file://cloudcmd/webpack/bootstrap","file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/try-to-catch/lib/try-to-catch.js","file://cloudcmd//Users/coderaiser/cloudcmd/client/sw/sw.js"],"sourcesContent":["'use strict';\n\nconst f = (fn) => [\n /*eslint no-unused-vars: 0*/\n function (a) {return fn(...arguments);},\n function (a, b) {return fn(...arguments);},\n function (a, b, c) {return fn(...arguments);},\n function (a, b, c, d) {return fn(...arguments);},\n function (a, b, c, d, e) {return fn(...arguments);},\n];\n\nconst currify = (fn, ...args) => {\n check(fn);\n \n if (args.length >= fn.length)\n return fn(...args);\n \n const again = (...args2) => {\n return currify(fn, ...[...args, ...args2]);\n };\n \n const count = fn.length - args.length - 1;\n const func = f(again)[count];\n \n return func || again;\n};\n\nmodule.exports = currify;\n\nfunction check(fn) {\n if (typeof fn !== 'function')\n throw Error('fn should be function!');\n}\n\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","const isFn = (a) => typeof a === 'function';\n\nexport const tryToCatch = async (fn, ...args) => {\n check(fn);\n \n try {\n return [null, await fn(...args)];\n } catch(e) {\n return [e];\n }\n};\n\nfunction check(fn) {\n if (!isFn(fn))\n throw Error('fn should be a function!');\n}\n","import process from 'node:process';\nimport codegen from 'codegen.macro';\nimport {tryToCatch} from 'try-to-catch';\nimport currify from 'currify';\n\nconst isDev = process.env.NODE_ENV === 'development';\n\nconst isGet = (a) => a.method === 'GET';\nconst isBasic = (a) => a.type === 'basic';\n\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {request} = e;\n const {url} = request;\n const pathname = getPathName(url);\n \n if (url.endsWith('/') || /\\^\\/fs/.test(pathname))\n return;\n \n if (!isGet(request))\n return;\n \n if (!isBasic(request))\n return;\n \n if (pathname.startsWith('/api'))\n return;\n \n if (/^socket.io/.test(pathname))\n return;\n \n e.respondWith(f(e));\n});\n\nconst getPathName = (url) => new URL(url).pathname;\n\nconst date = codegen`module.exports = '\"' + Date() + '\"'`;\nconst NAME = `cloudcmd: ${date}`;\n\nconst createRequest = (a) => new Request(a, {\n credentials: 'same-origin',\n});\n\nconst getRequest = (a, request) => {\n if (a !== '/')\n return request;\n \n return createRequest('/');\n};\n\nglobalThis.addEventListener('install', wait(onInstall));\nglobalThis.addEventListener('fetch', respondWith(onFetch));\nglobalThis.addEventListener('activate', wait(onActivate));\n\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n \n await globalThis.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n \n await Promise.all(keys.map(deleteCache));\n}\n\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n \n await globalThis.skipWaiting();\n}\n\nasync function onFetch(event) {\n const {request} = event;\n const {url} = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n \n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n \n if (!isDev && response)\n return response;\n \n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin',\n });\n \n if (e)\n return new Response(e.message);\n \n await addToCache(request, resp.clone());\n \n return resp;\n}\n\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n"],"names":["process","tryToCatch","currify","isDev","env","NODE_ENV","isGet","a","method","isBasic","type","wait","f","e","waitUntil","respondWith","request","url","pathname","getPathName","endsWith","test","startsWith","URL","date","NAME","createRequest","Request","credentials","getRequest","globalThis","addEventListener","onInstall","onFetch","onActivate","console","info","clients","claim","keys","caches","deleteCache","delete","bind","Promise","all","map","skipWaiting","event","newRequest","cache","open","response","match","resp","fetch","Response","message","addToCache","clone","put"],"sourceRoot":""}
|
|
1
|
+
{"version":3,"file":"sw.js","mappings":";;;;;;;AAAa;;AAEb;AACA;AACA,kBAAkB,yBAAyB;AAC3C,qBAAqB,yBAAyB;AAC9C,wBAAwB,yBAAyB;AACjD,2BAA2B,yBAAyB;AACpD,8BAA8B,yBAAyB;AACvD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;;AAEA;AACA;AACA;AACA;;;;;;;;;AChCA;AACA;;AAEA;AACA;AACA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA,UAAU;AACV;AACA;AACA,MAAM;AACN;AACA;AACA,EAAE;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA,UAAU;AACV;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM;AACN;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AAC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_modules/currify/lib/currify.js","file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/process/browser.js","file://cloudcmd/webpack/bootstrap","file://cloudcmd//Users/coderaiser/cloudcmd/node_modules/try-to-catch/lib/try-to-catch.js","file://cloudcmd//Users/coderaiser/cloudcmd/client/sw/sw.js"],"sourcesContent":["'use strict';\n\nconst f = (fn) => [\n /*eslint no-unused-vars: 0*/\n function (a) {return fn(...arguments);},\n function (a, b) {return fn(...arguments);},\n function (a, b, c) {return fn(...arguments);},\n function (a, b, c, d) {return fn(...arguments);},\n function (a, b, c, d, e) {return fn(...arguments);},\n];\n\nconst currify = (fn, ...args) => {\n check(fn);\n \n if (args.length >= fn.length)\n return fn(...args);\n \n const again = (...args2) => {\n return currify(fn, ...[...args, ...args2]);\n };\n \n const count = fn.length - args.length - 1;\n const func = f(again)[count];\n \n return func || again;\n};\n\nmodule.exports = currify;\n\nfunction check(fn) {\n if (typeof fn !== 'function')\n throw Error('fn should be function!');\n}\n\n","// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","const isFn = (a) => typeof a === 'function';\n\nexport const tryToCatch = async (fn, ...args) => {\n check(fn);\n \n try {\n return [null, await fn(...args)];\n } catch(e) {\n return [e];\n }\n};\n\nfunction check(fn) {\n if (!isFn(fn))\n throw Error('fn should be a function!');\n}\n","import process from 'node:process';\nimport codegen from 'codegen.macro';\nimport {tryToCatch} from 'try-to-catch';\nimport currify from 'currify';\n\nconst isDev = process.env.NODE_ENV === 'development';\n\nconst isGet = (a) => a.method === 'GET';\nconst isBasic = (a) => a.type === 'basic';\n\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {request} = e;\n const {url} = request;\n const pathname = getPathName(url);\n \n if (url.endsWith('/') || /\\^\\/fs/.test(pathname))\n return;\n \n if (!isGet(request))\n return;\n \n if (!isBasic(request))\n return;\n \n if (pathname.startsWith('/api'))\n return;\n \n if (/^socket.io/.test(pathname))\n return;\n \n e.respondWith(f(e));\n});\n\nconst getPathName = (url) => new URL(url).pathname;\n\nconst date = codegen`module.exports = '\"' + Date() + '\"'`;\nconst NAME = `cloudcmd: ${date}`;\n\nconst createRequest = (a) => new Request(a, {\n credentials: 'same-origin',\n});\n\nconst getRequest = (a, request) => {\n if (a !== '/')\n return request;\n \n return createRequest('/');\n};\n\nglobalThis.addEventListener('install', wait(onInstall));\nglobalThis.addEventListener('fetch', respondWith(onFetch));\nglobalThis.addEventListener('activate', wait(onActivate));\n\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n \n await globalThis.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n \n await Promise.all(keys.map(deleteCache));\n}\n\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n \n await globalThis.skipWaiting();\n}\n\nasync function onFetch(event) {\n const {request} = event;\n const {url} = request;\n const pathname = getPathName(url);\n const newRequest = getRequest(pathname, event.request);\n \n const cache = await caches.open(NAME);\n const response = await cache.match(request);\n \n if (!isDev && response)\n return response;\n \n const [e, resp] = await tryToCatch(fetch, newRequest, {\n credentials: 'same-origin',\n });\n \n if (e)\n return new Response(e.message);\n \n await addToCache(request, resp.clone());\n \n return resp;\n}\n\nasync function addToCache(request, response) {\n const cache = await caches.open(NAME);\n return cache.put(request, response);\n}\n"],"names":["process","tryToCatch","currify","isDev","env","NODE_ENV","isGet","a","method","isBasic","type","wait","f","e","waitUntil","respondWith","request","url","pathname","getPathName","endsWith","test","startsWith","URL","date","NAME","createRequest","Request","credentials","getRequest","globalThis","addEventListener","onInstall","onFetch","onActivate","console","info","clients","claim","keys","caches","deleteCache","delete","bind","Promise","all","map","skipWaiting","event","newRequest","cache","open","response","match","resp","fetch","Response","message","addToCache","clone","put"],"sourceRoot":""}
|
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 = \"Sun Mar 29 2026
|
|
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 = \"Sun Mar 29 2026 12:38:39 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.9.
|
|
3
|
+
"version": "19.9.12",
|
|
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",
|
|
@@ -135,7 +135,6 @@
|
|
|
135
135
|
"restafary": "^13.0.1",
|
|
136
136
|
"restbox": "^4.0.0",
|
|
137
137
|
"shortdate": "^2.0.0",
|
|
138
|
-
"simport": "^1.0.1",
|
|
139
138
|
"socket.io": "^4.0.0",
|
|
140
139
|
"socket.io-client": "^4.0.1",
|
|
141
140
|
"squad": "^3.0.0",
|
package/server/config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import path
|
|
1
|
+
import path from 'node:path';
|
|
2
2
|
import fs from 'node:fs';
|
|
3
3
|
import Emitter from 'node:events';
|
|
4
4
|
import {homedir} from 'node:os';
|
|
5
|
-
import {fileURLToPath} from 'node:url';
|
|
6
5
|
import currify from 'currify';
|
|
7
6
|
import wraptile from 'wraptile';
|
|
8
7
|
import {tryToCatch} from 'try-to-catch';
|
|
@@ -15,15 +14,16 @@ import {tryCatch} from 'try-catch';
|
|
|
15
14
|
import criton from 'criton';
|
|
16
15
|
import * as CloudFunc from '#common/cloudfunc';
|
|
17
16
|
import exit from './exit.js';
|
|
17
|
+
import rootConfig from '../json/config.json' with {
|
|
18
|
+
type: 'json',
|
|
19
|
+
};
|
|
18
20
|
|
|
19
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
-
const __dirname = dirname(__filename);
|
|
21
|
-
const DIR_SERVER = `${__dirname}/`;
|
|
22
21
|
const isUndefined = (a) => typeof a === 'undefined';
|
|
23
|
-
|
|
22
|
+
|
|
24
23
|
const HOME = homedir();
|
|
25
24
|
|
|
26
25
|
const resolve = Promise.resolve.bind(Promise);
|
|
26
|
+
|
|
27
27
|
const formatMsg = currify((a, b) => CloudFunc.formatMsg(a, b));
|
|
28
28
|
|
|
29
29
|
const {apiURL} = CloudFunc;
|
|
@@ -32,10 +32,10 @@ const key = (a) => Object
|
|
|
32
32
|
.keys(a)
|
|
33
33
|
.pop();
|
|
34
34
|
|
|
35
|
-
const ConfigPath = path.join(DIR, 'json/config.json');
|
|
36
|
-
|
|
37
35
|
const connection = currify(_connection);
|
|
36
|
+
|
|
38
37
|
const connectionWrapped = wraptile(_connection);
|
|
38
|
+
|
|
39
39
|
const middle = currify(_middle);
|
|
40
40
|
|
|
41
41
|
const readjsonSync = (name) => {
|
|
@@ -44,8 +44,6 @@ const readjsonSync = (name) => {
|
|
|
44
44
|
});
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
-
const rootConfig = readjsonSync(ConfigPath);
|
|
48
|
-
|
|
49
47
|
function read(filename) {
|
|
50
48
|
if (!filename)
|
|
51
49
|
return rootConfig;
|