Copy
, move
, delete
and rename
files on your server from your web browser.
- Easy, single binary installation
- Multiple platforms (Windows, Linux, OSX)
- Predefined folder access only
- Files cannot be uploaded nor downloaded
A simple, portable web file commander implemented in the Go language. It compiles into one single binary which bundles all HTML, javascript etc. The protocol for the API is JSON RPC 2.0 through HTTP posts. You can define virtual file system roots to make certain parts of the file system accessible.
https://github.com/alphapeter/filecommander/releases
The front end will only run on modern browsers, such as chrome, firefox, opera or edge, internet explorer will not work
The only dependency required to build the application is the go framework https://golang.org/
- Install, (if not already installed), the go framework https://golang.org/dl/
- run
go build
in the source directory - (optional) rename the main binary to filecommander (or main.exe to filecommander if on windows)
Before you can utilize the file commander, you have to define your (virtual) file system roots.
example of settings.json
{
"roots": [
{
"name": "temp",
"path": "/tmp"
},
{
"name": "incoming",
"path": "/var/incoming"
}
],
"binding": "0.0.0.0:8080"
}
example of settings.json
for windows
{
"roots": [
{
"name": "temp",
"path": "c:/temp"
},
{
"name": "incoming",
"path": "c:/incoming"
}
],
"binding": "0.0.0.0:8080"
}
if binding is specified as 0.0.0.0:8080
it will listen to all addresses
if binding is specified as 192.168.0.100:80
it will listen to 192.168.0.100 at port 80
file location
- the default search path is './settings.json'
- to load settings file from another location, use the argument
--settings <path-to-settings>/<filename>.json
when starting the application
For complete specification of the JSON RPC protocol, please visit http://www.jsonrpc.org/specification
Copy a file to an other file
Example of command:
{
"jsonrpc":"2.0",
"method": "cp",
"params": ["private/animals/cat.jpg", "public/animals/cat.jpg"],
"id": "3"
}
Example of successful response:
{
"jsonrpc":"2.0",
"result":null,
"id":"3"
}
Example of unsuccessful response:
{
"jsonrpc":"2.0",
"id":"3",
"error":
{
"code":-32603,
"message":"open /temp/animals/cat.jpg: The system cannot find the file specified."
}
}
Lists available (virtual) file system roots by name
Example of command:
{
"jsonrpc":"2.0",
"method": "df",
"params": [],
"id": "3"
}
Example of successful response:
{
"jsonrpc":"2.0",
"result":["incoming","temp"],
"id":"3"
}
Lists all files and directories for a certain path
Example of command:
{
"jsonrpc":"2.0",
"method": "ls",
"params": ["incoming/public"],
"id": "3"
}
Example of successful response: Note: Type d: Directory, Type f: File
{
"jsonrpc":"2.0",
"result":[{"Type":"d","Name":"dir1"},{"Type":"f","Name":"file1.txt"},{"Type":"f","Name":"file2.txt"}]
}
Creates a directory
Example of command:
{
"jsonrpc":"2.0",
"method": "mkdir",
"params": ["incoming/animals", "cats"],
"id": "3"
}
Example of successful response:
{
"jsonrpc":"2.0",
"result":null,
"id":"3"
}
Moves/renames a file or directory Note. A file cannot be moved between two phycically different drives
Example of command:
{
"jsonrpc":"2.0",
"method": "mv",
"params": ["incoming/public/dog.jpg", "public/animals/dog.jpg"],
"id": "3"
}
Example of successful response:
{
"jsonrpc":"2.0",
"result":null,
"id":"3"
}
Deletes a file
Example of command:
{
"jsonrpc":"2.0",
"method": "rm",
"params": ["incoming/public/dog.jpg"],
"id": "3"
}
Example of successful response:
{
"jsonrpc":"2.0",
"result":null,
"id":"3"
}
- Download and install nodejs from https://nodejs.org (go for the LTS release if you are unsure which version to choose)
- Install webpack
npm install webpack -g
- Install webpack development server
npm install webpack-dev-server -g
- Install the additional dependencies run
npm install
in the frontend directory
The front end is written using vue.js, vuex and webpack. There's no need to recompile the backend during development. The webpack development server will proxy the api calls to the backend once it is started.
- Compile and start the backend application, let it listen to port 8080
- Start webpack-dev-server run
npm run dev
in the frontend directory - browse to
localhost:8080
with your favourite browser - make your changes to the code and it will update in the browser as you save
- press
ctrl + c
to stop the dev server
- Run
npm run build
to run webpack en embed the content into go - Compile the go source with the updated front end code
TODO
- implement key navigation
- implement demo
- make precompile binaries available
- code cleanup