An Ephemeral file hosting server, written in Rust using Salvo. Reimplementation of QuadFile.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
Volkor 3e83b51e9a
add metrics page, and fix up some warnings
1 week ago
.vscode config, blocked files working, unsafe files broken 3 weeks ago
docs add metrics page, and fix up some warnings 1 week ago
src add metrics page, and fix up some warnings 1 week ago
static Add new icons (Thanks Areganno) 4 weeks ago
templates/localhost:8282 Implement static pages! 4 weeks ago
.env /correctly/ implement get_old_files fn 3 weeks ago
.gitignore speed up DB by like 2x at least by using WAL 2 weeks ago
Cargo.lock start work on postgres support 2 weeks ago
Cargo.toml start work on postgres support 2 weeks ago
LICENSE add agpl license 2 months ago
README.md give up on postgres, replace clone with borrows 2 weeks ago
config.toml give up on postgres, replace clone with borrows 2 weeks ago
schema.sql speed up DB by like 2x at least by using WAL 2 weeks ago

README.md

Ephemeral

This is the repository for a ephemeral file hosting server. It receives files and serves them on request. After a while it decides to delete them. That's it!

History

This project is a re-write of QuadFile, a project I found years ago, being a old python project, It already wasn't the fastest it could be. I extended on it's features into my own fork, and now that I want to learn rust, I've decided to stop work on it, and start work on the 2nd generation of the server; Ephemeral.

What Exactly does it do?

  • Receives files from users
  • Sends files to users.
  • Allows the admin to configure what files are allowed.
  • Allows the admin to configure how long files are stored for. (See here)
  • Allows the admin to configure if the files should be renamed automatically.
  • Has a cool 'API' and is nicely configured for ShareX to upload files! (also see: SUpload)
  • Generates cool statistics about what files are being uploaded/downloaded in a way that it can be shown on grafana.

Okay, how do I install it?

That's a little more complicated. Eventually we'll have 2 different environments, development and production, each with different logging and such.

  1. Make sure you have a /supported/ database installed and working, either sqlite, or Postgres.
  2. Initialise the database with the following command sqlite3 ephemeral.db < schema.sql 1.1. If you want to speed up sqlite a little bit more, run sqlite3 ephemeral.db and then PRAGMA synchronous = OFF; and then Ctrl+D
  3. Compile and run ephemeral with LOG=debug cargo run for the debug build. LOG=info cargo run -r will run the release build.

Configuration Options

Configuration is done by settings environment variables in the launch command. (This definitely isn't because I cannot be bothered implementing a proper config file in code.)

Variable Default Value
HOST 0.0.0.0 What IP the application listens on
PORT 8282 What port the application listens on.
EPHEMERAL_LOG (Required) Sets the log level output
ENGINE 2 Sets the engine mode
CLEANER_INTERVAL 1800 How long the cleaner task runs, in seconds.
FILE_EXPIRY_MIN 7 (Depends on engine setting) The Minimum a file /should/ exist on the server for.
FILE_EXPIRY_MAX 365 (Depends on engine setting) The Longest a file /should/ exist on the server for.
MAX_FILESIZE* 1073741824 The 'cap' for calculating expiry.

*MAX_FILESIZE doesn't actually set the maximum allowed filesize, it's only used for calculating the expiry.

Wierd Security things you should probably be aware of

If you're running outside of a reverse proxy, it's possible to access any file on the file system that is readable by the user. Since we use the HTTP Host header to find the theme, you could set your host to something like ../../../../etc/passwd and it may or may not work. Chucking it behind a proxy (that uses the config in the documentation) means a invalid Host header /should/ break. TODO: Test this please before I start using it publically, it rEALLY isn't a smart idea. :)

Acknowledgements

exhail - seriously, without your babying me on IRC, I woudln't have been able to do this. audron - who told me to use rust in the first place, and showed me a bunch of cool stuff. Areganno - improved upon the StableDiffusion logo. (and by that I mean completely remade it) Shadowhand & hailey - I had a moment of weakness while writing nginx configs, and they were there when I needed them the most.