Access to remote File System via Web-App.
- Run
git clone https://github.com/gbrlfrc/HomeServer-WebApp.git
to clone repository. cd HomeServer-WebApp && yarn install
to install dependecies.
- To start File-Manager Server
yarn start /absoulute/path/to/dir
.
NOTE: alternatively you can use the bash scriptstart.sh
passing the directory as argument.
API | METHOD | DESCRIPTION | REQUESTED BODY | RETURNED TYPE |
---|---|---|---|---|
/list |
GET | parse directory provided by user as absolute path | null | JSON |
/download |
POST | retrive file or directory as attachment | relative path as string | ATTACHMENT |
/newDir |
POST | create new directory | relative path as string | JSON |
/deleteElement |
POST | delete an element | relative path as string | JSON |
/upload |
POST | upload file | Form-Data | JSON |
- the
/list
returned Object has the following structure :
OBJ{
status : 200 || 400,
dirent : Array<JSON> || null,
path : string,
isFile : boolean,
fileCont : Array<string>
}
- the
/upload
reuqest need to be submitted as follow :
let form = new FormData();
const data = {
name : string, //name of file
type : string, //extension of file
path : string, //relative path to the file
};
form.append('file', file) // type file
form.append('data', JSON.stringify(data))
- To start OAuth Server we need to create SECRETS from tokens generation first:
- run
hexdump -n 16 -e '4/4 "%08X" 1 "\n"' /dev/random
twice, and save the results inHomeServer-WebApp/OAuth/util/.env.ts
as string in access and refresh token variable yarn startOauth
.
NOTE: alternatively you can use the bash scriptstartOAuth.sh
.
- run
API | METHOD | DESCRIPTION | REQUESTED BODY | RETURNED TYPE |
---|---|---|---|---|
/signUp |
POST | add new user to userDB | JSON | JSON |
/logIn |
POST | user authenitcation | JSON | JSON |
/verify |
GET | verify AccessToken provided at logIn | JSON | JSON |
/refreshToken |
POST | generate new RefreshToken | JSON | JSON |
/logOut |
DELETE | remove RefreshToken from tokenDB | JSON | JSON |
- The
/signUp
request need a JSON with the following structure :
const user = {
name : string,
mail : string,
password : string,
}
The JSON for the /logIn
endpoint is closely the same, need only the name
and password
fields.
Example of requests are in FileManager and OAuth
- To start client simply open
HomeServer-WebApp/client/index.html
on an HTTP server like Apache or VS-Code LiveServer extension.
- API: download file
- API: compress and download directory
- API: add and remove directory
- API: upload single file
- API: upload directory
- OAuth Server
- Authentication
- NeDB database credentials
- Bcrypt credentials encrypting
- Authorization
- Access and Refresh token workflow
- Authentication
- CLIENT: FileManager workflow
- CLIENT: LogIn
- CLIENT: js, python, html, css Parser
- CLIENT: Live editor