Merge pull request #7 from coderaiser/dev

v0.5.0
This commit is contained in:
coderaiser 2013-10-17 02:17:10 -07:00
commit 934963a9e9
26 changed files with 620 additions and 534 deletions

View file

@ -1,4 +1,42 @@
2012.09.27, v0.4.0
2013.10.17, v0.5.0
feature:
- (view) rm fancybox spinner
- (util) ownRedner: { } -> {{ }}
- (util) render: rm param, it is default
- (util) replaceStr: add pNotEscape
- (index) robots: add noindex, nofollow
- (config) minification -> minify: {} -> true
- (json) rm " "
- (util) retExec: add any count of params
- (util) retFunc: add any count of params
- (css) rm button width:10%
- (menu) add "(Un)Select All"
- (dom) Cmd jqueryLoad: add navigator.onLine
- (config) add online
upadate:
- minify: v0.2.1 -> v0.2.2*
fix:
- (util) retExec: if param was - use it
- (util) copyObj
- (socket) max reconnection attempts: Math.pow(2, 64) -> Math.pow(2, 32)
- (appcache) addFiles: pFilesNames -> pFileNames
- (listeners) pop: ajaxLoad -> CloudCmd.ajaxLoad
- (key) current -> current && current.parent;
- (dom) Loader: this -> Loader
- (util) retExec if: "n" -> "n > 1"
refactor:
- (pipe) create: add ifExec
- (main) MOVED_PERMANENTLY
- (key) Tab: add " "
- (dom) mv set font to listeners
- (cloudcmd) writeLogsToFile
2013.09.27, v0.4.0
feature:
- (edit) add showMessage
@ -104,7 +142,8 @@ inside:
- (css) rm !important
- (css) path-icon: rm font-family, font-size
2012.07.01, v0.3.0
2013.08.01, v0.3.0
* Changed jquery cdn to one with https suport jquery.com -> google cdn.
@ -255,7 +294,7 @@ getJSONfromFileTable.
* chore(minify) v0.2.0 -> v0.2.1
2012.04.22, v0.2.0
2013.04.22, v0.2.0
* Added alerting about errors.
@ -351,7 +390,7 @@ query other then json on /fs url.
directory where file was removed.
2012.03.01, v0.1.9
2013.03.01, v0.1.9
* Changed the way of getting github application id
(now it's just from config, rest api removed).

View file

@ -1,4 +1,4 @@
2012.07.01, v0.3.0
2012.08.01, v0.3.0
===============
Уже прошла середина лета и, благодаря легкому похолоданию, мы, кажется, начали больше ценить эту волшебную пору года. Через месяц детишки пойдут в школу, в город нахлынут толпы жаждущих новых знаний студентов, и город плавно войдет в привычный ритм.
С момента прошлого релиза прошло уже больше трёх месяцев, а это значит пора выкатывать новый релиз. В нём будет очень много нового и интересного. У командира наконецто появилась новая иконка, терминал и редактор были полностью заменены и привязаны к вьеру. Код значительно упрощен и оптимизирован. Далее подробнее.

349
HELP.md Normal file
View file

@ -0,0 +1,349 @@
Cloud Commander v0.5.0 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
===============
###[Main][MainURL] [Blog][BlogURL] [Demo][DemoURL]
[NPMIMGURL]: https://badge.fury.io/js/cloudcmd.png
[BuildStatusIMGURL]: https://secure.travis-ci.org/coderaiser/cloudcmd.png?branch=master
[DependencyStatusIMGURL]: https://gemnasium.com/coderaiser/cloudcmd.png
[FlattrIMGURL]: http://api.flattr.com/button/flattr-badge-large.png
[NPM_INFO_IMG]: https://nodei.co/npm/cloudcmd.png?downloads=true&&stars
[NPMURL]: https://npmjs.org/package/cloudcmd
[BuildStatusURL]: http://travis-ci.org/coderaiser/cloudcmd "Build Status"
[DependencyStatusURL]: https://gemnasium.com/coderaiser/cloudcmd "Dependency Status"
[FlattrURL]: https://flattr.com/submit/auto?user_id=coderaiser&url=github.com/coderaiser/cloudcmd&title=cloudcmd&language=&tags=github&category=software "flattr"
[NPM_INFO_URL]: https://npmjs.org/package/cloudcmd "npm"
[MainURL]: http://cloudcmd.io "Main"
[BlogURL]: http://blog.cloudcmd.io "Blog"
[DemoURL]: http://io.cloudcmd.io "Demo"
**Cloud Commander** - cloud file manager with console and editor.
![Cloud Commander](/img/logo/cloudcmd.png "Cloud Commander")
[![Flattr][FlattrIMGURL]][FlattrURL]
Benefits
---------------
- Open Source.
- Has 2 classic ortodox panels.
- Works on Windows, Linux and Mac OS.
- Could be used local or remotly.
- Has nice console and editor.
- Writed on JavaScript/Node.js.
Install
---------------
[![NPM_INFO][NPM_INFO_IMG]][NPM_INFO_URL]
Installing **Cloud Commander** is very simple.
All you need is
- install [node.js](http://nodejs.org/ "node.js")
- [download](https://github.com/coderaiser/cloudcmd/archive/master.zip)
and unpack or just clone repository from github:
```
git clone git://github.com/coderaiser/cloudcmd.git
cd cloudcmd
node cloudcmd
```
or install in npm:
```
npm i cloudcmd -g
cloudcmd
```
Hot keys
---------------
- **F1** - help
- **F2** - rename current file
- **F3** - view
- **F4** - edit
- **F5** - copy
- **F6** - rename/move
- **F7** - new dir
- **F8, Delete** - remove current file
- **F9** - menu
- **Ctrl + r** - reload dir content
- **Ctrl + d** - clear local cache (wich contains dir contents)
- **Alt + q** - disable key bindings
- **Alt + s** - get all key bindings back
- **Ctrl + a** - select all files in a panel
- **up, down, enter** - filesystem navigation
- **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
- **Shift + Delete** - remove without prompt
- **Insert** - select current file
- **Shift + F10** - context menu
- **~** - console
Edit
---------------
[Demo](http://io.cloudcmd.io/fs/etc#/edit/passwd "Edit")
![Edit](/img/screenshot/edit.png "Edit")
###Hot keys
- **F4** - open
- **Ctrl + s** - save
- **Esc** - close
For more details see [Ace keyboard shortcuts](https://github.com/ajaxorg/ace/wiki/Default-Keyboard-Shortcuts "Ace keyboard shortcuts").
Console
---------------
[Demo](http://io.cloudcmd.io#/console "Console")
![Console](/img/screenshot/console.png "Console")
###Hot keys
- **~** - open
- **Esc** - close
Menu
---------------
[Demo](http://io.cloudcmd.io#/menu "Menu")
![Menu](/img/screenshot/menu.png "Menu")
Right mouse click button shows context menu with items:
- View
- Edit
- Rename
- Delete
- Zip file
- (Un)Select All
- Upload to (Dropbox, Github, GDrive)
- Download
- New (File, Dir, from cloud)
###Hot keys
- **F9** - open
- **Esc** - close
Menu
---------------
Right mouse click button shows context menu with items:
- View
- Edit
- Rename
- Delete
- Upload to (Dropbox, Github, GDrive)
- Download
- New (File, Dir, from cloud)
Configuration
---------------
All main configuration could be done via [config.json](json/config.json "Config").
```js
{
"api_url" :"/api/v1",
"appcache" : false, /* cache files for offline use */
"analytics" : true, /* google analytics suport */
"localStorage" : true, /* cache directory data */
"minify" : true /* minification of js,css,html and img */
"online" : true, /* load js files from cdn or local path */
"cache" : true, /* add cache-control */
"logs" : false, /* logs or console ouput */
"show_keys_panel" : true, /* show classic panel with buttons of keys */
"server" : true, /* server mode or testing mode */
"socket" : true /* enable web sockets */
"port" : 8000, /* http port or null(default) */
"sslPort" : 443, /* https port or null(default) */
"ip" : null, /* ip or null(default) */
"ssl" : false /* should use https? */
"rest" : true /* enable rest interface */
}
```
If you had changed **config** and want to keep updating via git,
you should execute next command in root directory of **Cloud Commander**:
```
git update-index --assume-unchanged json/config.json
```
To get back to tracking:
```
git update-index --no-assume-unchanged json/config.json
```
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](shell/addtables.sh) for default options.
```sh
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -L # look rules before
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4430
@:/tmp/cloudcmd (dev) $ sudo 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).
```sh
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 2
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 1
```
###nginx
Get [nginx](http://nginx.org/ "nginx"). On linux it could be done like that
```sh
sudo apt-get install nginx #for ubuntu and debian
```
Than make host file **/etc/nginx/sites-enabled/io.cloudcmd.io**
( *io.cloudcmd.io* is your domain name) with content:
```sh
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/;
}
}
```
```sh
# create symlink of this file
ln -s ./sites-enabled/io.cloudcmd.io ./sites-available
# restart nginx
/etc/init.d/nginx restart
```
To run Cloud Commander as daemon in linux you could set **log** to true in config and
do something like this:
nohup node cloudcmd
Authorization
---------------
Cloud Commander could authorize clients on GitHub via openID.
All things that should be done is must be added **id** and **secret** of application
from github settings page and added to [modules.json](json/modules.json) (id just) and env variable (secret)
with names: *github_id*, *github_secret*, *dropbox_key*, *dropbox_secret* etc in
[secret.bat](shell/secret.bat) *(on win32)* or [secret.sh](shell/secret.sh) *(on nix)*.
Start
---------------
To start **Cloud Commander** only one command needed:
node cloudcmd
or on win platform just
cloudcmd
After that Cloud Commander reads port information from config file [config.json](json/config.json#L17 "Config") and start server
on this port ( **8000** by default ), if none of port variables ( *cloud9*, *cloudfoundry* and *nodester* ) isn't exist.
Then type in browser
http://127.0.0.1:8000
or
http://localhost:8000
Update
---------------
**Cloud Commander** is very often updates.
Update is doing automagically but it could be done also manualy
by typing a few commands in cloudcmd directory:
git pull
or check new version on npm
npm info cloudcmd
and then, if there is new version
npm r cloudcmd
npm i cloudcmd
Additional modules
---------------
**Cloud Commander's Server Side** not using additional modules for main functionality.
But for minification and optimization tricks optional can be
assingned (and installed) modules: [Minify] (https://github.com/coderaiser/minify "Minify")
and [socket.io] (https://github.com/LearnBoost/socket.io "Socket.IO").
Install addtitional modules (type in **Cloud Commander** directory):
npm i
Extensions
---------------
**Cloud Commander** desinged to easily porting extensions.
For extend main functionality Cloud Commander use next modules:
- [Ace] [AceURL]
- [FancyBox] [FancyBoxURL]
- [jQuery-contextMenu] [jQuery-contextMenuURL]
- [jq-console] [jq-consoleURL]
- [github] [githubURL]
- [dropbox-js] [dropbox-jsURL]
- [jquery] [jqueryURL]
[AceURL]: //ace.ajax.org/ "Ace"
[FancyBoxURL]: //github.com/fancyapps/fancyBox "FancyBox"
[jQuery-contextMenuURL]: //github.com/medialize/jQuery-contextMenu "jQuery-contextMenu"
[jq-consoleURL]: //github.com/replit/jq-console "jq-console"
[githubURL]: //github.com/michael/github "github"
[dropbox-jsURL]: //github.com/dropbox/dropbox-js "dropbox-js"
[jqueryURL]: //jquery.com
Contributing
---------------
If you would like to contribute - send pull request to dev branch.
Getting dev version of **Cloud Commander**:
git clone git://github.com/coderaiser/cloudcmd.git
git checkout dev
It is possible that dev version of Cloud Commander will needed dev version of Minify,
so to get it you should type a couple more commands:
cd node_modules
rm -rf minify
git clone git://github.com/coderaiser/minify
git checkout dev
Version history
---------------
- *2013.10.17*, **[v0.5.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.5.0.zip)**
- *2013.09.27*, **[v0.4.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.4.0.zip)**
- *2013.08.01*, **[v0.3.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.3.0.zip)**
- *2013.04.22*, **[v0.2.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.2.0.zip)**
- *2013.03.01*, **[v0.1.9](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.9.zip)**
- *2012.12.12*, **[v0.1.8](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.8.zip)**
- *2012.10.01*, **[v0.1.7](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.7.zip)**
- *2012.08.24*, **[v0.1.6](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.6.zip)**
- *2012.08.06*, **[v0.1.5](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.5.zip)**
- *2012.07.27*, **[v0.1.4](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.4.zip)**
- *2012.07.19*, **[v0.1.3](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.3.zip)**
- *2012.07.14*, **[v0.1.2](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.2.zip)**
- *2012.07.11*, **[v0.1.1](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.1.zip)**
- *2012.00.00*, **[v0.1.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.0.zip)**
License
---------------
MIT [license](LICENSE "license").
Special Thanks
---------------
- [Polietilena](http://polietilena.github.io/ "Polietilena") for [logo](img/logo/cloudcmd.png "logo") and [favicon](img/favicon/favicon.png "favicon").
- [Elec-ua](https://github.com/elec-ua) for [ru](http://ru.cloudcmd.io "Cloud Commander in Russian") and [ua](http://ua.cloudcmd.io "Cloud Commander in Ukrainian") translations.

323
README.md
View file

@ -1,13 +1,12 @@
Cloud Commander v0.4.0 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
Cloud Commander v0.5.0 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL]
===============
###[Main][MainURL] [Blog][BlogURL] [Demo][DemoURL]
[![Flattr][FlattrIMGURL]][FlattrURL]
[NPMIMGURL]: https://badge.fury.io/js/cloudcmd.png
[BuildStatusIMGURL]: https://secure.travis-ci.org/coderaiser/cloudcmd.png?branch=master
[DependencyStatusIMGURL]: https://gemnasium.com/coderaiser/cloudcmd.png
[FlattrIMGURL]: http://api.flattr.com/button/flattr-badge-large.png
[NPM_INFO_IMG]: https://nodei.co/npm/cloudcmd.png?downloads=true&&stars
[NPMURL]: http://badge.fury.io/js/cloudcmd
[NPMURL]: https://npmjs.org/package/cloudcmd
[BuildStatusURL]: http://travis-ci.org/coderaiser/cloudcmd "Build Status"
[DependencyStatusURL]: https://gemnasium.com/coderaiser/cloudcmd "Dependency Status"
[FlattrURL]: https://flattr.com/submit/auto?user_id=coderaiser&url=github.com/coderaiser/cloudcmd&title=cloudcmd&language=&tags=github&category=software "flattr"
@ -20,320 +19,4 @@ Cloud Commander v0.4.0 [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status]
![Cloud Commander](/img/logo/cloudcmd.png "Cloud Commander")
Benefits
---------------
- full browser compatibility *(ie6+,chrome,safari,opera,firefox)*;
- responsible design
- one full page loading, *and then just one-time json-dir-listings loading
(with refresh opportunity).*
- caching read directories *to localStorage (for now)
(so if network will disconnected or something happens with a signal, we
definitely will can work with cached copy of directory listings)*;
- key binding
- disabled js support *(working in limited mode)*.
- automated minification *client js-files and onstart-reading Cloud manager files on server starting.*
**Cloud Commander** uses all benefits of js, so if js is disabled,
we go to *limited mode*.
Limited-mode features
---------------
- no keybinding
- no local caching
- full loading of all web page(with styles, js-scripts, html-page etc).
Hot keys
---------------
In all modern web browsers (but not in IE, becouse he special) hot keys works.
There is a short list:
- **F1** - help
- **F2** - rename current file
- **F3** - view
- **F4** - edit
- **F5** - copy
- **F6** - rename/move
- **F7** - new dir
- **F8, Delete** - remove current file
- **F9** - menu
- **Ctrl + r** - reload dir content
- **Ctrl + d** - clear local cache (wich contains dir contents)
- **Alt + q** - disable key bindings
- **Alt + s** - get all key bindings back
- **Ctrl + a** - select all files in a panel
- **up, down, enter** - filesystem navigation
- **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
- **Shift + Delete** - remove without prompt
- **Insert** - select current file
- **Shift + F10** - context menu
- **~** - console
Edit
---------------
[Demo](http://io.cloudcmd.io/fs/etc#/edit/passwd "Edit")
![Edit](/img/screenshot/edit.png "Edit")
###Hot keys
- **F4** - open
- **Ctrl + s** - save
- **Esc** - close
Console
---------------
[Demo](http://io.cloudcmd.io#/console "Console")
![Console](/img/screenshot/console.png "Console")
###Hot keys
- **~** - open
- **Esc** - close
Menu
---------------
[Demo](http://io.cloudcmd.io#/menu "Menu")
![Menu](/img/screenshot/menu.png "Menu")
Right mouse click button shows context menu with items:
- View
- Edit
- Rename
- Delete
- Zip file
- Upload to (Dropbox, Github, GDrive)
- Download
- New (File, Dir, from cloud)
###Hot keys
- **F9** - open
- **Esc** - close
Menu
---------------
Right mouse click button shows context menu with items:
- View
- Edit
- Rename
- Delete
- Upload to (Dropbox, Github, GDrive)
- Download
- New (File, Dir, from cloud)
Install
---------------
[![NPM_INFO][NPM_INFO_IMG]][NPM_INFO_URL]
Installing **Cloud Commander** is very simple.
All you need is
- install [node.js](http://nodejs.org/ "node.js")
- [download](https://github.com/coderaiser/cloudcmd/archive/master.zip)
and unpack or just clone repository from github:
```
git clone git://github.com/coderaiser/cloudcmd.git
cd cloudcmd
node cloudcmd
```
or install in npm:
```
npm i cloudcmd -g
cloudcmd
```
Configuration
---------------
All main configuration could be done via config.json.
```js
{
"api_url" :"/api/v1",
"appcache" : false, /* cache files for offline use */
"analytics" : true, /* google analytics suport */
"localStorage" : true, /* cache directory data */
"minification" : { /* minification of js,css,html and img */
"js" : false, /* minify module needed */
"css" : false, /* npm i minify */
"html" : true,
"img" : false
},
"cache" : true,
"logs" : false, /* logs or console ouput */
"show_keys_panel" : true, /* show classic panel with buttons of keys */
"server" : true, /* server mode or testing mode */
"socket" : true /* enable web sockets */
"port" : 8000, /* http port or null(default) */
"sslPort" : 443, /* https port or null(default) */
"ip" : null, /* ip or null(default) */
"ssl" : false /* should use https? */
"rest" : true /* enable rest interface */
}
```
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](shell/addtables.sh) for default options.
```sh
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -L # look rules before
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 8000
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -A PREROUTING -p tcp --dport 443 -j REDIRECT --to-ports 4430
@:/tmp/cloudcmd (dev) $ sudo 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).
```sh
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 2
@:/tmp/cloudcmd (dev) $ sudo iptables -t nat -D PREROUTING 1
```
###nginx
Get [nginx](http://nginx.org/ "nginx"). On linux it could be done like that
```sh
sudo apt-get install nginx #for ubuntu and debian
```
Than make host file **/etc/nginx/sites-enabled/io.cloudcmd.io**
( *io.cloudcmd.io* is your domain name) with content:
```sh
server {
listen 80;
server_name io.cloudcmd.io;
access_log /var/log/nginx/io.cloudcmd.io.access.log;
location / {
proxy_pass http://127.0.0.1:8000/;
}
}
```
```sh
# create symlink of this file
ln -s ./sites-enabled/io.cloudcmd.io ./sites-available
# restart nginx
/etc/init.d/nginx restart
```
To run Cloud Commander as daemon in linux you could set **log** to true in config and
do something like this:
nohup node cloudcmd
Authorization
---------------
Cloud Commander could authorize clients on GitHub via openID.
All things that should be done is must be added **id** and **secret** of application
from github settings page and added to [modules.json](json/modules.json) (id just) and env variable (secret)
with names: *github_id*, *github_secret*, *dropbox_key*, *dropbox_secret* etc in
[secret.bat](shell/secret.bat) *(on win32)* or [secret.sh](shell/secret.sh) *(on nix)*.
Start
---------------
To start **Cloud Commander** only one command needed:
node cloudcmd
or on win platform just
cloudcmd
After that Cloud Commander reads port information from config file [config.json](json/config.json#L17) and start server
on this port ( **8000** by default ), if none of port varibles ( *cloud9*, *cloudfoundry* and *nodester* ) isn't exist.
Then type in browser
http://127.0.0.1:8000
or
http://localhost:8000
Update
---------------
**Cloud Commander** is very often updates.
Update is doing automagically but it could be done also manualy
by typing a few commands in cloudcmd directory:
git pull
or check new version on npm
npm info cloudcmd
and then, if there is new version
npm r cloudcmd
npm i cloudcmd
Additional modules
---------------
**Cloud Commander's Server Side** not using additional modules for main functionality.
But for minification and optimization tricks optional can be
assingned (and installed) modules: [Minify] (https://github.com/coderaiser/minify "Minify")
and [socket.io] (https://github.com/LearnBoost/socket.io "Socket.IO").
Install addtitional modules (type in **Cloud Commander** directory):
npm i
Extensions
---------------
**Cloud Commander** desinged to easily porting extensions.
For extend main functionality Cloud Commander use next modules:
- [Ace] [AceURL]
- [FancyBox] [FancyBoxURL]
- [jQuery-contextMenu] [jQuery-contextMenuURL]
- [jq-console] [jq-consoleURL]
- [github] [githubURL]
- [dropbox-js] [dropbox-jsURL]
- [jquery] [jqueryURL]
[AceURL]: //ace.ajax.org/ "Ace"
[FancyBoxURL]: //github.com/fancyapps/fancyBox "FancyBox"
[jQuery-contextMenuURL]: //github.com/medialize/jQuery-contextMenu "jQuery-contextMenu"
[jq-consoleURL]: //github.com/replit/jq-console "jq-console"
[githubURL]: //github.com/michael/github "github"
[dropbox-jsURL]: //github.com/dropbox/dropbox-js "dropbox-js"
[jqueryURL]: //jquery.com
Contributing
---------------
If you would like to contribute - send pull request to dev branch.
Getting dev version of **Cloud Commander**:
git clone git://github.com/coderaiser/cloudcmd.git
git checkout dev
It is possible that dev version of Cloud Commander will needed dev version of Minify,
so to get it you should type a couple more commands:
cd node_modules
rm -rf minify
git clone git://github.com/coderaiser/minify
git checkout dev
Version history
---------------
- *2013.09.27*, **[v0.4.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.4.0.zip)**
- *2013.07.01*, **[v0.3.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.3.0.zip)**
- *2013.04.22*, **[v0.2.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.2.0.zip)**
- *2013.03.01*, **[v0.1.9](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.9.zip)**
- *2012.12.12*, **[v0.1.8](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.8.zip)**
- *2012.10.01*, **[v0.1.7](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.7.zip)**
- *2012.08.24*, **[v0.1.6](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.6.zip)**
- *2012.08.06*, **[v0.1.5](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.5.zip)**
- *2012.07.27*, **[v0.1.4](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.4.zip)**
- *2012.07.19*, **[v0.1.3](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.3.zip)**
- *2012.07.14*, **[v0.1.2](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.2.zip)**
- *2012.07.11*, **[v0.1.1](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.1.zip)**
- *2012.00.00*, **[v0.1.0](//github.com/coderaiser/cloudcmd-archive/raw/master/cloudcmd-v0.1.0.zip)**
License
---------------
MIT [license](LICENSE "license").
Special Thanks
---------------
- [Polietilena](http://polietilena.github.io/ "Polietilena") for [logo](img/logo/cloudcmd.png "logo") and [favicon](img/favicon/favicon.png "favicon").
- [Elec-ua](https://github.com/elec-ua) for [ru](http://ru.cloudcmd.io "Cloud Commander in Russian") and [ua](http://ua.cloudcmd.io "Cloud Commander in Ukrainian") translations.
[![Flattr][FlattrIMGURL]][FlattrURL]

View file

@ -44,7 +44,7 @@
/**
* additional processing of index file
*/
function indexProcessing(pData){
function indexProcessing(pData) {
var lPath, lReplace, lKeysPanel,
lData = pData.data,
lAdditional = pData.additional;
@ -54,18 +54,13 @@
* меняем в index.html обычные css на
* минифицированый
*/
if (Minify.allowed.css){
if (Minify.allowed) {
lPath = '/' + Util.removeStr(Minify.MinFolder, DIR);
lReplace = '<link rel=stylesheet href="/css/reset.css">';
lData = Util.removeStr(lData, lReplace)
.replace('/css/style.css', lPath + 'all.min.css');
}
lData = Util.render(lData, {
title : CloudFunc.getTitle(),
fm : lAdditional
});
if (!Config.appcache)
lData = Util.removeStr(lData, [
/* min */
@ -74,11 +69,16 @@
' manifest="/cloudcmd.appcache"'
]);
if (!Config.show_keys_panel){
if (!Config.show_keys_panel) {
lKeysPanel = '<div id=keyspanel';
lData = lData.replace(lKeysPanel, lKeysPanel +' class=hidden');
}
lData = Util.render(lData, {
title : CloudFunc.getTitle(),
fm : lAdditional
});
return lData;
}
@ -96,7 +96,7 @@
lFiles[0][lFONT_REMOTE] = lFONT_LOCAL;
lFiles[1][lJQUERY_REMOTE] = lJQUERY_LOCAL;
if (Config.minification.css)
if (Config.minify)
lFiles.push('node_modules/minify/min/all.min.css');
AppCache.addFiles(lFiles);
@ -109,22 +109,19 @@
*/
function minimize(pAllowed){
var lOptimizeParams = [],
lStyleCSS = DIR + 'css/style.css',
lResetCSS = DIR + 'css/reset.css',
lStyles = [{}, {}],
lStyleCSS = DIR + 'css/style.css',
lResetCSS = DIR + 'css/reset.css',
lCSSOptions = {
img : pAllowed.img,
lCSSOptions = {
img : true,
merge : true
};
if (pAllowed.js)
if (pAllowed) {
lOptimizeParams.push(LIBDIR + 'client.js');
if (pAllowed.html)
lOptimizeParams.push(INDEX);
if (pAllowed.css) {
var lStyles = [{}, {}];
lStyles[0][lStyleCSS] = lCSSOptions;
lStyles[1][lResetCSS] = lCSSOptions;
@ -240,14 +237,14 @@
var lStr = pData.toString(),
lReadedConf = Util.parseJSON(lStr);
if (!Config.minification)
if (!Config.minify)
main.config = Config = lReadedConf;
Util.tryCatchLog(function(){
Config.minification.js = lReadedConf.minification.js;
Config.cache = lReadedConf.cache;
Config.minify = lReadedConf.minify;
Config.cache = lReadedConf.cache;
Minify.setAllowed(Config.minification);
Minify.setAllowed(Config.minify);
});
}
else
@ -318,9 +315,9 @@
main.sendResponse(p);
}
else{ /* get back html*/
p.name = Minify.allowed.html ? Minify.getName(INDEX) : INDEX;
p.name = Minify.allowed ? Minify.getName(INDEX) : INDEX;
fs.readFile(p.name, function(pError, pData){
if (!pError){
if (!pError) {
var lPanel = CloudFunc.buildFromJSON(pJSON, FileTemplate, PathTemplate),
lList = '<ul id=left class=panel>' + lPanel + '</ul>' +
'<ul id=right class=panel>' + lPanel + '</ul>';
@ -343,13 +340,11 @@
/* function sets stdout to file log.txt */
function writeLogsToFile(){
var stdo = fs.createWriteStream('./log.txt');
function writeLogsToFile() {
var stdout = process.stdout,
writeFile = fs.createWriteStream('log.txt'),
write = writeFile.write.bind(writeFile);
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
stdo.write(string);
};
})(process.stdout.write);
stdout.write = write;
}
})();

View file

@ -66,21 +66,21 @@ body {
}
.error::before {
position: relative;
font-size: 14px;
position : relative;
font-family : 'Fontello';
color: rgb(222, 41, 41);
cursor :default;
content: '\2757';
font-size : 14px;
color : rgb(222, 41, 41);
cursor : default;
content : '\2757';
}
.loading {
position : relative;
top : 1px;
display : inline-block;
width : 15px;
height : 14.8px;
position:relative;
top:1px;
background:url(/img/spinner.gif);
background : url(/img/spinner.gif);
}
.refresh-icon {
@ -228,10 +228,6 @@ body {
cursor: default;
}
button {
width:10%;
}
a {
text-decoration:none;
}

View file

@ -1,8 +1,8 @@
<li draggable class>
<span class="mini-icon {type}"></span>
<span class="mini-icon {{ type }}"></span>
<span class=name>
<a href="{link}" title="{name}" target="{target}" draggable=true>{name}</a>
<a href="{{ link }}" title="{{ name }}" target="{{ target }}" draggable=true>{{ name }}</a>
</span>
<span class=size>{size}</span><span class=owner>{owner}</span>
<span class=mode>{mode}</span>
<span class=size>{{ size }}</span><span class=owner>{{ owner }}</span>
<span class=mode>{{ mode }}</span>
</li>

View file

@ -2,19 +2,20 @@
<html manifest="/cloudcmd.appcache">
<head>
<meta charset="utf-8">
<meta name="robots" content="noindex,nofollow">
<!-- mobile first design -->
<meta content="width=device-width,initial-scale=1" name="viewport" />
<!-- chrome frame -->
<meta http-equiv="X-UA-Compatible" content=" chrome=1" />
<link href=/img/favicon/favicon.png rel=icon type=image/png />
<title>{title}</title>
<title>{{ title }}</title>
<link rel=stylesheet href="/css/reset.css">
<link rel=stylesheet href="/css/style.css">
</head>
<body>
<div id=fm class=no-js>{fm}</div>
<div id=fm class=no-js>{{ fm }}</div>
<div id=keyspanel>
<button id=f1 class=cmd-button>F1 - help</button>
<button id=f2 class=cmd-button>F2 - rename</button>

View file

@ -1 +1 @@
<li class=path><span class="path-icon clear-cache" id=clear-cache title="clear cache (Ctrl+D)"></span><span class="path-icon refresh-icon" title="refresh (Ctrl+R)"><a href="{link}"></a></span><span>{path}</span></li>
<li class=path><span class="path-icon clear-cache" id=clear-cache title="clear cache (Ctrl+D)"></span><span class="path-icon refresh-icon" title="refresh (Ctrl+R)"><a href="{{ link }}"></a></span><span>{{ path }}</span></li>

View file

@ -1,22 +1,18 @@
{
"api_url" : "/api/v1",
"appcache" : false,
"analytics" : true,
"localStorage" : true,
"minification" : {
"js" : true,
"css" : true,
"html" : true,
"img" : true
},
"cache" : true,
"logs" : false,
"show_keys_panel" : true,
"server" : true,
"socket" : true,
"port" : 8000,
"sslPort" : 4430,
"ip" : null,
"ssl" : false,
"rest" : true
"api_url": "/api/v1",
"appcache": false,
"analytics": true,
"localStorage": true,
"minify": true,
"online": true,
"cache": true,
"logs": false,
"show_keys_panel": true,
"server": true,
"socket": true,
"port": 8000,
"sslPort": 4430,
"ip": null,
"ssl": false,
"rest": true
}

View file

@ -47,7 +47,7 @@ var Util, DOM, CloudFunc, CloudCmd;
DOM.Images.showLoad(pNeedRefresh ? {top:true} : null);
/* загружаем содержимое каталога */
ajaxLoad(lLink, { refresh: pNeedRefresh });
CloudCmd.ajaxLoad(lLink, { refresh: pNeedRefresh });
}
DOM.preventDefault(pEvent);
@ -338,7 +338,7 @@ var Util, DOM, CloudFunc, CloudCmd;
* @param pOptions
* { refresh, nohistory } - необходимость обновить данные о каталоге
*/
function ajaxLoad(pPath, pOptions){
CloudCmd.ajaxLoad = function(pPath, pOptions){
if(!pOptions)
pOptions = {};
@ -404,7 +404,7 @@ var Util, DOM, CloudFunc, CloudCmd;
Cache.set(lCleanPath, lJSON_s);
}
});
}
};
/**
* Функция строит файловую таблицу

View file

@ -699,9 +699,8 @@ var CloudCmd, Util, DOM, CloudFunc;
/* If it's json - parse it as json */
if (lType && Util.isContainStr(lType, TYPE_JSON) )
lData = Util.parseJSON(lJqXHR.response) || lJqXHR.response;
if ( Util.isFunction(p.success) )
p.success(lData, lJqXHR.statusText, lJqXHR);
Util.exec(p.success, lData, lJqXHR.statusText, lJqXHR);
}
/* file not found or connection lost */
else{
@ -730,8 +729,6 @@ var CloudCmd, Util, DOM, CloudFunc;
* @param pFunc - onload function
*/
this.anyLoadOnLoad = function(pParams_a, pFunc) {
var lRet = this;
if ( Util.isArray(pParams_a) ) {
var lParam = pParams_a.pop(),
lFunc = function() {
@ -742,19 +739,19 @@ var CloudCmd, Util, DOM, CloudFunc;
lParam = { src : lParam };
else if ( Util.isArray(lParam) ) {
this.anyLoadInParallel(lParam, lFunc);
Loader.anyLoadInParallel(lParam, lFunc);
}
if (lParam && !lParam.func) {
lParam.func = lFunc;
this.anyload(lParam);
Loader.anyload(lParam);
}else
Util.exec(pFunc);
}
return lRet;
return Loader;
};
/**
@ -766,8 +763,7 @@ var CloudCmd, Util, DOM, CloudFunc;
* @param pFunc - onload function
*/
this.anyLoadInParallel = function(pParams_a, pFunc) {
var lRet = this,
lDone = [],
var lDone = [],
lDoneFunc = function (pCallBack) {
Util.exec(pCallBack);
@ -792,11 +788,11 @@ var CloudCmd, Util, DOM, CloudFunc;
var lFunc = lParam.func;
lParam.func = Util.retExec(lDoneFunc, lFunc);
this.anyload(lParam);
Loader.anyload(lParam);
}
}
return lRet;
return Loader;
};
/**
@ -853,7 +849,7 @@ var CloudCmd, Util, DOM, CloudFunc;
}
/* убираем путь к файлу, оставляя только название файла */
if (!lID && lSrc)
lID = this.getIdBySrc(lSrc);
lID = DOM.getIdBySrc(lSrc);
var lElement = DOMTree.getById(lID);
@ -953,7 +949,7 @@ var CloudCmd, Util, DOM, CloudFunc;
* @param pFunc
*/
this.jsload = function(pSrc, pFunc) {
var lRet = this.anyload({
var lRet = Loader.anyload({
name : 'script',
src : pSrc,
func : pFunc
@ -984,7 +980,7 @@ var CloudCmd, Util, DOM, CloudFunc;
pParams_o.name = 'style';
pParams_o.parent = pParams_o.parent || document.head;
return this.anyload(pParams_o);
return Loader.anyload(pParams_o);
},
/**
@ -1000,7 +996,7 @@ var CloudCmd, Util, DOM, CloudFunc;
pParams_o[i].parent = pParams_o.parent || document.head;
}
return this.anyload(pParams_o);
return Loader.anyload(pParams_o);
}
else if ( Util.isString(pParams_o) )
@ -1009,7 +1005,7 @@ var CloudCmd, Util, DOM, CloudFunc;
pParams_o.name = 'link';
pParams_o.parent = pParams_o.parent || document.head;
return this.anyload(pParams_o);
return Loader.anyload(pParams_o);
};
/**
@ -1053,26 +1049,21 @@ var CloudCmd, Util, DOM, CloudFunc;
* @param pCallBack
*/
this.jqueryLoad = function(pCallBack) {
Loader.jquery({
onload: pCallBack,
CloudCmd.getConfig(function(config) {
var online = config.online && navigator.onLine;
onerror: function() {
Loader.jsload('/lib/client/jquery.js', {
onload: pCallBack
Util.ifExec(!online,
function() {
Loader.jsload('/lib/client/jquery.js', {
onload: pCallBack
});
},
function(callback) {
Loader.jquery({
onload: pCallBack,
onerror: callback
});
});
/* if could not load jquery from google server
* maybe we offline, load font from local
* directory */
Loader.cssSet({
id :'local-droids-font',
element : document.head,
inner : '@font-face {font-family: "Droid Sans Mono";' +
'font-style: normal;font-weight: normal;' +
'src: local("Droid Sans Mono"), local("DroidSansMono"),'+
' url("/font/DroidSansMono.woff") format("woff");}'
});
}
});
};
@ -1486,6 +1477,20 @@ var CloudCmd, Util, DOM, CloudFunc;
return this;
};
this.toggleAllSelectedFiles = function(pCurrent) {
var i, n,
isStr = Util.isString(pCurrent),
lCurrent = !isStr && pCurrent || Cmd.getCurrentFile(),
lParent = lCurrent.parentElement,
lNodes = lParent.childNodes;
/* not path and fm_header */
for (i = 2, n = lNodes.length; i < n; i++)
DOM.toggleSelectedFile( lNodes[i] );
return Cmd;
};
/**
* setting history wrapper

View file

@ -24,7 +24,7 @@ var CloudCmd, Util, DOM;
this.show = function(){
Images.showLoad({top:true});
DOM.ajax({
url: '/README.md',
url: '/HELP.md',
success: function (pData){
var lData = {text: pData};
DOM.ajax({

View file

@ -52,7 +52,6 @@ var CloudCmd, Util, DOM;
lTabPanel = {
left : 0,
right : 0
};
this.isBind = function() {return Binded;};
@ -80,18 +79,20 @@ var CloudCmd, Util, DOM;
switch (lKeyCode) {
case Key.TAB:
/* changing parent panel of curent-file */
var lPanel = DOM.getPanel(),
lId = lPanel.id;
var lFirstFileOnList,
lPanel = DOM.getPanel(),
lId = lPanel.id;
lTabPanel[lId] = lCurrent;
lTabPanel[lId] = lCurrent;
lPanel = DOM.getPanel({active:false});
lId = lPanel.id;
lPanel = DOM.getPanel({active:false});
lId = lPanel.id;
if (lTabPanel[lId])
DOM.setCurrentFile(lTabPanel[lId]);
else{
var lFirstFileOnList = DOM.getByTag('li', lPanel)[2];
lCurrent = lTabPanel[lId];
if (lCurrent && lCurrent.parentElement)
DOM.setCurrentFile(lCurrent);
else {
lFirstFileOnList = DOM.getByTag('li', lPanel)[2];
DOM.setCurrentFile(lFirstFileOnList);
}
@ -268,14 +269,8 @@ var CloudCmd, Util, DOM;
case Key.A:
if (pEvent.ctrlKey) {
var lParent = lCurrent.parentElement,
lNodes = lParent.childNodes;
/* not path and fm_header */
for (i = 2, n = lNodes.length; i < n; i++)
DOM.toggleSelectedFile( lNodes[i] );
DOM.preventDefault(pEvent);
DOM .toggleAllSelectedFiles(lCurrent)
.preventDefault(pEvent);
}
break;

View file

@ -12,7 +12,10 @@ var Util, DOM, CloudCmd;
this.analytics = function() {
getConfig(function(config) {
if (config.analytics) {
var analytics = config.analytics,
online = config.online;
if (analytics && online) {
Events.addOneTime('mousemove', function(){
var FIVE_SECONDS = 5000,
lUrl = CloudCmd.LIBDIRCLIENT + 'analytics.js';
@ -31,6 +34,7 @@ var Util, DOM, CloudCmd;
dragndrop();
unload();
pop();
online();
};
this.initKeysPanel = function() {
@ -278,7 +282,7 @@ var Util, DOM, CloudCmd;
if (pEvent.state) {
lPath = pEvent.state + '?json';
ajaxLoad(lPath, {nohistory: true});
CloudCmd.ajaxLoad(lPath, {nohistory: true});
} else
CloudCmd.route(location.hash);
@ -286,6 +290,22 @@ var Util, DOM, CloudCmd;
});
}
function online() {
var cssSet = Util.retExec(DOM.cssSet, {
id :'local-droids-font',
element : document.head,
inner : '@font-face {font-family: "Droid Sans Mono";' +
'font-style: normal;font-weight: normal;' +
'src: local("Droid Sans Mono"), local("DroidSansMono"),'+
' url("/font/DroidSansMono.woff") format("woff");}'
});
if (navigator.onLine)
Events.addOneTime('offline', cssSet);
else
cssSet();
}
}
})(Util, DOM);

View file

@ -180,6 +180,7 @@ var CloudCmd, Util, DOM, CloudFunc, $;
setTimeout( Util.retExec(DOM.renameCurrent), 100);
},
'Delete' : Util.retExec(DOM.promptDeleteSelected),
'(Un)Select All': DOM.toggleAllSelectedFiles,
'Zip file' : DOM.zipFile
};

View file

@ -19,7 +19,7 @@ var CloudCmd, Util, DOM, io;
socket = io.connect(CloudCmd.HOST, {
'reconnect' : true,
'reconnection delay' : 500,
'max reconnection attempts' : Math.pow(2, 64),
'max reconnection attempts' : Math.pow(2, 32),
'reconnect_failed' : function() {
Util.log('Could not reconnect. Reload page.');
}

View file

@ -137,6 +137,11 @@ var CloudCmd, Util, DOM, CloudFunc, $;
*/
'background: #b3d4fc;' +
'text-shadow: none;' +
'}' +
'#fancybox-loading div {' +
'background: none;' +
'width: 0;' +
'height: 0' +
'}'
});

View file

@ -32,7 +32,7 @@
/* базовая инициализация */
function init(pAppCachProcessing) {
var lConfig = main.config,
lMinifyAllowed = lConfig.minification;
lMinifyAllowed = lConfig.minify;
/* Change default parameters of
* js/css/html minification
@ -179,9 +179,7 @@
lName = Path.join(DIR, lName);
lMin = Minify.allowed,
lExt = Util.getExtension(lName),
lResult = lExt === '.js' && lMin.js ||
lExt === '.css' && lMin.css ||
lExt === '.html' && lMin.html;
lResult = lMin && Util.strCmp(lExt, ['.js', '.css', '.html']);
Util.ifExec(!lResult,
function(pParams) {

View file

@ -45,7 +45,7 @@
/* if a couple files */
if (Util.isArray(pFileNames)) {
n = pFilesNames.length;
n = pFileNames.length;
for (i = 0; i < n; i++) {
/* if fallback setted up */

View file

@ -13,7 +13,7 @@
ext,
path, fs, zlib, url, pipe,
OK, FILE_NOT_FOUND, MOVED_PERMANENTLY = 301,
OK, FILE_NOT_FOUND, MOVED_PERMANENTLY,
REQUEST, RESPONSE,
Config = {
@ -25,6 +25,7 @@
/* Consts */
exports.OK = OK = 200;
MOVED_PERMANENTLY = 301;
exports.FILE_NOT_FOUND = FILE_NOT_FOUND = 404;
exports.REQUEST = REQUEST = 'request';
@ -318,14 +319,15 @@
* send error response
*/
function sendError(pParams, pError) {
var lRet = checkParams(pParams);
var p, lRet = checkParams(pParams);
if(lRet){
var p = pParams;
if (lRet) {
p = pParams;
p.status = FILE_NOT_FOUND;
if (!p.data && pError)
p.data = pError.toString();
p.data = pError.toString();
sendResponse(p);
}
}

View file

@ -29,12 +29,7 @@
/* pathes to directories */
INDEX : HTMLDIR + 'index.html',
/* приватный переключатель минимизации */
allowed : {
css : true,
js : true,
html : true,
img : true
},
allowed : true,
/* функция разрешает или
* запрещает минимизировать
@ -47,19 +42,16 @@
* и сохранение их в css-файл
*/
setAllowed :function(pAllowed) {
this.allowed = pAllowed && Minify ? pAllowed : {
js : false,
css : false,
html : false
};
this.allowed = pAllowed && Minify;
},
optimize: function(pName, pParams) {
var lRet;
if (Minify) {
pParams.name = Minify.getName(pName);
lRet = this.allowed.css || this.allowed.js || this.allowed.html;
lRet = this.allowed;
if(!this.MinFolder)
this.MinFolder = Minify.MinFolder;
@ -75,12 +67,8 @@
});
}
else {
this.allowed = {
js : false,
css : false,
html : false
};
this.allowed = false;
Util.log(COULD_NOT_MINIFY);
}

View file

@ -18,10 +18,10 @@
exports.create = function(pParams) {
var lZlib, lError, lMsg, lRead, lWrite, lIsFsWrite,
p = pParams;
p = pParams;
if (p) {
lRead = p.read || fs.createReadStream(p.from, {
lRead = p.read || fs.createReadStream(p.from, {
bufferSize: 4 * 1024
});
@ -37,23 +37,20 @@
};
if (p.zip) {
lZlib = zlib.createGzip();
lZlib = zlib.createGzip();
lRead.on('error', lError);
lRead = lRead.pipe(lZlib);
lRead = lRead.pipe(lZlib);
}
lWrite.on('error', lError);
lRead.on('error', lError);
if (lIsFsWrite)
lWrite.on('open', function() {
lRead.pipe(lWrite);
lRead.on('end', Util.retExec(p.callback));
});
else {
Util.ifExec(!lIsFsWrite, function() {
lRead.pipe(lWrite);
lRead.on('end', Util.retExec(p.callback));
}
}, function(pCallBack) {
lWrite.on('open', pCallBack);
});
}
};

View file

@ -151,8 +151,10 @@
callback : function(pError) {
var lName;
if (pError)
if (pError) {
Util.log(pError);
main.sendError(pParams, pError);
}
else {
lName = path.basename(p.name);
sendMsg(pParams, 'save', lName);

View file

@ -170,26 +170,24 @@ Util = exports || {};
* @param pProps
*/
Util.copyObj = function(pFromObj, pToObj, pProps) {
var lRet;
if (!pToObj)
lRet = pToObj = {};
function copy(pI) {
var lName = pProps ? pProps[pI] : pI,
lValue = pFromObj[lName];
var lRet = pToObj || pProps || {},
copy = function(name, obj) {
var value = obj[name];
if (lValue)
pToObj[lName] = pFromObj[lName];
}
if (value)
pToObj[name] = obj[name];
},
forIn = function(obj) {
Util.forIn(obj, function(name) {
copy(name, obj);
});
};
if ( Util.isObject(pFromObj) ) {
if (!pProps)
Util.forIn(pFromObj, copy);
else
Util.fori(pProps.length, copy);
if (Util.isObject(pFromObj)) {
if (pProps)
forIn(pProps);
lRet = lRet || true;
forIn(pFromObj);
}
return lRet;
@ -515,13 +513,15 @@ Util = exports || {};
* @pStr
* @pFrom
* @pTo
* @pNotEscape
*/
Util.replaceStr = function(pStr, pFrom, pTo) {
Util.replaceStr = function(pStr, pFrom, pTo, pNotEscape) {
var lRet = pStr;
if (pStr && pFrom) {
pFrom = Util.escapeRegExp(pFrom);
if (!pNotEscape)
pFrom = Util.escapeRegExp(pFrom);
lRet = pStr.replace(new RegExp(pFrom, 'g'), pTo);
}
@ -544,7 +544,7 @@ Util = exports || {};
* @pView
*/
Util.render = function(pTempl, pView) {
var lRet = Util.ownRender(pTempl, pView, ['{', '}']);
var lRet = Util.ownRender(pTempl, pView);
return lRet;
};
@ -556,9 +556,11 @@ Util = exports || {};
* @pSymbols
*/
Util.ownRender = function(pTempl, pView, pSymbols) {
var SPACES = '\\s*';
if (!pSymbols)
pSymbols = ['{', '}'];
pSymbols = ['{{' + SPACES, SPACES + '}}'];
var lRet = pTempl,
lFirstChar,
lSecondChar;
@ -570,7 +572,7 @@ Util = exports || {};
var lStr = pView[lVar];
lStr = Util.exec(lStr) || lStr;
lRet = Util.replaceStr(lRet, lFirstChar + lVar + lSecondChar, lStr);
lRet = Util.replaceStr(lRet, lFirstChar + lVar + lSecondChar, lStr, true);
}
return lRet;
@ -699,22 +701,34 @@ Util = exports || {};
* @param pCallBack
* @param pArg
*/
Util.retExec = function(pCallBack, pArg) {
return function(pArgument) {
if ( !Util.isUndefined(pArg) )
pArgument = pArg;
Util.exec(pCallBack, pArgument);
Util.retExec = function() {
var args = arguments;
return function() {
var argsLocal, callback,
n = args.length;
if (n > 1)
argsLocal = args;
else {
callback = args[0];
argsLocal = arguments;
[].unshift.call(argsLocal, callback);
}
Util.exec.apply(null, argsLocal);
};
};
/**
* return function wich exec function in params
* @param pCallBack
* @param pArg
* @param arguments: callback, args
*/
Util.retFunc = function(pCallBack, pArg) {
Util.retFunc = function() {
var args = arguments;
return function() {
return Util.exec(pCallBack, pArg);
return Util.exec.apply(null, args);
};
};
@ -1025,4 +1039,4 @@ Util = exports || {};
return lRet;
};
})(Util, exports);
})(Util, exports);

View file

@ -1,8 +1,8 @@
{
"name": "cloudcmd",
"version": "0.4.0",
"version": "0.5.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",
"description": "User friendly cloud file manager.",
"description": "Cloud Commander - file manager with console and editor",
"homepage": "https://github.com/coderaiser/cloudcmd",
"repository": {
"type": "git",
@ -19,7 +19,7 @@
"subdomain": "cloudcmd",
"dependencies": {
"dropbox": "0.10.1",
"minify": "0.2.1",
"minify": "0.2.2",
"socket.io": "0.9.16"
},
"devDependencies": {},