release nouri 0.5.0 shopping rhythm pwa and reminders
This commit is contained in:
@@ -11,13 +11,18 @@ from . import db
|
||||
from .admin import admin_bp
|
||||
from .auth import auth_bp
|
||||
from .constants import (
|
||||
BUILDER_DESCRIPTIONS,
|
||||
BUILDER_LABELS,
|
||||
BUILDER_OPTIONS,
|
||||
DAYPARTS,
|
||||
DEFAULT_CATEGORIES,
|
||||
ITEM_KIND_LABELS,
|
||||
ITEM_KIND_SINGULAR_LABELS,
|
||||
NOTIFICATION_CHANNEL_OPTIONS,
|
||||
ROLE_LABELS,
|
||||
VISIBILITY_DESCRIPTIONS,
|
||||
VISIBILITY_LABELS,
|
||||
WEEKDAY_OPTIONS,
|
||||
)
|
||||
from .main import main_bp
|
||||
|
||||
@@ -63,6 +68,10 @@ def create_app() -> Flask:
|
||||
PERMANENT_SESSION_LIFETIME=timedelta(days=30),
|
||||
SESSION_COOKIE_HTTPONLY=True,
|
||||
SESSION_COOKIE_SAMESITE="Lax",
|
||||
APP_VERSION="0.5.0",
|
||||
VAPID_PUBLIC_KEY=os.environ.get("NOURI_VAPID_PUBLIC_KEY", ""),
|
||||
VAPID_PRIVATE_KEY=os.environ.get("NOURI_VAPID_PRIVATE_KEY", ""),
|
||||
VAPID_SUBJECT=os.environ.get("NOURI_VAPID_SUBJECT", "mailto:mail@hnz.io"),
|
||||
)
|
||||
|
||||
db.init_app(app)
|
||||
@@ -78,11 +87,19 @@ def create_app() -> Flask:
|
||||
"item_kind_labels": ITEM_KIND_LABELS,
|
||||
"item_kind_singular_labels": ITEM_KIND_SINGULAR_LABELS,
|
||||
"category_suggestions": DEFAULT_CATEGORIES,
|
||||
"builder_labels": BUILDER_LABELS,
|
||||
"builder_descriptions": BUILDER_DESCRIPTIONS,
|
||||
"builder_options": BUILDER_OPTIONS,
|
||||
"daypart_suggestions": DAYPARTS,
|
||||
"visibility_labels": VISIBILITY_LABELS,
|
||||
"visibility_descriptions": VISIBILITY_DESCRIPTIONS,
|
||||
"role_labels": ROLE_LABELS,
|
||||
"weekday_options": WEEKDAY_OPTIONS,
|
||||
"notification_channel_options": NOTIFICATION_CHANNEL_OPTIONS,
|
||||
"today": date.today(),
|
||||
"app_version": app.config["APP_VERSION"],
|
||||
"push_public_key": app.config["VAPID_PUBLIC_KEY"],
|
||||
"push_available": bool(app.config["VAPID_PUBLIC_KEY"] and app.config["VAPID_PRIVATE_KEY"]),
|
||||
"weekday_name": lambda value: WEEKDAY_NAMES[value.weekday()],
|
||||
"weekday_short_name": lambda value: WEEKDAY_SHORT_NAMES[value.weekday()],
|
||||
"is_admin": lambda: bool(getattr(g, "user", None)) and g.user["role"] == "admin",
|
||||
@@ -92,4 +109,12 @@ def create_app() -> Flask:
|
||||
def uploaded_file(filename: str):
|
||||
return send_from_directory(app.config["UPLOAD_FOLDER"], filename)
|
||||
|
||||
@app.get("/app.webmanifest")
|
||||
def webmanifest():
|
||||
return send_from_directory(root_dir / "nouri" / "static" / "pwa", "app.webmanifest", mimetype="application/manifest+json")
|
||||
|
||||
@app.get("/service-worker.js")
|
||||
def service_worker():
|
||||
return send_from_directory(root_dir / "nouri" / "static" / "pwa", "service-worker.js", mimetype="application/javascript")
|
||||
|
||||
return app
|
||||
|
||||
Reference in New Issue
Block a user