cloudcmd 16.1.0 → 16.3.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 +21 -0
- package/HELP.md +4 -1
- package/LICENSE +1 -1
- package/README.md +1 -1
- package/bin/cloudcmd.mjs +13 -12
- package/dist/cloudcmd.common.js +2 -2
- package/dist/cloudcmd.common.js.map +1 -1
- package/dist/cloudcmd.js +1 -1
- package/dist/cloudcmd.js.map +1 -1
- package/dist/modules/cloud.js +1 -1
- package/dist/modules/cloud.js.map +1 -1
- package/dist/modules/config.js +1 -1
- package/dist/modules/config.js.map +1 -1
- package/dist/modules/edit.js +1 -1
- package/dist/modules/edit.js.map +1 -1
- package/dist/modules/markdown.js +1 -1
- package/dist/modules/markdown.js.map +1 -1
- package/dist/modules/menu.js +1 -1
- package/dist/modules/operation.js +1 -1
- package/dist/modules/operation.js.map +1 -1
- package/dist/modules/terminal-run.js +1 -1
- package/dist/modules/terminal-run.js.map +1 -1
- package/dist/modules/upload.js +1 -1
- package/dist/modules/user-menu.js +1 -1
- package/dist/modules/user-menu.js.map +1 -1
- package/dist/modules/view.js +1 -1
- package/dist/sw.js +1 -1
- package/dist/sw.js.map +1 -1
- package/dist-dev/cloudcmd.common.js +4 -4
- package/dist-dev/cloudcmd.js +6 -6
- package/dist-dev/modules/cloud.js +1 -1
- package/dist-dev/modules/config.js +1 -1
- package/dist-dev/modules/edit.js +1 -1
- package/dist-dev/modules/markdown.js +1 -1
- package/dist-dev/modules/operation.js +1 -1
- package/dist-dev/modules/terminal-run.js +1 -1
- package/dist-dev/modules/user-menu.js +1 -1
- package/dist-dev/sw.js +1 -1
- package/package.json +5 -5
- package/server/cloudcmd.js +5 -5
- package/server/config.js +4 -4
- package/server/distribute/import.js +2 -2
- package/server/markdown/index.js +2 -2
- package/server/rest/index.js +2 -2
- package/server/route.js +6 -6
- package/server/{server.js → server.mjs} +19 -22
- package/tmpl/config.hbs +2 -2
|
@@ -163,7 +163,7 @@
|
|
|
163
163
|
/***/ (function(module, exports, __webpack_require__) {
|
|
164
164
|
|
|
165
165
|
"use strict";
|
|
166
|
-
eval("\n/* global CloudCmd, gritty */\n\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst fullstore = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n\nconst DOM = __webpack_require__(/*! ../dom */ \"./client/dom/index.js\");\n\nconst Images = __webpack_require__(/*! ../dom/images */ \"./client/dom/images.js\");\n\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = fullstore();\n\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 tryToCatch(load.parallel, [js, css]);\n\n if (e) {\n const src = e.target.src.replace(window.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n\n Loaded = true;\n};\n\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n};\n\nmodule.exports.show = promisify(function () {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let fn = arguments.length > 1 ? arguments[1] : undefined;\n if (!Loaded) return;\n if (!config('terminal')) return;\n create(options);\n CloudCmd.View.show(Terminal.element, {\n afterShow: () => {\n Terminal.focus();\n },\n afterClose: () => {\n fn(null, exitCodeStore());\n }\n });\n});\nmodule.exports.hide = hide;\n\nfunction hide() {\n CloudCmd.View.hide();\n}\n\nfunction getPrefix() {\n return CloudCmd.prefix + '/gritty';\n}\n\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\n\nfunction getEnv() {\n return {\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n };\n}\n\nfunction create(createOptions) {\n const {\n cwd = DOM.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 } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(_ref => {\n let {\n domEvent\n } = _ref;\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (commandExit) hide();\n\n if (shiftKey && keyCode === Key.ESC) {\n hide();\n }\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', exec.with(authCheck, socket));\n}\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/client/modules/terminal-run.js");
|
|
166
|
+
eval("\n/* global CloudCmd, gritty */\n\nconst {\n promisify\n} = __webpack_require__(/*! es6-promisify */ \"./node_modules/es6-promisify/dist/promisify.mjs\");\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst fullstore = __webpack_require__(/*! fullstore */ \"./node_modules/fullstore/lib/fullstore.js\");\n\n__webpack_require__(/*! ../../css/terminal.css */ \"./css/terminal.css\");\n\nconst exec = __webpack_require__(/*! execon */ \"./node_modules/execon/lib/exec.js\");\n\nconst load = __webpack_require__(/*! load.js */ \"./node_modules/load.js/lib/load.js\");\n\nconst DOM = __webpack_require__(/*! ../dom */ \"./client/dom/index.js\");\n\nconst Images = __webpack_require__(/*! ../dom/images */ \"./client/dom/images.js\");\n\nconst {\n Dialog\n} = DOM;\nconst {\n Key,\n config\n} = CloudCmd;\nCloudCmd.TerminalRun = exports;\nlet Loaded;\nlet Terminal;\nlet Socket;\nconst exitCodeStore = fullstore();\n\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 tryToCatch(load.parallel, [js, css]);\n\n if (e) {\n const src = e.target.src.replace(window.location.href, '');\n return Dialog.alert(`file ${src} could not be loaded`);\n }\n\n Loaded = true;\n};\n\nmodule.exports.init = async () => {\n if (!config('terminal')) return;\n Images.show.load('top');\n await CloudCmd.View();\n await loadAll();\n};\n\nmodule.exports.show = promisify(function () {\n let options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n let fn = arguments.length > 1 ? arguments[1] : undefined;\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: () => {\n fn(null, exitCodeStore());\n }\n });\n});\nmodule.exports.hide = hide;\n\nfunction hide() {\n CloudCmd.View.hide();\n}\n\nfunction getPrefix() {\n return CloudCmd.prefix + '/gritty';\n}\n\nfunction getPrefixSocket() {\n return CloudCmd.prefixSocket + '/gritty';\n}\n\nfunction getEnv() {\n return {\n ACTIVE_DIR: DOM.getCurrentDirPath,\n PASSIVE_DIR: DOM.getNotCurrentDirPath,\n CURRENT_NAME: DOM.getCurrentName,\n CURRENT_PATH: DOM.getCurrentPath\n };\n}\n\nfunction create(createOptions) {\n const {\n cwd = DOM.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 } = gritty(document.body, options);\n Socket = socket;\n Terminal = terminal;\n Terminal.onKey(_ref => {\n let {\n domEvent\n } = _ref;\n const {\n keyCode,\n shiftKey\n } = domEvent;\n if (commandExit) hide();\n\n if (shiftKey && keyCode === Key.ESC) {\n hide();\n }\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', exec.with(authCheck, socket));\n}\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/client/modules/terminal-run.js");
|
|
167
167
|
|
|
168
168
|
/***/ })
|
|
169
169
|
|
|
@@ -211,7 +211,7 @@ eval("\n\nconst isNumber = a => typeof a === 'number';\n\nmodule.exports = error
|
|
|
211
211
|
/***/ (function(module, exports, __webpack_require__) {
|
|
212
212
|
|
|
213
213
|
"use strict";
|
|
214
|
-
eval("\n\nconst {\n entries,\n assign\n} = Object;\n\nmodule.exports = userMenu => {\n const names = [];\n const keys = {};\n const items = {};\n const settings = {};\n\n for (const [str, fn] of entries(userMenu)) {\n if (str === '__settings') {\n assign(settings, userMenu[str]);\n continue;\n }\n\n if (
|
|
214
|
+
eval("\n\nconst {\n entries,\n assign\n} = Object;\n\nmodule.exports = userMenu => {\n const names = [];\n const keys = {};\n const items = {};\n const settings = {};\n\n for (const [str, fn] of entries(userMenu)) {\n if (str === '__settings') {\n assign(settings, userMenu[str]);\n continue;\n }\n\n if (str.startsWith('_')) {\n continue;\n }\n\n names.push(str);\n const [key, name] = str.split(' - ');\n keys[key] = fn;\n items[name] = fn;\n }\n\n return {\n names,\n keys,\n items,\n settings\n };\n};\n\n//# sourceURL=file://cloudcmd/client/modules/user-menu/parse-user-menu.js");
|
|
215
215
|
|
|
216
216
|
/***/ }),
|
|
217
217
|
|
package/dist-dev/sw.js
CHANGED
|
@@ -101,7 +101,7 @@ var serviceWorkerOption = {
|
|
|
101
101
|
/***/ (function(module, exports, __webpack_require__) {
|
|
102
102
|
|
|
103
103
|
"use strict";
|
|
104
|
-
eval("\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst isDev = \"development\" === 'development';\n\nconst isGet = a => a.method === 'GET';\n\nconst isBasic = a => a.type === 'basic';\n\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((f, e) => {\n const {\n request\n } = e;\n const {\n url\n } = request;\n const pathname = getPathName(url);\n if (
|
|
104
|
+
eval("\n\nconst tryToCatch = __webpack_require__(/*! try-to-catch */ \"./node_modules/try-to-catch/lib/try-to-catch.js\");\n\nconst currify = __webpack_require__(/*! currify */ \"./node_modules/currify/lib/currify.js\");\n\nconst isDev = \"development\" === 'development';\n\nconst isGet = a => a.method === 'GET';\n\nconst isBasic = a => a.type === 'basic';\n\nconst wait = currify((f, e) => e.waitUntil(f()));\nconst respondWith = currify((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});\n\nconst getPathName = url => new URL(url).pathname;\n\nconst date = \"Fri Jul 01 2022 14:29:13 GMT+0300 (Eastern European Summer Time)\";\nconst NAME = `cloudcmd: ${date}`;\n\nconst createRequest = a => new Request(a, {\n credentials: 'same-origin'\n});\n\nconst getRequest = (a, request) => {\n if (a !== '/') return request;\n return createRequest('/');\n};\n\nself.addEventListener('install', wait(onInstall));\nself.addEventListener('fetch', respondWith(onFetch));\nself.addEventListener('activate', wait(onActivate));\n\nasync function onActivate() {\n console.info(`cloudcmd: sw: activate: ${NAME}`);\n await self.clients.claim();\n const keys = await caches.keys();\n const deleteCache = caches.delete.bind(caches);\n await Promise.all(keys.map(deleteCache));\n}\n\nasync function onInstall() {\n console.info(`cloudcmd: sw: install: ${NAME}`);\n await self.skipWaiting();\n}\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 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}\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/client/sw/sw.js");
|
|
105
105
|
|
|
106
106
|
/***/ }),
|
|
107
107
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cloudcmd",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.3.0",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
|
|
6
6
|
"description": "File manager for the web with console and editor",
|
|
@@ -96,7 +96,7 @@
|
|
|
96
96
|
"deepmerge": "^4.0.0",
|
|
97
97
|
"deepword": "^8.0.0",
|
|
98
98
|
"dword": "^14.0.0",
|
|
99
|
-
"edward": "^
|
|
99
|
+
"edward": "^14.0.0",
|
|
100
100
|
"es6-promisify": "^7.0.0",
|
|
101
101
|
"execon": "^1.2.0",
|
|
102
102
|
"express": "^4.13.0",
|
|
@@ -111,7 +111,7 @@
|
|
|
111
111
|
"jju": "^1.3.0",
|
|
112
112
|
"jonny": "^3.0.0",
|
|
113
113
|
"just-snake-case": "^1.1.0",
|
|
114
|
-
"markdown-it": "^
|
|
114
|
+
"markdown-it": "^13.0.1",
|
|
115
115
|
"mellow": "^3.0.0",
|
|
116
116
|
"nomine": "^4.0.0",
|
|
117
117
|
"object.omit": "^3.0.0",
|
|
@@ -121,7 +121,7 @@
|
|
|
121
121
|
"package-json": "^7.0.0",
|
|
122
122
|
"ponse": "^7.0.0",
|
|
123
123
|
"pullout": "^4.0.0",
|
|
124
|
-
"putout": "^
|
|
124
|
+
"putout": "^26.0.1",
|
|
125
125
|
"redzip": "^2.0.0",
|
|
126
126
|
"rendy": "^3.0.0",
|
|
127
127
|
"restafary": "^11.0.0",
|
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"socket.io-client": "^4.0.1",
|
|
133
133
|
"squad": "^3.0.0",
|
|
134
134
|
"table": "^6.0.1",
|
|
135
|
-
"thread-it": "^
|
|
135
|
+
"thread-it": "^2.0.0",
|
|
136
136
|
"try-catch": "^3.0.0",
|
|
137
137
|
"try-to-catch": "^3.0.0",
|
|
138
138
|
"tryrequire": "^3.0.0",
|
package/server/cloudcmd.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const DIR = __dirname + '/';
|
|
4
|
-
const DIR_ROOT = DIR + '../';
|
|
5
4
|
const DIR_COMMON = DIR + '../common/';
|
|
6
|
-
|
|
7
5
|
const path = require('path');
|
|
8
|
-
const fs = require('fs');
|
|
9
6
|
|
|
7
|
+
const fs = require('fs');
|
|
10
8
|
const cloudfunc = require(DIR_COMMON + 'cloudfunc');
|
|
9
|
+
|
|
11
10
|
const authentication = require(DIR + 'auth');
|
|
12
11
|
const {
|
|
13
12
|
createConfig,
|
|
14
13
|
configPath,
|
|
15
14
|
} = require(DIR + 'config');
|
|
16
|
-
|
|
17
15
|
const modulas = require(DIR + 'modulas');
|
|
16
|
+
|
|
18
17
|
const userMenu = require(DIR + 'user-menu');
|
|
19
18
|
const rest = require(DIR + 'rest');
|
|
20
19
|
const route = require(DIR + 'route');
|
|
@@ -22,8 +21,8 @@ const validate = require(DIR + 'validate');
|
|
|
22
21
|
const prefixer = require(DIR + 'prefixer');
|
|
23
22
|
const terminal = require(DIR + 'terminal');
|
|
24
23
|
const distribute = require(DIR + 'distribute');
|
|
25
|
-
|
|
26
24
|
const currify = require('currify');
|
|
25
|
+
|
|
27
26
|
const apart = require('apart');
|
|
28
27
|
const ponse = require('ponse');
|
|
29
28
|
const restafary = require('restafary');
|
|
@@ -34,6 +33,7 @@ const dword = require('dword');
|
|
|
34
33
|
const deepword = require('deepword');
|
|
35
34
|
const nomine = require('nomine');
|
|
36
35
|
const fileop = require('@cloudcmd/fileop');
|
|
36
|
+
const DIR_ROOT = DIR + '../';
|
|
37
37
|
|
|
38
38
|
const isDev = process.env.NODE_ENV === 'development';
|
|
39
39
|
const getDist = (isDev) => isDev ? 'dist-dev' : 'dist';
|
package/server/config.js
CHANGED
|
@@ -2,17 +2,16 @@
|
|
|
2
2
|
|
|
3
3
|
const DIR_SERVER = __dirname + '/';
|
|
4
4
|
const DIR_COMMON = '../common/';
|
|
5
|
-
const DIR = DIR_SERVER + '../';
|
|
6
|
-
|
|
7
5
|
const path = require('path');
|
|
6
|
+
|
|
8
7
|
const fs = require('fs');
|
|
9
8
|
const Emitter = require('events');
|
|
10
9
|
const {homedir} = require('os');
|
|
11
|
-
|
|
12
10
|
const exit = require(DIR_SERVER + 'exit');
|
|
13
|
-
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
|
14
11
|
|
|
12
|
+
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
|
15
13
|
const currify = require('currify');
|
|
14
|
+
|
|
16
15
|
const wraptile = require('wraptile');
|
|
17
16
|
const tryToCatch = require('try-to-catch');
|
|
18
17
|
const pullout = require('pullout');
|
|
@@ -22,6 +21,7 @@ const jju = require('jju');
|
|
|
22
21
|
const writejson = require('writejson');
|
|
23
22
|
const tryCatch = require('try-catch');
|
|
24
23
|
const criton = require('criton');
|
|
24
|
+
const DIR = DIR_SERVER + '../';
|
|
25
25
|
const HOME = homedir();
|
|
26
26
|
|
|
27
27
|
const resolve = Promise.resolve.bind(Promise);
|
|
@@ -6,10 +6,10 @@ const squad = require('squad');
|
|
|
6
6
|
const fullstore = require('fullstore');
|
|
7
7
|
|
|
8
8
|
const io = require('socket.io-client');
|
|
9
|
-
const forEachKey = currify(require('for-each-key'));
|
|
10
|
-
|
|
11
9
|
const log = require('./log');
|
|
10
|
+
|
|
12
11
|
const env = require('../env');
|
|
12
|
+
const forEachKey = currify(require('for-each-key'));
|
|
13
13
|
|
|
14
14
|
const {
|
|
15
15
|
importStr,
|
package/server/markdown/index.js
CHANGED
|
@@ -8,10 +8,10 @@ const ponse = require('ponse');
|
|
|
8
8
|
const threadIt = require('thread-it');
|
|
9
9
|
const {read} = require('redzip');
|
|
10
10
|
|
|
11
|
-
const parse = threadIt(join(__dirname, 'worker'));
|
|
12
|
-
|
|
13
11
|
const root = require('../root');
|
|
14
12
|
|
|
13
|
+
const parse = threadIt(join(__dirname, 'worker'));
|
|
14
|
+
|
|
15
15
|
threadIt.init();
|
|
16
16
|
|
|
17
17
|
// warm up
|
package/server/rest/index.js
CHANGED
|
@@ -87,7 +87,7 @@ function rest(config, request, response) {
|
|
|
87
87
|
*/
|
|
88
88
|
function sendData(params, config, callback) {
|
|
89
89
|
const p = params;
|
|
90
|
-
const isMD =
|
|
90
|
+
const isMD = p.name.startsWith('/markdown');
|
|
91
91
|
const rootDir = config('root');
|
|
92
92
|
|
|
93
93
|
if (isMD)
|
|
@@ -122,7 +122,7 @@ function onGET(params, config, callback) {
|
|
|
122
122
|
if (p.name[0] === '/')
|
|
123
123
|
cmd = p.name.replace('/', '');
|
|
124
124
|
|
|
125
|
-
if (
|
|
125
|
+
if (cmd.startsWith('pack')) {
|
|
126
126
|
cmd = cmd.replace(/^pack/, '');
|
|
127
127
|
streamPack(root(cmd, rootDir), p.response, packer);
|
|
128
128
|
return;
|
package/server/route.js
CHANGED
|
@@ -20,9 +20,11 @@ const root = require(DIR_SERVER + 'root');
|
|
|
20
20
|
const prefixer = require(DIR_SERVER + 'prefixer');
|
|
21
21
|
const CloudFunc = require(DIR_COMMON + 'cloudfunc');
|
|
22
22
|
|
|
23
|
-
const
|
|
23
|
+
const Columns = require(`${DIR_SERVER}/columns`);
|
|
24
24
|
|
|
25
|
-
const
|
|
25
|
+
const Template = require(`${DIR_SERVER}/template`);
|
|
26
|
+
|
|
27
|
+
const {FS} = CloudFunc;
|
|
26
28
|
|
|
27
29
|
const sendIndex = (params, data) => {
|
|
28
30
|
const ponseParams = {
|
|
@@ -33,10 +35,8 @@ const sendIndex = (params, data) => {
|
|
|
33
35
|
ponse.send(data, ponseParams);
|
|
34
36
|
};
|
|
35
37
|
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
const Columns = require(`${DIR_SERVER}/columns`);
|
|
39
|
-
const Template = require(`${DIR_SERVER}/template`);
|
|
38
|
+
const onceRequire = once(require);
|
|
39
|
+
const getPrefix = (config) => prefixer(config('prefix'));
|
|
40
40
|
|
|
41
41
|
const getReadDir = (config) => {
|
|
42
42
|
if (!config('dropbox'))
|
|
@@ -1,39 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
import cloudcmd from './cloudcmd.js';
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import http from 'http';
|
|
4
|
+
import {promisify} from 'util';
|
|
5
|
+
import currify from 'currify';
|
|
6
|
+
import squad from 'squad';
|
|
7
|
+
import tryToCatch from 'try-to-catch';
|
|
8
|
+
import wraptile from 'wraptile';
|
|
9
|
+
import compression from 'compression';
|
|
10
|
+
import threadIt from 'thread-it';
|
|
5
11
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const currify = require('currify');
|
|
9
|
-
const squad = require('squad');
|
|
10
|
-
const tryToCatch = require('try-to-catch');
|
|
11
|
-
const wraptile = require('wraptile');
|
|
12
|
-
const compression = require('compression');
|
|
13
|
-
const threadIt = require('thread-it');
|
|
12
|
+
import exit from './exit.js';
|
|
13
|
+
import opn from 'open';
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
import express from 'express';
|
|
16
|
+
import {Server} from 'socket.io';
|
|
17
|
+
import tryRequire from 'tryrequire';
|
|
17
18
|
|
|
18
|
-
const exitPort = two(exit, 'cloudcmd --port: %s');
|
|
19
19
|
const bind = (f, self) => f.bind(self);
|
|
20
|
-
const promisifySelf = squad(promisify, bind);
|
|
21
20
|
|
|
21
|
+
const two = currify((f, a, b) => f(a, b));
|
|
22
22
|
const shutdown = wraptile(async (promises) => {
|
|
23
23
|
console.log('closing cloudcmd...');
|
|
24
24
|
await Promise.all(promises);
|
|
25
25
|
threadIt.terminate();
|
|
26
26
|
process.exit(0);
|
|
27
27
|
});
|
|
28
|
+
const promisifySelf = squad(promisify, bind);
|
|
28
29
|
|
|
29
|
-
const
|
|
30
|
-
const express = require('express');
|
|
31
|
-
const io = require('socket.io');
|
|
32
|
-
|
|
33
|
-
const tryRequire = require('tryrequire');
|
|
30
|
+
const exitPort = two(exit, 'cloudcmd --port: %s');
|
|
34
31
|
const logger = tryRequire('morgan');
|
|
35
32
|
|
|
36
|
-
|
|
33
|
+
export default async (options, config) => {
|
|
37
34
|
const prefix = config('prefix');
|
|
38
35
|
const port = process.env.PORT /* c9 */
|
|
39
36
|
|| config('port');
|
|
@@ -51,7 +48,7 @@ module.exports = async (options, config) => {
|
|
|
51
48
|
if (prefix)
|
|
52
49
|
app.get('/', (req, res) => res.redirect(prefix + '/'));
|
|
53
50
|
|
|
54
|
-
const socketServer =
|
|
51
|
+
const socketServer = new Server(server, {
|
|
55
52
|
path: `${prefix}/socket.io`,
|
|
56
53
|
});
|
|
57
54
|
|
package/tmpl/config.hbs
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
Diff
|
|
35
35
|
</label>
|
|
36
36
|
</li>
|
|
37
|
-
<li title="Pack text data
|
|
37
|
+
<li title="Pack text data transferred by an Editor">
|
|
38
38
|
<label>
|
|
39
39
|
<input
|
|
40
40
|
data-name="js-zip"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
Zip
|
|
44
44
|
</label>
|
|
45
45
|
</li>
|
|
46
|
-
<li title="Visible
|
|
46
|
+
<li title="Visible Columns">
|
|
47
47
|
<select data-name="js-columns" class="form-control full-width" title="Visible Columns">
|
|
48
48
|
<option {{ name-size-date-owner-mode-selected }}>name-size-date-owner-mode</option>
|
|
49
49
|
<option {{ name-size-date-selected }}>name-size-date</option>
|