Skip to content

Latest commit

 

History

History
977 lines (839 loc) · 45.2 KB

HELP.md

File metadata and controls

977 lines (839 loc) · 45.2 KB

Cloud Commander v10.3.1

Cloud Commander is an orthodox web file manager with console and editor. Will help you manage the server and work with files, directories and programs in browser from any computer, mobile or tablet.

Cloud Commander

Benefits

  • Open Source (MIT License).
  • Has 2 classic panels.
  • Optional authorization.
  • Client works in web browser.
  • Server works on Windows, Linux, Mac OS and Android (with help of Termux).
  • Could be used local or remotely.
  • Adapting to screen size.
  • 3 built-in editors with support of syntax highlighting: Dword, Edward and Deepword.
  • Console with support of default OS command line.
  • Written in JavaScript/Node.js.
  • Built-in archives pack: zip and tar.gz.
  • Built-in archives extract: zip, tar, gz, bz2, .tar.gz and .tar.bz2 (with help of inly).

Install

The installation of file manager is very simple.

  • install latest version of node.js.
  • install cloudcmd via npm with:
npm i cloudcmd -g

When in trouble use:

npm i cloudcmd -g --force

Start

For starting just type in console:

cloudcmd

Cloud Commander supports command line parameters:

Parameter Operation
-h, --help display help and exit
-v, --version display version and exit
-s, --save save configuration
-o, --online load scripts from remote servers
-a, --auth enable authorization
-u, --username set username
-p, --password set password
-c, --config configuration file path
--show-config show config values
--editor set editor: "dword", "edward" or "deepword"
--packer set packer: "tar" or "zip"
--root set root directory
--prefix set url prefix
--port set port number
--progress show progress of file operations
--confirm-copy confirm copy
--confirm-move confirm move
--open open web browser when server started
--name set tab name in web browser
--one-file-panel show one file panel
--keys-panel show keys panel
--contact enable contact
--config-dialog enable config dialog
--console enable console
--sync-console-path sync console path
--terminal enable terminal
--terminal-path set terminal path
--vim enable vim hot keys
--columns set visible columns
--no-server do not start server
--no-auth disable authorization
--no-online load scripts from local server
--no-open do not open web browser when server started
--no-name set empty tab name in web browser
--no-one-file-panel show two file panels
--no-keys-panel hide keys panel
--no-progress do not show progress of file operations
--no-confirm-copy do not confirm copy
--no-confirm-move do not confirm move
--no-contact disable contact
--no-config-dialog disable config dialog
--no-console disable console
--no-sync-console-path do not sync console path
--no-terminal disable terminal
--no-vim disable vim hot keys
--no-columns set visible default columns

If no parameters given Cloud Commander reads information from ~/.cloudcmd.json and use port from it (8000 default). if port variables PORT or VCAP_APP_PORT isn't exist.

To begin use, type in address bar of your browser:

http://localhost:8000

Update

If you installed Cloud Commander with npm, stop application and re-install it:

npm install cloudcmd -g

Then start it again and reload the page.

Hot keys

Key Operation
F1 help
F2 rename
F3 view
Shift + F3 view as markdown
F4 edit
Shift + F4 edit in vim mode
F5 copy
Alt + F5 pack
F6 rename/move
F7 new directory
Shift + F7 new file
F8, Delete remove
Shift + Delete remove without prompt
F9 menu
Alt + F9 extract
F10 config
* select/unselect all
+ expand selection
- shrink selection
Ctrl + x cut to buffer
Ctrl + с copy to buffer
Ctrl + v paste from buffer
Ctrl + z clear buffer
Ctrl + p copy path
Ctrl + r refresh
Ctrl + d clear local storage
Ctrl + a select all files in a panel
Ctrl + m rename selected files in editor
Shift + Ctrl + m rename selected files in vim mode of editor
Ctrl + u swap panels
Ctrl + F3 sort by name
Ctrl + F5 sort by date
Ctrl + F6 sort by size
Up, Down, Enter file system navigation
Alt + Left/Right show content of directory under cursor in target panel
Alt + g go to directory
Ctrl + \ go to the root directory
Tab move via panels
Page Up up on one page
Page Down down on one page
Home to begin of list
End to end of list
Space select current file (and get size of directory)
Insert select current file (and move to next)
F9 context menu
~ console
Ctrl + Click open file on new tab

Vim

When --vim option provided, or configuration parameter vim set, next hot keys become available:

Key Operation
j navigate to next file
k navigate to previous file
dd remove current file
G navigate to bottom file
gg navigate to top file
v visual mode
y copy (selected in visual mode files)
p paste files
Esc unselect all
/ find file in current directory
n navigate to next found file
N navigate to previous found file

Commands can be joined, for example:

  • 5j will navigate 5 files below current;
  • d5j will remove next 5 files;
  • dG will remove all files from current to bottom;

Drag and Drop

Next file operations are accessible through Drag and Drop.

Drag Mouse Button Key Origin Destination Operation
Left Panel Panel copy files
Left Shift Panel Panel rename/move files
Left Panel Desktop download files
Left Desktop Panel upload files

View

View

Features

  • View images.
  • View text files.
  • Playing audio.
  • Playing video.

Hot keys

Key Operation
F3 open
Esc close

Edit

Edit

Hot keys

Key Operation
F4 open
Shift + F4 open in vim mode
Esc close

For more details see Edward hot keys.

Console

Console

Hot keys

Key Operation
~ open
Ctrl + p paste path of current directory
Esc close

For more details see console hot keys.

Terminal

Terminal

Install

Terminal disabled and not installed by default. To use it you should install gritty with:

npm i gritty -g

And then set the path of a terminal with:

cloudcmd --terminal --terminal-path `gritty --path` --save

Windows

If you can't install gritty on Windows try to install windows-build-tools first:

npm install windows-build-tools -g

Then get path of a gritty with:

gritty --path

It will returns something like:

C:\Users\coderaiser\AppData\Roaming\npm\node_modules\gritty

Set this path as --terminal-path with:

cloudcmd --save --terminal --terminal-path "C:\Users\coderaiser\AppData\Roaming\npm\node_modules\gritty"

After that you can use terminal in the same way as a console.

Hot keys

Key Operation
Shift + ~ open
Shift + Esc close

Environment Variables

Every program executed in console or terminal has these environment variables:

  • ACTIVE_DIR - directory that contains cursor
  • PASSIVE_DIR - directory with no cursor
  • CURRENT_NAME - name of a file under cursor
  • CURRENT_PATH - path to file under cursor

On Unix you can use it this way:

~> echo $CURRENT_PATH
/home/coderaiser/cloudcmd/bin/cloudcmd.js

Config

Config

Hot keys

Key Operation
F10 open
Esc close

When you change one of options file ~/.cloudcmd.json would be saved. It could be edited manually with any text editor. Here is description of options:

{
    "name"              : "",       /* set tab name in web browser              */
    "auth"              : false,    /* enable http authentication               */
    "username"          : "root",   /* username for authentication              */
    "password"          : "toor",   /* password hash for authentication         */
    "algo"              : "sha512WithRSAEncryption", /* cryptographic algorithm */
    "editor"            : "edward", /* default, could be "dword" or "edward"    */
    "packer"            : "tar",    /* default, could be "tar" or "zip"         */
    "diff"              : true,     /* when save - send patch, not whole file   */
    "zip"               : true,     /* zip text before send / unzip before save */
    "buffer"            : true,     /* buffer for copying files                 */
    "dirStorage"        : true,     /* store directory listing                  */
    "online"            : true,     /* load js files from cdn or local path     */
    "open"              : false     /* open web browser when server started     */
    "oneFilePanel"      : false,    /* show one file panel                      */
    "keysPanel"         : true,     /* show classic panel with buttons of keys  */
    "port"              : 8000,     /* http port                                */
    "ip"                : null,     /* ip or null(default)                      */
    "root"              : "/",      /* root directory                           */
    "prefix"            : "",       /* url prefix                               */
    "progress"          : true,     /* show progress of file operations         */
    "confirmCopy"       : true,     /* confirm copy                             */
    "confirmMove"       : true,     /* confirm move                             */
    "showConfig"        : false,    /* show config at startap                   */
    "contact"           : true,     /* enable contact                           */
    "configDialog"      : true,     /* enable config dialog                     */
    "console"           : true,     /* enable console                           */
    "syncConsolePath"   : false     /* do not sync console path                 */
    "terminal"          : false,    /* disable terminal                         */
    "terminalPath"      : '',       /* path of a terminal                       */
    "vim"               : false,    /* disable vim hot keys                     */
    "columns"           : "name-size-date-owner-mode", /* set visible columns   */
}

Environment Variables

Some config options can be overridden with environment variables such:

  • CLOUDCMD_NAME - set tab name in web browser
  • CLOUDCMD_EDITOR - set editor
  • CLOUDCMD_COLUMNS - set visible columns
  • CLOUDCMD_CONTACT - enable contact
  • CLOUDCMD_CONFIG_DIALOG - enable config dialog
  • CLOUDCMD_CONSOLE - enable console
  • CLOUDCMD_SYNC_CONSOLE_PATH - sync console path
  • CLOUDCMD_TERMINAL - enable terminal
  • CLOUDCMD_TERMINAL_PATH - set terminal path
  • CLOUDCMD_KEYS_PANEL - show keys panel
  • CLOUDCMD_ONE_FILE_PANEL - show one file panel
  • CLOUDCMD_AUTH - enable authentication
  • CLOUDCMD_USERNAME - set username
  • CLOUDCMD_PASSWORD - set password
  • CLOUDCMD_ROOT - set root directory
  • CLOUDCMD_VIM - enable vim hot keys
  • CLOUDCMD_CONFIRM_COPY - confirm copy
  • CLOUDCMD_CONFIRM_MOVE - confirm move

Menu

Menu

Right mouse click button shows context menu with items:

  • View
  • Edit
  • Rename
  • Delete
  • Pack
  • Extract
  • Upload To Cloud
  • Download
  • Cut
  • Copy
  • Paste
  • New (File, Directory)
  • Upload
  • Upload From Cloud
  • (Un)Select All
  • Log Out (available when the authorization is enabled)

Hot keys

Key Operation
F9 open
Esc close

One file panel

Cloud Commander can work in one panel mode when screen size can not accommodate second panel or via --one-file-panel options flag. It could happen when mobile device, tablet or small window size used to work with file manager.

One file panel

Using as Middleware

Cloud Commander could be used as middleware for node.js applications based on socket.io and express:

Init package.json:

npm init -y

Install dependencies:

npm i cloudcmd express socket.io -S

And create index.js:

const http = require('http');
const cloudcmd = require('cloudcmd');
const io = require('socket.io');
const app = require('express')();

const port = 1337;
const prefix = '/cloudcmd';

const server = http.createServer(app);
const socket = io.listen(server, {
    path: `${prefix}/socket.io`
});

const config = {
    prefix // base URL or function which returns base URL (optional)
};

const plugins = [
    __dirname + '/plugin.js'
];

const filePicker = {
    data: {
        FilePicker: {
            key: 'key'
        }
    }
};

// override option from json/modules.json
const modules = {
    filePicker,
};

app.use(cloudcmd({
    socket,  // used by Config, Edit (optional) and Console (required)
    config,  // config data (optional)
    plugins, // optional
    modules, // optional
}));

server.listen(port);

And you are ready to go.

Authorization

If you want to enable authorization you can pass credentials in a config. To generate password you can install criton with npm i criton --save and use it or any other way to generate a hash of a password.

const criton = require('criton');
const algo = 'sha512WithRSAEncryption'; // default

// you can generate hash dynamically
const password = criton('root', algo);

// or use pregenerated hash as well
'2b64f2e..ca5d9a9';

const auth = true;
const username = 'root';

const config = {
    algo, // optional
    auth,
    username,
    pasword,
}

Server

Standard practices say no non-root process gets to talk to the Internet on a port less than 1024. Anyway I suggest you to start Cloud Commander as non-root. How it could be solved? There is a couple easy and fast ways. One of them is port forwarding.

Iptables

Just run shell/addtables.sh for default options.

iptables -t nat -L # look rules before
iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4430
iptables -t nat -L # look rules after

You should see something like this ( 8000 and 4430 should be in config as port and sslPort )

target     prot opt source               destination
REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:http redir ports 8000
REDIRECT   tcp  --  anywhere             anywhere             tcp dpt:https redir ports 4430

If you would want to get things back just clear rules ( 1 and 2 it's rule numbers, in your list they could differ).

iptables -t nat -D PREROUTING 2
iptables -t nat -D PREROUTING 1

nginx

Get nginx. On Linux it could be done this way:

sudo apt-get install nginx #for ubuntu and debian

Then make host file /etc/nginx/sites-available/io.cloudcmd.io ( io.cloudcmd.io is your domain name) with content:

server {
    listen 80;
    client_max_body_size 100m;
    server_name io.cloudcmd.io;
    access_log /var/log/nginx/io.cloudcmd.io.access.log;
    location / {
        proxy_pass          http://127.0.0.1:8000/;
    }
}

If you want add SSL, add a couple lines to server block:

server {
    listen 443;
    client_max_body_size 100m;
    ssl                  on;
    ssl_certificate      /home/coderaiser/cloudcmd/ssl/ssl.crt;
    ssl_certificate_key  /home/coderaiser/cloudcmd/ssl/ssl.key;
    server_name io.cloudcmd.io;
    access_log /var/log/nginx/io.cloudcmd.io.access.log;
    location / {
        proxy_pass    http://127.0.0.1:8000/;
    }
}

For WebSocket support (nginx >= v1.3.13) modify server block:

    location / {
        proxy_http_version  1.1;
        proxy_set_header    Upgrade $http_upgrade;
        proxy_set_header    Connection "upgrade";

        proxy_pass          http://127.0.0.1:8000/;
    }

If you need redirection from http to https, it's simple:

server {
    listen 80;
    server_name admin.cloudcmd.io;
    rewrite ^ https://io.cloudcmd.io$request_uri? permanent; #301 redirect
    access_log /var/log/nginx/io.cloudcmd.io.access.log;
}
# create symlink of this file
ln -s ./sites-available/io.cloudcmd.io ./sites-enabled
# restart nginx
/etc/init.d/nginx restart

Deploy

Cloud Commander could be easily deployed to Heroku.

Deploy to Heroku

Docker

Cloud Commander could be used as docker container this way:

docker run -t --rm -v ~:/root -v /:/mnt/fs -p 8000:8000 coderaiser/cloudcmd

Config would be read from home directory, hosts root file system would be mount to /mnt/fs, 8000 port would be exposed to hosts port.

Also you could use docker compose with docker-compose.yml:

version: '2'
services:
  web:
    ports:
      - 8000:8000
    volumes:
      - ~:/root
      - /:/mnt/fs
    image: coderaiser/cloudcmd

When you create this file run:

docker-compose up

Get involved

There is a lot ways to be involved in Cloud Commander development:

Version history

Special Thanks

  • Olena Zalitok for logo and favicon.
  • TarZak
    • Russian and Ukrainian translations;
    • config template and style;
    • change order of directories and files;
    • add ability do not hide path and header when files are scrolling;