new readmes

This commit is contained in:
Henrique Dias 2017-07-18 08:55:15 +01:00
parent 49d2060628
commit af8ea27dee
No known key found for this signature in database
GPG Key ID: 936F5EB68D786730
3 changed files with 84 additions and 196 deletions

View File

@ -1,140 +1,80 @@
# filemanager - a caddy plugin
filemanager provides WebDAV features and a file managing interface within the specified directory and it can be used to upload, delete, preview, rename and edit your files within that directory. It is an implementation of [hacdias/filemanager](https://github.com/hacdias/filemanager) library.
It is extremely important for security reasons to cover the path of filemanager with some kind of authentication. You can use, for example, [`basicauth`](https://caddyserver.com/docs/basicauth) directive.
Note that if you are handling large files you might run into troubles due to the defaults of [`timeouts`](https://caddyserver.com/docs/timeouts) plugin. Check its [documentation](https://caddyserver.com/docs/timeouts) to learn more about that plugin.
For information about the working of filemanager itself, go to the [main repository](https://github.com/hacdias/filemanager).
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 is an implementation of [hacdias/filemanager][1] library.
## Get Started
To start using this plugin you just need to go to the [download Caddy page](https://caddyserver.com/download) and choose `filemanager` in the directives section. For further information on how Caddy works refer to [its documentation](https://caddyserver.com/docs).
To start using this plugin you just need to go to the [download Caddy page][3] and choose `http.filemanager` in the directives section. For further information on how Caddy works refer to [its documentation][4].
If you want to build it from source, consult our [developers section](#developers).
The default credentials are `admin` for both the user and the password. It is highy recommended to change them after logging in for the first time and to use HTTPS. You can create more users and define their own permissions using the web interface.
For information about the working of filemanager itself, go to the [main repository](https://github.com/hacdias/filemanager).
## Syntax
```
filemanager [baseurl] {
show directory
webdav [path]
styles filepath
allow_new [true|false]
allow_edit [true|false]
allow_commands [true|false]
allow_command command
block_command command
before_save command
after_save command
allow [url|dotfiles]
allow_r regex
block [url|dotfiles]
block_r regex
filemanager [baseurl] [scope] {
database path
}
```
All of the options above are optional.
+ `baseurl` is the URL path where you will access File Manager. Defaults to `/`.
+ `scope` is the path, relative or absolute, to the directory you want to browse in. This value will be used for the creation of the first user. Defaults to `./`.
+ `path` is the database path where the settings will be stored. By default, the settings will be stored on [`.caddy`][5] folder.
+ **baseurl** is the URL where you will access the File Manager interface. Defaults to `/`.
+ **show** is the path, relative or absolute, to the directory you want to browse in. Defaults to `./`.
+ **webdav** is the path that will be appended to baseurl in which the [WebDAV](https://en.wikipedia.org/wiki/WebDAV) will be accessible. Defaults to `/webdav`.
+ **styles** is the relative or absolute path to the stylesheet file. This file doesn't need to be accessible from the web.
+ **allow_new** is the permission to create new files and directories. Defaults to `true`.
+ **allow_edit** is the permission to edit, rename and delete files or directories. Defaults to `true`.
+ **allow_commands** is the permission to execute commands. Defaults to `true`.
+ **allow_command** and **block_command** gives, or denies, permission to execute a certain command through the admin interface. By default `git`, `svn` and `hg` are enabled.
+ **before_save** and **after_save** allow you to set a custom command to be executed before saving and after saving a file. The placeholder `{path}` can be used and it will be replaced by the file path.
+ **allow** and **block** can be used to allow or deny the access to specific files or directories using their URL. You can use the magic word `dotfiles` to allow or block the access to dot-files. The blocked files won't show in the admin interface. By default, `block dotfiles` is activated.
+ **allow_r** and **block_r** and variations of the previous options but you are able to use regular expressions with them. These regular expressions are used to match the URL, **not** the internal file path.
## Database
By default the database will be stored on [`.caddy`][5] directory, in a sub-directory called `filemanager`. Each file name is an hash of the combination of the host and the base URL.
So, by **default** we have:
If you don't set a database path, you will receive a warning like this:
```
filemanager / {
show ./
webdav /webdav
allow_new true
allow_edit true
allow_commands true
allow_command git
allow_command svn
allow_command hg
block dotfiles
}
```
> [WARNING] A database is going to be created for your File Manager instace at ~/.caddy/filemanager/xxx.db. It is highly recommended that you set the 'database' option to 'xxx.db'
As already mentioned, this extension should be used with [`basicauth`](https://caddyserver.com/docs/basicauth). If you do that, you will also be able to set permissions for different users using the following syntax:
Why? If you don't set a database path and you change the host or the base URL, your settings will be reseted. So it is *highly* recommended to set this option.
```
filemanager {
# You set the global configurations here and
# all the users will inherit them.
user1:
# Here you can set specific settings for the 'user1'.
# They will override the global ones for this specific user.
}
```
When you set a relative path, such as `xxxxxxxxxx.db`, it will always be relative to `.caddy/filemanager` directory. Although, you may also use an absolute path if you wish to store the database in other place.
## Examples
Show the directory where Caddy is being executed at the root of the domain:
```
filemanager
```
Use only WebDAV:
```
filemanager {
webdav /
database myinstance.db
}
```
Show the content of `foo` at the root of the domain:
```
filemanager {
show foo/
filemanager / ./foo {
database myinstance.db
}
```
Show the directory where Caddy is being executed at `/filemanager`:
```
filemanager /filemanager
filemanager /filemanager {
database myinstance.db
}
```
Show the content of `foo` at `/bar`:
```
filemanager /bar{
show foo/
filemanager /bar /show {
database myinstance.db
}
```
Now, a bit more complicated example. You have three users: an administrator, a manager and an editor. The administrator can do everything and has access to the commands `rm` and `mv` because he is a geeky. The manager, doesn't have access to commands, but can create and edit files. The editor can **only** edit files. He can't even create new ones, because he will only edit the files after the manager creates them for him. Both the editor and the manager won't have access to the financial folder. We would have:
## Known Issues
```
basicauth /admin admin pass
basicauth /admin manager pass
basicauth /admin editor pass
If you are having troubles **handling large files** you might need to check out the [`timeouts`][2] plugin, which can be used to change the default HTTP Timeouts.
filemanager /admin {
show ./
allow_commands false
admin:
allow_commands true
allow_command rm
allow_command mv
allow dotfiles
manager:
block /admin/financial
editor:
allow_new false
block /admin/financial
}
```
[1]:https://github.com/hacdias/filemanager
[2]:https://caddyserver.com/docs/timeouts
[3]:https://caddyserver.com/download
[4]:https://caddyserver.com/docs
[5]:https://caddyserver.com/docs/automatic-https#dot-caddy

View File

@ -1,80 +0,0 @@
# filemanager - a caddy plugin
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.bIt is an implementation of [hacdias/filemanager][1] library.
## Get Started
To start using this plugin you just need to go to the [download Caddy page][3] and choose `http.filemanager` in the directives section. For further information on how Caddy works refer to [its documentation][4].
The default credentials are `admin` for both the user and the password. It is highy recommended to change them after logging in for the first time and to use HTTPS. You can create more users and define their own permissions using the web interface.
For information about the working of filemanager itself, go to the [main repository](https://github.com/hacdias/filemanager).
## Syntax
```
filemanager [baseurl] [scope] {
database path
}
```
+ `baseurl` is the URL path where you will access File Manager. Defaults to `/`.
+ `scope` is the path, relative or absolute, to the directory you want to browse in. This value will be used for the creation of the first user. Defaults to `./`.
+ `path` is the database path where the settings will be stored. By default, the settings will be stored on [`.caddy`][5] folder.
## Database
By default the database will be stored on [`.caddy`][5] directory, in a sub-directory called `filemanager`. Each file name is an hash of the combination of the host and the base URL.
If you don't set a database path, you will receive a warning like this:
> [WARNING] A database is going to be created for your File Manager instace at ~/.caddy/filemanager/xxx.db. It is highly recommended that you set the 'database' option to 'xxx.db'
Why? If you don't set a database path and you change the host or the base URL, your settings will be reseted. So it is *highly* recommended to set this option.
When you set a relative path, such as `xxxxxxxxxx.db`, it will always be relative to `.caddy/filemanager` directory. Although, you may also use an absolute path if you wish to store the database in other place.
## Examples
Show the directory where Caddy is being executed at the root of the domain:
```
filemanager {
database myinstance.db
}
```
Show the content of `foo` at the root of the domain:
```
filemanager / ./foo {
database myinstance.db
}
```
Show the directory where Caddy is being executed at `/filemanager`:
```
filemanager /filemanager {
database myinstance.db
}
```
Show the content of `foo` at `/bar`:
```
filemanager /bar /show {
database myinstance.db
}
```
## Known Issues
If you are having troubles **handling large files** you might need to check out the [`timeouts`][2] plugin, which can be used to change the default HTTP Timeouts.
[1]:https://github.com/hacdias/filemanager
[2]:https://caddyserver.com/docs/timeouts
[3]:https://caddyserver.com/download
[4]:https://caddyserver.com/docs
[5]:https://caddyserver.com/docs/automatic-https#dot-caddy

View File

@ -2,47 +2,75 @@
[![community](https://img.shields.io/badge/community-forum-ff69b4.svg?style=flat-square)](https://caddy.community)
hugo fills the gap between Hugo and the browser. [Hugo](http://gohugo.io/) is an easy and fast static website generator. This plugin fills the gap between Hugo and the end-user, providing you a web interface to manage the whole website.
hugo fills the gap between Hugo and the browser. [Hugo][6] is an easy and fast static website generator. This plugin fills the gap between Hugo and the end-user, providing you a web interface to manage the whole website.
Using this plugin, you won't need to have your own computer to edit posts, neither regenerate your static website, because you can do all of that just through your browser.
Using this plugin, you won't need to have your own computer to edit posts, neither regenerate your static website, because you can do all of that just through your browser. It is an implementation of [hacdias/filemanager][1] library.
**Requirements:** you need to have the hugo executable in your PATH. You can download it from its [official page](http://gohugo.io).
**Requirements:** you need to have the hugo executable in your PATH. You can download it from its [official page][6].
### Syntax
## Get Started
To start using this plugin you just need to go to the [download Caddy page][3] and choose `http.hugo` in the directives section. For further information on how Caddy works refer to [its documentation][4].
The default credentials are `admin` for both the user and the password. It is highy recommended to change them after logging in for the first time and to use HTTPS. You can create more users and define their own permissions using the web interface.
## Syntax
```
hugo [directory] [admin] {
database path
database path
}
```
All of the options above are optional.
+ `directory` is the path, relative or absolute to the directory of your Hugo files. Defaults to `./`.
+ `admin` is the URL path where you will access the admin interface. Defaults to `/admin`.
+ `path` is the database path where the settings will be stored. By default, the settings will be stored on [`.caddy`][5] folder.
* **directory** is the folder where the commands are going to be executed. By default, it is the current working directory. Default: `./`.
* **admin** is the path where you will find your administration interface. Default: `/admin`.
* **clean_public** sets if the `public` folder should be removed before generating the website again. Default: `true`.
* **before_publish** and **after_publish** allow you to set a custom command to be executed before publishing and after publishing a post/page. The placeholder `{path}` can be used and it will be replaced by the file path.
* **name** refers to the Hugo available flags. Please use their long form without `--` in the beginning. If no **value** is set, it will be evaluated as `true`.
## Database
In spite of these options, you can also use the [filemanager](https://caddyserver.com/docs/http.filemanager) so you can have more control about what can be acceded, the permissions of each user, and so on.
By default the database will be stored on [`.caddy`][5] directory, in a sub-directory called `hugo`. Each file name is an hash of the combination of the host and the base URL.
This directive should be used with [root](https://caddyserver.com/docs/root), [basicauth](https://caddyserver.com/docs/basicauth) and [errors](https://caddyserver.com/docs/errors) middleware to have the best experience. See the examples to know more.
If you don't set a database path, you will receive a warning like this:
### Examples
> [WARNING] A database is going to be created for your File Manager instace at ~/.caddy/hugo/xxx.db. It is highly recommended that you set the 'database' option to 'xxx.db'
If you don't already have an Hugo website, don't worry. This plugin will auto-generate it for you. But that's not everything. It is recommended that you take a look at Hugo [documentation](http://gohugo.io/themes/overview/) to learn more about themes, content types, and so on.
Why? If you don't set a database path and you change the host or the base URL, your settings will be reseted. So it is *highly* recommended to set this option.
A simple Caddyfile to use with Hugo static website generator:
When you set a relative path, such as `xxxxxxxxxx.db`, it will always be relative to `.caddy/hugo` directory. Although, you may also use an absolute path if you wish to store the database in other place.
## Examples
Manage the current working directory's Hugo website at `/admin`.
```
root public # the folder where Hugo generates the website
basicauth /admin user pass # protect the admin area using HTTP basic auth
hugo # enable the admin panel
hugo {
database myinstance.db
}
```
### Screenshots
Manage the Hugo website located at `/var/www/mysite` at `/admin`.
![capture](https://cloud.githubusercontent.com/assets/5447088/25630072/b9a95dfa-2f63-11e7-81fe-00bab89e3391.PNG)
![2](https://cloud.githubusercontent.com/assets/5447088/25630073/b9b00678-2f63-11e7-8f5d-6488c641ed19.PNG)
![3](https://cloud.githubusercontent.com/assets/5447088/25630074/b9cbe3ca-2f63-11e7-8e53-19a3e553f86b.PNG)
![4](https://cloud.githubusercontent.com/assets/5447088/25630075/b9cfa320-2f63-11e7-8262-cdd942d4a3b5.PNG)
```
hugo /var/www/mysite {
database myinstance.db
}
```
Manage the Hugo website located at `/var/www/mysite` at `/private`.
```
hugo /var/www/mysite /private {
database myinstance.db
}
```
## Known Issues
If you are having troubles **handling large files** you might need to check out the [`timeouts`][2] plugin, which can be used to change the default HTTP Timeouts.
[1]:https://github.com/hacdias/filemanager
[2]:https://caddyserver.com/docs/timeouts
[3]:https://caddyserver.com/download
[4]:https://caddyserver.com/docs
[5]:https://caddyserver.com/docs/automatic-https#dot-caddy
[6]:http://gohugo.io