Simple upload service with TOTP support, made with Python Flask
Find a file
swee 8dbd0c082a
All checks were successful
Test web app / Check syntax (push) Successful in 21s
Test web app / docker (push) Successful in 2m6s
Update .forgejo/workflows/code.yml
2025-04-07 14:41:18 -07:00
.forgejo/workflows Update .forgejo/workflows/code.yml 2025-04-07 14:41:18 -07:00
templates Update templates/fastfile.html 2025-03-28 23:17:55 -07:00
.gitignore Initial commit 2025-02-10 21:26:03 -08:00
Dockerfile Update Dockerfile 2025-04-06 02:16:45 -07:00
LICENSE Initial commit 2025-02-10 21:26:03 -08:00
README.md Update README.md 2025-03-29 17:02:08 -07:00
server.py Update server.py 2025-04-05 13:43:16 -07:00

FastFile

Simple upload service with TOTP support, made with Python Flask.

This is basically an open-sourced + enhanced version of the one I had in my old PythonAnywhere site.

Features

  • TOTP authentication
  • View both frontend and raw files
  • Object storage support (kind of)
    • With environment variable FASTFILE_REALRAWURL=https://cdn.example.com/somefile/ (Must end with /)
    • And with environment variable FASTFILE_RCLONE_REMOTE=remote:directory_or_bucket/ (Must end with /)
    • Need to add rclone config to volumes if using docker

Installation

Via Docker

Create this docker-compose.yml file in an empty directory:

services:
    fastfile:
        image: git.swee.codes/swee/fastfile:latest
        restart: unless-stopped
        ports:
            - 2007:2007
        environment:
            - FASTFILE_TOTPKEY=totp_key_here
            - FASTFILE_FILEPATH=/files/ # # Replace with whatever you want to store files in - Must end with /
            # - FASTFILE_RCLONE_REMOTE=r2demo:fastfile/
        volumes:
            - ./files:/files
            - ./cache.json:/app/cache.json
            # - /home/user/.config/rclone/rclone.conf:/root/.config/rclone/rclone.conf

And run this:

mkdir files
touch cache.json
docker compose up -d

Directly

Install packages:

Directly: pip install flask gunicorn pytotp magic

Debian/Ubuntu: sudo apt install python3-flask python3-gunicorn python3-pyotp python3-magic

Alpine: apk add py3-flask py3-gunicorn py3-otp py3-magic

Run:

export FASTFILE_TOTPKEY=totp_key_here
export FASTFILE_FILEPATH=/home/user/files/ # Replace with whatever you want to store files in - Must end with /
gunicorn -w --bind=0.0.0.0:2007 server:app

How to get TOTP key?

Install the pyotp (py3-otp in alpine) as shown above, run

python3 -c "import pyotp; print(pyotp.random_base32())"

Copy the output and use in your environment variable.