52 lines
1.8 KiB
Markdown
52 lines
1.8 KiB
Markdown
# FoxBox
|
|
A file upload service inspired by [https://catbox.moe], written in Guile Scheme.
|
|
|
|
## Usage
|
|
Start the server like so:
|
|
```sh
|
|
$ guile -L mod foxbox.scm \
|
|
--port 8080 \
|
|
--file-size-permanent "100MiB" \
|
|
--file-size-temporary "1GiB" \
|
|
--file-lifetime "72hr" \
|
|
--file-type-whitelist "image/png image/jpeg image/gif video/webm"
|
|
# There's also --file-type-blacklist; everything is allowed by default
|
|
```
|
|
|
|
Then you use it with the following commands:
|
|
```sh
|
|
## Upload `tezuka_rin.png` with default settings
|
|
## Try uploading as a permanent file if it fits within the size limit, or fall
|
|
## back to temporary hosting with the maximum lifetime, if it fits there instead
|
|
$ curl -X POST --data-binary '@tezuka_rin.png' \
|
|
http://localhost:8080
|
|
|
|
## Set the lifetime of the file to be 48 hours long (clamps to maximum allowed)
|
|
$ curl -X POST --data-binary '@tezuka_rin.png' \
|
|
http://localhost:8080?lifetime=48hr
|
|
|
|
## Require the access token in order to view
|
|
$ curl -X POST --data-binary '@tezuka_rin.png' \
|
|
http://localhost:8080?secret=supersecret
|
|
|
|
## Request a resource
|
|
$ curl http://localhost:8080/XXXXXX.png
|
|
|
|
## Request a resource with an access token
|
|
$ curl http://localhost:8080/XXXXXX.png?secret=supersecret
|
|
|
|
## Modify a resource
|
|
$ curl -X PATCH -H 'X-Token: XXXXXX' \
|
|
http://localhost:8080/XXXXXX.png?secret=supersecret
|
|
$ curl -X PATCH -H 'X-Token: XXXXXX' \
|
|
http://localhost:8080/XXXXXX.png?lifetime=30min
|
|
|
|
## Delete a resource
|
|
$ curl -X DELETE -H 'X-Token: XXXXXX' \
|
|
http://localhost:8080/XXXXXX.png
|
|
```
|
|
|
|
The response will contain the following headers:
|
|
* `Location`: The URL of the uploaded file
|
|
* `Expires`: The expiration date and time of the file
|
|
* `X-Token`: A token required to modify or delete uploads
|