Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -441,27 +441,61 @@ def get_pwa_html():
|
|
441 |
return """
|
442 |
<!DOCTYPE html>
|
443 |
<meta charset="UTF-8">
|
444 |
-
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
445 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
446 |
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
447 |
<meta name="theme-color" content="#4299e1">
|
448 |
-
<link rel="manifest" href="
|
449 |
-
<link rel="apple-touch-icon" href="
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
450 |
<script>
|
451 |
-
|
452 |
-
|
453 |
-
navigator.serviceWorker.register('
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
|
|
|
|
|
|
|
|
464 |
</script>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
465 |
"""
|
466 |
|
467 |
def main():
|
|
|
441 |
return """
|
442 |
<!DOCTYPE html>
|
443 |
<meta charset="UTF-8">
|
444 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
445 |
<meta name="apple-mobile-web-app-capable" content="yes">
|
446 |
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
447 |
<meta name="theme-color" content="#4299e1">
|
448 |
+
<link rel="manifest" href="manifest.json" crossorigin="use-credentials">
|
449 |
+
<link rel="apple-touch-icon" href="icon-192.png">
|
450 |
+
<link rel="apple-touch-startup-image" href="icon-512.png">
|
451 |
+
|
452 |
+
<!-- Safari 特定的 meta 標籤 -->
|
453 |
+
<meta name="apple-mobile-web-app-title" content="PawMatch AI">
|
454 |
+
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
|
455 |
+
|
456 |
+
<!-- iOS 啟動畫面 -->
|
457 |
+
<link rel="apple-touch-startup-image"
|
458 |
+
media="(device-width: 320px) and (device-height: 568px) and (-webkit-device-pixel-ratio: 2)"
|
459 |
+
href="icon-512.png">
|
460 |
+
<link rel="apple-touch-startup-image"
|
461 |
+
media="(device-width: 375px) and (device-height: 667px) and (-webkit-device-pixel-ratio: 2)"
|
462 |
+
href="icon-512.png">
|
463 |
+
|
464 |
<script>
|
465 |
+
window.addEventListener('load', function() {
|
466 |
+
if ('serviceWorker' in navigator) {
|
467 |
+
navigator.serviceWorker.register('/service-worker.js', {
|
468 |
+
scope: '/',
|
469 |
+
updateViaCache: 'none'
|
470 |
+
}).then(function(registration) {
|
471 |
+
console.log('ServiceWorker 註冊成功:', registration.scope);
|
472 |
+
}).catch(function(err) {
|
473 |
+
console.log('ServiceWorker 註冊失敗:', err);
|
474 |
+
});
|
475 |
+
}
|
476 |
+
|
477 |
+
// Safari 特定處理
|
478 |
+
if (navigator.standalone) {
|
479 |
+
document.documentElement.classList.add('standalone');
|
480 |
+
}
|
481 |
+
});
|
482 |
</script>
|
483 |
+
|
484 |
+
<style>
|
485 |
+
/* 防止 iOS 上的橡皮筋效果 */
|
486 |
+
html {
|
487 |
+
overflow: hidden;
|
488 |
+
position: fixed;
|
489 |
+
width: 100%;
|
490 |
+
height: 100%;
|
491 |
+
}
|
492 |
+
|
493 |
+
/* PWA 模式樣式 */
|
494 |
+
html.standalone {
|
495 |
+
-webkit-user-select: none;
|
496 |
+
-webkit-touch-callout: none;
|
497 |
+
}
|
498 |
+
</style>
|
499 |
"""
|
500 |
|
501 |
def main():
|