mirror of
https://github.com/lyx0/yaf.git
synced 2024-11-13 19:49:53 +01:00
58 lines
2.3 KiB
Markdown
58 lines
2.3 KiB
Markdown
|
# jaf - Just Another Fileshare
|
|||
|
jaf is a simple, zero-dependency Go program to handle file uploads.
|
|||
|
If you also want to serve the uploaded files, consider a web server like [nginx](https://nginx.org/en/).
|
|||
|
|
|||
|
## Installation
|
|||
|
**Clone** the directory:
|
|||
|
```bash
|
|||
|
git clone https://github.com/leon-richardt/jaf.git
|
|||
|
```
|
|||
|
**Build** the executable:
|
|||
|
```bash
|
|||
|
go build
|
|||
|
```
|
|||
|
Run **tests** (optional):
|
|||
|
```bash
|
|||
|
go test
|
|||
|
```
|
|||
|
|
|||
|
If you plan on using a systemd service or another init system, you might want to move the `jaf` executable to a different directory (e.g. `/opt`) at this point; you know your setup best.
|
|||
|
|
|||
|
## Configuration
|
|||
|
There are just a few parameters that need to be configured for jaf.
|
|||
|
Refer to the `example.conf` file:
|
|||
|
```
|
|||
|
Port: 4711
|
|||
|
# a comment
|
|||
|
LinkPrefix: https://jaf.example.com/
|
|||
|
FileDir: /var/www/jaf.example.com/
|
|||
|
LinkLength: 5
|
|||
|
```
|
|||
|
|
|||
|
Option | Use
|
|||
|
------------ | -------------------------------------------------------------------
|
|||
|
`Port` | the port number jaf will listen on
|
|||
|
`LinkPrefix` | a string that will be prepended to the file name generated by jaf
|
|||
|
`FileDir` | path to the directory jaf will save uploaded files in
|
|||
|
`LinkLength` | the number of characters the generated file name is allowed to have
|
|||
|
|
|||
|
Make sure the user running jaf has suitable permissions to read, and write to, `FileDir`.
|
|||
|
Also note that `LinkLength` directly relates to the number of files that can be saved.
|
|||
|
Since jaf only uses alphanumeric characters for file name generation, a maximum of `(26 + 26 + 10)^LinkLength` names can be generated.
|
|||
|
|
|||
|
If you use a reverse-proxy to forward requests to jaf, make sure to correctly forward the original request headers.
|
|||
|
For nginx, this is achieved via the `proxy_pass_request_headers on;` option.
|
|||
|
|
|||
|
If you want to limit access to jaf (e.g. require basic authentication), you will also need to do this via your reverse-proxy.
|
|||
|
|
|||
|
## Running
|
|||
|
After adjusting the configuration file to your needs, run:
|
|||
|
```bash
|
|||
|
jaf -configFile example.conf
|
|||
|
```
|
|||
|
Of course, you can also write a init system script to handle this for you.
|
|||
|
|
|||
|
## Inspiration
|
|||
|
- [i](https://github.com/fourtf/i) by [fourtf](https://github.com/fourtf) – a project very similar in scope and size
|
|||
|
- [filehost](https://github.com/nuuls/filehost) by [nuuls](https://github.com/nuuls) – a more integrated, fully-fledged solution that offers a web interface and also serves the files
|