update packages and readme

This commit is contained in:
2020-12-05 10:53:41 +05:30
parent 223a9cb197
commit 252a21203c
3 changed files with 58 additions and 26 deletions

View File

@@ -6,31 +6,36 @@ A simple file manager for managing files on a remote fs using Node.
![Sample Image](https://github.com/chrisvrose/chrisvrose.github.io/raw/gh-pages/static/projects/screenshots/nodejs-fm.png) ![Sample Image](https://github.com/chrisvrose/chrisvrose.github.io/raw/gh-pages/static/projects/screenshots/nodejs-fm.png)
Dependencies: `express` `body-parser` `@fortawesome/fontawesome-free` `jquery` `connect-busboy` Dependencies: `express` `body-parser` `@fortawesome/fontawesome-free` `jquery` `connect-busboy`,`morgan`
Dependencies(testing): `chai` `mocha` `chai-http` Dependencies(testing): `chai` `mocha` `chai-http`
## Checklist
- [x] Folder Traversal
- [X] File Downloads
- [X] File Moving
- [X] Upload
### Why ### Why
Personal requirement. Personal requirement.
Because of this, only renaming/moving(only in same fs, due to `fs.rename()`) is available, and uploading/downloading. Because of this, only renaming/moving(only in same fs, due to `fs.rename()`) is available, and uploading/downloading.
No authentication, as it is based on a small local server, and the major way of accessing it, is ssh. No authentication, as it is based on a small local server, and the major way of accessing it, is ssh.
## TOC
- [nodejs-fm](#nodejs-fm)
- [Why](#why)
- [TOC](#toc)
- [Usage](#usage)
- [Using settings.json](#using-settingsjson)
- [Server requests](#server-requests)
- [Credit](#credit)
- [Checklist](#checklist)
- [Dev Checklist](#dev-checklist)
## Usage ## Usage
Use `settings.json` and point it to a valid path, and select a required port. Default `8080`. Use `settings.json` and point it to a valid path, and select a required port. Default `8080`. Refer [how to use settings.json](#using-settingsjson).
*_Travis only checks the backend, which is a separate entity._* *_Travis only checks the backend, which is a separate entity._*
For running it: For running it:
```shell ```bash
# Clone repo # Clone repo
git clone https://github.com/chrisvrose/nodejs-fm.git git clone https://github.com/chrisvrose/nodejs-fm.git
# Move into repo folder # Move into repo folder
@@ -43,38 +48,49 @@ npm i
npm start npm start
``` ```
### Using settings.json
You need to have a `settings.json` in the project directory. A sample has been provided for usage.
|Key |Type |Default |Desc |
|:---------|:-------:|----------:|:-----------------------|
|dirname |`string` |`./sandbox`|Directory to serve |
|showHidden|`boolean`|false |Show hidden files |
|port |`number` |8080 |Webserver listening port|
### Server requests ### Server requests
Requests: Requests:
```javascript ```json
{ {
'loc': "<valid location>" "loc": "<valid location>"
} }
``` ```
Responses (View directory): Responses (View directory):
```javascript ```json
{ {
'loc': "<location>", "loc": "<location>",
'back': "<location|null>", "back": "<location|null>",
'contents':[ "contents":[
{ {
'name':"<filename>", "name":"<filename>",
'path':"<location>", "path":"<location>",
'isDir': "<true|false>" "isDir": "<true|false>"
}, },
...
] ]
} }
``` ```
Responses(Rename/Move Success,Upload) Responses(Rename/Move Success,Upload)
```javascript ```json
{ {
'loc':"<new location>" "loc":"<new location>"
} }
``` ```
@@ -84,3 +100,19 @@ Responses(Rename/Move Success,Upload)
- Chris Pratt: [File Download via Ajax]('https://codepen.io/chrisdpratt/pen/RKxJNo') - Chris Pratt: [File Download via Ajax]('https://codepen.io/chrisdpratt/pen/RKxJNo')
- StackOverflow: Troubleshooting errors - StackOverflow: Troubleshooting errors
- Google: All knowing - Google: All knowing
## Checklist
- [x] Folder Traversal
- [X] File Downloads
- [X] File Moving
- [X] Upload
## Dev Checklist
- [x] Folder Traversal
- [X] File Downloads
- [X] File Moving
- [X] Upload
- [X] Integration with frontend

6
package-lock.json generated
View File

@@ -5,9 +5,9 @@
"requires": true, "requires": true,
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": { "@fortawesome/fontawesome-free": {
"version": "5.13.1", "version": "5.15.1",
"resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.13.1.tgz", "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free/-/fontawesome-free-5.15.1.tgz",
"integrity": "sha512-D819f34FLHeBN/4xvw0HR0u7U2G7RqjPSggXqf7LktsxWQ48VAfGwvMrhcVuaZV2fF069c/619RdgCCms0DHhw==" "integrity": "sha512-OEdH7SyC1suTdhBGW91/zBfR6qaIhThbcN8PUXtXilY4GYnSBbVqOntdHbC1vXwsDnX0Qix2m2+DSU1J51ybOQ=="
}, },
"@types/body-parser": { "@types/body-parser": {
"version": "1.19.0", "version": "1.19.0",

View File

@@ -26,7 +26,7 @@
}, },
"homepage": "https://github.com/chrisvrose/nodejs-fm#readme", "homepage": "https://github.com/chrisvrose/nodejs-fm#readme",
"dependencies": { "dependencies": {
"@fortawesome/fontawesome-free": "^5.13.1", "@fortawesome/fontawesome-free": "^5.15.1",
"body-parser": "^1.19.0", "body-parser": "^1.19.0",
"connect-busboy": "0.0.2", "connect-busboy": "0.0.2",
"express": "^4.17.1", "express": "^4.17.1",