This commit is contained in:
nose
2025-12-19 15:20:08 -08:00
parent d3edd6420c
commit 900a37e210
13 changed files with 729 additions and 32 deletions

View File

@@ -13,6 +13,7 @@ class ZeroXZero(Provider):
def upload(self, file_path: str, **kwargs: Any) -> str:
from API.HTTP import HTTPClient
from models import ProgressFileReader
if not os.path.exists(file_path):
raise FileNotFoundError(f"File not found: {file_path}")
@@ -21,7 +22,12 @@ class ZeroXZero(Provider):
headers = {"User-Agent": "Medeia-Macina/1.0"}
with HTTPClient(headers=headers) as client:
with open(file_path, "rb") as handle:
response = client.post("https://0x0.st", files={"file": handle})
try:
total = os.path.getsize(file_path)
except Exception:
total = None
wrapped = ProgressFileReader(handle, total_bytes=total, label="upload")
response = client.post("https://0x0.st", files={"file": wrapped})
if response.status_code == 200:
uploaded_url = response.text.strip()