Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
|
@@ -439,21 +439,22 @@ def show_details_html(choice, previous_output, initial_state):
|
|
| 439 |
|
| 440 |
|
| 441 |
def get_pwa_html():
|
| 442 |
-
|
|
|
|
| 443 |
"name": "PawMatch AI",
|
| 444 |
"short_name": "PawMatch",
|
| 445 |
-
"start_url": "
|
| 446 |
"display": "standalone",
|
| 447 |
"background_color": "#ffffff",
|
| 448 |
"theme_color": "#4299e1",
|
| 449 |
"icons": [
|
| 450 |
-
{
|
| 451 |
-
"src": "icon-192.png",
|
| 452 |
"sizes": "192x192",
|
| 453 |
"type": "image/png"
|
| 454 |
-
}
|
| 455 |
]
|
| 456 |
-
}'''
|
| 457 |
|
| 458 |
return f"""
|
| 459 |
<!DOCTYPE html>
|
|
@@ -469,13 +470,17 @@ def get_pwa_html():
|
|
| 469 |
|
| 470 |
<script>
|
| 471 |
window.addEventListener('load', function() {{
|
| 472 |
-
|
| 473 |
-
|
| 474 |
-
|
| 475 |
-
|
| 476 |
-
|
| 477 |
-
|
| 478 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 479 |
}});
|
| 480 |
</script>
|
| 481 |
|
|
@@ -484,13 +489,6 @@ def get_pwa_html():
|
|
| 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>
|
| 495 |
"""
|
| 496 |
|
|
|
|
| 439 |
|
| 440 |
|
| 441 |
def get_pwa_html():
|
| 442 |
+
base_url = "https://dawnc-pawmatchai.hf.space"
|
| 443 |
+
manifest_content = f'''{{
|
| 444 |
"name": "PawMatch AI",
|
| 445 |
"short_name": "PawMatch",
|
| 446 |
+
"start_url": "{base_url}/",
|
| 447 |
"display": "standalone",
|
| 448 |
"background_color": "#ffffff",
|
| 449 |
"theme_color": "#4299e1",
|
| 450 |
"icons": [
|
| 451 |
+
{{
|
| 452 |
+
"src": "{base_url}/icon-192.png",
|
| 453 |
"sizes": "192x192",
|
| 454 |
"type": "image/png"
|
| 455 |
+
}}
|
| 456 |
]
|
| 457 |
+
}}'''
|
| 458 |
|
| 459 |
return f"""
|
| 460 |
<!DOCTYPE html>
|
|
|
|
| 470 |
|
| 471 |
<script>
|
| 472 |
window.addEventListener('load', function() {{
|
| 473 |
+
try {{
|
| 474 |
+
const manifestContent = document.getElementById('pwa-manifest').textContent;
|
| 475 |
+
const manifestBlob = new Blob([manifestContent], {{type: 'application/json'}});
|
| 476 |
+
const manifestUrl = URL.createObjectURL(manifestBlob);
|
| 477 |
+
const manifestLink = document.createElement('link');
|
| 478 |
+
manifestLink.rel = 'manifest';
|
| 479 |
+
manifestLink.href = manifestUrl;
|
| 480 |
+
document.head.appendChild(manifestLink);
|
| 481 |
+
}} catch (error) {{
|
| 482 |
+
console.error('Manifest registration error:', error);
|
| 483 |
+
}}
|
| 484 |
}});
|
| 485 |
</script>
|
| 486 |
|
|
|
|
| 489 |
overscroll-behavior-y: none;
|
| 490 |
-webkit-overflow-scrolling: touch;
|
| 491 |
}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 492 |
</style>
|
| 493 |
"""
|
| 494 |
|