All Projects → orhun → rustypaste

orhun / rustypaste

Licence: MIT License
A minimal file upload/pastebin service.

Programming Languages

rust
11053 projects
Dockerfile
14818 projects
shell
77523 projects

Projects that are alternatives of or similar to rustypaste

Django-WebApp
This is a web-app created using Python, Django. By using this user can login, upload files and also can view and download files uploaded by other users.
Stars: ✭ 285 (+179.41%)
Mutual labels:  file-upload, file-sharing, upload-file, upload-images
Linx Server
Self-hosted file/code/media sharing website. ~~~~~~~~~~~~~~~~~~~ Demo: https://demo.linx-server.net/
Stars: ✭ 1,044 (+923.53%)
Mutual labels:  upload, file-upload, pastebin, file-sharing
Psitransfer
Simple open source self-hosted file sharing solution.
Stars: ✭ 712 (+598.04%)
Mutual labels:  upload, pastebin, file-sharing
react-native-tus-client
React Native client for the tus resumable upload protocol.
Stars: ✭ 38 (-62.75%)
Mutual labels:  upload, file-upload, upload-file
kipp
A flexible file storage server
Stars: ✭ 33 (-67.65%)
Mutual labels:  upload, file-upload, file-sharing
Meteor-Files-Demos
Demos for ostrio:files package
Stars: ✭ 51 (-50%)
Mutual labels:  upload, file-upload, file-sharing
uploadcare client
A flutter library for working with Uploadcare REST API. File uploads, media processing, and adaptive delivery for web and mobile.
Stars: ✭ 14 (-86.27%)
Mutual labels:  file-upload, upload-file, upload-images
AndroidFlask
Image Upload from Android to Python-Based Flask Server
Stars: ✭ 45 (-55.88%)
Mutual labels:  upload, upload-file, upload-images
Pomf
Simple file uploading and sharing
Stars: ✭ 535 (+424.51%)
Mutual labels:  upload, file-upload, file-sharing
lolisafe
Blazing fast file uploader and awesome bunker written in node! 🚀
Stars: ✭ 181 (+77.45%)
Mutual labels:  upload, file-upload, file-sharing
PiZilla
A lightweight, open-source file sharing web application for local networks.
Stars: ✭ 22 (-78.43%)
Mutual labels:  file-upload, file-sharing
Transfer.sh
Easy file sharing from your Android device!
Stars: ✭ 14 (-86.27%)
Mutual labels:  file-upload, file-sharing
bin
highly opinionated, minimal pastebin
Stars: ✭ 97 (-4.9%)
Mutual labels:  file-upload, pastebin
files
Laravel Enso file management add-on for smoothing out some of common cases found when working with files
Stars: ✭ 15 (-85.29%)
Mutual labels:  file-upload, upload-file
PasteBinApp
iOS app for PasteBin
Stars: ✭ 27 (-73.53%)
Mutual labels:  pastebin, pastebin-service
tiny-qiniu-request
tiny-qiniu for rc-upload or antd upload component `customRequest` property
Stars: ✭ 13 (-87.25%)
Mutual labels:  upload, upload-file
cpomf
Pomf API compatible file host written in Crystal - The software behind nya.is.
Stars: ✭ 36 (-64.71%)
Mutual labels:  file-upload, file-sharing
google-music-manager-uploader
Google Music Manager Uploader module / Easily upload MP3 (folder) to Google Music
Stars: ✭ 21 (-79.41%)
Mutual labels:  upload, upload-file
crocofile
A webbased file upload manager to share files by sharing an account
Stars: ✭ 40 (-60.78%)
Mutual labels:  file-upload, file-sharing
zipline
A ShareX/file upload server that is easy to use, packed with features, and with an easy setup!
Stars: ✭ 215 (+110.78%)
Mutual labels:  file-upload, file-sharing

Rustypaste is a minimal file upload/pastebin service.

$ echo "some text" > awesome.txt

$ curl -F "[email protected]" https://paste.site.com
https://paste.site.com/safe-toad.txt

$ curl https://paste.site.com/safe-toad.txt
some text

Features

  • File upload & URL shortening & upload from URL
    • supports basic HTTP authentication
    • random file names (optional)
      • pet name (e.g. capital-mosquito.txt)
      • alphanumeric string (e.g. yB84D2Dv.txt)
    • supports expiring links
      • auto-deletion of expired files (optional)
    • supports one shot links (can only be viewed once)
    • guesses MIME types
      • supports overriding and blacklisting
    • no duplicate uploads (optional)
  • Single binary
  • Simple configuration
    • supports hot reloading
  • Easy to deploy
  • No database
    • filesystem is used
  • Self-hosted
    • centralization is bad!
  • Written in Rust
    • blazingly fast!

Installation

From crates.io

cargo install rustypaste

Arch Linux

pacman -S rustypaste

Binary releases

See the available binaries on releases page.

Build from source

git clone https://github.com/orhun/rustypaste.git
cd rustypaste/
cargo build --release

Testing

# run unit tests
cargo test -- --test-threads 1

Usage

The standalone command line tool (rpaste) is available here.

CLI

function rpaste() {
  curl -F "file=@$1" -H "Authorization: <auth_token>" "<server_address>"
}

* consider reading authorization headers from a file. (e.g. -H @rpaste_auth)

# upload a file
$ rpaste x.txt

# paste from stdin
$ rpaste -

Expiration

$ curl -F "[email protected]" -H "expire:10min" "<server_address>"

(supported units: ns, us, ms, sec, min, hours, days, weeks, months, years)

One shot

$ curl -F "[email protected]" "<server_address>"

URL shortening

$ curl -F "url=https://example.com/some/long/url" "<server_address>"

Paste file from remote URL

$ curl -F "remote=https://example.com/file.png" "<server_address>"

Cleaning up expired files

Configure delete_expired_files to set an interval for deleting the expired files automatically.

On the other hand, following script can be used as cron for cleaning up the expired files manually:

#!/bin/env sh
now=$(date +%s)
find upload/ -maxdepth 2 -type f -iname "*.[0-9]*" |
while read -r filename; do
	[ "$(( ${filename##*.} / 1000 - "${now}" ))" -lt 0 ] && rm -v "${filename}"
done

Server

To start the server:

$ rustypaste

If the configuration file is not found in the current directory, specify it via CONFIG environment variable:

$ CONFIG="$HOME/.rustypaste.toml" rustypaste

To enable basic HTTP auth, set the AUTH_TOKEN environment variable (via .env):

$ echo "AUTH_TOKEN=$(openssl rand -base64 16)" > .env
$ rustypaste

See config.toml for configuration options.

Docker

Following command can be used to run a container which is built from the Dockerfile in this repository:

$ docker run --rm -d \
  -v "$(pwd)/upload/":/app/upload \
  -v "$(pwd)/config.toml":/app/config.toml \
  --env-file "$(pwd)/.env" \
  -e "RUST_LOG=debug" \
  -p 8000:8000 \
  --name rustypaste \
  orhunp/rustypaste
  • uploaded files go into ./upload (on the host machine)
  • set the AUTH_TOKEN via -e or --env-file to enable auth

You can build this image using docker build -t rustypaste . command.

If you want to run the image using docker compose, simply run docker-compose up -d. (see docker-compose.yml)

Nginx

Example server configuration with reverse proxy:

server {
    listen 80;
    location / {
        proxy_pass                         http://localhost:8000/;
        proxy_set_header Host              $host;
        proxy_set_header X-Forwarded-For   $remote_addr;
        proxy_set_header X-Forwarded-Proto $scheme;
        add_header X-XSS-Protection        "1; mode=block";
        add_header X-Frame-Options         "sameorigin";
        add_header X-Content-Type-Options  "nosniff";
    }
}

If you get a 413 Request Entity Too Large error during upload, set the max body size in nginx.conf:

http {
    # ...
    client_max_body_size 100M;
}

Roadmap

Nothing here yet! 🎉

Contributing

Pull requests are welcome!

Consider submitting your ideas via issues first. Also, see the roadmap and/or run the following command to see what is needed to be done:

$ grep -nr "TODO:" src/

License

All code is licensed under The MIT License.
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].