CyberGen49 / sftp-browser

A web-based SFTP file browser that makes managing your server files easy!
https://sftpbrowser.cybah.me/
MIT License
11 stars 5 forks source link
browser files sftp webapp

sftp-browser

A web-based SFTP file browser that makes managing your server files easy!

Screenshot

SFTP Browser is still in development, but you can play with it at sftpbrowser.cybah.me. In addition to the web interface, there's a fully-built SFTP HTTP API that's used for interfacing with the origin server.

This line was written using the text file editor built into SFTP Browser!!

Features

API Basics

Authentication

All API endpoints require a set of request headers for connecting to the target server:

Response format

All API responses are in JSON format and include a boolean success property. This is true if no errors were encountered, or false otherwise. If an error was encountered, a string error property is included, which contains an error description.

Successful response example:

{
    "success": true,
    "...": "..."
}

Failed response example:

{
    "success": false,
    "error": "[error description]",
    "...": "..."
}

Failed responses will always use a 400 or 500 level HTTP status code.

API Endpoints

List files in a directory

Endpoint: GET /api/sftp/directories/list

Query params

Successful response

Create a directory

Endpoint: POST /api/sftp/directories/create

Query params

Successful response

Delete a directory

Endpoint: DELETE /api/sftp/directories/delete

Query params

Successful response

Check if a path exists

Endpoint: GET /api/sftp/files/exists

Query params

Successful response

Get information about a file

Endpoint: GET /api/sftp/files/stat

Query params

Successful response

Get raw file data

Endpoint: GET /api/sftp/files/get/single

Query params

Successful response

The raw file data

Failed response

An error response in JSON

Get file download link

Gets a temporary URL to download a single file without the need for connection headers. These URLs last 24 hours or until the server is restarted.

Endpoint: GET /api/sftp/files/get/single/url

Query params

Successful response

Get zipped download link

Gets a temporary URL for downloading a set of files and directories as a zip archive without the need for connection headers.

Endpoint: GET /api/sftp/files/get/multi

Query params

Successful response

Create a file

Endpoint: POST /api/sftp/files/create

Query params

Request body

The raw data to insert into the new file

Successful response

Append data to a file

Endpoint: PUT /api/sftp/files/append

Query params

Request body

The raw data to append to the file

Successful response

Move a file

Endpoint: PUT /api/sftp/files/move

Query params

Successful response

Copy a file

Directories not supported.

Endpoint: PUT /api/sftp/files/copy

Query params

Successful response

Edit a file's permissions

Directories are supported, but with no recursion.

Endpoint: PUT /api/sftp/files/chmod

Query params

Successful response

Delete a file

Endpoint: DELETE /api/sftp/files/delete

Query params

Successful response