~zenomat/shors

A file hoster in the spirit of 0x0.st

clone

read-only
https://git.sr.ht/~zenomat/shors
read/write
git@git.sr.ht:~zenomat/shors

You can also use your local clone with git send-email.

#What is shors

If you know 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
kill -SIGUSR1 $(pgrep shors)
  • to automate that task, add it to cron

#Running

To run, simply execute

./shors

A static, precompiled binary can be found in the 1.0 tag.

Everything else is handled by the config file, see 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

cargo build

or, to build a release build

cargo build --release

#Configuration

The config is relatively simply and is commented in the default config.

#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!