filebrowser/README.md

200 lines
7.9 KiB
Markdown
Raw Normal View History

2017-07-24 17:59:56 +00:00
![Preview](https://user-images.githubusercontent.com/5447088/28537288-39be4288-70a2-11e7-8ce9-0813d59f46b7.gif)
2017-07-24 17:43:35 +00:00
2017-06-25 09:02:16 +00:00
# filemanager
[![Build](https://img.shields.io/travis/hacdias/filemanager.svg?style=flat-square)](https://travis-ci.org/hacdias/filemanager)
[![Go Report Card](https://goreportcard.com/badge/github.com/hacdias/filemanager?style=flat-square)](https://goreportcard.com/report/hacdias/filemanager)
2017-06-25 09:09:39 +00:00
[![Documentation](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square)](http://godoc.org/github.com/hacdias/filemanager)
2017-06-26 14:44:39 +00:00
2017-07-18 20:50:32 +00:00
filemanager provides a file managing interface within a specified directory and it can be used to upload, delete, preview, rename and edit your files. It allows the creation of multiple users and each user can have its own directory. It can be used as a standalone app or as a middleware.
2017-06-26 14:44:39 +00:00
2017-07-19 06:40:36 +00:00
# Table of contents
+ [Getting started](#getting-started)
2017-07-20 08:21:24 +00:00
- [Caddy](#caddy)
- [Standalone](#standalone)
2017-07-19 06:40:36 +00:00
+ [Features](#features)
- [Users](#users)
- [Search](#search)
2017-07-19 07:46:45 +00:00
+ [Contributing](#contributing)
2017-07-22 19:02:58 +00:00
+ [Donate](#donate)
2017-07-19 06:40:36 +00:00
2017-07-18 20:59:47 +00:00
# Getting started
2017-07-20 08:23:18 +00:00
This is a library that can be used on your own applications as a middleware (see the [documentation](http://godoc.org/github.com/hacdias/filemanager)), as a plugin to Caddy web server or as a standalone app.
2017-07-18 20:59:47 +00:00
Once you have everything deployed, the default credentials to login to the filemanager are:
**Username:** `admin`
**Password:** `admin`
2017-07-20 08:03:14 +00:00
## Caddy
The easiest way to get started is using this with Caddy web server. You just need to download Caddy from its [official website](https://caddyserver.com/download) with `http.filemanager` plugin enabled. For more information about the plugin itself, please refer to its [documentation](https://caddyserver.com/docs/http.filemanager).
## Standalone
2017-07-27 17:15:51 +00:00
You can use filemanager as a standalone executable. You just need to download it from the [releases page](https://github.com/hacdias/filemanager/releases), where you can find multiple releases.
2017-07-20 08:21:24 +00:00
You can either use flags or a JSON configuration file, which should have the following appearance:
2017-07-20 08:03:14 +00:00
```json
{
"port": 80,
2017-07-26 10:28:47 +00:00
"address": "127.0.0.1",
2017-07-20 08:03:14 +00:00
"database": "/path/to/database.db",
"scope": "/path/to/my/files",
"allowCommands": true,
"allowEdit": true,
"allowNew": true,
"commands": [
"git",
"svn"
]
}
```
2017-07-26 09:01:06 +00:00
The `scope`, `allowCommands`, `allowEdit`, `allowNew` and `commands` options are the defaults for new users. To set a configuration file, you will need to pass the path with a flag, like this: `filemanager --config=/path/to/config.json`.
2017-07-20 08:21:24 +00:00
Otherwise, you may not want to use a configuration file, which can be done using the following flags:
```
2017-07-26 09:01:06 +00:00
-address string
Address to listen to (default is all of them)
2017-07-20 08:21:24 +00:00
-allow-commands
Default allow commands option (default true)
-allow-edit
Default allow edit option (default true)
-allow-new
Default allow new option (default true)
-commands string
Space separated commands available for new users (default "git svn hg")
-database string
Database path (default "./filemanager.db")
-port string
2017-07-26 09:01:06 +00:00
HTTP Port (default is random)
2017-07-20 08:21:24 +00:00
-scope string
2017-07-26 09:01:06 +00:00
Default scope for new users (default ".")
2017-07-20 08:21:24 +00:00
```
2017-07-27 17:15:51 +00:00
## Docker
2017-07-28 10:04:31 +00:00
File Manager is also on [Docker Hub](https://hub.docker.com/r/hacdias/filemanager/) so you can just `docker pull hacdias/filemanager`.
### Paths in the container
- Config: `/etc/config.json`
- Database: `/etc/database.db`
- Base scope: `/srv`
### Default config.json
```json
{
"port": 80,
"address": "",
"database": "/etc/database.db",
"scope": "/srv",
"allowCommands": true,
"allowEdit": true,
"allowNew": true,
"commands": []
}
```
### Usage
If the user wants to use the `config.json` file:
```shell
docker run \
-v /path/to/sites/root:/srv \
-v /path/to/config.json:/etc/config.json \
-v /path/to/database.db:/etc/database.db \
-p 80:80 \
hacdias/filemanager
```
If the user doesn't use the `config.json` file:
```shell
docker run \
-v /path/to/sites/root:/srv \
-v /path/to/database.db:/etc/database.db \
-p 80:80 \
hacdias/filemanager
--port 80
--database /etc/database.db
--scope /srv
--other-flag other-value
```
2017-07-27 17:15:51 +00:00
2017-07-18 20:50:32 +00:00
# Features
Easy login system.
2017-07-20 18:15:25 +00:00
![Login Page](https://user-images.githubusercontent.com/5447088/28432382-975493dc-6d7f-11e7-9190-23f8037159dc.jpg)
2017-07-18 20:50:32 +00:00
Listings of your files, available in two styles: mosaic and list. You can delete, move, rename, upload and create new files, as well as directories. Single files can be downloaded directly, and multiple files as *.zip*, *.tar*, *.tar.gz*, *.tar.bz2* or *.tar.xz*.
2017-07-20 18:15:25 +00:00
![Mosaic Listing](https://user-images.githubusercontent.com/5447088/28432384-9771bb4c-6d7f-11e7-8564-3a9bd6a3ce3a.jpg)
2017-07-18 20:50:32 +00:00
File Manager editor is powered by [Codemirror](https://codemirror.net/) and if you're working with markdown files with metadata, both parts will be separated from each other so you can focus on the content.
2017-07-20 18:15:25 +00:00
![Markdown Editor](https://user-images.githubusercontent.com/5447088/28432383-9756fdac-6d7f-11e7-8e58-fec49470d15f.jpg)
2017-07-18 20:50:32 +00:00
On the settings page, a regular user can set its own custom CSS to personalize the experience and change its password. For admins, they can manage the permissions of each user, set commands which can be executed when certain events are triggered (such as before saving and after saving) and change plugin's settings.
2017-07-20 18:15:25 +00:00
![Settings](https://user-images.githubusercontent.com/5447088/28432385-9776ec66-6d7f-11e7-90a5-891bacd4d02f.jpg)
2017-07-18 20:50:32 +00:00
We also allow the users to search in the directories and execute commands if allowed.
2017-07-18 20:59:47 +00:00
## Users
2017-07-19 06:48:48 +00:00
We support multiple users and each user can have its own scope and custom stylesheet. The administrator is able to choose which permissions should be given to the users, as well as the commands they can execute. Each user also have a set of rules, in which he can be prevented or allowed to access some directories (regular expressions included!).
2017-07-20 18:15:25 +00:00
![Users](https://user-images.githubusercontent.com/5447088/28432386-977f388a-6d7f-11e7-9006-87d16f05f1f8.jpg)
2017-07-18 20:50:32 +00:00
## Search
2017-06-26 14:44:39 +00:00
FileManager allows you to search through your files and it has some options. By default, your search will be something like this:
```
this are keywords
```
If you search for that it will look at every file that contains "this", "are" or "keywords" on their name. If you want to search for an exact term, you should surround your search by double quotes:
```
"this is the name"
```
That will search for any file that contains "this is the name" on its name. It won't search for each separated term this time.
By default, every search will be case sensitive. Although, you can make a case insensitive search by adding `case:insensitive` to the search terms, like this:
```
this are keywords case:insensitive
2017-07-18 20:50:32 +00:00
```
2017-07-19 07:46:45 +00:00
# Contributing
2017-07-27 13:30:40 +00:00
If you want to contribute or want to build the code from source, you will need to have the most recent version of Go and, if you want to change the static assets (JS, CSS, ...), Node.js installed on your computer. To start developing, you just need to do the following:
2017-07-19 07:46:45 +00:00
2017-07-27 13:30:40 +00:00
1. `go get github.com/hacdias/filemanager`
2. `cd $GOPATH/src/github.com/hacdias/filemanager`
3. `npm install`
4. `npm start dev` - regenerates the static assets automatically
5. `go install gihthub.com/hacdias/filemanager/cmd/filemanager`
6. Execute `$GOPATH/bin/filemanager`
2017-07-19 07:46:45 +00:00
2017-07-28 10:01:48 +00:00
The steps 3 and 4 are only required **if you want to develop the front-end**. Otherwise, you can ignore them. Before pulling, if you made any change on assets folder, you must run the `build.sh` script on the root of this repository. Also ensure that you have [go.rice](https://github.com/GeertJohan/go.rice) tool installed on your computer.
2017-07-19 07:46:45 +00:00
If you are using this as a Caddy plugin, you should use its [official instructions for plugins](https://github.com/mholt/caddy/wiki/Extending-Caddy#2-plug-in-your-plugin) and import `github.com/hacdias/filemanager/caddy/filemanager`.
2017-07-19 07:56:30 +00:00
2017-07-22 19:02:58 +00:00
# Donate
Enjoying this project? You can [donate to its creator](https://henriquedias.com/donate/). He will appreciate.