nathanwoodburn f99bdd957f
Check Code Quality / RuffCheck (push) Successful in 12s
Build Docker / BuildImage (push) Successful in 18s
feat: Add initial code
2026-09-14 09:22:22 +10:00
2026-09-11 22:13:14 +10:00
2026-09-14 09:22:22 +10:00
2026-09-14 09:22:22 +10:00
2026-09-11 22:13:14 +10:00
2026-09-14 09:22:22 +10:00
2026-09-11 22:13:14 +10:00
2026-09-11 22:13:14 +10:00
2026-09-14 09:22:22 +10:00
2026-09-11 22:13:14 +10:00
2026-09-11 22:13:14 +10:00
2026-09-11 22:13:14 +10:00
2026-09-11 22:13:14 +10:00
2026-09-14 09:22:22 +10:00
2026-09-11 22:13:14 +10:00
2026-09-14 09:22:22 +10:00
2026-09-14 09:22:22 +10:00
2026-09-11 22:13:14 +10:00

Upload Server

A lightweight, high-performance file upload service designed for both CLI (curl, shell alias) and web browser workflows.

Features

  • CLI-First: Upload directly with curl or using an installable shell alias (upload).
  • One-Command Setup: Install the shell function directly by serving it at /bashrc:
    curl -sL https://your-server/bashrc >> ~/.bashrc && source ~/.bashrc
    
  • Custom Expiry: Specify expiration times (30m, 2h, 1d, 7d, 30d, 1y) or default to 7 days. Expired files are automatically cleaned up.
  • Delete URL: Every upload returns a dedicated delete URL (/delete/<token>) allowing instantaneous one-shot deletion via CLI or confirmation in the browser.
  • Modify Link: Customize the link slug (vanity URL), update the expiration date, or replace the file content via /modify/<token> or CLI.
  • List All Your Links: View active links uploaded from your machine or browser:
    • CLI: Machine token persistence or header X-User-Token / X-Machine-Id lists your CLI uploads (upload --list or curl -H "X-User-Token: ..." .../list).
    • Browser: Cookie-based dashboard on the homepage and /list with instant token syncing between terminal and browser.

Quick Start

1. Requirements

  • Python 3.13+
  • uv

2. Run the Development Server

uv sync
uv run python3 server.py

3. Run in Production (Gunicorn)

uv run python3 main.py

Usage Guide

  1. Add the alias to your shell:
    curl -sL http://localhost:5000/bashrc >> ~/.bashrc && source ~/.bashrc
    
  2. Upload a file (default 7-day expiry):
    upload photo.png
    
  3. Upload with custom expiry and custom slug:
    upload report.pdf 24h quarterly-report
    
  4. Upload piped stdin:
    cat /var/log/syslog | upload syslog.txt 1d
    
  5. List active files uploaded by your machine:
    upload --list
    
  6. Modify link slug or expiry:
    upload --modify <modify_token_or_url> new-slug 14d
    
  7. Delete a file:
    upload --delete <delete_token_or_url>
    

B. Upload with curl

Basic upload (default 7 days):

curl -F "file=@document.pdf" http://localhost:5000/

Upload with custom expiry:

curl -F "file=@document.pdf" -F "expires=3d" http://localhost:5000/

Upload with custom link slug:

curl -F "file=@document.pdf" -F "slug=my-docs" http://localhost:5000/

Get raw download URL only:

curl -s -F "file=@document.pdf" "http://localhost:5000/?raw=1"

Upload with JSON output:

curl -s -F "file=@document.pdf" -H "Accept: application/json" http://localhost:5000/

  • Download: http://localhost:5000/u/<slug> (or direct http://localhost:5000/<slug>)
  • Delete: curl -X POST http://localhost:5000/delete/<delete_token> (or open in browser for confirmation)
  • Modify: curl -X POST http://localhost:5000/modify/<manage_token> -F "slug=new-slug" -F "expires=14d"

Testing & Quality

Run the test suite:

uv run pytest

Check linting and formatting:

uv run ruff check
uv run ruff format --check
S
Description
Easy terminal file share server
Readme AGPL-3.0
163 KiB
Languages
Python 61.3%
HTML 37.5%
CSS 0.6%
Dockerfile 0.6%