working pwa?
BIN
static/apple-touch-icon.png
Normal file
After Width: | Height: | Size: 8.9 KiB |
BIN
static/favicon-96x96.png
Normal file
After Width: | Height: | Size: 4.6 KiB |
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
3
static/favicon.svg
Normal file
After Width: | Height: | Size: 176 KiB |
Before Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 8.2 KiB |
Before Width: | Height: | Size: 24 KiB |
@ -1,22 +1,15 @@
|
||||
self.addEventListener('install', function (event) {
|
||||
event.waitUntil(
|
||||
caches.open('my-cache').then(function (cache) {
|
||||
return cache.addAll([
|
||||
'/',
|
||||
'/index.html',
|
||||
'/static/styles.css',
|
||||
'/static/script.js',
|
||||
'/static/icons/icon-192x192.png',
|
||||
'/static/icons/icon-512x512.png'
|
||||
]);
|
||||
})
|
||||
);
|
||||
self.addEventListener('install', e => {
|
||||
// console.log('[Service Worker] Installed');
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', function (event) {
|
||||
event.respondWith(
|
||||
caches.match(event.request).then(function (response) {
|
||||
return response || fetch(event.request);
|
||||
})
|
||||
);
|
||||
self.addEventListener('activate', e => {
|
||||
// console.log('[Service Worker] Activated');
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', e => {
|
||||
// e.respondWith(
|
||||
// caches.match(e.request).then(res => {
|
||||
// return res || fetch(e.request);
|
||||
// })
|
||||
// );
|
||||
});
|
21
static/site.webmanifest
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"name": "kTvManager",
|
||||
"short_name": "kTv",
|
||||
"icons": [
|
||||
{
|
||||
"src": "/web-app-manifest-192x192.png",
|
||||
"sizes": "192x192",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
},
|
||||
{
|
||||
"src": "/web-app-manifest-512x512.png",
|
||||
"sizes": "512x512",
|
||||
"type": "image/png",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
],
|
||||
"theme_color": "#ffffff",
|
||||
"background_color": "#ffffff",
|
||||
"display": "standalone"
|
||||
}
|
BIN
static/web-app-manifest-192x192.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
static/web-app-manifest-512x512.png
Normal file
After Width: | Height: | Size: 42 KiB |
@ -6,7 +6,12 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>KTV Manager</title>
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
|
||||
<link rel="manifest" href="{{ url_for('static', filename='manifest.json') }}">
|
||||
<link rel="icon" type="image/png" href="{{ url_for('static', filename='favicon-96x96.png') }}" sizes="96x96" />
|
||||
<link rel="icon" type="image/svg+xml" href="{{ url_for('static', filename='favicon.svg') }}" />
|
||||
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}" />
|
||||
<link rel="apple-touch-icon" sizes="180x180" href="{{ url_for('static', filename='apple-touch-icon.png') }}" />
|
||||
<meta name="apple-mobile-web-app-title" content="kTvManager" />
|
||||
<link rel="manifest" href="{{ url_for('static', filename='site.webmanifest') }}" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -61,17 +66,13 @@
|
||||
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
<script>
|
||||
if ('serviceWorker' in navigator) {
|
||||
window.addEventListener('load', function() {
|
||||
navigator.serviceWorker.register("{{ url_for('static', filename='service-worker.js') }}")
|
||||
.then(function(registration) {
|
||||
console.log('Service Worker registered with scope: ', registration.scope);
|
||||
})
|
||||
.catch(function(error) {
|
||||
console.log('Service Worker registration failed: ', error);
|
||||
});
|
||||
});
|
||||
navigator.serviceWorker.register('{{ url_for("static", filename="service-worker.js") }}')
|
||||
// .then(reg => {
|
||||
// console.log('Service worker:', reg);
|
||||
// .catch(err => {
|
||||
// console.log('Service worker:', err);
|
||||
// });
|
||||
}
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|