diff --git a/bin/release.js b/bin/release.js index b5de64cc..f3e6bf93 100755 --- a/bin/release.js +++ b/bin/release.js @@ -18,10 +18,10 @@ main((error) => { }); function main(callback) { - const history = 'Version history\n---------------\n'; - const link = '//github.com/coderaiser/cloudcmd/releases/tag/'; - const template = '- *{{ date }}*, ' + - '**[v{{ version }}]' + + const history = 'Version history\n---------------\n'; + const link = '//github.com/coderaiser/cloudcmd/releases/tag/'; + const template = '- *{{ date }}*, ' + + '**[v{{ version }}]' + '(' + link + 'v{{ version }})**\n'; const {version} = Info; @@ -47,7 +47,7 @@ function replaceVersion(name, version, versionNew, callback) { if (error) return callback(error); - callback(null, 'done: ' + name); + callback(null, 'done: ' + name); }); } diff --git a/client/client.js b/client/client.js index 77eb673f..20a1361f 100644 --- a/client/client.js +++ b/client/client.js @@ -66,8 +66,8 @@ function CloudCmdProto(DOM) { this.DIRCLIENT = '/dist/'; this.DIRCLIENT_MODULES = this.DIRCLIENT + 'modules/'; - this.MIN_ONE_PANEL_WIDTH = 1155; - this.HOST = location.origin || + this.MIN_ONE_PANEL_WIDTH = 1155; + this.HOST = location.origin || location.protocol + '//' + location.host; const TITLE = 'Cloud Commander'; @@ -392,7 +392,7 @@ function CloudCmdProto(DOM) { }; if (!options) - options = {}; + options = {}; CloudCmd.log('reading dir: "' + path + '";'); diff --git a/client/dom/buffer.js b/client/dom/buffer.js index 3b12e918..989c8788 100644 --- a/client/dom/buffer.js +++ b/client/dom/buffer.js @@ -17,7 +17,7 @@ function BufferProto() { const CUT = 'cut'; const TITLE = 'Buffer'; - const Buffer = { + const Buffer = { cut : callIfEnabled.bind(null, cut), copy : callIfEnabled.bind(null, copy), clear : callIfEnabled.bind(null, clear), diff --git a/client/dom/current-file.js b/client/dom/current-file.js index a167f343..d0dd578b 100644 --- a/client/dom/current-file.js +++ b/client/dom/current-file.js @@ -101,7 +101,7 @@ module.exports.getCurrentDirName = () => { const href = DOM.getCurrentDirPath() .replace(/\/$/, ''); - const substr = href.substr(href, href.lastIndexOf('/')); + const substr = href.substr(href, href.lastIndexOf('/')); const ret = href.replace(substr + '/', '') || '/'; return ret; diff --git a/client/dom/dom-tree.js b/client/dom/dom-tree.js index be4523f3..dcbff43b 100644 --- a/client/dom/dom-tree.js +++ b/client/dom/dom-tree.js @@ -54,7 +54,7 @@ module.exports.getByClass = (className, element = document) => { }; module.exports.getByDataName = (attribute, element = document) => { - const selector = '[' + 'data-name="' + attribute + '"]'; + const selector = '[' + 'data-name="' + attribute + '"]'; return element.querySelector(selector); }; diff --git a/client/dom/events/index.js b/client/dom/events/index.js index 52947415..aa78bcd6 100644 --- a/client/dom/events/index.js +++ b/client/dom/events/index.js @@ -47,8 +47,8 @@ function EventsProto() { isFunc = itype.function(element); if (isFunc) { - listener = element; - element = null; + listener = element; + element = null; } if (!element) @@ -122,8 +122,8 @@ function EventsProto() { }; if (!listener) { - listener = element; - element = null; + listener = element; + element = null; } this.add(type, element, once); diff --git a/client/dom/files.js b/client/dom/files.js index fe64eb9f..2d8695b8 100644 --- a/client/dom/files.js +++ b/client/dom/files.js @@ -80,11 +80,11 @@ function getPath(name, isHTML, isJSON) { if (isRoot) path = DIR_HTML + name.replace('-tmpl', ''); else - path = DIR_HTML_FS + name; + path = DIR_HTML_FS + name; path += '.hbs'; } else if (isJSON) { - path = DIR_JSON + name + '.json'; + path = DIR_JSON + name + '.json'; } return path; diff --git a/client/dom/images.js b/client/dom/images.js index 68cff451..bdff634f 100644 --- a/client/dom/images.js +++ b/client/dom/images.js @@ -67,7 +67,7 @@ module.exports.error = () => { }; module.exports.show = show; -module.exports.show.load = show; +module.exports.show.load = show; module.exports.show.error = error; /** @@ -135,7 +135,7 @@ module.exports.setProgress = (value, title) => { return Images; }; -module.exports.clearProgress = () => { +module.exports.clearProgress = () => { const DATA = 'data-progress'; const element = Images.get(); diff --git a/client/dom/index.js b/client/dom/index.js index c6b83a5f..2eb64e3b 100644 --- a/client/dom/index.js +++ b/client/dom/index.js @@ -950,6 +950,8 @@ function CmdProto() { const filesPassive = DOM.getFiles(panelPassive); const name = DOM.getCurrentName(current); + /* eslint no-multi-spaces:0 */ + info.dir = DOM.getCurrentDirName(); info.dirPath = DOM.getCurrentDirPath(); info.parentDirPath = DOM.getParentDirPath(); diff --git a/client/dom/load-remote.js b/client/dom/load-remote.js index 5a2c4dfa..511efb59 100644 --- a/client/dom/load-remote.js +++ b/client/dom/load-remote.js @@ -31,10 +31,10 @@ module.exports = (name, options, callback = options) => { let local; if (isArray) { remoteTmpls = module.remote; - local = module.local; + local = module.local; } else { - remoteTmpls = [module.remote]; - local = [module.local]; + remoteTmpls = [module.remote]; + local = [module.local]; } const localURL = local.map((url) => { diff --git a/client/dom/load.js b/client/dom/load.js index 022b01e4..a091645d 100644 --- a/client/dom/load.js +++ b/client/dom/load.js @@ -64,7 +64,7 @@ module.exports.ajax = (params) => { xhr.onreadystatechange = (event) => { const xhr = event.target; - const OK = 200; + const OK = 200; if (xhr.readyState !== xhr.DONE) return; @@ -72,7 +72,7 @@ module.exports.ajax = (params) => { Images.clearProgress(); const TYPE_JSON = 'application/json'; - const type = xhr.getResponseHeader('content-type'); + const type = xhr.getResponseHeader('content-type'); if (xhr.status !== OK) return exec(p.error, xhr); @@ -104,7 +104,7 @@ module.exports.put = (url, body) => { return; const percent = (event.loaded / event.total) * 100; - const count = Math.round(percent); + const count = Math.round(percent); emitter.emit('progress', count); }; diff --git a/client/dom/rest.js b/client/dom/rest.js index c12e4b42..6ea78088 100644 --- a/client/dom/rest.js +++ b/client/dom/rest.js @@ -55,8 +55,8 @@ function RESTful() { const isFunc = itype.function(data); if (!callback && isFunc) { - callback = data; - data = null; + callback = data; + data = null; } sendRequest({ @@ -149,7 +149,7 @@ function RESTful() { }, }; - this.Markdown = { + this.Markdown = { read(url, callback) { sendRequest({ method : 'GET', diff --git a/client/listeners/index.js b/client/listeners/index.js index 8358f0a9..b9c54d97 100644 --- a/client/listeners/index.js +++ b/client/listeners/index.js @@ -315,8 +315,8 @@ function onDragStart(event) { } event.dataTransfer.setData('DownloadURL', - 'application/octet-stream' + ':' + - name + ':' + + 'application/octet-stream' + ':' + + name + ':' + link); } diff --git a/client/modules/edit-file-vim.js b/client/modules/edit-file-vim.js index 60ce4a65..fe8198af 100644 --- a/client/modules/edit-file-vim.js +++ b/client/modules/edit-file-vim.js @@ -8,7 +8,7 @@ const Events = require('../dom/events'); const {Key} = CloudCmd; -const ConfigView = { +const ConfigView = { bindKeys: false, beforeClose: () => { Events.rmKey(listener); diff --git a/client/modules/edit-file.js b/client/modules/edit-file.js index cc514cb8..f2153e2c 100644 --- a/client/modules/edit-file.js +++ b/client/modules/edit-file.js @@ -25,7 +25,7 @@ const TITLE = 'Edit'; let MSG_CHANGED; const isLoading = fullstore(); -const ConfigView = { +const ConfigView = { beforeClose: () => { exec.ifExist(Menu, 'hide'); isChanged(); diff --git a/client/modules/edit-names-vim.js b/client/modules/edit-names-vim.js index 75aef699..66087294 100644 --- a/client/modules/edit-names-vim.js +++ b/client/modules/edit-names-vim.js @@ -7,7 +7,7 @@ CloudCmd.EditNamesVim = exports; const Events = require('../dom/events'); const {Key} = CloudCmd; -const ConfigView = { +const ConfigView = { bindKeys: false, beforeClose: () => { Events.rmKey(listener); diff --git a/client/modules/edit-names.js b/client/modules/edit-names.js index dbf85e09..5a23ec6d 100644 --- a/client/modules/edit-names.js +++ b/client/modules/edit-names.js @@ -21,7 +21,7 @@ const rename = currify(_rename); let Menu; const EditNames = exec.bind(); -const ConfigView = { +const ConfigView = { beforeClose: () => { exec.ifExist(Menu, 'hide'); DOM.Events.remove('keydown', keyListener); diff --git a/client/modules/edit.js b/client/modules/edit.js index 7fb1ab19..9e37d1da 100644 --- a/client/modules/edit.js +++ b/client/modules/edit.js @@ -39,8 +39,8 @@ module.exports.init = async () => { function create() { const element = createElement('div', { style: - 'width : 100%;' + - 'height : 100%;' + + 'width : 100%;' + + 'height : 100%;' + 'font-family: "Droid Sans Mono";', notAppend: true, }); diff --git a/client/modules/menu.js b/client/modules/menu.js index 3b551c67..fc621e09 100644 --- a/client/modules/menu.js +++ b/client/modules/menu.js @@ -94,10 +94,10 @@ function getOptions(notFile) { let func; if (notFile) { - name = 'context'; - func = Key.unsetBind; + name = 'context'; + func = Key.unsetBind; } else { - name = 'contextFile'; + name = 'contextFile'; } const options = { @@ -244,7 +244,7 @@ function uploadFromCloud() { CloudCmd.execFromModule('Cloud', 'saveFile', (currentName, data) => { const path = DOM.getCurrentDirPath() + currentName; - RESTful.write(path, data, (error) => { + RESTful.write(path, data, (error) => { if (error) return; diff --git a/client/modules/operation/index.js b/client/modules/operation/index.js index 1249695d..db79fa7f 100644 --- a/client/modules/operation/index.js +++ b/client/modules/operation/index.js @@ -294,6 +294,8 @@ function _processFiles(options, data) { let names = []; + /* eslint no-multi-spaces: 0 */ + if (data) { from = data.from; to = data.to; diff --git a/client/modules/upload.js b/client/modules/upload.js index 3d021fa4..eb144e93 100644 --- a/client/modules/upload.js +++ b/client/modules/upload.js @@ -43,9 +43,9 @@ function show() { createElement('style', { dataName: 'upload-css', innerText: '[data-name=js-upload-file-button] {' + - `font-family: ${fontFamily};` + - 'font-size: 20px;' + - 'width: 97%' + + `font-family: ${fontFamily};` + + 'font-size: 20px;' + + 'width: 97%' + '}', }); } diff --git a/client/modules/view.js b/client/modules/view.js index ac7b1e85..636842ab 100644 --- a/client/modules/view.js +++ b/client/modules/view.js @@ -267,10 +267,10 @@ function getMediaElement(src, callback) { return alert(error); if (!TemplateAudio) - TemplateAudio = template; + TemplateAudio = template; const is = isAudio(name); - const type = is ? 'audio' : 'video'; + const type = is ? 'audio' : 'video'; const innerHTML = rendy(TemplateAudio, { src, diff --git a/common/cloudfunc.js b/common/cloudfunc.js index aef0a2f0..b60da851 100644 --- a/common/cloudfunc.js +++ b/common/cloudfunc.js @@ -253,7 +253,7 @@ function getSize(file) { } function _getHeaderField(sort, order, name) { - const arrow = order === 'asc' ? '↑' : '↓'; + const arrow = order === 'asc' ? '↑' : '↓'; if (sort !== name) return name; diff --git a/server/config.js b/server/config.js index 946c9efe..c96a99f1 100644 --- a/server/config.js +++ b/server/config.js @@ -58,9 +58,9 @@ const config = { const connectionWraped = wraptile(connection); -module.exports = manage; -module.exports.save = save; -module.exports.middle = middle; +module.exports = manage; +module.exports.save = save; +module.exports.middle = middle; module.exports.subscribe = (fn) => { changeEmitter.on('change', fn); }; @@ -69,7 +69,7 @@ module.exports.unsubscribe = (fn) => { changeEmitter.removeListener('change', fn); }; -module.exports.listen = (socket, auth) => { +module.exports.listen = (socket, auth) => { check(socket, auth); if (!manage('configDialog')) diff --git a/server/rest/index.js b/server/rest/index.js index 08d16034..a9f4aaf5 100644 --- a/server/rest/index.js +++ b/server/rest/index.js @@ -42,7 +42,7 @@ module.exports = (request, response, next) => { function rest(request, response) { const name = ponse.getPathName(request); - const params = { + const params = { request, response, name: name.replace(apiURL, '') || '/', @@ -194,8 +194,8 @@ function onPUT(name, body, callback) { if (isRootAll([files.to, files.from])) return callback(getWin32RootMsg()); - files.from = root(files.from); - files.to = root(files.to); + files.from = root(files.from); + files.to = root(files.to); copy(files.from, files.to, files.names, (error) => { const msg = formatMsg('copy', files.names); @@ -262,8 +262,8 @@ function getPacker(operation) { function operation(op, from, to, names, fn) { if (!fn) { - fn = names; - names = [ + fn = names; + names = [ path.basename(from), ]; } diff --git a/server/server.js b/server/server.js index ef3973a3..ca18db49 100644 --- a/server/server.js +++ b/server/server.js @@ -34,11 +34,11 @@ const logger = tryRequire('morgan'); module.exports = async (options) => { const prefix = config('prefix'); - const port = process.env.PORT || /* c9 */ + const port = process.env.PORT || /* c9 */ config('port'); - const ip = process.env.IP || /* c9 */ - config('ip') || + const ip = process.env.IP || /* c9 */ + config('ip') || '0.0.0.0'; const app = express(); diff --git a/test/common/cloudfunc.js b/test/common/cloudfunc.js index b10d224c..682d530d 100644 --- a/test/common/cloudfunc.js +++ b/test/common/cloudfunc.js @@ -21,7 +21,7 @@ const {reRequire} = require('mock-require'); const htmlLooksLike = require('html-looks-like'); const readFilesSync = require('@cloudcmd/read-files-sync'); -const FS_DIR = TMPLDIR + 'fs/'; +const FS_DIR = TMPLDIR + 'fs/'; const EXPECT_PATH = __dirname + '/cloudfunc.html'; const addHBS = (a) => `${a}.hbs`; @@ -51,19 +51,21 @@ const JSON_FILES = { }], }; +/* eslint no-multi-space: 0 */ + let Expect = - '
' + - '' + - '' + - '' + - '' + - '/' + - '' + - 'etc' + - '/X11/' + - '' + + '
' + + '' + + '' + + '' + + '' + + '/' + + '' + + 'etc' + + '/X11/' + + '' + '
'; test('cloudfunc: render', (t) => { diff --git a/test/server/modulas.js b/test/server/modulas.js index ee836548..f4a4d37f 100644 --- a/test/server/modulas.js +++ b/test/server/modulas.js @@ -8,7 +8,7 @@ const dir = join(__dirname, '..', '..'); const modulesPath = join(dir, 'json', 'modules.json'); const cloudcmdPath = dir; -const localModules = require(modulesPath); +const localModules = require(modulesPath); const modulas = require(`${dir}/server/modulas`); const cloudcmd = require(cloudcmdPath);