diff --git a/pyproject.toml b/pyproject.toml index bfc1011..629f7e6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -46,11 +46,13 @@ dev = [ registry = [ "Flask>=2.3", "argon2-cffi>=21.0", + "sentry-sdk[flask]>=1.0", ] all = [ "urwid>=2.1.0", "Flask>=2.3", "argon2-cffi>=21.0", + "sentry-sdk[flask]>=1.0", ] [project.scripts] diff --git a/src/smarttools/web/app.py b/src/smarttools/web/app.py index 10e2c5f..797ac69 100644 --- a/src/smarttools/web/app.py +++ b/src/smarttools/web/app.py @@ -7,6 +7,24 @@ import secrets from flask import Flask, render_template, session +# Initialize Sentry before importing Flask app (if DSN is configured) +_sentry_dsn = os.environ.get("SENTRY_DSN") +if _sentry_dsn: + try: + import sentry_sdk + from sentry_sdk.integrations.flask import FlaskIntegration + + sentry_sdk.init( + dsn=_sentry_dsn, + integrations=[FlaskIntegration()], + traces_sample_rate=float(os.environ.get("SENTRY_TRACES_RATE", "0.1")), + profiles_sample_rate=float(os.environ.get("SENTRY_PROFILES_RATE", "0.1")), + environment=os.environ.get("SMARTTOOLS_ENV", "development"), + send_default_pii=False, # Privacy: don't send user IPs, emails, etc. + ) + except ImportError: + pass # sentry-sdk not installed + from smarttools.registry import app as registry_app from . import web_bp diff --git a/src/smarttools/web/templates/components/consent_banner.html b/src/smarttools/web/templates/components/consent_banner.html index eec47b8..dadaeb1 100644 --- a/src/smarttools/web/templates/components/consent_banner.html +++ b/src/smarttools/web/templates/components/consent_banner.html @@ -61,10 +61,10 @@
Required for the website to function properly.
© {{ now().year }} SmartTools. Open source under MIT License.
-+
Made with care for the developer community.
diff --git a/src/smarttools/web/templates/components/header.html b/src/smarttools/web/templates/components/header.html index ace903f..df54c6b 100644 --- a/src/smarttools/web/templates/components/header.html +++ b/src/smarttools/web/templates/components/header.html @@ -166,6 +166,7 @@ diff --git a/src/smarttools/web/templates/components/tool_card.html b/src/smarttools/web/templates/components/tool_card.html index 83c1b95..1bc1a61 100644 --- a/src/smarttools/web/templates/components/tool_card.html +++ b/src/smarttools/web/templates/components/tool_card.html @@ -47,7 +47,7 @@ {{ tool.downloads|default(0) }} downloads - v{{ tool.version }} + v{{ tool.version }} diff --git a/src/smarttools/web/templates/components/tutorial_card.html b/src/smarttools/web/templates/components/tutorial_card.html index 4997c87..619f447 100644 --- a/src/smarttools/web/templates/components/tutorial_card.html +++ b/src/smarttools/web/templates/components/tutorial_card.html @@ -30,7 +30,7 @@Step {{ step_number }}
+Step {{ step_number }}
{% endif %}pip install smarttools && smarttools init