Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,7 +14,7 @@ HTML_CONTENT = """
|
|
14 |
<title>Radd PRO Uploader</title>
|
15 |
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
|
16 |
<style>
|
17 |
-
/* Global Styles
|
18 |
body {
|
19 |
font-family: 'Poppins', sans-serif;
|
20 |
background-color: #121212;
|
@@ -24,7 +24,7 @@ HTML_CONTENT = """
|
|
24 |
overflow: hidden;
|
25 |
}
|
26 |
|
27 |
-
|
28 |
body::before {
|
29 |
content: "";
|
30 |
position: fixed;
|
@@ -52,6 +52,13 @@ HTML_CONTENT = """
|
|
52 |
100% { transform: translate(5%, 0); }
|
53 |
}
|
54 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
.container {
|
56 |
position: relative;
|
57 |
max-width: 450px;
|
@@ -72,13 +79,13 @@ HTML_CONTENT = """
|
|
72 |
text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
|
73 |
}
|
74 |
|
75 |
-
|
76 |
.btn {
|
77 |
display: inline-block;
|
78 |
position: relative;
|
79 |
-
padding:
|
80 |
-
margin: 0.
|
81 |
-
font-size:
|
82 |
font-weight: 600;
|
83 |
color: #ffffff;
|
84 |
background-color: #2a2a2a;
|
@@ -92,67 +99,32 @@ HTML_CONTENT = """
|
|
92 |
|
93 |
.btn:hover {
|
94 |
color: #ffffff;
|
95 |
-
box-shadow: 0 0 15px rgba(0,
|
96 |
}
|
97 |
|
98 |
.btn:hover::before {
|
99 |
content: '';
|
100 |
position: absolute;
|
101 |
inset: -10px;
|
102 |
-
background: radial-gradient(circle at center, rgba(0,
|
103 |
filter: blur(20px);
|
104 |
animation: glowAnimation 2s infinite;
|
105 |
z-index: -1;
|
106 |
pointer-events: none;
|
107 |
}
|
108 |
|
109 |
-
@keyframes glowAnimation {
|
110 |
-
0% { transform: scale(0.8); }
|
111 |
-
50% { transform: scale(1.2); }
|
112 |
-
100% { transform: scale(0.8); }
|
113 |
-
}
|
114 |
-
|
115 |
.btn:active {
|
116 |
transform: scale(0.98);
|
117 |
}
|
118 |
|
119 |
-
|
120 |
-
.
|
121 |
-
padding:
|
122 |
-
font-size: 0.
|
123 |
-
|
124 |
-
background-color: #2a2a2a;
|
125 |
-
color: #ffffff;
|
126 |
-
border: none;
|
127 |
-
border-radius: 5px;
|
128 |
-
cursor: pointer;
|
129 |
-
transition: color 0.3s ease, box-shadow 0.3s ease;
|
130 |
-
position: relative;
|
131 |
-
overflow: hidden;
|
132 |
-
z-index: 1;
|
133 |
-
}
|
134 |
-
|
135 |
-
.small-btn:hover {
|
136 |
-
color: #ffffff;
|
137 |
-
box-shadow: 0 0 10px rgba(0, 122, 255, 0.5);
|
138 |
-
}
|
139 |
-
|
140 |
-
.small-btn:hover::before {
|
141 |
-
content: '';
|
142 |
-
position: absolute;
|
143 |
-
inset: -10px;
|
144 |
-
background: radial-gradient(circle at center, rgba(0,122,255,0.2), transparent);
|
145 |
-
filter: blur(15px);
|
146 |
-
animation: glowAnimation 2s infinite;
|
147 |
-
z-index: -1;
|
148 |
-
pointer-events: none;
|
149 |
-
}
|
150 |
-
|
151 |
-
.small-btn:active {
|
152 |
-
transform: scale(0.98);
|
153 |
}
|
154 |
|
155 |
-
|
156 |
.drop-zone {
|
157 |
position: relative;
|
158 |
padding: 20px;
|
@@ -162,25 +134,29 @@ HTML_CONTENT = """
|
|
162 |
cursor: pointer;
|
163 |
transition: all 0.3s ease;
|
164 |
background: rgba(255, 255, 255, 0.05);
|
|
|
165 |
}
|
166 |
|
167 |
-
.drop-zone
|
168 |
-
border-color: #ffffff;
|
169 |
-
background: rgba(255, 255, 255, 0.1);
|
170 |
-
position: relative;
|
171 |
-
}
|
172 |
-
|
173 |
-
.drop-zone:hover::before {
|
174 |
content: '';
|
175 |
position: absolute;
|
176 |
-
inset:
|
177 |
-
background:
|
178 |
-
|
179 |
-
animation: glowAnimation 2s infinite;
|
180 |
-
z-index: -1;
|
181 |
pointer-events: none;
|
182 |
}
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
.file-input {
|
185 |
display: none;
|
186 |
}
|
@@ -191,7 +167,7 @@ HTML_CONTENT = """
|
|
191 |
color: #aaa;
|
192 |
}
|
193 |
|
194 |
-
|
195 |
.progress-container {
|
196 |
display: none;
|
197 |
margin-top: 1.5rem;
|
@@ -213,7 +189,7 @@ HTML_CONTENT = """
|
|
213 |
transition: width 0.3s ease;
|
214 |
}
|
215 |
|
216 |
-
|
217 |
.loading-spinner {
|
218 |
display: none;
|
219 |
width: 40px;
|
@@ -230,7 +206,7 @@ HTML_CONTENT = """
|
|
230 |
100% { transform: rotate(360deg); }
|
231 |
}
|
232 |
|
233 |
-
|
234 |
.result-container {
|
235 |
display: none;
|
236 |
margin-top: 1.5rem;
|
@@ -248,14 +224,14 @@ HTML_CONTENT = """
|
|
248 |
text-decoration: underline;
|
249 |
}
|
250 |
|
251 |
-
|
252 |
.file-types {
|
253 |
margin-top: 2rem;
|
254 |
font-size: 0.8rem;
|
255 |
color: #aaa;
|
256 |
}
|
257 |
|
258 |
-
|
259 |
.modal {
|
260 |
display: none;
|
261 |
position: fixed;
|
@@ -319,7 +295,7 @@ HTML_CONTENT = """
|
|
319 |
margin-right: 10px;
|
320 |
}
|
321 |
|
322 |
-
|
323 |
@media (max-width: 480px) {
|
324 |
.container {
|
325 |
padding: 2rem 1rem;
|
@@ -346,7 +322,7 @@ HTML_CONTENT = """
|
|
346 |
<h1>Radd PRO Uploader</h1>
|
347 |
<form id="uploadForm">
|
348 |
<div id="dropZone" class="drop-zone">
|
349 |
-
<input type="file" name="file" id="file" class="file-input" accept=".zip,.mp4,.txt,.mp3,image
|
350 |
<label for="file" class="btn">Choose File</label>
|
351 |
<p>or drag and drop file here/paste image</p>
|
352 |
</div>
|
@@ -363,12 +339,12 @@ HTML_CONTENT = """
|
|
363 |
|
364 |
<div id="embedModal" class="modal">
|
365 |
<div class="modal-content">
|
366 |
-
<span class="close"
|
367 |
<h2>Embed Video Link</h2>
|
368 |
<p>Copy the following link to embed the video:</p>
|
369 |
<div class="embed-container">
|
370 |
<input type="text" id="embedLink" readonly>
|
371 |
-
<button onclick="copyEmbedLink()" class="
|
372 |
</div>
|
373 |
</div>
|
374 |
</div>
|
@@ -394,6 +370,10 @@ HTML_CONTENT = """
|
|
394 |
}
|
395 |
});
|
396 |
|
|
|
|
|
|
|
|
|
397 |
dropZone.addEventListener('dragover', (e) => {
|
398 |
e.preventDefault();
|
399 |
dropZone.classList.add('drag-over');
|
@@ -512,13 +492,13 @@ HTML_CONTENT = """
|
|
512 |
|
513 |
const link = document.createElement('a');
|
514 |
link.href = url;
|
515 |
-
link.textContent =
|
516 |
link.className = 'result-link';
|
517 |
link.target = '_blank';
|
518 |
|
519 |
const copyBtn = document.createElement('button');
|
520 |
copyBtn.textContent = 'Copy Link';
|
521 |
-
copyBtn.className = '
|
522 |
copyBtn.onclick = () => {
|
523 |
navigator.clipboard.writeText(window.location.origin + url).then(() => {
|
524 |
alert('Link copied to clipboard!');
|
@@ -531,7 +511,7 @@ HTML_CONTENT = """
|
|
531 |
if (fileName.toLowerCase().endsWith('.mp4')) {
|
532 |
const embedBtn = document.createElement('button');
|
533 |
embedBtn.textContent = 'Embed Video for Discord';
|
534 |
-
embedBtn.className = '
|
535 |
embedBtn.onclick = () => {
|
536 |
showEmbedModal(url);
|
537 |
};
|
@@ -543,7 +523,7 @@ HTML_CONTENT = """
|
|
543 |
}
|
544 |
|
545 |
function showEmbedModal(url) {
|
546 |
-
const embedUrl =
|
547 |
embedLinkInput.value = embedUrl;
|
548 |
modal.style.display = "block";
|
549 |
}
|
@@ -598,7 +578,7 @@ async def handle_video_stream(path: str, request: Request):
|
|
598 |
yield chunk
|
599 |
|
600 |
headers = dict(response.headers)
|
601 |
-
headers['Access-Control-Allow-Origin'] = '
|
602 |
headers['Content-Disposition'] = 'inline'
|
603 |
|
604 |
if response.status_code == 206:
|
@@ -662,10 +642,10 @@ async def initiate_upload(cookies: Dict[str, str], filename: str, content_type:
|
|
662 |
try:
|
663 |
response = requests.post(url, cookies=cookies, headers={
|
664 |
'X-CSRFToken': cookies.get('csrftoken'),
|
665 |
-
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64)
|
666 |
'Referer': 'https://replicate.com/levelsio/neon-tokyo',
|
667 |
'Origin': 'https://replicate.com',
|
668 |
-
'Accept': '
|
669 |
'Accept-Language': 'en-US,en;q=0.5',
|
670 |
'Accept-Encoding': 'identity',
|
671 |
'Sec-Fetch-Dest': 'empty',
|
|
|
14 |
<title>Radd PRO Uploader</title>
|
15 |
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;600&display=swap" rel="stylesheet">
|
16 |
<style>
|
17 |
+
/* Global Styles /
|
18 |
body {
|
19 |
font-family: 'Poppins', sans-serif;
|
20 |
background-color: #121212;
|
|
|
24 |
overflow: hidden;
|
25 |
}
|
26 |
|
27 |
+
/ Moving Grainy Background /
|
28 |
body::before {
|
29 |
content: "";
|
30 |
position: fixed;
|
|
|
52 |
100% { transform: translate(5%, 0); }
|
53 |
}
|
54 |
|
55 |
+
/ Glow Animation /
|
56 |
+
@keyframes glowAnimation {
|
57 |
+
0% { box-shadow: 0 0 5px rgba(0, 150, 255, 0.3); }
|
58 |
+
50% { box-shadow: 0 0 20px rgba(0, 150, 255, 0.6); }
|
59 |
+
100% { box-shadow: 0 0 5px rgba(0, 150, 255, 0.3); }
|
60 |
+
}
|
61 |
+
|
62 |
.container {
|
63 |
position: relative;
|
64 |
max-width: 450px;
|
|
|
79 |
text-shadow: 0 0 5px rgba(255, 255, 255, 0.2);
|
80 |
}
|
81 |
|
82 |
+
/ Buttons /
|
83 |
.btn {
|
84 |
display: inline-block;
|
85 |
position: relative;
|
86 |
+
padding: 8px 16px;
|
87 |
+
margin: 0.3rem;
|
88 |
+
font-size: 0.9rem;
|
89 |
font-weight: 600;
|
90 |
color: #ffffff;
|
91 |
background-color: #2a2a2a;
|
|
|
99 |
|
100 |
.btn:hover {
|
101 |
color: #ffffff;
|
102 |
+
box-shadow: 0 0 15px rgba(0,150,255,0.5);
|
103 |
}
|
104 |
|
105 |
.btn:hover::before {
|
106 |
content: '';
|
107 |
position: absolute;
|
108 |
inset: -10px;
|
109 |
+
background: radial-gradient(circle at center, rgba(0,150,255,0.2), transparent);
|
110 |
filter: blur(20px);
|
111 |
animation: glowAnimation 2s infinite;
|
112 |
z-index: -1;
|
113 |
pointer-events: none;
|
114 |
}
|
115 |
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
.btn:active {
|
117 |
transform: scale(0.98);
|
118 |
}
|
119 |
|
120 |
+
/ Specific Button Sizes /
|
121 |
+
.copy-btn, .embed-btn {
|
122 |
+
padding: 6px 12px;
|
123 |
+
font-size: 0.8rem;
|
124 |
+
margin: 0.2rem;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
125 |
}
|
126 |
|
127 |
+
/ Drop Zone /
|
128 |
.drop-zone {
|
129 |
position: relative;
|
130 |
padding: 20px;
|
|
|
134 |
cursor: pointer;
|
135 |
transition: all 0.3s ease;
|
136 |
background: rgba(255, 255, 255, 0.05);
|
137 |
+
overflow: hidden;
|
138 |
}
|
139 |
|
140 |
+
.drop-zone::before {
|
|
|
|
|
|
|
|
|
|
|
|
|
141 |
content: '';
|
142 |
position: absolute;
|
143 |
+
inset: 0;
|
144 |
+
background: none;
|
145 |
+
transition: background 0.3s ease;
|
|
|
|
|
146 |
pointer-events: none;
|
147 |
}
|
148 |
|
149 |
+
.drop-zone:hover::before {
|
150 |
+
background: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADwAAAA8CAQAAACM/9unAAAACXBIWXMAAAsTAAALEwEAmpwYAAABF0lEQVR4nO3YMRLCQBRE0clsYgxZwwq7oLGxAgp2AtbsqQZsYgEG0wEWc/LSZnb9HcMjR8fHvEKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgsK8tJOq9fzs7vlkNlWvf5ELi+20t5k2VSL7p/iHJ5Rz5ynOhU7rQ4pUi+6b4hyeUc+cpzoVO60OkV7rQ4pUi+6b4hxenu+en4rQAOkaks/eJegGaUfOHI+nRvQCND1w2J9yf8C2KZwNjkeUsAKRa7Nz50tQAokVbO/U6AaiWjl5wd6kQAOke8Xpx3JgTQKVq7Heh0ADpFvF6cd0kE0Claux3odAA6RfxenHc+BNCpWrsd6HQAOkX8Xpx3PgTQqVq7Heh0ADpF/F6cdz4E0KlarjdI/cR1FBQUGBgYGBgYGBgYG/AT4AIHph6aQGU7oAAAAASUVORK5CYII=') repeat;
|
151 |
+
animation: grain 8s steps(10) infinite;
|
152 |
+
opacity: 0.3;
|
153 |
+
}
|
154 |
+
|
155 |
+
.drop-zone:hover, .drop-zone.drag-over {
|
156 |
+
border-color: #ffffff;
|
157 |
+
background: rgba(255, 255, 255, 0.1);
|
158 |
+
}
|
159 |
+
|
160 |
.file-input {
|
161 |
display: none;
|
162 |
}
|
|
|
167 |
color: #aaa;
|
168 |
}
|
169 |
|
170 |
+
/ Progress Bar /
|
171 |
.progress-container {
|
172 |
display: none;
|
173 |
margin-top: 1.5rem;
|
|
|
189 |
transition: width 0.3s ease;
|
190 |
}
|
191 |
|
192 |
+
/ Loading Spinner /
|
193 |
.loading-spinner {
|
194 |
display: none;
|
195 |
width: 40px;
|
|
|
206 |
100% { transform: rotate(360deg); }
|
207 |
}
|
208 |
|
209 |
+
/ Result Container /
|
210 |
.result-container {
|
211 |
display: none;
|
212 |
margin-top: 1.5rem;
|
|
|
224 |
text-decoration: underline;
|
225 |
}
|
226 |
|
227 |
+
/ File Types /
|
228 |
.file-types {
|
229 |
margin-top: 2rem;
|
230 |
font-size: 0.8rem;
|
231 |
color: #aaa;
|
232 |
}
|
233 |
|
234 |
+
/ Modal Styles /
|
235 |
.modal {
|
236 |
display: none;
|
237 |
position: fixed;
|
|
|
295 |
margin-right: 10px;
|
296 |
}
|
297 |
|
298 |
+
/ Media Queries /
|
299 |
@media (max-width: 480px) {
|
300 |
.container {
|
301 |
padding: 2rem 1rem;
|
|
|
322 |
<h1>Radd PRO Uploader</h1>
|
323 |
<form id="uploadForm">
|
324 |
<div id="dropZone" class="drop-zone">
|
325 |
+
<input type="file" name="file" id="file" class="file-input" accept=".zip,.mp4,.txt,.mp3,image/,.pdf" required>
|
326 |
<label for="file" class="btn">Choose File</label>
|
327 |
<p>or drag and drop file here/paste image</p>
|
328 |
</div>
|
|
|
339 |
|
340 |
<div id="embedModal" class="modal">
|
341 |
<div class="modal-content">
|
342 |
+
<span class="close">×</span>
|
343 |
<h2>Embed Video Link</h2>
|
344 |
<p>Copy the following link to embed the video:</p>
|
345 |
<div class="embed-container">
|
346 |
<input type="text" id="embedLink" readonly>
|
347 |
+
<button onclick="copyEmbedLink()" class="btn copy-embed-btn">Copy</button>
|
348 |
</div>
|
349 |
</div>
|
350 |
</div>
|
|
|
370 |
}
|
371 |
});
|
372 |
|
373 |
+
dropZone.addEventListener('click', () => {
|
374 |
+
fileInput.click();
|
375 |
+
});
|
376 |
+
|
377 |
dropZone.addEventListener('dragover', (e) => {
|
378 |
e.preventDefault();
|
379 |
dropZone.classList.add('drag-over');
|
|
|
492 |
|
493 |
const link = document.createElement('a');
|
494 |
link.href = url;
|
495 |
+
link.textContent = View ${fileName};
|
496 |
link.className = 'result-link';
|
497 |
link.target = '_blank';
|
498 |
|
499 |
const copyBtn = document.createElement('button');
|
500 |
copyBtn.textContent = 'Copy Link';
|
501 |
+
copyBtn.className = 'btn copy-btn';
|
502 |
copyBtn.onclick = () => {
|
503 |
navigator.clipboard.writeText(window.location.origin + url).then(() => {
|
504 |
alert('Link copied to clipboard!');
|
|
|
511 |
if (fileName.toLowerCase().endsWith('.mp4')) {
|
512 |
const embedBtn = document.createElement('button');
|
513 |
embedBtn.textContent = 'Embed Video for Discord';
|
514 |
+
embedBtn.className = 'btn embed-btn';
|
515 |
embedBtn.onclick = () => {
|
516 |
showEmbedModal(url);
|
517 |
};
|
|
|
523 |
}
|
524 |
|
525 |
function showEmbedModal(url) {
|
526 |
+
const embedUrl = ${window.location.origin}/embed?url=${encodeURIComponent(window.location.origin + url)}&thumbnail=${encodeURIComponent('https://example.com/thumbnail.png')};
|
527 |
embedLinkInput.value = embedUrl;
|
528 |
modal.style.display = "block";
|
529 |
}
|
|
|
578 |
yield chunk
|
579 |
|
580 |
headers = dict(response.headers)
|
581 |
+
headers['Access-Control-Allow-Origin'] = ''
|
582 |
headers['Content-Disposition'] = 'inline'
|
583 |
|
584 |
if response.status_code == 206:
|
|
|
642 |
try:
|
643 |
response = requests.post(url, cookies=cookies, headers={
|
644 |
'X-CSRFToken': cookies.get('csrftoken'),
|
645 |
+
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWeb/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36',
|
646 |
'Referer': 'https://replicate.com/levelsio/neon-tokyo',
|
647 |
'Origin': 'https://replicate.com',
|
648 |
+
'Accept': '/*',
|
649 |
'Accept-Language': 'en-US,en;q=0.5',
|
650 |
'Accept-Encoding': 'identity',
|
651 |
'Sec-Fetch-Dest': 'empty',
|