The filesharing service everyone either hates or loves
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.
 
 
 
 
Go to file
Volkor c883146501
add git modules
3 years ago
QuadFile add deletion keys, better random files naming, basic web changes 4 years ago
quadfile-theme@5e2094b2e2 add git modules 3 years ago
theme Move themes around, add configurable theme 3 years ago
.gitignore Fix some documenation, fix sample config 5 years ago
.gitmodules add git modules 3 years ago
LICENSE.md Updated to match 7 years ago
README.md Move themes around, add configurable theme 3 years ago
__init__.py Initial move from Hyozan 7 years ago
conf.py.sample Add proper domain detection 4 years ago
requirements.txt *hopefully* merge from new repo from quad 5 years ago
run.py Move themes around, add configurable theme 3 years ago
schema.sql add deletion keys, better random files naming, basic web changes 4 years ago
wsgi.py Add Gunicorn entry point 7 years ago

README.md

QuadFile Version 2

A temporary (or permanent, depending on configuration) file sharing service written in Flask.

Features

  • Automatically remove files that aren't accessed often enough
  • Supports all filetypes, with options to filter by mimetypes
  • Prevents duplicate filenames
  • Works on all platforms (as long as they can use basic JavaScript)
  • Both easy to set up and use
  • Threaded for effective use of resources (Unless you're not on SSD, in which case, enjoy your I/O clogs m8)
  • Color-coded and real-time console log
  • Easy to use with most applications, such as ShareX

Requirements

Needed:

  • Python 3 (Required for python-magic)
  • sqlite3 package for your OS (To create the database)
  • Install the python requirements with (pip install -r requirements.txt)
  • nginx or another reverse proxy.

Recommended:

  • nginx, great for proxy_pass
  • gunicorn, allows you to use QuadFile with multiple workers

Using the thing

When deletion keys are enabled, you must either use the curl-supported 'api' or use the web browser to delete files. (Notice: these have been barely tested. Use at your own risk!)
To get your deletion key, either upload through curl, or through the web browser, it's the 16 character long random string.

  • API: curl -F key=KEYINHERE https://QUADFILE.WEBSITE/delete
  • WEB: Browse to https://QUADFILE.WEBSITE/delete/KEYINHERE

Test deployment

  • Clone the repo somewhere
  • pip install -r requirements.txt
  • Do cp conf.py.sample conf.py
  • Edit conf.py so that the information is correct
  • sqlite3 files.db < schema.sql
  • chmod +x run.py and then ./run.py
  • ???
  • PROFIT (Hopefully)

Production deployment

  • Clone the repo somewhere
  • Set up a virtual environment for QuadFile
  • pip install -r requirements.txt
  • Do cp conf.py.sample conf.py
  • Edit conf.py so that the information is correct
  • sqlite3 files.db < schema.sql
  • gunicorn wsgi:app -w 4 --bind 127.0.0.1:8282 --log-file $HOME/quadfile.log (Use systemd service to run it on boot if needed)
  • Configure nginx and proxy_pass it to gunicorn
  • ???
  • PROFIT (Hopefully)
  • Edit the pages in templates/*.html to personalize

systemd service file

Make sure to replace user with whatever user you want to run quadfile with (I reccomend a seperate user)

[Unit]
Description=QuadFile + Gunicorn Server
After=network.target

[Service]
PermissionsStartOnly = true
User = user
Group = user
WorkingDirectory = /home/user/prod/QuadFile/

ExecStart = /usr/bin/gunicorn3 wsgi:app -w 8 --bind 127.0.0.1:8282 --log-file /home/user/logs/quadfile/quadfile.log --capture-output --error-log /home/user/logs/quadfile.log
ExecReload = /bin/kill -s HUP $MAINPID
ExecStop = /bin/kill -s TERM $MAINPID

[Install]
WantedBy = multi-user.target

nginx config files

To have dynamic domain support, you must pass through a few things ontop of 'just proxy_pass it to gunicorn'.
This example includes a permenant redirect to https.

# Global redirect for http --> https
server {
        listen 80;
        listen [::]:80;
        # for certbot autorenew webroot
        location '/.well-known/acme-challenge/' {
                root /var/www/acme/;
        }
        # redirect
        location / {
                return 301 https://$host$request_uri;
        }
}

server {
        listen 443 ssl;
        listen [::]:443 ssl;
        server_name domain1 domain2;
        root /path/to/QuadFile;

        ## SSL/TLS
        include snippets/https.conf;
        ssl_certificate /etc/letsencrypt/live/domain/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/domain/privkey.pem;

        ## Reverse Proxy
        location / {
                proxy_pass http://127.0.0.1:8282$request_uri;
                proxy_set_header Host host;
                proxy_set_header X-Forwarded-Proto $scheme;
                proxy_set_header Accept-Encoding "";
                proxy_set_header X-Real-IP $remote_addr;
                proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
                proxy_set_header X-Forwarded-Host $http_host;
        }

        location /static {
                autoindex on;
        }
}