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:
@@ -1,4 +1,4 @@
|
||||
from flask import Flask, render_template, redirect, url_for, request, flash, abort
|
||||
from flask import Flask, render_template, redirect, url_for, request, flash, abort, send_from_directory
|
||||
from sqlalchemy import create_engine, func
|
||||
from sqlalchemy.orm import scoped_session, sessionmaker
|
||||
|
||||
@@ -25,6 +25,11 @@ def create_app(config_object="config"):
|
||||
# Dashboard
|
||||
# ------------------------------------------------------------------ #
|
||||
|
||||
@app.route("/sw.js")
|
||||
def service_worker():
|
||||
return send_from_directory(app.static_folder, "sw.js",
|
||||
mimetype="application/javascript")
|
||||
|
||||
@app.route("/")
|
||||
def dashboard():
|
||||
batteries = db.query(Battery).order_by(Battery.label).all()
|
||||
|
||||
Reference in New Issue
Block a user