diff --git a/app.py b/app.py index 478483d..38158e4 100644 --- a/app.py +++ b/app.py @@ -1,5 +1,5 @@ # app.py -from flask import Flask, render_template, request, redirect, url_for, session, flash +from flask import Flask, render_template, request, redirect, url_for, session, flash, send_file from flask_caching import Cache import requests.auth import os @@ -17,6 +17,9 @@ app.config.from_object( ) cache = Cache(app, config={"CACHE_TYPE": "SimpleCache"}) +@app.route('/manifest.json') +def serve_manifest(): + return send_file('manifest.json', mimetype='application/manifest+json') @app.route("/favicon.ico") def favicon(): diff --git a/static/icons/android-launchericon-144-144.png b/static/icons/android-launchericon-144-144.png new file mode 100644 index 0000000..b077e84 Binary files /dev/null and b/static/icons/android-launchericon-144-144.png differ diff --git a/static/icons/android-launchericon-192-192.png b/static/icons/android-launchericon-192-192.png new file mode 100644 index 0000000..4f4c83d Binary files /dev/null and b/static/icons/android-launchericon-192-192.png differ diff --git a/static/icons/android-launchericon-512-512.png b/static/icons/android-launchericon-512-512.png new file mode 100644 index 0000000..653c9cc Binary files /dev/null and b/static/icons/android-launchericon-512-512.png differ diff --git a/static/manifest.json b/static/manifest.json new file mode 100644 index 0000000..d77aea2 --- /dev/null +++ b/static/manifest.json @@ -0,0 +1,29 @@ +{ + "name": "KTVManager", + "short_name": "KTV", + "start_url": "https://tv-ui.k-world.me.uk/", + "scope": "/", + "display": "standalone", + "theme_color": "#317EFB", + "background_color": "#317EFB", + "icons": [ + { + "src": "/static/icons/android-launchericon-144-144.png", + "sizes": "144x144", + "type": "image/png", + "purpose": "any maskable" + }, + { + "src": "/static/icons/android-launchericon-192-192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "any maskable" + }, + { + "src": "/static/icons/android-launchericon-512-512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "any maskable" + } + ] +} \ No newline at end of file diff --git a/static/service-worker.js b/static/service-worker.js new file mode 100644 index 0000000..92d09ad --- /dev/null +++ b/static/service-worker.js @@ -0,0 +1,22 @@ +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('fetch', function (event) { + event.respondWith( + caches.match(event.request).then(function (response) { + return response || fetch(event.request); + }) + ); +}); diff --git a/templates/index.html b/templates/index.html index 57baa12..a37ae61 100644 --- a/templates/index.html +++ b/templates/index.html @@ -6,6 +6,7 @@ KTV Manager + @@ -58,5 +59,19 @@ + +