~zenomat/shors

5aaffa71b3c87c0f25f640cc343a9e88b7995efb — Adrian Eichelbaum 1 year, 14 days ago 36f9f53
add README
1 files changed, 80 insertions(+), 0 deletions(-)

A README.md
A README.md => README.md +80 -0
@@ 0,0 1,80 @@
# What is shors
If you know [0x0.st](https://0x0.st), it's kinda like that.

I tried to selfhost 0x0 several times, but always failed, so I've decided
to write my own replacement, which could be easily hosted.

Shors is a file hosting service, where you upload a file and get back a unique URL, where you can retrieve that file.
Files can be uploaded through a browser, or anything that can make a POST request. The response will be the URL of your file.
Only one file can be uploaded per request. To upload multiple files, tar them up.

Files will be retained for an amount of hours, indirectly proportional to the file size,
so larger files will be retained for a shorter period of time.

# File retention

`retention = min_age + (-max_age + min_age) * pow((file_size / max_size - 1), 3)`

```
	days
    MAX_RETENTION	|  \
        			|   \
        			|    \
        			|     \
        			|      \
        			|       \
        			|        ..
        			|          \
        			| ----------..-------------------------------------------
        			|             ..
        			|               \
        			|                ..
        			|                  ...
        			|                     ..
        			|                       ...
        			|                          ....
        			|                              ......
     MIN_RETENTION	|                                    ....................
          			 0                                                   MAX_SIZE
                                                              			 MiB
```

- to run the cleanup job, send `SIGUSR1` to shors
```bash
kill -SIGUSR1 $(pgrep shors)
```
- to automate that task, add it to `cron`

# Running
To run, simply execute
```bash
./shors
```
Everything else is handled by the config file, see [Configuration](#Configuration).

Please keep in mind, that the server won't start, if the configured download directory,
by default `./download`, can not be found.

# Compilation
To compile, simply run
```bash
cargo build
```
or, to build a release build
```bash
cargo build --release
```

# Configuration
The config is relatively simply and is commented in the default [config](config.toml).

# TLS
There is no built in TLS support. To still use TLS, put a reverse proxy in front.

# WARNING
While files, as configurable by the admin, will not be stored forever, there is NO SUCH THING as
antivirus checking built in. You will have to do that on you own!
Also, if you use this service, without any access control, anybody with the URL can upload anything to your server,
so there is the possibility, that illegal content will be hosted on your server,
or that it will be abused for other nefarious purposes, if you do not take appropriate measures.
You have been warned!