File upload service
Find a file
2025-07-30 16:43:13 -05:00
mod configuration file ! its just an alist !!! 2025-07-30 16:43:13 -05:00
config.scm configuration file ! its just an alist !!! 2025-07-30 16:43:13 -05:00
foxbox.scm configuration file ! its just an alist !!! 2025-07-30 16:43:13 -05:00
LICENSE Basic design outline 2025-07-28 00:12:00 -05:00
README.md Basic routing and response setup with a barebones index, 404, and file upload set up 2025-07-30 13:44:55 -05:00

FoxBox

A file upload service inspired by [https://catbox.moe], written in Guile Scheme.

Usage

Start the server like so:

$ 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:

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