A simple, light and standalone pastebin, URL shortener and file-sharing service
Go to file
Raphaël Thériault 0e4b47fea9 Update README, upgrade dependencies and bump version 2019-10-28 11:02:14 -04:00
.github/workflows Fix copy-pasting error in Actions 2019-10-25 01:19:32 -04:00
migrations Removed highlight field for tets 2019-10-24 23:32:23 -04:00
resources Hide overflow on x axis (fixes #8) 2019-10-28 10:51:24 -04:00
src Merge pull request #15 from steven-joruk/no-password-no-auth 2019-10-27 18:54:59 -04:00
.env.example Rename token to password 2019-10-24 23:39:34 -04:00
.gitignore Custom static files path in cdebug builds 2019-10-07 21:18:34 -04:00
Cargo.lock Update README, upgrade dependencies and bump version 2019-10-28 11:02:14 -04:00
Cargo.toml Update README, upgrade dependencies and bump version 2019-10-28 11:02:14 -04:00
LICENSE Added license 2019-10-15 09:09:39 -04:00
README.md Update README, upgrade dependencies and bump version 2019-10-28 11:02:14 -04:00
diesel.toml Initial commit 2019-10-07 17:44:59 -04:00
screenshot.png Add a screenshot 2019-10-26 09:20:30 +11:00

README.md

filite

A simple, light and standalone pastebin, URL shortener and file-sharing service that hosts files, redirects links and stores texts.

GitHub Actions Crates.io

Features

  • Easy to use. Installation and set-up take less than a minute and a built-in web UI is provided.
  • Standalone. No external dependencies required, everything that is needed is packed into the binary.
  • Light and fast. The Rust web framework Actix is used under the hood, providing great speed with a minimal footprint.

Screenshot of filite UI

Installation

  1. Get the binary either from the releases page or using Cargo
  2. Run it a first time and follow the instructions
  3. Edit your config file, check the dedicated section for details
  4. Run the binary again and you're good to go, just browse to http://localhost:8080 (don't forget to replace 8080 with the port specified in your config)
  5. Optionally, set up a reverse proxy

Usage

When asked for a login, use whatever username you want and the password you provided during setup. Usage is pretty straightforward using the web UI, but here are some tips.

  • On successful submission, the URL will be copied to clipboard. If copying to clipboard fails, it will be displayed as an alert.
  • Press space in the URL input to generate a random one
  • If the entered URL is already in use, the input will have a yellow outline

Details for programmatic usage are provided in the dedicated section.

Planned features

  • Decent test suite
  • TLS support
  • Opt-in stats (visits per element over time)
  • Opt-in syntax highlighting for text
  • Multiple users and passwords
  • Simple admin page
  • systemd service generation

Config

The config is located at ~/.filite/config.toml and follows the following format. Most of the time, the defaults are reasonable.

# Port to listen on
port = 8080
# SQLite database URL
database_url = "database.db"
# Database connection pool size
pool_size = 4
# Path to the directory where files will be stored, relative or absolute
files_dir = "files"
# Max allowed size for file uploads, in bytes
max_filesize = 10000000

Reverse proxy

NGINX

Don't forget to replace 8080 with the port specified in your config and example.com with your own domain.

server {
    listen 80;
    listen [::]:80;

    server_name example.com;

    location / {
        proxy_pass http://localhost:8080;
    }
}

Programmatic usage

Posting new elements

Send a PUT request with a JSON body following the following schemes. Don't forget to set the Content-Type header to application/json and the Authorization header to a valid value (username isn't important).

File

PUT /f/id

{
    "base64": "Base64-encoded file",
    "filename": "Filename"
}

PUT /l/id

{
    "forward": "URL to forward to"
}

Text

PUT /t/id

{
    "contents": "Text contents"
}

Getting existing elements

The response will be a JSON array following the following schemes

Files

GET /f

[
    {
        "id": "ID (URL) as an integer",
        "filepath": "Absolute path to the stored file",
        "created": "Creation timestamp"
    }
]

GET /l

[
    {
        "id": "ID (URL) as an integer",
        "forward": "URL to forward to",
        "created": "Creation timestamp"
    }
]

Texts

GET /t

[
    {
        "id": "ID (URL) as an integer",
        "contents": "Text contents",
        "created": "Creation timestamp"
    }
]

Contributing

The project is open to contributions! Before submitting a PR, make sure your changes work both with and without the dev feature enabled.

Requirements

  • The Rust toolchain
  • diesel_cli with the sqlite feature enabled

Setup

  1. Copy .env.example to .env and set the variables to your liking
  2. Run diesel database setup
  3. Build or run with the dev feature enabled

License

filite is licensed under the MIT License.