Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -442,35 +442,34 @@ def show_details_html(choice, previous_output, initial_state):
|
|
442 |
def get_pwa_html():
|
443 |
return """
|
444 |
<!DOCTYPE html>
|
445 |
-
<
|
446 |
-
<
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
464 |
-
|
465 |
-
|
466 |
-
|
467 |
-
|
468 |
-
|
469 |
-
|
470 |
-
|
471 |
-
|
472 |
-
|
473 |
-
</script>
|
474 |
"""
|
475 |
|
476 |
def main():
|
@@ -555,6 +554,8 @@ def main():
|
|
555 |
</div>
|
556 |
''')
|
557 |
|
|
|
|
|
558 |
return iface
|
559 |
|
560 |
if __name__ == "__main__":
|
|
|
442 |
def get_pwa_html():
|
443 |
return """
|
444 |
<!DOCTYPE html>
|
445 |
+
<html lang="en">
|
446 |
+
<head>
|
447 |
+
<meta charset="UTF-8" />
|
448 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
449 |
+
<meta name="apple-mobile-web-app-capable" content="yes">
|
450 |
+
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
451 |
+
<meta name="theme-color" content="#4299e1">
|
452 |
+
|
453 |
+
<link rel="manifest" href="manifest.json">
|
454 |
+
<link rel="apple-touch-icon" href="assets/icon-192.png">
|
455 |
+
|
456 |
+
<script>
|
457 |
+
// PWA: Service Worker 註冊
|
458 |
+
document.addEventListener('DOMContentLoaded', function() {
|
459 |
+
if ('serviceWorker' in navigator) {
|
460 |
+
const swURL = new URL('service-worker.js', window.location.origin + window.location.pathname).href;
|
461 |
+
navigator.serviceWorker.register(swURL)
|
462 |
+
.then(function(registration) {
|
463 |
+
console.log('Service Worker 註冊成功,範圍:', registration.scope);
|
464 |
+
})
|
465 |
+
.catch(function(error) {
|
466 |
+
console.log('Service Worker 註冊失敗:', error.message);
|
467 |
+
});
|
468 |
+
}
|
469 |
+
});
|
470 |
+
</script>
|
471 |
+
</head>
|
472 |
+
<body>
|
|
|
473 |
"""
|
474 |
|
475 |
def main():
|
|
|
554 |
</div>
|
555 |
''')
|
556 |
|
557 |
+
gr.HTML("</body></html>")
|
558 |
+
|
559 |
return iface
|
560 |
|
561 |
if __name__ == "__main__":
|