An Ephemeral file hosting server, written in Rust using Salvo. Reimplementation of QuadFile.
You cannot 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 9266e4b617
remove test because it's broken anyway
3 months ago
.gitea/workflows remove test because it's broken anyway 3 months ago
.vscode config, blocked files working, unsafe files broken 5 months ago
docs add API support 4 months ago
src Clean up and add more documentation 3 months ago
static Replace rendering with just sending 200 OK 4 months ago
templates/localhost:8282 add QR Tracking, and czb page 4 months ago
.env /correctly/ implement get_old_files fn 5 months ago
.gitignore add config to gitignore 4 months ago
Cargo.lock start work on postgres support 5 months ago
Cargo.toml start work on postgres support 5 months ago
LICENSE fix license, update docs 4 months ago
README.md fix license, update docs 4 months ago
config.sample.toml add config to gitignore 4 months ago
config.toml add API support 4 months ago
schema.sql finished? metrics and fixed nginx sendfile 4 months 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.

Production (nginx proxy)

This is the exact setup I'm using to run the test instance https://cz0.au

  1. git clone this repo. preferably as /opt/ephemeral/
  2. Create the DB sqlite3 ephemeral.db < schema.sql (Half broken, requires a dummy file to compile)
  3. If you want to speed up sqlite a little bit more, run sqlite3 ephemeral.db and then PRAGMA synchronous = OFF; and then Ctrl+D
  4. Copy the systemd service sudo cp ephemeral.service /etc/systemd/system/, editing if necessary
  5. Compile the release version. cargo build --release
  6. Use /docs/nginx.conf as a base for your nginx config. You're on your own for this.
  7. sudo systemctl daemon-reload then sudo systemctl enable ephemeral and sudo systemctl start ephemeral to reload systemd, get ephemeral to run at startup, and run it.

To see the logs (even in colour!) use sudo journalctl -xefu ephemeral --output cat

Configuration Options

Configuration options are available in the `config.toml' file. They're all fairly self explanatory with nice comments. Just make sure to restart your server to see the changes. I definitely have wasted a few hours bug-fixing in vain.

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.