From 639b7da3eb59be76f9addd4db329332816072da7 Mon Sep 17 00:00:00 2001 From: Linh Pham Date: Thu, 12 Sep 2024 09:42:42 -0700 Subject: [PATCH] Add missing Umami Analytics config logic update --- CHANGELOG.md | 6 ++++++ app/__init__.py | 5 +---- app/config.py | 18 ++++++++++++++++++ app/version.py | 2 +- 4 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8761d39..2f147b9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changes +## 3.0.2 + +### Application Notes + +- Add missing Umami Analytics config logic update + ## 3.0.1 ### Application Notes diff --git a/app/__init__.py b/app/__init__.py index 252659d..f3b4989 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -48,10 +48,7 @@ def create_app(): app.jinja_env.globals["ga_property_code"] = _config["settings"].get( "ga_property_code", "" ) - umami = _config["settings"].get("umami_analytics", None) - app.jinja_env.globals["umami_analytics"] = format_umami_analytics( - umami_analytics=umami - ) + app.jinja_env.globals["umami"] = _config["settings"]["umami"] app.jinja_env.globals["api_url"] = _config["settings"].get("api_url", "") app.jinja_env.globals["blog_url"] = _config["settings"].get("blog_url", "") app.jinja_env.globals["repo_url"] = _config["settings"].get("repo_url", "") diff --git a/app/config.py b/app/config.py index 18e20ee..5102024 100644 --- a/app/config.py +++ b/app/config.py @@ -59,6 +59,24 @@ def load_config( settings_config["time_zone"] = time_zone_string database_config["time_zone"] = time_zone_string + # Read in Umami Analytics settings + if "umami_analytics" in settings_config: + _umami = dict(settings_config["umami_analytics"]) + settings_config["umami"] = { + "enabled": bool(_umami.get("enabled", False)), + "url": _umami.get("url"), + "website_id": _umami.get("data_website_id"), + "auto_track": bool(_umami.get("data_auto_track", True)), + "host_url": _umami.get("data_host_url"), + "domains": _umami.get("data_domains"), + } + + del settings_config["umami_analytics"] + else: + settings_config["umami"] = { + "enabled": False, + } + return { "database": database_config, "settings": settings_config, diff --git a/app/version.py b/app/version.py index 09910e3..138a597 100644 --- a/app/version.py +++ b/app/version.py @@ -5,4 +5,4 @@ # vim: set noai syntax=python ts=4 sw=4: """Application Version for Wait Wait Graphs Site.""" -APP_VERSION = "3.0.1" +APP_VERSION = "3.0.2"