diff --git a/CHANGELOG.md b/CHANGELOG.md index 3e5c398..d3372fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [2.3.2] - 2026-10-31 + +### Changed + +- Header link reads "Admin" (was "Dashboard") when logged in + +### Fixed + +- Public pages never knew you were logged in (only `/admin` routes checked the session), so the header always said "Log in" + ## [2.3.1] - 2026-10-31 ### Fixed diff --git a/starpunk/__init__.py b/starpunk/__init__.py index bead5a0..65bb855 100644 --- a/starpunk/__init__.py +++ b/starpunk/__init__.py @@ -280,6 +280,21 @@ def create_app(config=None): """Add correlation ID to request context for tracing""" add_correlation_id() + # Know who is logged in on every page, not just /admin (v2.3.2), so + # the header can say "Admin" instead of "Log in". Only requests that + # carry a session cookie touch the database. + from flask import g, request + token = request.cookies.get("starpunk_session") + if token: + from starpunk.auth import verify_session + try: + info = verify_session(token) + except Exception: + info = None + if info: + g.user = info + g.me = info["me"] + # Response middleware - Add webmention Link header (v1.6.0) @app.after_request def add_webmention_headers(response): @@ -449,5 +464,5 @@ def create_app(config=None): # Package version (Semantic Versioning 2.0.0) # See docs/standards/versioning-strategy.md for details -__version__ = "2.3.1" +__version__ = "2.3.2" __version_info__ = (2, 1, 0) diff --git a/templates/base.html b/templates/base.html index 16664bd..8688a39 100644 --- a/templates/base.html +++ b/templates/base.html @@ -40,7 +40,7 @@ Home RSS {% if g.me %} - Dashboard + Admin {% else %} Log in {% endif %} diff --git a/tests/test_public_style.py b/tests/test_public_style.py index a34af67..5ff9317 100644 --- a/tests/test_public_style.py +++ b/tests/test_public_style.py @@ -57,3 +57,13 @@ def test_note_page_meta_line(app): html = app.test_client().get(f"/note/{note.slug}").data.decode() assert "