项目作者: scotow

项目描述 :
Temporary file hosting and sharing.
高级语言: Rust
项目地址: git://github.com/scotow/dropit.git
创建时间: 2021-04-15T19:45:01Z
项目社区:https://github.com/scotow/dropit

开源协议:

下载


Release
Build Status

Logo

Features

  • Upload files from the terminal (by using curl or the shell script)
  • 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

  1. Usage: dropit [OPTIONS] --threshold <THRESHOLDS> --origin-size-sum <ORIGIN_SIZE_SUM> --origin-file-count <ORIGIN_FILE_COUNT> --global-size-sum <GLOBAL_SIZE_SUM> <--ip-origin|--username-origin>
  2. Options:
  3. -v, --verbose... Increase logs verbosity (Error (default), Warn, Info, Debug, Trace)
  4. -u, --uploads-dir <UPLOADS_DIR> Upload files directory path (relative) [default: uploads]
  5. -U, --no-uploads-dir-creation Disable upload files directory automatic creation (if missing)
  6. -d, --database <DATABASE> Metadata database path (relative) [default: dropit.db]
  7. -D, --no-database-creation Disable metadata database automatic creation (if missing)
  8. -a, --address <ADDRESS> HTTP listening address [default: 127.0.0.1]
  9. -p, --port <PORT> HTTP listening port [default: 8080]
  10. -R, --behind-reverse-proxy Use X-Forwarded-For, X-Forwarded-Proto and X-Forwarded-Host to determine uploads' origin
  11. -t, --threshold <THRESHOLDS> Relations between files' sizes and their durations. Must be ordered by increasing size and decreasing duration
  12. -o, --ip-origin Use usernames as uploaders' identities
  13. -O, --username-origin Use IP addresses as uploaders' identities
  14. -s, --origin-size-sum <ORIGIN_SIZE_SUM> Cumulative size limit from the same uploader
  15. -c, --origin-file-count <ORIGIN_FILE_COUNT> Number of files limit from the same uploader
  16. -S, --global-size-sum <GLOBAL_SIZE_SUM> Cumulative size limit from all users
  17. --auth-upload Protect upload endpoint with authentication
  18. --auth-download Protect download endpoint with authentication
  19. -C, --credential <CREDENTIALS> Static list of credentials
  20. --ldap-address <LDAP_ADDRESS> URI of the LDAP used to authenticate users
  21. --ldap-dn-pattern <LDAP_DN_PATTERN> LDAP DN pattern used when using single bind process
  22. --ldap-search-base-dn <LDAP_SEARCH_BASE_DN> LDAP base DN used during username searches
  23. --ldap-search-attribute-pattern <LDAP_SEARCH_ATTRIBUTE_PATTERN> LDAP attribute(s) pattern used to match usernames during searches [default: (uid=%u)]
  24. --ldap-search-dn <LDAP_SEARCH_DN> LDAP DN used to bind during username searches
  25. --ldap-search-password <LDAP_SEARCH_PASSWORD> LDAP password used to bind during username searches
  26. -T, --theme <THEME> CSS color used in the web UI [default: #15b154]
  27. -h, --help Print help information
  28. -V, --version Print version information

Here is an example of a Dropit instance:

  1. dropit \
  2. --ip-origin \
  3. --origin-size-sum 512MB \
  4. --origin-file-count 64 \
  5. --global-size-sum 10GB \
  6. --threshold 64MB:24h \
  7. --threshold 256MB:6h \
  8. --credential admin:password \
  9. --auth-upload \
  10. --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 built by the GitHub action.

  1. docker run -p 8080:8080 docker.pkg.github.com/scotow/dropit/dropit:latest [FLAGS] [OPTIONS]

Please read 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