Add PWA support — installable as home screen app
Adds Web App Manifest, a minimal Service Worker, and Apple/Android meta tags so the app can be added to a phone home screen and opens full-screen in standalone mode (no browser chrome). - static/manifest.json: name, short_name, display=standalone, icons - static/sw.js: minimal SW served at /sw.js (root scope) via new Flask route - static/icon-192.png, icon-512.png: generated by sbin/gen_icons.py (stdlib only) - base.html: manifest link, theme-color, apple-mobile-web-app-* tags, SW registration
This commit is contained in:
@@ -4,6 +4,12 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>{% block title %}Battery Tracker{% endblock %}</title>
|
||||
<link rel="manifest" href="/static/manifest.json">
|
||||
<meta name="theme-color" content="#2563eb">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-status-bar-style" content="default">
|
||||
<meta name="apple-mobile-web-app-title" content="Batteries">
|
||||
<link rel="apple-touch-icon" href="/static/icon-192.png">
|
||||
<style>
|
||||
/* ─── Color variables (light mode) ──────────────────────────────── */
|
||||
:root {
|
||||
@@ -320,5 +326,10 @@
|
||||
|
||||
{% block content %}{% endblock %}
|
||||
</div>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
navigator.serviceWorker.register('/sw.js');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user