upload

/upload/ is a TUS upload server

upload your files! maybe i will reseed them via bittorrent...

https://some_user:some_password@milahu.duckdns.org/upload/

authentication

for now, you have to ask me to create user accounts

see also /contact.md

browser client

there is uppy running at /upload/

python client

github.com/tus/tus-py-client

#!/usr/bin/env python3

# config
username, password = "milahu", "xxxxxxxx"
server_url = f"https://{username}:{password}@milahu.duckdns.org/upload/"

# print(f"server url: {server_url}")

import sys, base64, urllib.parse

# pip install tuspy
import tusclient.client

if len(sys.argv) == 1:
    print("error: no arguments")
    print(f"example use: {sys.argv[0]} file1.txt file2.txt")
    sys.exit(1)

tus_client = tusclient.client.TusClient(server_url)

# workaround: TusClient ignores auth values in server_url
# https://github.com/tus/tus-py-client/issues/108
server_netloc = urllib.parse.urlparse(server_url).netloc
if "@" in server_netloc:
    auth = server_netloc.split("@", 1)[0]
    tus_client.set_headers({
        "Authorization": "Basic " + base64.b64encode(auth.encode("utf8")).decode("ascii"),
    })

for file_path in sys.argv[1:]:
    print(f"uploading {file_path!r}... ", end="", flush=True)
    uploader = tus_client.uploader(file_path)
    uploader.upload()
    print(f"done: {uploader.url}")