Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -462,7 +462,6 @@ def get_pwa_html():
|
|
| 462 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
| 463 |
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
| 464 |
<meta name="theme-color" content="#4299e1">
|
| 465 |
-
<meta http-equiv="Content-Security-Policy" content="default-src 'self' 'unsafe-inline' 'unsafe-eval' data: blob: https:">
|
| 466 |
|
| 467 |
<script type="application/json" id="pwa-manifest">
|
| 468 |
{manifest_content}
|
|
@@ -470,52 +469,26 @@ def get_pwa_html():
|
|
| 470 |
|
| 471 |
<script>
|
| 472 |
window.addEventListener('load', function() {{
|
| 473 |
-
const
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
| 479 |
-
|
| 480 |
-
input.addEventListener('change', async function(e) {{
|
| 481 |
-
const file = e.target.files[0];
|
| 482 |
-
if (file) {{
|
| 483 |
-
const formData = new FormData();
|
| 484 |
-
formData.append('file', file);
|
| 485 |
-
|
| 486 |
-
try {{
|
| 487 |
-
const response = await fetch('/upload', {{
|
| 488 |
-
method: 'POST',
|
| 489 |
-
body: formData
|
| 490 |
-
}});
|
| 491 |
-
|
| 492 |
-
if (!response.ok) throw new Error('Upload failed');
|
| 493 |
-
|
| 494 |
-
const result = await response.json();
|
| 495 |
-
console.log('Upload successful:', result);
|
| 496 |
-
}} catch (error) {{
|
| 497 |
-
console.error('Upload error:', error);
|
| 498 |
-
}}
|
| 499 |
-
}}
|
| 500 |
-
}});
|
| 501 |
-
}});
|
| 502 |
-
}}
|
| 503 |
}});
|
| 504 |
</script>
|
| 505 |
|
| 506 |
<style>
|
| 507 |
-
|
| 508 |
-
-
|
| 509 |
-
|
| 510 |
-
border-radius: 8px;
|
| 511 |
-
padding: 10px;
|
| 512 |
-
background: #f3f4f6;
|
| 513 |
}}
|
| 514 |
|
| 515 |
-
@
|
| 516 |
body {{
|
| 517 |
-
padding-top: env(safe-area-inset-top);
|
| 518 |
-
padding-bottom: env(safe-area-inset-bottom);
|
| 519 |
}}
|
| 520 |
}}
|
| 521 |
</style>
|
|
|
|
| 462 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
| 463 |
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
| 464 |
<meta name="theme-color" content="#4299e1">
|
|
|
|
| 465 |
|
| 466 |
<script type="application/json" id="pwa-manifest">
|
| 467 |
{manifest_content}
|
|
|
|
| 469 |
|
| 470 |
<script>
|
| 471 |
window.addEventListener('load', function() {{
|
| 472 |
+
const manifestContent = document.getElementById('pwa-manifest').textContent;
|
| 473 |
+
const manifestBlob = new Blob([manifestContent], {{type: 'application/json'}});
|
| 474 |
+
const manifestUrl = URL.createObjectURL(manifestBlob);
|
| 475 |
+
const manifestLink = document.createElement('link');
|
| 476 |
+
manifestLink.rel = 'manifest';
|
| 477 |
+
manifestLink.href = manifestUrl;
|
| 478 |
+
document.head.appendChild(manifestLink);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
}});
|
| 480 |
</script>
|
| 481 |
|
| 482 |
<style>
|
| 483 |
+
body {{
|
| 484 |
+
overscroll-behavior-y: none;
|
| 485 |
+
-webkit-overflow-scrolling: touch;
|
|
|
|
|
|
|
|
|
|
| 486 |
}}
|
| 487 |
|
| 488 |
+
@supports (padding: max(0px)) {{
|
| 489 |
body {{
|
| 490 |
+
padding-top: max(0px, env(safe-area-inset-top));
|
| 491 |
+
padding-bottom: max(0px, env(safe-area-inset-bottom));
|
| 492 |
}}
|
| 493 |
}}
|
| 494 |
</style>
|