https://github.com/scotow/dropit
Temporary file hosting and sharing
https://github.com/scotow/dropit
file-sharing file-upload rust
Last synced: about 1 year ago
JSON representation
Temporary file hosting and sharing
- Host: GitHub
- URL: https://github.com/scotow/dropit
- Owner: scotow
- Created: 2021-04-15T19:45:01.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2024-02-14T19:40:34.000Z (over 2 years ago)
- Last Synced: 2025-03-23T04:11:49.257Z (over 1 year ago)
- Topics: file-sharing, file-upload, rust
- Language: Rust
- Homepage:
- Size: 396 KB
- Stars: 33
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://github.com/scotow/dropit/tags)
[](https://github.com/scotow/dropit/actions)

## Features
- Upload files from the terminal (by using `curl` or the [shell script](https://github.com/scotow/dropit/blob/master/upload.sh))
- Short and long aliases generation, short to copy/past and long to easily share it verbally
- Configurable expiration based on file size
- Quota based on users' IP addresses or usernames
- Revocable files
- Expiration refresh
- Alias regeneration
- Archive download
- Downloads limit
- JSON or plain text response (helpful for scripting)
- Authenticate upload and/or download using Basic HTTP Auth or LDAP (direct bind or dn search)
- Upload files from a minimalist web interface:
- Drag & drop
- QRCode generation
- Upload progress bar
- Readable size, duration and expiration
- Cache uploads links
- Customizable color
## Configuration
### Options
```
Usage: dropit [OPTIONS] --threshold --origin-size-sum --origin-file-count --global-size-sum <--ip-origin|--username-origin>
Options:
-v, --verbose... Increase logs verbosity (Error (default), Warn, Info, Debug, Trace)
-u, --uploads-dir Upload files directory path (relative) [default: uploads]
-U, --no-uploads-dir-creation Disable upload files directory automatic creation (if missing)
-d, --database Metadata database path (relative) [default: dropit.db]
-D, --no-database-creation Disable metadata database automatic creation (if missing)
-a, --address
HTTP listening address [default: 127.0.0.1]
-p, --port HTTP listening port [default: 8080]
-R, --behind-reverse-proxy Use X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host to determine uploads' origin
-t, --threshold Relations between files' sizes and their durations. Must be ordered by increasing size and decreasing duration
-o, --ip-origin Use usernames as uploaders' identities
-O, --username-origin Use IP addresses as uploaders' identities
-s, --origin-size-sum Cumulative size limit from the same uploader
-c, --origin-file-count Number of files limit from the same uploader
-S, --global-size-sum Cumulative size limit from all users
--auth-upload Protect upload endpoint with authentication
--auth-download Protect download endpoint with authentication
-C, --credential Static list of credentials
--ldap-address URI of the LDAP used to authenticate users
--ldap-dn-pattern LDAP DN pattern used when using single bind process
--ldap-search-base-dn LDAP base DN used during username searches
--ldap-search-attribute-pattern LDAP attribute(s) pattern used to match usernames during searches [default: (uid=%u)]
--ldap-search-dn LDAP DN used to bind during username searches
--ldap-search-password LDAP password used to bind during username searches
-T, --theme CSS color used in the web UI [default: #15b154]
-h, --help Print help information
-V, --version Print version information
```
Here is an example of a Dropit instance:
```
dropit \
--ip-origin \
--origin-size-sum 512MB \
--origin-file-count 64 \
--global-size-sum 10GB \
--threshold 64MB:24h \
--threshold 256MB:6h \
--credential admin:password \
--auth-upload \
--behind-reverse-proxy
```
- Using uploader IP address to limit / calculate upload quota
- Allowing at most 64 simultaneous files from the same IP
- Allowing a total of 512MB of file content from the same IP
- Allowing a total of 10GB of file content from anybody
- Setting the duration of files smaller than 64MB to 24h
- Setting the duration of files smaller than 256MB to 6h
- Forbidding files larger than 256MB
- Protecting upload endpoint with a basic auth and using admin/password as credentials
- Using the X-Forwarded-For header to determine user IP address
- Listening on default address and port (127.0.0.1:8080)
- Creating (if needed) a directory named "uploads" (default) and storing uploaded files in it
- Creating (if needed) the SQLite database "dropit.db" (default)
### Reverse-proxy
If you host Dropit behind a reverse-proxy, make sure to use the `--behind-reverse-proxy` option and to forward the client IP, protocol and original host by setting the `X-Forwarded-For`, `X-Forwarded-Proto` and `X-Forwarded-Host` headers.
### Docker
If you prefer to run Dropit as a Docker container, you can either build the image yourself using the Dockerfile available in this repo, or you can use the [image](https://github.com/scotow/dropit/packages/737180) built by the GitHub action.
```
docker run -p 8080:8080 docker.pkg.github.com/scotow/dropit/dropit:latest [FLAGS] [OPTIONS]
```
Please read [Binding to all interfaces](#binding-to-all-interfaces) if you can't reach the process from outside the image.
### Binding to all interfaces
By default, Dropit will only listen on the loopback interface, aka. 127.0.0.1. If you **don't** want to host Dropit behind a reverse proxy or if you are using the Docker image, you should specify the `0.0.0.0` address by using the `-a | --address` option.
## Libraries
- `hyper` as an HTTP backend and `axum` for routing
- `SQLite` and `sqlx` as a metadata storage
- `tokio` as an async runtime
- `clap` for options parsing and usage generation