mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
chore(cloudcmd) add dangle-comma
This commit is contained in:
parent
4447d43c89
commit
ea08b92e8b
69 changed files with 242 additions and 242 deletions
|
|
@ -69,7 +69,7 @@ function extract(extractPlugin) {
|
|||
test: RegExp(`css/${filename}`),
|
||||
use: extractPlugin.extract([
|
||||
'css-loader',
|
||||
])
|
||||
]),
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ const babelDev = {
|
|||
plugins: [
|
||||
'module:babel-plugin-macros',
|
||||
'@babel/plugin-proposal-object-rest-spread',
|
||||
]
|
||||
],
|
||||
};
|
||||
|
||||
const rules = clean([
|
||||
|
|
@ -45,12 +45,12 @@ const rules = clean([
|
|||
test: /sw\.js$/,
|
||||
exclude: /node_modules/,
|
||||
loader: 'babel-loader',
|
||||
options: babelDev
|
||||
options: babelDev,
|
||||
}]);
|
||||
|
||||
const plugins = [
|
||||
new EnvironmentPlugin({
|
||||
NODE_ENV: 'production'
|
||||
NODE_ENV: 'production',
|
||||
}),
|
||||
|
||||
new ServiceWorkerWebpackPlugin({
|
||||
|
|
@ -66,7 +66,7 @@ const splitChunks = {
|
|||
|
||||
module.exports = {
|
||||
resolve: {
|
||||
symlinks: false
|
||||
symlinks: false,
|
||||
},
|
||||
devtool,
|
||||
optimization: {
|
||||
|
|
@ -100,7 +100,7 @@ module.exports = {
|
|||
publicPath: '/dist/',
|
||||
},
|
||||
externals: [
|
||||
externals
|
||||
externals,
|
||||
],
|
||||
module: {
|
||||
rules,
|
||||
|
|
|
|||
|
|
@ -126,11 +126,11 @@ const args = require('minimist')(argv.slice(2), {
|
|||
u: 'username',
|
||||
s: 'save',
|
||||
a: 'auth',
|
||||
c: 'config'
|
||||
c: 'config',
|
||||
},
|
||||
unknown: (cmd) => {
|
||||
exit('\'%s\' is not a cloudcmd option. See \'cloudcmd --help\'.', cmd);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
if (args.version)
|
||||
|
|
@ -266,7 +266,7 @@ function readConfig(name) {
|
|||
const forEachKey = require('for-each-key');
|
||||
|
||||
const readjsonSync = (name) => jju.parse(fs.readFileSync(name, 'utf8'), {
|
||||
mode: 'json'
|
||||
mode: 'json',
|
||||
});
|
||||
|
||||
const [error, data] = tryCatch(readjsonSync, name);
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ function main(callback) {
|
|||
replaceVersion('HELP.md', version, versionNew, () => {
|
||||
const historyNew = history + rendy(template, {
|
||||
date : shortdate(),
|
||||
version : versionNew
|
||||
version : versionNew,
|
||||
});
|
||||
|
||||
replaceVersion('HELP.md', history, historyNew, callback);
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ function CloudCmdProto(DOM) {
|
|||
|
||||
const {
|
||||
Storage,
|
||||
Files
|
||||
Files,
|
||||
} = DOM;
|
||||
|
||||
this.log = log;
|
||||
|
|
@ -103,7 +103,7 @@ function CloudCmdProto(DOM) {
|
|||
panel,
|
||||
history,
|
||||
noCurrent,
|
||||
currentName
|
||||
currentName,
|
||||
} = p;
|
||||
|
||||
let panelChanged;
|
||||
|
|
@ -231,7 +231,7 @@ function CloudCmdProto(DOM) {
|
|||
|
||||
loadModule({
|
||||
path,
|
||||
func
|
||||
func,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -273,7 +273,7 @@ function CloudCmdProto(DOM) {
|
|||
// when hash is present
|
||||
// it should be handled with this.route
|
||||
// overwre otherwise
|
||||
history: !location.hash
|
||||
history: !location.hash,
|
||||
});
|
||||
|
||||
const dirPath = DOM.getCurrentDirPath();
|
||||
|
|
@ -446,8 +446,8 @@ function CloudCmdProto(DOM) {
|
|||
file : templFile,
|
||||
path : templPath,
|
||||
pathLink : templPathLink,
|
||||
link : templLink
|
||||
}
|
||||
link : templLink,
|
||||
},
|
||||
});
|
||||
|
||||
Listeners.setOnPanel(panel);
|
||||
|
|
@ -517,7 +517,7 @@ function CloudCmdProto(DOM) {
|
|||
const {
|
||||
dir,
|
||||
dirPath,
|
||||
parentDirPath
|
||||
parentDirPath,
|
||||
} = Info;
|
||||
|
||||
if (dirPath === parentDirPath)
|
||||
|
|
@ -531,7 +531,7 @@ function CloudCmdProto(DOM) {
|
|||
const first = DOM.getFiles(panel)[0];
|
||||
|
||||
DOM.setCurrentFile(current || first, {
|
||||
history
|
||||
history,
|
||||
});
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ function BufferProto() {
|
|||
cut : callIfEnabled.bind(null, cut),
|
||||
copy : callIfEnabled.bind(null, copy),
|
||||
clear : callIfEnabled.bind(null, clear),
|
||||
paste : callIfEnabled.bind(null, paste)
|
||||
paste : callIfEnabled.bind(null, paste),
|
||||
};
|
||||
|
||||
function showMessage(msg) {
|
||||
|
|
|
|||
|
|
@ -126,7 +126,7 @@ module.exports.getParentDirPath = (panel) => {
|
|||
*/
|
||||
module.exports.getNotCurrentDirPath = () => {
|
||||
const panel = DOM.getPanel({
|
||||
active: false
|
||||
active: false,
|
||||
});
|
||||
|
||||
return DOM.getCurrentDirPath(panel);
|
||||
|
|
@ -267,7 +267,7 @@ module.exports.setTitle = (name) => {
|
|||
if (!Title)
|
||||
Title = DOM.getByTag('title')[0] || createElement('title', {
|
||||
innerHTML: name,
|
||||
parent: document.head
|
||||
parent: document.head,
|
||||
});
|
||||
|
||||
Title.textContent = name;
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ test('current-file: setCurrentName: return', (t) => {
|
|||
const link = {};
|
||||
|
||||
global.DOM = getDOM({
|
||||
link
|
||||
link,
|
||||
});
|
||||
|
||||
global.CloudCmd = getCloudCmd();
|
||||
|
|
@ -153,7 +153,7 @@ test('current-file: isCurrentFile', (t) => {
|
|||
const isContainClass = stub();
|
||||
|
||||
global.DOM = getDOM({
|
||||
isContainClass
|
||||
isContainClass,
|
||||
});
|
||||
|
||||
global.CloudCmd = getCloudCmd();
|
||||
|
|
@ -190,7 +190,7 @@ function getDOM({
|
|||
CurrentInfo: {
|
||||
link,
|
||||
dirPath: '/',
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ function EventsProto() {
|
|||
return false;
|
||||
|
||||
return {
|
||||
passive: true
|
||||
passive: true,
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ function getSystemFile(file, callback) {
|
|||
load.ajax({
|
||||
url,
|
||||
success,
|
||||
error
|
||||
error,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ function getElement() {
|
|||
id: 'js-status-image',
|
||||
className: 'icon',
|
||||
dataName: 'progress',
|
||||
notAppend: true
|
||||
notAppend: true,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ function CmdProto() {
|
|||
const TITLE = 'Cloud Commander';
|
||||
const TabPanel = {
|
||||
'js-left' : null,
|
||||
'js-right' : null
|
||||
'js-right' : null,
|
||||
};
|
||||
|
||||
this.loadRemote = (name, options, callback) => {
|
||||
|
|
@ -57,7 +57,7 @@ function CmdProto() {
|
|||
|
||||
this.loadSocket = function(callback) {
|
||||
DOM.loadRemote('socket', {
|
||||
name : 'io'
|
||||
name : 'io',
|
||||
}, callback);
|
||||
|
||||
return DOM;
|
||||
|
|
@ -117,7 +117,7 @@ function CmdProto() {
|
|||
const currentName = name;
|
||||
|
||||
CloudCmd.refresh({
|
||||
currentName
|
||||
currentName,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
@ -686,7 +686,7 @@ function CmdProto() {
|
|||
*/
|
||||
this.hidePanel = (active) => {
|
||||
const panel = DOM.getPanel({
|
||||
active
|
||||
active,
|
||||
});
|
||||
|
||||
if (!panel)
|
||||
|
|
@ -769,7 +769,7 @@ function CmdProto() {
|
|||
|
||||
const files = {
|
||||
from : dirPath + from,
|
||||
to : dirPath + to
|
||||
to : dirPath + to,
|
||||
};
|
||||
|
||||
RESTful.mv(files, (error) => {
|
||||
|
|
@ -815,7 +815,7 @@ function CmdProto() {
|
|||
CloudCmd.emit('passive-dir', Info.dirPath);
|
||||
|
||||
const panelPassive = DOM.getPanel({
|
||||
active: false
|
||||
active: false,
|
||||
});
|
||||
|
||||
let name = DOM.getCurrentName();
|
||||
|
|
@ -848,7 +848,7 @@ function CmdProto() {
|
|||
}
|
||||
|
||||
DOM.setCurrentFile(current, {
|
||||
history: true
|
||||
history: true,
|
||||
});
|
||||
|
||||
CloudCmd.emit('active-dir', Info.dirPath);
|
||||
|
|
@ -869,7 +869,7 @@ function CmdProto() {
|
|||
const {Dialog} = DOM;
|
||||
const cancel = false;
|
||||
const setPath = (path) => ({
|
||||
path
|
||||
path,
|
||||
});
|
||||
|
||||
Dialog.prompt(TITLE, msg, path, {cancel})
|
||||
|
|
@ -905,7 +905,7 @@ function CmdProto() {
|
|||
panel,
|
||||
files,
|
||||
element,
|
||||
panelPassive
|
||||
panelPassive,
|
||||
} = Info;
|
||||
|
||||
const dirPath = DOM.getCurrentDirPath();
|
||||
|
|
@ -916,12 +916,12 @@ function CmdProto() {
|
|||
CloudCmd.loadDir({
|
||||
path: dirPath,
|
||||
panel: panelPassive,
|
||||
noCurrent: true
|
||||
noCurrent: true,
|
||||
});
|
||||
|
||||
CloudCmd.loadDir({
|
||||
path: dirPathPassive,
|
||||
panel
|
||||
panel,
|
||||
}, () => {
|
||||
const {files} = Info;
|
||||
const length = files.length - 1;
|
||||
|
|
@ -944,7 +944,7 @@ function CmdProto() {
|
|||
const panel = files.parentElement;
|
||||
|
||||
const panelPassive = DOM.getPanel({
|
||||
active: false
|
||||
active: false,
|
||||
});
|
||||
|
||||
const filesPassive = DOM.getFiles(panelPassive);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ module.exports = (name, options, callback = options) => {
|
|||
|
||||
const remoteURL = remoteTmpls.map((tmpl) => {
|
||||
return rendy(tmpl, {
|
||||
version
|
||||
version,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ function RESTful() {
|
|||
url : FS + url,
|
||||
data,
|
||||
callback,
|
||||
imgPosition : { top: !!data }
|
||||
imgPosition : { top: !!data },
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -39,7 +39,7 @@ function RESTful() {
|
|||
}
|
||||
|
||||
const imgPosition = {
|
||||
top: true
|
||||
top: true,
|
||||
};
|
||||
|
||||
sendRequest({
|
||||
|
|
@ -64,7 +64,7 @@ function RESTful() {
|
|||
url: FS + url,
|
||||
data,
|
||||
callback,
|
||||
imgPosition : { top: true }
|
||||
imgPosition : { top: true },
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -95,7 +95,7 @@ function RESTful() {
|
|||
url: '/cp',
|
||||
data,
|
||||
callback,
|
||||
imgPosition : { top: true }
|
||||
imgPosition : { top: true },
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -113,7 +113,7 @@ function RESTful() {
|
|||
method : 'PUT',
|
||||
url : '/extract',
|
||||
data,
|
||||
callback
|
||||
callback,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -123,7 +123,7 @@ function RESTful() {
|
|||
url : '/mv',
|
||||
data,
|
||||
callback,
|
||||
imgPosition : { top: true }
|
||||
imgPosition : { top: true },
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ function RESTful() {
|
|||
url : '/config',
|
||||
callback,
|
||||
imgPosition : { top: true },
|
||||
notLog : true
|
||||
notLog : true,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -144,9 +144,9 @@ function RESTful() {
|
|||
url : '/config',
|
||||
data,
|
||||
callback,
|
||||
imgPosition : { top: true }
|
||||
imgPosition : { top: true },
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
this.Markdown = {
|
||||
|
|
@ -156,7 +156,7 @@ function RESTful() {
|
|||
url : '/markdown' + url,
|
||||
callback,
|
||||
imgPosition : { top: true },
|
||||
notLog : true
|
||||
notLog : true,
|
||||
});
|
||||
},
|
||||
|
||||
|
|
@ -167,9 +167,9 @@ function RESTful() {
|
|||
data,
|
||||
callback,
|
||||
imgPosition : { top: true },
|
||||
notLog : true
|
||||
notLog : true,
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
function sendRequest(params) {
|
||||
|
|
@ -195,7 +195,7 @@ function RESTful() {
|
|||
|
||||
const {
|
||||
statusText,
|
||||
status
|
||||
status,
|
||||
} = jqXHR;
|
||||
|
||||
const text = status === 404 ? response : statusText;
|
||||
|
|
@ -216,7 +216,7 @@ function RESTful() {
|
|||
CloudCmd.log(data);
|
||||
|
||||
p.callback(null, data);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ module.exports = (dir, files) => {
|
|||
|
||||
function _onEnd(currentName) {
|
||||
CloudCmd.refresh({
|
||||
currentName
|
||||
currentName,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ module.exports.getName = (element) => {
|
|||
|
||||
module.exports.convert = (config) => {
|
||||
const result = {
|
||||
...config
|
||||
...config,
|
||||
};
|
||||
|
||||
const array = Object.keys(result);
|
||||
|
|
|
|||
|
|
@ -125,7 +125,7 @@ function KeyProto() {
|
|||
name,
|
||||
panel,
|
||||
path,
|
||||
isDir
|
||||
isDir,
|
||||
} = Info;
|
||||
|
||||
const {Operation} = CloudCmd;
|
||||
|
|
@ -386,7 +386,7 @@ function KeyProto() {
|
|||
case Key.ENTER:
|
||||
if (Info.isDir)
|
||||
CloudCmd.loadDir({
|
||||
path: path === '/' ? '/' : path + '/'
|
||||
path: path === '/' ? '/' : path + '/',
|
||||
});
|
||||
break;
|
||||
|
||||
|
|
@ -398,7 +398,7 @@ function KeyProto() {
|
|||
case Key.BACKSLASH:
|
||||
if (ctrlMeta)
|
||||
CloudCmd.loadDir({
|
||||
path: '/'
|
||||
path: '/',
|
||||
});
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -76,6 +76,6 @@ module.exports = {
|
|||
TRA : 192, /* Typewritten Reverse Apostrophe (`) */
|
||||
BACKSLASH : 220,
|
||||
|
||||
BRACKET_CLOSE: 221
|
||||
BRACKET_CLOSE: 221,
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ module.exports.getDOM = () => {
|
|||
};
|
||||
|
||||
const Dialog = {
|
||||
prompt: resolve
|
||||
prompt: resolve,
|
||||
};
|
||||
|
||||
return {
|
||||
|
|
@ -36,8 +36,8 @@ module.exports.getCloudCmd = () => {
|
|||
|
||||
return {
|
||||
Operation: {
|
||||
show
|
||||
}
|
||||
show,
|
||||
},
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ test('cloudcmd: client: key: set next file: no', (t) => {
|
|||
test('cloudcmd: client: key: set next file current', (t) => {
|
||||
const nextSibling = 'hello';
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -63,7 +63,7 @@ test('cloudcmd: client: key: set next file current', (t) => {
|
|||
test('cloudcmd: client: key: set next file current', (t) => {
|
||||
const nextSibling = 'hello';
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -83,7 +83,7 @@ test('cloudcmd: client: key: set next file current', (t) => {
|
|||
test('cloudcmd: client: key: set next file current: g', (t) => {
|
||||
const nextSibling = 'hello';
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -102,10 +102,10 @@ test('cloudcmd: client: key: set next file current: g', (t) => {
|
|||
test('cloudcmd: client: key: set +2 file current', (t) => {
|
||||
const last = {};
|
||||
const nextSibling = {
|
||||
nextSibling: last
|
||||
nextSibling: last,
|
||||
};
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -126,10 +126,10 @@ test('cloudcmd: client: key: set +2 file current', (t) => {
|
|||
test('cloudcmd: client: key: select +2 files from current before delete', (t) => {
|
||||
const last = {};
|
||||
const nextSibling = {
|
||||
nextSibling: last
|
||||
nextSibling: last,
|
||||
};
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -154,10 +154,10 @@ test('cloudcmd: client: key: select +2 files from current before delete', (t) =>
|
|||
test('cloudcmd: client: key: delete +2 files from current', (t) => {
|
||||
const last = {};
|
||||
const nextSibling = {
|
||||
nextSibling: last
|
||||
nextSibling: last,
|
||||
};
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -183,7 +183,7 @@ test('cloudcmd: client: key: delete +2 files from current', (t) => {
|
|||
test('cloudcmd: client: key: set previous file current', (t) => {
|
||||
const previousSibling = 'hello';
|
||||
const element = {
|
||||
previousSibling
|
||||
previousSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -277,10 +277,10 @@ test('cloudcmd: client: key: selectFile', (t) => {
|
|||
test('cloudcmd: client: key: set last file current', (t) => {
|
||||
const last = 'last';
|
||||
const nextSibling = {
|
||||
nextSibling: last
|
||||
nextSibling: last,
|
||||
};
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -298,11 +298,11 @@ test('cloudcmd: client: key: set last file current', (t) => {
|
|||
test('cloudcmd: client: key: set first file current', (t) => {
|
||||
const first = 'first';
|
||||
const previousSibling= {
|
||||
previousSibling: first
|
||||
previousSibling: first,
|
||||
};
|
||||
|
||||
const element = {
|
||||
previousSibling
|
||||
previousSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -344,7 +344,7 @@ test('cloudcmd: client: key: ESC', (t) => {
|
|||
global.DOM.unselectFiles = unselectFiles ;
|
||||
|
||||
vim('', {
|
||||
keyCode: KEY.ESC
|
||||
keyCode: KEY.ESC,
|
||||
});
|
||||
|
||||
t.ok(unselectFiles.calledWith(), 'should toggle selection');
|
||||
|
|
@ -355,7 +355,7 @@ test('cloudcmd: client: key: ESC', (t) => {
|
|||
test('cloudcmd: client: key: Enter', (t) => {
|
||||
const nextSibling = 'hello';
|
||||
const element = {
|
||||
nextSibling
|
||||
nextSibling,
|
||||
};
|
||||
|
||||
const setCurrentFile = stub();
|
||||
|
|
@ -364,7 +364,7 @@ test('cloudcmd: client: key: Enter', (t) => {
|
|||
DOM.setCurrentFile = setCurrentFile;
|
||||
|
||||
vim('', {
|
||||
keyCode: KEY.ENTER
|
||||
keyCode: KEY.ENTER,
|
||||
});
|
||||
|
||||
vim('j', {});
|
||||
|
|
@ -382,7 +382,7 @@ test('cloudcmd: client: key: /', (t) => {
|
|||
DOM.getCurrentName = () => '';
|
||||
|
||||
vim('/', {
|
||||
preventDefault
|
||||
preventDefault,
|
||||
});
|
||||
|
||||
t.ok(preventDefault.calledWith(), 'should call preventDefault');
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ function onPathElementClick(panel, event) {
|
|||
if (attr === 'js-refresh')
|
||||
return CloudCmd.refresh({
|
||||
panel,
|
||||
noCurrent
|
||||
noCurrent,
|
||||
});
|
||||
|
||||
if (attr !== 'js-path-link')
|
||||
|
|
@ -213,7 +213,7 @@ function onPathElementClick(panel, event) {
|
|||
CloudCmd.loadDir({
|
||||
path,
|
||||
isRefresh: false,
|
||||
panel: noCurrent ? panel : Info.panel
|
||||
panel: noCurrent ? panel : Info.panel,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ function onDblClick(event) {
|
|||
|
||||
if (isDir) {
|
||||
CloudCmd.loadDir({
|
||||
path: path === '/' ? '/' : path + '/'
|
||||
path: path === '/' ? '/' : path + '/',
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
|
|
@ -291,7 +291,7 @@ function onTouch(event) {
|
|||
return;
|
||||
|
||||
CloudCmd.loadDir({
|
||||
path: DOM.getCurrentPath(current)
|
||||
path: DOM.getCurrentPath(current),
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ function setCurrentFileByEvent(event) {
|
|||
alt: event.altKey,
|
||||
ctrl: event.ctrlKey,
|
||||
meta: event.metaKey,
|
||||
shift: event.shiftKey
|
||||
shift: event.shiftKey,
|
||||
};
|
||||
|
||||
const element = getLIElement(event.target);
|
||||
|
|
@ -381,7 +381,7 @@ function contextMenu() {
|
|||
Events.addOnce('contextmenu', fm, (event) => {
|
||||
CloudCmd.Menu.show({
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
y: event.clientY,
|
||||
});
|
||||
});
|
||||
|
||||
|
|
@ -407,7 +407,7 @@ function dragndrop() {
|
|||
const onDrop = (event) => {
|
||||
const {
|
||||
files,
|
||||
items
|
||||
items,
|
||||
} = event.dataTransfer;
|
||||
|
||||
const {length: filesCount} = files;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ module.exports.init = async () => {
|
|||
|
||||
const {
|
||||
config,
|
||||
Key
|
||||
Key,
|
||||
} = CloudCmd;
|
||||
|
||||
let Element;
|
||||
|
|
@ -84,7 +84,7 @@ function initSocket() {
|
|||
const socket = io.connect(href + prefixSocket + '/config', {
|
||||
reconnectionAttempts: Infinity,
|
||||
reconnectionDelay: ONE_MINUTE,
|
||||
path: prefix + '/socket.io'
|
||||
path: prefix + '/socket.io',
|
||||
});
|
||||
|
||||
const save = (data) => {
|
||||
|
|
@ -237,7 +237,7 @@ function onAuthChange(checked) {
|
|||
|
||||
function onNameChange(name) {
|
||||
setTitle(getTitle({
|
||||
name
|
||||
name,
|
||||
}));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const ConfigView = {
|
|||
beforeClose: () => {
|
||||
Events.rmKey(listener);
|
||||
CloudCmd.EditFile.isChanged();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.init = async () => {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ const Info = DOM.CurrentInfo;
|
|||
|
||||
const {
|
||||
Dialog,
|
||||
Images
|
||||
Images,
|
||||
} = DOM;
|
||||
|
||||
const {config} = CloudCmd;
|
||||
|
|
@ -29,7 +29,7 @@ const ConfigView = {
|
|||
beforeClose: () => {
|
||||
exec.ifExist(Menu, 'hide');
|
||||
isChanged();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.init = async () => {
|
||||
|
|
@ -118,7 +118,7 @@ function authCheck(spawn) {
|
|||
function setMenu(event) {
|
||||
const position = {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
y: event.clientY,
|
||||
};
|
||||
|
||||
event.preventDefault();
|
||||
|
|
@ -136,7 +136,7 @@ function setMenu(event) {
|
|||
CloudCmd.Edit
|
||||
.getEditor()
|
||||
.focus();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const element = CloudCmd.Edit.getElement();
|
||||
|
|
@ -178,7 +178,7 @@ function getMenuData() {
|
|||
},
|
||||
'Close Esc' : () => {
|
||||
hide();
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const ConfigView = {
|
|||
beforeClose: () => {
|
||||
Events.rmKey(listener);
|
||||
CloudCmd.EditNames.isChanged();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.init = async () => {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const ConfigView = {
|
|||
exec.ifExist(Menu, 'hide');
|
||||
DOM.Events.remove('keydown', keyListener);
|
||||
isChanged();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.init = async () => {
|
||||
|
|
@ -39,7 +39,7 @@ module.exports.init = async () => {
|
|||
module.exports.show = (options) => {
|
||||
const names = getActiveNames().join('\n');
|
||||
const config = {
|
||||
...ConfigView,
|
||||
...ConfigView,
|
||||
...options,
|
||||
};
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ function _refresh(to, nameIndex, res) {
|
|||
const currentName = to[nameIndex];
|
||||
|
||||
CloudCmd.refresh({
|
||||
currentName
|
||||
currentName,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -133,14 +133,14 @@ function _rename(path, from, to, root) {
|
|||
from,
|
||||
to,
|
||||
dir,
|
||||
})
|
||||
}),
|
||||
});
|
||||
}
|
||||
|
||||
function setMenu(event) {
|
||||
const position = {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
y: event.clientY,
|
||||
};
|
||||
|
||||
event.preventDefault();
|
||||
|
|
@ -157,7 +157,7 @@ function setMenu(event) {
|
|||
|
||||
afterClick: () => {
|
||||
editor.focus();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const menuData = {
|
||||
|
|
@ -185,7 +185,7 @@ function setMenu(event) {
|
|||
},
|
||||
'Close Esc' : () => {
|
||||
EditNames.hide();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const element = CloudCmd.Edit.getElement();
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ const ConfigView = {
|
|||
editor
|
||||
.moveCursorTo(0, 0)
|
||||
.focus();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
module.exports.init = async () => {
|
||||
|
|
@ -42,7 +42,7 @@ function create() {
|
|||
'width : 100%;' +
|
||||
'height : 100%;' +
|
||||
'font-family: "Droid Sans Mono";',
|
||||
notAppend: true
|
||||
notAppend: true,
|
||||
});
|
||||
|
||||
Element = element;
|
||||
|
|
|
|||
|
|
@ -67,7 +67,7 @@ function getEnv() {
|
|||
CURRENT_NAME: DOM.getCurrentName.bind(DOM),
|
||||
CURRENT_PATH: () => {
|
||||
return Info.path;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -111,7 +111,7 @@ const create = async () => {
|
|||
const path = DOM.getCurrentDirPath();
|
||||
|
||||
konsole.setPromptText(command + path);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -134,7 +134,7 @@ module.exports.show = (callback) => {
|
|||
afterShow: () => {
|
||||
konsole.focus();
|
||||
exec(callback);
|
||||
}
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ const load = async () => {
|
|||
|
||||
if (error)
|
||||
return Dialog.alert(TITLE, error.message, {
|
||||
cancel: false
|
||||
cancel: false,
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ const RESTful = require('../dom/rest');
|
|||
|
||||
const {
|
||||
config,
|
||||
Key
|
||||
Key,
|
||||
} = CloudCmd;
|
||||
|
||||
const {
|
||||
Buffer,
|
||||
Events,
|
||||
Dialog,
|
||||
Images
|
||||
Images,
|
||||
} = DOM;
|
||||
|
||||
const Info = DOM.CurrentInfo;
|
||||
|
|
@ -116,13 +116,13 @@ function getMenuData(isAuth) {
|
|||
'Paste': Buffer.paste,
|
||||
'New': {
|
||||
'File': DOM.promptNewFile,
|
||||
'Directory': DOM.promptNewDir
|
||||
'Directory': DOM.promptNewDir,
|
||||
},
|
||||
'Upload': () => {
|
||||
CloudCmd.Upload.show();
|
||||
},
|
||||
'Upload From Cloud': uploadFromCloud,
|
||||
'(Un)Select All': DOM.toggleAllSelectedFiles
|
||||
'(Un)Select All': DOM.toggleAllSelectedFiles,
|
||||
};
|
||||
|
||||
if (isAuth)
|
||||
|
|
@ -199,7 +199,7 @@ function beforeShow(callback, params) {
|
|||
const {name} = params;
|
||||
const el = DOM.getCurrentByPosition({
|
||||
x: params.x,
|
||||
y: params.y
|
||||
y: params.y,
|
||||
});
|
||||
|
||||
const menuName = getMenuNameByEl(el);
|
||||
|
|
@ -311,7 +311,7 @@ function getCurrentPosition() {
|
|||
|
||||
const position = {
|
||||
x: Math.round(rect.left + rect.width / 3),
|
||||
y: Math.round(rect.top)
|
||||
y: Math.round(rect.top),
|
||||
};
|
||||
|
||||
return position;
|
||||
|
|
@ -320,7 +320,7 @@ function getCurrentPosition() {
|
|||
function listener(event) {
|
||||
const {
|
||||
F9,
|
||||
ESC
|
||||
ESC,
|
||||
} = Key;
|
||||
|
||||
const key = event.keyCode;
|
||||
|
|
|
|||
|
|
@ -75,7 +75,7 @@ module.exports.init = promisify((callback) => {
|
|||
Loaded = true;
|
||||
Images.hide();
|
||||
callback();
|
||||
}
|
||||
},
|
||||
], callback);
|
||||
});
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ Operation.copy = processFiles({
|
|||
});
|
||||
|
||||
Operation.move = processFiles({
|
||||
type: 'move'
|
||||
type: 'move',
|
||||
});
|
||||
|
||||
Operation.delete = () => {
|
||||
|
|
@ -391,7 +391,7 @@ function twopack(operation, type) {
|
|||
|
||||
const {
|
||||
path,
|
||||
dirPath
|
||||
dirPath,
|
||||
} = Info;
|
||||
|
||||
const activeFiles = DOM.getActiveFiles();
|
||||
|
|
@ -408,7 +408,7 @@ function twopack(operation, type) {
|
|||
|
||||
fileFrom = {
|
||||
from: path,
|
||||
to: dirPath
|
||||
to: dirPath,
|
||||
};
|
||||
|
||||
currentName = removeExtension(currentName);
|
||||
|
|
@ -435,7 +435,7 @@ function twopack(operation, type) {
|
|||
|
||||
op(fileFrom, (error) => {
|
||||
!error && CloudCmd.refresh({
|
||||
currentName
|
||||
currentName,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ module.exports = (options, callback) => (emitter) => {
|
|||
}, () => {
|
||||
emitter.abort();
|
||||
});
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
forEachKey(on, listeners);
|
||||
|
|
|
|||
|
|
@ -6,6 +6,6 @@ require('domtokenlist-shim');
|
|||
|
||||
const scrollIntoViewIfNeeded = require('scroll-into-view-if-needed').default;
|
||||
DOM.scrollIntoViewIfNeeded = (el) => scrollIntoViewIfNeeded(el, {
|
||||
block: 'nearest'
|
||||
block: 'nearest',
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ test('cloudcmd: client: polyfill: scrollIntoViewIfNeaded', (t) => {
|
|||
global.DOM = {};
|
||||
|
||||
mockRequire('scroll-into-view-if-needed', {
|
||||
default: scroll
|
||||
default: scroll,
|
||||
});
|
||||
|
||||
mockRequire.reRequire('./polyfill');
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ const TITLE = 'Terminal';
|
|||
const {Dialog} = DOM;
|
||||
const {
|
||||
Key,
|
||||
config
|
||||
config,
|
||||
} = CloudCmd;
|
||||
|
||||
CloudCmd.Terminal = exports;
|
||||
|
|
@ -121,7 +121,7 @@ function show(callback) {
|
|||
Terminal.focus();
|
||||
|
||||
exec(callback);
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ function show() {
|
|||
'"Droid Sans Mono"',
|
||||
'"Ubuntu Mono"',
|
||||
'"Consolas"',
|
||||
'monospace'
|
||||
'monospace',
|
||||
].join(', ');
|
||||
|
||||
createElement('style', {
|
||||
|
|
@ -46,7 +46,7 @@ function show() {
|
|||
`font-family: ${fontFamily};` +
|
||||
'font-size: 20px;' +
|
||||
'width: 97%' +
|
||||
'}'
|
||||
'}',
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -130,8 +130,8 @@ function viewMedia(path) {
|
|||
element
|
||||
.querySelector('audio, video')
|
||||
.focus();
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
modal.open(element, allConfig);
|
||||
|
|
@ -158,7 +158,7 @@ function viewFile() {
|
|||
|
||||
function initConfig(Config, options) {
|
||||
const config = {
|
||||
...Config
|
||||
...Config,
|
||||
};
|
||||
|
||||
if (!options)
|
||||
|
|
@ -209,8 +209,8 @@ function viewImage(prefixURL) {
|
|||
arrows : true,
|
||||
keys : true,
|
||||
helpers : {
|
||||
title : {}
|
||||
}
|
||||
title : {},
|
||||
},
|
||||
};
|
||||
|
||||
const config = {
|
||||
|
|
@ -229,7 +229,7 @@ function isImage(name) {
|
|||
'bmp',
|
||||
'webp',
|
||||
'svg',
|
||||
'ico'
|
||||
'ico',
|
||||
];
|
||||
|
||||
return images
|
||||
|
|
@ -311,7 +311,7 @@ async function loadAll() {
|
|||
function onOverlayClick(event) {
|
||||
const position = {
|
||||
x: event.clientX,
|
||||
y: event.clientY
|
||||
y: event.clientY,
|
||||
};
|
||||
|
||||
setCurrentByPosition(position);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const Info = DOM.CurrentInfo;
|
|||
|
||||
const {
|
||||
sort,
|
||||
order
|
||||
order,
|
||||
} = CloudCmd;
|
||||
|
||||
const position = DOM.getPanelPosition();
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ const date = codegen`module.exports = '"' + Date() + '"'`;
|
|||
const NAME = `cloudcmd: ${date}`;
|
||||
|
||||
const createRequest = (a) => new Request(a, {
|
||||
credentials: 'same-origin'
|
||||
credentials: 'same-origin',
|
||||
});
|
||||
|
||||
const getRequest = (a, request) => {
|
||||
|
|
@ -82,7 +82,7 @@ async function onFetch(event) {
|
|||
return response;
|
||||
|
||||
const [e, resp] = await tryToCatch(fetch, newRequest, {
|
||||
credentials: 'same-origin'
|
||||
credentials: 'same-origin',
|
||||
});
|
||||
|
||||
if (e)
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ const getDataName = (name) => {
|
|||
module.exports.buildFromJSON = (params) => {
|
||||
const {
|
||||
prefix,
|
||||
template
|
||||
template,
|
||||
} = params;
|
||||
|
||||
const templateFile = template.file;
|
||||
|
|
@ -168,7 +168,7 @@ module.exports.buildFromJSON = (params) => {
|
|||
const linkResult = rendy(template.link, {
|
||||
link,
|
||||
title : '..',
|
||||
name : '..'
|
||||
name : '..',
|
||||
});
|
||||
|
||||
const dataName = 'data-name="js-file-.." ';
|
||||
|
|
@ -184,7 +184,7 @@ module.exports.buildFromJSON = (params) => {
|
|||
size : '<dir>',
|
||||
date : '--.--.----',
|
||||
owner : '.',
|
||||
mode : '--- --- ---'
|
||||
mode : '--- --- ---',
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -194,7 +194,7 @@ module.exports.buildFromJSON = (params) => {
|
|||
|
||||
const {
|
||||
type,
|
||||
mode
|
||||
mode,
|
||||
} = file;
|
||||
const size = getSize(file);
|
||||
|
||||
|
|
@ -205,7 +205,7 @@ module.exports.buildFromJSON = (params) => {
|
|||
link,
|
||||
title: name,
|
||||
name,
|
||||
attribute: getAttribute(file.type)
|
||||
attribute: getAttribute(file.type),
|
||||
});
|
||||
|
||||
const dataName = getDataName(file.name);
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ module.exports = defaultPreset({
|
|||
plugins: [
|
||||
{convertPathData: false},
|
||||
{convertShapeToPath: false},
|
||||
]
|
||||
}
|
||||
],
|
||||
},
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@ const config = require('./config');
|
|||
|
||||
module.exports = () => {
|
||||
const auth = httpAuth.basic({
|
||||
realm: 'Cloud Commander'
|
||||
realm: 'Cloud Commander',
|
||||
}, check);
|
||||
|
||||
return middle(auth);
|
||||
|
|
|
|||
|
|
@ -220,16 +220,16 @@ function cloudcmd(prefix, plugins, modules) {
|
|||
|
||||
restafary({
|
||||
prefix: cloudfunc.apiURL + '/fs',
|
||||
root
|
||||
root,
|
||||
}),
|
||||
|
||||
rest,
|
||||
route({
|
||||
html: defaultHtml
|
||||
html: defaultHtml,
|
||||
}),
|
||||
|
||||
pluginer(plugins),
|
||||
ponseStatic
|
||||
ponseStatic,
|
||||
]);
|
||||
|
||||
return funcs;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const {request} = require('serve-once')(cloudcmd, {
|
|||
config: {
|
||||
auth: false,
|
||||
dropbox: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
test('cloudcmd: args: no', (t) => {
|
||||
|
|
@ -33,7 +33,7 @@ test('cloudcmd: args: no', (t) => {
|
|||
|
||||
test('cloudcmd: args: plugins: error', (t) => {
|
||||
const fn = () => cloudcmd({
|
||||
plugins: ''
|
||||
plugins: '',
|
||||
});
|
||||
|
||||
t.throws(fn, /plugins should be an array!/, 'should throw when plugins not an array');
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ const ConfigHome = path.join(HOME, '.cloudcmd.json');
|
|||
|
||||
const readjsonSync = (name) => {
|
||||
return jju.parse(fs.readFileSync(name, 'utf8'), {
|
||||
mode: 'json'
|
||||
mode: 'json',
|
||||
});
|
||||
};
|
||||
|
||||
|
|
@ -172,7 +172,7 @@ function get(request, response) {
|
|||
name : 'config.json',
|
||||
request,
|
||||
response,
|
||||
cache : false
|
||||
cache : false,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ test('config: manage: get', async (t) => {
|
|||
const editor = 'deepword';
|
||||
|
||||
const {done} = await connect({
|
||||
config: {editor}
|
||||
config: {editor},
|
||||
});
|
||||
|
||||
done();
|
||||
|
|
@ -34,7 +34,7 @@ test('config: manage: get', async (t) => {
|
|||
test('config: manage: get', async (t) => {
|
||||
const editor = 'deepword';
|
||||
const conf = {
|
||||
editor
|
||||
editor,
|
||||
};
|
||||
|
||||
const {done} = await connect({config: conf});
|
||||
|
|
@ -103,7 +103,7 @@ test('config: middle: no', (t) => {
|
|||
const method = 'POST';
|
||||
const req = {
|
||||
url,
|
||||
method
|
||||
method,
|
||||
};
|
||||
|
||||
middle(req, res, next);
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ const {
|
|||
makeColor,
|
||||
getMessage,
|
||||
getDescription,
|
||||
logWraped
|
||||
logWraped,
|
||||
} = log;
|
||||
|
||||
const omitList = [
|
||||
|
|
@ -72,7 +72,7 @@ function getHost(socket) {
|
|||
const {
|
||||
name,
|
||||
port,
|
||||
color
|
||||
color,
|
||||
} = socket.handshake.query;
|
||||
|
||||
if (!name)
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ test('distribute: export', async (t) => {
|
|||
};
|
||||
|
||||
const {port, done} = await connect({
|
||||
config: defaultConfig
|
||||
config: defaultConfig,
|
||||
});
|
||||
|
||||
const url = `http://localhost:${port}/distribute?port=${1111}`;
|
||||
|
|
@ -49,7 +49,7 @@ test('distribute: export: config', async (t) => {
|
|||
};
|
||||
|
||||
const {port, done} = await connect({
|
||||
config: defaultConfig
|
||||
config: defaultConfig,
|
||||
});
|
||||
|
||||
const url = `http://localhost:${port}/distribute?port=${1111}`;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const {
|
|||
stringToRGB,
|
||||
getMessage,
|
||||
getDescription,
|
||||
logWraped
|
||||
logWraped,
|
||||
} = log;
|
||||
|
||||
const equal = (a, b) => `${a}=${b}`;
|
||||
|
|
@ -54,7 +54,7 @@ const canceled = (f) => f(null, {
|
|||
});
|
||||
|
||||
const done = wraptile((fn, store) => fn(null, {
|
||||
status: store()
|
||||
status: store(),
|
||||
}));
|
||||
|
||||
const emitAuth = wraptile((importUrl, socket) => {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ test('distribute: import: canceled', async (t) => {
|
|||
import: false,
|
||||
importListen: false,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const {status} = await distribute.import();
|
||||
|
|
@ -34,7 +34,7 @@ test('distribute: import: received: no error', async (t) => {
|
|||
importListen: false,
|
||||
export: true,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
config('importUrl', `http://localhost:${port}`);
|
||||
|
|
@ -57,7 +57,7 @@ test('distribute: import: received', async (t) => {
|
|||
export: true,
|
||||
importListen: false,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
config('importUrl', `http://localhost:${port}`);
|
||||
|
|
@ -79,7 +79,7 @@ test('distribute: import: received: auth: reject', async (t) => {
|
|||
export: true,
|
||||
importListen: false,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
config('importUrl', `http://localhost:${port}`);
|
||||
|
|
@ -101,7 +101,7 @@ test('distribute: import: received: auth: accept', async (t) => {
|
|||
export: true,
|
||||
importListen: false,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
config('importUrl', `http://localhost:${port}`);
|
||||
|
|
@ -121,7 +121,7 @@ test('distribute: import: received: no name', async (t) => {
|
|||
export: true,
|
||||
importListen: false,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
config('importUrl', `http://localhost:${port}`);
|
||||
|
|
@ -140,7 +140,7 @@ test('distribute: import: error', async (t) => {
|
|||
export: false,
|
||||
importListen: false,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
config('importUrl', `http://localhost:0`);
|
||||
|
|
@ -162,7 +162,7 @@ test('distribute: import: config:change: no export', async (t) => {
|
|||
export: false,
|
||||
importListen: true,
|
||||
log: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
const {status} = await distribute.import({
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ test('distribute: log: getMessage', (t) => {
|
|||
test('distribute: log: getMessage: message', (t) => {
|
||||
const message = 'hello';
|
||||
const result = log.getMessage({
|
||||
message
|
||||
message,
|
||||
});
|
||||
|
||||
t.equal(result, message, 'should equal');
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ module.exports = net.createServer((socket) => {
|
|||
input: socket,
|
||||
output: socket,
|
||||
terminal: true,
|
||||
useGlobal: false
|
||||
useGlobal: false,
|
||||
});
|
||||
|
||||
r.on('exit', () => {
|
||||
|
|
|
|||
|
|
@ -121,7 +121,7 @@ function onGET(params, callback) {
|
|||
|
||||
default:
|
||||
callback({
|
||||
message: 'Not Found'
|
||||
message: 'Not Found',
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
|
@ -139,7 +139,7 @@ function streamPack(cmd, response) {
|
|||
const filename = cmd.replace(getPackReg(), '');
|
||||
const dir = path.dirname(filename);
|
||||
const names = [
|
||||
path.basename(filename)
|
||||
path.basename(filename),
|
||||
];
|
||||
|
||||
operation('pack', dir, response, names, noop);
|
||||
|
|
@ -230,7 +230,7 @@ function pack(from, to, names, fn) {
|
|||
|
||||
if (!names) {
|
||||
names = [
|
||||
path.basename(from)
|
||||
path.basename(from),
|
||||
];
|
||||
|
||||
from = path.dirname(from);
|
||||
|
|
@ -264,7 +264,7 @@ function operation(op, from, to, names, fn) {
|
|||
if (!fn) {
|
||||
fn = names;
|
||||
names = [
|
||||
path.basename(from)
|
||||
path.basename(from),
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ test('cloudcmd: root: mellow', (t) => {
|
|||
const pathToWin = stub();
|
||||
|
||||
const mellow = {
|
||||
pathToWin
|
||||
pathToWin,
|
||||
};
|
||||
|
||||
mockRequire('mellow', mellow);
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ const prefix = squad(prefixer, apart(config, 'prefix'));
|
|||
const sendIndex = (params, data) => {
|
||||
const ponseParams = {
|
||||
...params,
|
||||
name: 'index.html'
|
||||
name: 'index.html',
|
||||
};
|
||||
|
||||
ponse.send(data, ponseParams);
|
||||
|
|
@ -97,7 +97,7 @@ async function route(options, request, response) {
|
|||
ponse.sendFile({
|
||||
...p,
|
||||
name: realPathError ? name : pathReal,
|
||||
gzip: false
|
||||
gzip: false,
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -142,7 +142,7 @@ function indexProcessing(options) {
|
|||
const left = rendy(Template.panel, {
|
||||
side : 'left',
|
||||
content : panel,
|
||||
className : !oneFilePanel ? '' : 'panel-single'
|
||||
className : !oneFilePanel ? '' : 'panel-single',
|
||||
});
|
||||
|
||||
let right = '';
|
||||
|
|
@ -150,7 +150,7 @@ function indexProcessing(options) {
|
|||
right = rendy(Template.panel, {
|
||||
side : 'right',
|
||||
content : panel,
|
||||
className : ''
|
||||
className : '',
|
||||
});
|
||||
|
||||
const name = config('name');
|
||||
|
|
@ -187,11 +187,11 @@ function hideKeysPanel(html) {
|
|||
const keysPanelRegExp = '<div id="?js-keyspanel"? class="?{{ className }}"?';
|
||||
|
||||
const from = rendy(keysPanelRegExp, {
|
||||
className: 'keyspanel'
|
||||
className: 'keyspanel',
|
||||
});
|
||||
|
||||
const to = rendy(keysPanel, {
|
||||
className: 'keyspanel hidden'
|
||||
className: 'keyspanel hidden',
|
||||
});
|
||||
|
||||
return html.replace(RegExp(from), to);
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ const {request} = serveOnce(cloudcmd, {
|
|||
test('cloudcmd: route: buttons: no console', async (t) => {
|
||||
const options = {
|
||||
config: {
|
||||
console: false
|
||||
console: false,
|
||||
},
|
||||
};
|
||||
|
||||
|
|
@ -58,7 +58,7 @@ test('cloudcmd: route: buttons: console', async (t) => {
|
|||
|
||||
test('cloudcmd: route: buttons: no config', async (t) => {
|
||||
const config = {
|
||||
configDialog: false
|
||||
configDialog: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -75,7 +75,7 @@ test('cloudcmd: route: buttons: no config', async (t) => {
|
|||
|
||||
test('cloudcmd: route: buttons: no contact', async (t) => {
|
||||
const config = {
|
||||
contact: false
|
||||
contact: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -92,7 +92,7 @@ test('cloudcmd: route: buttons: no contact', async (t) => {
|
|||
|
||||
test('cloudcmd: route: buttons: one file panel: move', async (t) => {
|
||||
const config = {
|
||||
oneFilePanel: true
|
||||
oneFilePanel: true,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -109,7 +109,7 @@ test('cloudcmd: route: buttons: one file panel: move', async (t) => {
|
|||
|
||||
test('cloudcmd: route: buttons: no one file panel: move', async (t) => {
|
||||
const config = {
|
||||
oneFilePanel: false
|
||||
oneFilePanel: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -126,7 +126,7 @@ test('cloudcmd: route: buttons: no one file panel: move', async (t) => {
|
|||
|
||||
test('cloudcmd: route: buttons: one file panel: move', async (t) => {
|
||||
const config = {
|
||||
oneFilePanel: true
|
||||
oneFilePanel: true,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -143,7 +143,7 @@ test('cloudcmd: route: buttons: one file panel: move', async (t) => {
|
|||
|
||||
test('cloudcmd: route: keys panel: hide', async (t) => {
|
||||
const config = {
|
||||
keysPanel: false
|
||||
keysPanel: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -160,7 +160,7 @@ test('cloudcmd: route: keys panel: hide', async (t) => {
|
|||
|
||||
test('cloudcmd: route: keys panel', async (t) => {
|
||||
const config = {
|
||||
keysPanel: true
|
||||
keysPanel: true,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -257,7 +257,7 @@ test('cloudcmd: route: realpath: error', async (t) => {
|
|||
const cloudcmd = reRequire(cloudcmdPath);
|
||||
|
||||
const {request} = serveOnce(cloudcmd, {
|
||||
config: defaultConfig
|
||||
config: defaultConfig,
|
||||
});
|
||||
|
||||
const {body} = await request.get('/fs/empty-file', {
|
||||
|
|
@ -283,7 +283,7 @@ test('cloudcmd: route: sendIndex: encode', async (t) => {
|
|||
});
|
||||
|
||||
mockRequire('flop', {
|
||||
read
|
||||
read,
|
||||
});
|
||||
|
||||
reRequire(routePath);
|
||||
|
|
@ -310,7 +310,7 @@ test('cloudcmd: route: sendIndex: encode: not encoded', async (t) => {
|
|||
});
|
||||
|
||||
mockRequire('flop', {
|
||||
read
|
||||
read,
|
||||
});
|
||||
|
||||
reRequire(routePath);
|
||||
|
|
@ -337,7 +337,7 @@ test('cloudcmd: route: sendIndex: ddos: render', async (t) => {
|
|||
});
|
||||
|
||||
mockRequire('flop', {
|
||||
read
|
||||
read,
|
||||
});
|
||||
|
||||
reRequire(routePath);
|
||||
|
|
@ -357,7 +357,7 @@ test('cloudcmd: route: sendIndex: ddos: render', async (t) => {
|
|||
|
||||
test('cloudcmd: route: buttons: no terminal', async (t) => {
|
||||
const config = {
|
||||
terminal: false
|
||||
terminal: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -365,7 +365,7 @@ test('cloudcmd: route: buttons: no terminal', async (t) => {
|
|||
};
|
||||
|
||||
const {body} = await request.get('/', {
|
||||
options
|
||||
options,
|
||||
});
|
||||
|
||||
t.ok(/icon-terminal none/.test(body), 'should hide terminal');
|
||||
|
|
@ -374,7 +374,7 @@ test('cloudcmd: route: buttons: no terminal', async (t) => {
|
|||
|
||||
test('cloudcmd: route: no termianl: /fs', async (t) => {
|
||||
const config = {
|
||||
terminal: false
|
||||
terminal: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -401,7 +401,7 @@ test('cloudcmd: route: buttons: terminal: can not load', async (t) => {
|
|||
};
|
||||
|
||||
const {body} = await request.get('/', {
|
||||
options
|
||||
options,
|
||||
});
|
||||
|
||||
t.ok(/icon-terminal none/.test(body), 'should not enable terminal');
|
||||
|
|
@ -419,7 +419,7 @@ test('cloudcmd: route: buttons: terminal', async (t) => {
|
|||
};
|
||||
|
||||
const {body} = await request.get('/', {
|
||||
options
|
||||
options,
|
||||
});
|
||||
|
||||
t.notOk(/icon-terminal none/.test(body), 'should not enable terminal');
|
||||
|
|
@ -437,7 +437,7 @@ test('cloudcmd: route: buttons: contact', async (t) => {
|
|||
|
||||
const {request} = serveOnce(cloudcmd);
|
||||
const {body} = await request.get('/', {
|
||||
options
|
||||
options,
|
||||
});
|
||||
|
||||
t.notOk(/icon-contact none/.test(body), 'should enable terminal');
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ module.exports = (config) => {
|
|||
1: {
|
||||
width: 30,
|
||||
truncate: 30,
|
||||
}
|
||||
},
|
||||
},
|
||||
border: getBorderCharacters('ramac'),
|
||||
});
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ const cloudcmd = require(cloudcmdPath);
|
|||
|
||||
test('validate: root: bad', (t) => {
|
||||
const config = {
|
||||
root: Math.random()
|
||||
root: Math.random(),
|
||||
};
|
||||
|
||||
const [e] = tryCatch(cloudcmd, {config});
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ module.exports.connect = promisify((options, fn = options) => {
|
|||
function defaultConfig() {
|
||||
return {
|
||||
auth: false,
|
||||
root: __dirname
|
||||
root: __dirname,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ const JSON_FILES = {
|
|||
uid : 0,
|
||||
mode: 'rwx r-x r-x',
|
||||
type: 'file',
|
||||
}]
|
||||
}],
|
||||
};
|
||||
|
||||
let Expect =
|
||||
|
|
@ -74,7 +74,7 @@ test('cloudfunc: render', (t) => {
|
|||
const result = CloudFunc.buildFromJSON({
|
||||
prefix : '',
|
||||
data : JSON_FILES,
|
||||
template
|
||||
template,
|
||||
});
|
||||
|
||||
Expect += expect;
|
||||
|
|
@ -147,7 +147,7 @@ test('cloudfunc: getTitle: no name', (t) => {
|
|||
const path = '/hello/world';
|
||||
|
||||
const result = CloudFunc.getTitle({
|
||||
path
|
||||
path,
|
||||
});
|
||||
|
||||
t.equal(result, 'Cloud Commander - /hello/world');
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ test('util: findObjByNameInArr: array', (t) => {
|
|||
name, [
|
||||
obj,
|
||||
item,
|
||||
]
|
||||
],
|
||||
];
|
||||
|
||||
const result = findObjByNameInArr(array, name);
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ test('cloudcmd: plugins: empty', async (t) => {
|
|||
|
||||
test('cloudcmd: plugins: one', async (t) => {
|
||||
const plugins = [
|
||||
__filename
|
||||
__filename,
|
||||
];
|
||||
|
||||
const options = {
|
||||
|
|
@ -49,7 +49,7 @@ test('cloudcmd: plugins: load error', async (t) => {
|
|||
const noEntry = __filename + Math.random();
|
||||
const plugins = [
|
||||
__filename,
|
||||
noEntry
|
||||
noEntry,
|
||||
];
|
||||
|
||||
const msg = `ENOENT: no such file or directory, open '${noEntry}'`;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ const pathConfig = path.join(os.homedir(), '.cloudcmd.json');
|
|||
|
||||
test('cloudcmd: rest: config: get', async (t) => {
|
||||
const {body} = await request.get('/api/v1/config', {
|
||||
type: 'json'
|
||||
type: 'json',
|
||||
});
|
||||
|
||||
t.notOk(body.auth, 'should config.auth to be false');
|
||||
|
|
@ -34,7 +34,7 @@ test('cloudcmd: rest: config: patch', async (t) => {
|
|||
};
|
||||
|
||||
const options = {
|
||||
config
|
||||
config,
|
||||
};
|
||||
|
||||
const json = {
|
||||
|
|
@ -43,7 +43,7 @@ test('cloudcmd: rest: config: patch', async (t) => {
|
|||
|
||||
const res = await request.patch('/api/v1/config', {
|
||||
options,
|
||||
body: json
|
||||
body: json,
|
||||
});
|
||||
|
||||
const result = res.body;
|
||||
|
|
@ -54,7 +54,7 @@ test('cloudcmd: rest: config: patch', async (t) => {
|
|||
|
||||
test('cloudcmd: rest: config: patch: no configDialog', async (t) => {
|
||||
const config = {
|
||||
configDialog: false
|
||||
configDialog: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -62,7 +62,7 @@ test('cloudcmd: rest: config: patch: no configDialog', async (t) => {
|
|||
};
|
||||
|
||||
const body = {
|
||||
ip: null
|
||||
ip: null,
|
||||
};
|
||||
|
||||
const result = await request.patch(`/api/v1/config`, {
|
||||
|
|
@ -76,7 +76,7 @@ test('cloudcmd: rest: config: patch: no configDialog', async (t) => {
|
|||
|
||||
test('cloudcmd: rest: config: patch: no configDialog: statusCode', async (t) => {
|
||||
const config = {
|
||||
configDialog: false
|
||||
configDialog: false,
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ const config = {
|
|||
|
||||
const cloudcmd = require('../..');
|
||||
const {request} = require('serve-once')(cloudcmd, {
|
||||
config
|
||||
config,
|
||||
});
|
||||
|
||||
test('cloudcmd: rest: cp', async (t) => {
|
||||
|
|
@ -21,14 +21,14 @@ test('cloudcmd: rest: cp', async (t) => {
|
|||
from: '/fixture/',
|
||||
to: '/fixture/tmp',
|
||||
names: [
|
||||
'cp.txt'
|
||||
]
|
||||
'cp.txt',
|
||||
],
|
||||
};
|
||||
|
||||
mkdirSync(tmp);
|
||||
|
||||
const {body} = await request.put(`/api/v1/cp`, {
|
||||
body: files
|
||||
body: files,
|
||||
});
|
||||
|
||||
rimraf.sync(tmp);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ const {request} = require('serve-once')(cloudcmd);
|
|||
|
||||
test('cloudcmd: rest: fs: path', async (t) => {
|
||||
const {body} = await request.get(`/api/v1/fs`, {
|
||||
type: 'json'
|
||||
type: 'json',
|
||||
});
|
||||
|
||||
const {path} = body;
|
||||
|
|
|
|||
|
|
@ -37,20 +37,20 @@ test('cloudcmd: rest: mv', async (t) => {
|
|||
|
||||
const {request} = serveOnce(cloudcmd, {
|
||||
config: {
|
||||
root: '/'
|
||||
}
|
||||
root: '/',
|
||||
},
|
||||
});
|
||||
|
||||
const files = {
|
||||
from: '/fixture/',
|
||||
to: '/fixture/tmp/',
|
||||
names: [
|
||||
'mv.txt'
|
||||
]
|
||||
'mv.txt',
|
||||
],
|
||||
};
|
||||
|
||||
const {body} = await request.put(`/api/v1/mv`, {
|
||||
body: files
|
||||
body: files,
|
||||
});
|
||||
|
||||
mockRequire.stop('fs');
|
||||
|
|
@ -81,8 +81,8 @@ test('cloudcmd: rest: mv: rename', async (t) => {
|
|||
|
||||
const {request} = serveOnce(cloudcmd, {
|
||||
config: {
|
||||
root: '/'
|
||||
}
|
||||
root: '/',
|
||||
},
|
||||
});
|
||||
|
||||
const files = {
|
||||
|
|
@ -91,7 +91,7 @@ test('cloudcmd: rest: mv: rename', async (t) => {
|
|||
};
|
||||
|
||||
const {body} = await request.put(`/api/v1/mv`, {
|
||||
body: files
|
||||
body: files,
|
||||
});
|
||||
|
||||
mockRequire.stop('fs');
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ const fixture = {
|
|||
const defaultOptions = {
|
||||
config: {
|
||||
root: join(__dirname, '..'),
|
||||
}
|
||||
},
|
||||
};
|
||||
const cloudcmd = require(cloudcmdPath);
|
||||
const serveOnce = require('serve-once');
|
||||
|
|
@ -65,7 +65,7 @@ test('cloudcmd: rest: pack: tar: get', async (t) => {
|
|||
|
||||
test('cloudcmd: rest: pack: tar: put: file', async (t) => {
|
||||
const config = {
|
||||
packer: 'tar'
|
||||
packer: 'tar',
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -211,7 +211,7 @@ test('cloudcmd: rest: pack: zip: put: error', async (t) => {
|
|||
const {body} = await request.put(`/api/v1/pack`, {
|
||||
options,
|
||||
body: getPackOptions('name', [
|
||||
'not found'
|
||||
'not found',
|
||||
]),
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -16,16 +16,16 @@ const {request} = require('serve-once')(cloudcmd, {
|
|||
config: {
|
||||
auth: false,
|
||||
dropbox: false,
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
test('cloudcmd: modules', async (t) => {
|
||||
const modules = {
|
||||
data: {
|
||||
FilePicker: {
|
||||
key: 'hello'
|
||||
}
|
||||
}
|
||||
key: 'hello',
|
||||
},
|
||||
},
|
||||
};
|
||||
const options = {
|
||||
modules,
|
||||
|
|
@ -47,7 +47,7 @@ test('cloudcmd: modules', async (t) => {
|
|||
|
||||
test('cloudcmd: modules: wrong route', async (t) => {
|
||||
const modules = {
|
||||
hello: 'world'
|
||||
hello: 'world',
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ test('cloudcmd: show-config: return', (t) => {
|
|||
|
||||
test('cloudcmd: show-config: return', (t) => {
|
||||
const config = {
|
||||
hello: 'world'
|
||||
hello: 'world',
|
||||
};
|
||||
|
||||
const result = [
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ test('cloudcmd: static: not found', async (t) => {
|
|||
test('cloudcmd: prefix: wrong', async (t) => {
|
||||
const originalPrefix = configFn('prefix');
|
||||
const config = {
|
||||
prefix: '/hello'
|
||||
prefix: '/hello',
|
||||
};
|
||||
|
||||
const options = {
|
||||
|
|
@ -63,7 +63,7 @@ test('cloudcmd: /cloudcmd.js', async (t) => {
|
|||
test('cloudcmd: /cloudcmd.js: auth: access denied', async (t) => {
|
||||
const name = 'cloudcmd.js';
|
||||
const config = {
|
||||
auth: true
|
||||
auth: true,
|
||||
};
|
||||
const options = {
|
||||
config,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue