Update app.py
Browse files
app.py
CHANGED
|
@@ -15,7 +15,7 @@ HTML_CONTENT = """
|
|
| 15 |
<head>
|
| 16 |
<meta charset="UTF-8">
|
| 17 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 18 |
-
<title>
|
| 19 |
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
|
| 20 |
<style>
|
| 21 |
body {
|
|
@@ -534,7 +534,7 @@ HTML_CONTENT = """
|
|
| 534 |
</head>
|
| 535 |
<body>
|
| 536 |
<div class="container">
|
| 537 |
-
<h1>
|
| 538 |
<form id="uploadForm">
|
| 539 |
<div id="dropZone" class="drop-zone">
|
| 540 |
<input type="file" name="file" id="file" class="file-input" accept="*" required>
|
|
@@ -969,14 +969,14 @@ async def handle_upload(file: UploadFile = File(...)):
|
|
| 969 |
return JSONResponse(content={"error": "FAILED GOD MAN AFTER alot of attempts"}, status_code=500)
|
| 970 |
|
| 971 |
original_url = upload_result['serving_url']
|
| 972 |
-
mirrored_url = f"/
|
| 973 |
|
| 974 |
if original_extension.lower() not in supported_types:
|
| 975 |
mirrored_url = mirrored_url.replace('.png', '')
|
| 976 |
|
| 977 |
return JSONResponse(content={"url": mirrored_url, "originalExtension": original_extension})
|
| 978 |
|
| 979 |
-
@app.get("/
|
| 980 |
async def handle_file_stream(path: str, request: Request):
|
| 981 |
original_url = f'https://replicate.delivery/pbxt/{path}'
|
| 982 |
|
|
|
|
| 15 |
<head>
|
| 16 |
<meta charset="UTF-8">
|
| 17 |
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 18 |
+
<title>PRO Uploader</title>
|
| 19 |
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
|
| 20 |
<style>
|
| 21 |
body {
|
|
|
|
| 534 |
</head>
|
| 535 |
<body>
|
| 536 |
<div class="container">
|
| 537 |
+
<h1>PRO Uploader</h1>
|
| 538 |
<form id="uploadForm">
|
| 539 |
<div id="dropZone" class="drop-zone">
|
| 540 |
<input type="file" name="file" id="file" class="file-input" accept="*" required>
|
|
|
|
| 969 |
return JSONResponse(content={"error": "FAILED GOD MAN AFTER alot of attempts"}, status_code=500)
|
| 970 |
|
| 971 |
original_url = upload_result['serving_url']
|
| 972 |
+
mirrored_url = f"/upload/{original_url.split('/pbxt/')[1]}"
|
| 973 |
|
| 974 |
if original_extension.lower() not in supported_types:
|
| 975 |
mirrored_url = mirrored_url.replace('.png', '')
|
| 976 |
|
| 977 |
return JSONResponse(content={"url": mirrored_url, "originalExtension": original_extension})
|
| 978 |
|
| 979 |
+
@app.get("/upload/{path:path}")
|
| 980 |
async def handle_file_stream(path: str, request: Request):
|
| 981 |
original_url = f'https://replicate.delivery/pbxt/{path}'
|
| 982 |
|