release nouri 0.3 household sharing and mobile polish
This commit is contained in:
+16
-4
@@ -5,11 +5,20 @@ import secrets
|
||||
from datetime import date, timedelta
|
||||
from pathlib import Path
|
||||
|
||||
from flask import Flask, send_from_directory
|
||||
from flask import Flask, g, send_from_directory
|
||||
|
||||
from . import db
|
||||
from .admin import admin_bp
|
||||
from .auth import auth_bp
|
||||
from .constants import CATEGORIES, DAYPARTS, ITEM_KIND_LABELS, ITEM_KIND_SINGULAR_LABELS
|
||||
from .constants import (
|
||||
CATEGORIES,
|
||||
DAYPARTS,
|
||||
ITEM_KIND_LABELS,
|
||||
ITEM_KIND_SINGULAR_LABELS,
|
||||
ROLE_LABELS,
|
||||
VISIBILITY_DESCRIPTIONS,
|
||||
VISIBILITY_LABELS,
|
||||
)
|
||||
from .main import main_bp
|
||||
|
||||
|
||||
@@ -46,8 +55,6 @@ def create_app() -> Flask:
|
||||
|
||||
app = Flask(__name__, instance_relative_config=False)
|
||||
app.config.update(
|
||||
# Persist the signing key inside the app's data directory so all
|
||||
# gunicorn workers and future restarts agree on the same sessions.
|
||||
SECRET_KEY=load_secret_key(data_dir),
|
||||
DATABASE_PATH=str(db_path),
|
||||
DATA_DIR=str(data_dir),
|
||||
@@ -62,6 +69,7 @@ def create_app() -> Flask:
|
||||
db.init_db_if_needed(app)
|
||||
|
||||
app.register_blueprint(auth_bp)
|
||||
app.register_blueprint(admin_bp)
|
||||
app.register_blueprint(main_bp)
|
||||
|
||||
@app.context_processor
|
||||
@@ -71,9 +79,13 @@ def create_app() -> Flask:
|
||||
"item_kind_singular_labels": ITEM_KIND_SINGULAR_LABELS,
|
||||
"category_suggestions": CATEGORIES,
|
||||
"daypart_suggestions": DAYPARTS,
|
||||
"visibility_labels": VISIBILITY_LABELS,
|
||||
"visibility_descriptions": VISIBILITY_DESCRIPTIONS,
|
||||
"role_labels": ROLE_LABELS,
|
||||
"today": date.today(),
|
||||
"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",
|
||||
}
|
||||
|
||||
@app.get("/uploads/<path:filename>")
|
||||
|
||||
Reference in New Issue
Block a user